summaryrefslogtreecommitdiff
path: root/src/ex_docmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ex_docmd.c')
-rw-r--r--src/ex_docmd.c985
1 files changed, 491 insertions, 494 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 677387f93..b5ce9df4b 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -23,7 +23,7 @@ static int ex_pressedreturn = FALSE;
static char_u *do_one_cmd(char_u **, int, struct condstack *, char_u *(*fgetline)(int, void *, int, int), void *cookie);
#else
static char_u *do_one_cmd(char_u **, int, char_u *(*fgetline)(int, void *, int, int), void *cookie);
-static int if_level = 0; /* depth in :if */
+static int if_level = 0; // depth in :if
#endif
static void free_cmdmod(void);
static void append_command(char_u *cmd);
@@ -383,11 +383,11 @@ static char_u dollar_command[2] = {'$', 0};
#ifdef FEAT_EVAL
-/* Struct for storing a line inside a while/for loop */
+// Struct for storing a line inside a while/for loop
typedef struct
{
- char_u *line; /* command line */
- linenr_T lnum; /* sourcing_lnum of the line */
+ char_u *line; // command line
+ linenr_T lnum; // sourcing_lnum of the line
} wcmd_T;
/*
@@ -397,10 +397,10 @@ typedef struct
*/
struct loop_cookie
{
- garray_T *lines_gap; /* growarray with line info */
- int current_line; /* last read line from growarray */
- int repeating; /* TRUE when looping a second time */
- /* When "repeating" is FALSE use "getline" and "cookie" to get lines */
+ garray_T *lines_gap; // growarray with line info
+ int current_line; // last read line from growarray
+ int repeating; // TRUE when looping a second time
+ // When "repeating" is FALSE use "getline" and "cookie" to get lines
char_u *(*getline)(int, void *, int, int);
void *cookie;
};
@@ -409,7 +409,7 @@ static char_u *get_loop_line(int c, void *cookie, int indent, int do_concat);
static int store_loop_line(garray_T *gap, char_u *line);
static void free_cmdlines(garray_T *gap);
-/* Struct to save a few things while debugging. Used in do_cmdline() only. */
+// Struct to save a few things while debugging. Used in do_cmdline() only.
struct dbg_stuff
{
int trylevel;
@@ -434,7 +434,7 @@ save_dbg_stuff(struct dbg_stuff *dsp)
dsp->vv_exception = v_exception(NULL);
dsp->vv_throwpoint = v_throwpoint(NULL);
- /* Necessary for debugging an inactive ":catch", ":finally", ":endtry" */
+ // Necessary for debugging an inactive ":catch", ":finally", ":endtry"
dsp->did_emsg = did_emsg; did_emsg = FALSE;
dsp->got_int = got_int; got_int = FALSE;
dsp->did_throw = did_throw; did_throw = FALSE;
@@ -467,7 +467,7 @@ restore_dbg_stuff(struct dbg_stuff *dsp)
*/
void
do_exmode(
- int improved) /* TRUE for "improved Ex" mode */
+ int improved) // TRUE for "improved Ex" mode
{
int save_msg_scroll;
int prev_msg_row;
@@ -480,23 +480,23 @@ do_exmode(
exmode_active = EXMODE_NORMAL;
State = NORMAL;
- /* When using ":global /pat/ visual" and then "Q" we return to continue
- * the :global command. */
+ // When using ":global /pat/ visual" and then "Q" we return to continue
+ // the :global command.
if (global_busy)
return;
save_msg_scroll = msg_scroll;
- ++RedrawingDisabled; /* don't redisplay the window */
- ++no_wait_return; /* don't wait for return */
+ ++RedrawingDisabled; // don't redisplay the window
+ ++no_wait_return; // don't wait for return
#ifdef FEAT_GUI
- /* Ignore scrollbar and mouse events in Ex mode */
+ // Ignore scrollbar and mouse events in Ex mode
++hold_gui_events;
#endif
msg(_("Entering Ex mode. Type \"visual\" to go to Normal mode."));
while (exmode_active)
{
- /* Check for a ":normal" command and no more characters left. */
+ // Check for a ":normal" command and no more characters left.
if (ex_normal_busy > 0 && typebuf.tb_len == 0)
{
exmode_active = FALSE;
@@ -527,8 +527,8 @@ do_exmode(
{
if (ex_pressedreturn)
{
- /* go up one line, to overwrite the ":<CR>" line, so the
- * output doesn't contain empty lines. */
+ // go up one line, to overwrite the ":<CR>" line, so the
+ // output doesn't contain empty lines.
msg_row = prev_msg_row;
if (prev_msg_row == Rows - 1)
msg_row--;
@@ -538,7 +538,7 @@ do_exmode(
msg_clr_eos();
}
}
- else if (ex_pressedreturn && !ex_no_reprint) /* must be at EOF */
+ else if (ex_pressedreturn && !ex_no_reprint) // must be at EOF
{
if (curbuf->b_ml.ml_flags & ML_EMPTY)
emsg(_(e_emptybuf));
@@ -611,30 +611,30 @@ do_cmdline_cmd(char_u *cmd)
do_cmdline(
char_u *cmdline,
char_u *(*fgetline)(int, void *, int, int),
- void *cookie, /* argument for fgetline() */
+ void *cookie, // argument for fgetline()
int flags)
{
- char_u *next_cmdline; /* next cmd to execute */
- char_u *cmdline_copy = NULL; /* copy of cmd line */
- int used_getline = FALSE; /* used "fgetline" to obtain command */
- static int recursive = 0; /* recursive depth */
+ char_u *next_cmdline; // next cmd to execute
+ char_u *cmdline_copy = NULL; // copy of cmd line
+ int used_getline = FALSE; // used "fgetline" to obtain command
+ static int recursive = 0; // recursive depth
int msg_didout_before_start = 0;
- int count = 0; /* line number count */
- int did_inc = FALSE; /* incremented RedrawingDisabled */
+ int count = 0; // line number count
+ int did_inc = FALSE; // incremented RedrawingDisabled
int retval = OK;
#ifdef FEAT_EVAL
- struct condstack cstack; /* conditional stack */
- garray_T lines_ga; /* keep lines for ":while"/":for" */
- int current_line = 0; /* active line in lines_ga */
- char_u *fname = NULL; /* function or script name */
- linenr_T *breakpoint = NULL; /* ptr to breakpoint field in cookie */
- int *dbg_tick = NULL; /* ptr to dbg_tick field in cookie */
- struct dbg_stuff debug_saved; /* saved things for debug mode */
+ struct condstack cstack; // conditional stack
+ garray_T lines_ga; // keep lines for ":while"/":for"
+ int current_line = 0; // active line in lines_ga
+ char_u *fname = NULL; // function or script name
+ linenr_T *breakpoint = NULL; // ptr to breakpoint field in cookie
+ int *dbg_tick = NULL; // ptr to dbg_tick field in cookie
+ struct dbg_stuff debug_saved; // saved things for debug mode
int initial_trylevel;
struct msglist **saved_msg_list = NULL;
struct msglist *private_msg_list;
- /* "fgetline" and "cookie" passed to do_one_cmd() */
+ // "fgetline" and "cookie" passed to do_one_cmd()
char_u *(*cmd_getline)(int, void *, int, int);
void *cmd_cookie;
struct loop_cookie cmd_loop_cookie;
@@ -644,23 +644,23 @@ do_cmdline(
# define cmd_getline fgetline
# define cmd_cookie cookie
#endif
- static int call_depth = 0; /* recursiveness */
+ static int call_depth = 0; // recursiveness
#ifdef FEAT_EVAL
- /* For every pair of do_cmdline()/do_one_cmd() calls, use an extra memory
- * location for storing error messages to be converted to an exception.
- * This ensures that the do_errthrow() call in do_one_cmd() does not
- * combine the messages stored by an earlier invocation of do_one_cmd()
- * with the command name of the later one. This would happen when
- * BufWritePost autocommands are executed after a write error. */
+ // For every pair of do_cmdline()/do_one_cmd() calls, use an extra memory
+ // location for storing error messages to be converted to an exception.
+ // This ensures that the do_errthrow() call in do_one_cmd() does not
+ // combine the messages stored by an earlier invocation of do_one_cmd()
+ // with the command name of the later one. This would happen when
+ // BufWritePost autocommands are executed after a write error.
saved_msg_list = msg_list;
msg_list = &private_msg_list;
private_msg_list = NULL;
#endif
- /* It's possible to create an endless loop with ":execute", catch that
- * here. The value of 200 allows nested function calls, ":source", etc.
- * Allow 200 or 'maxfuncdepth', whatever is larger. */
+ // It's possible to create an endless loop with ":execute", catch that
+ // here. The value of 200 allows nested function calls, ":source", etc.
+ // Allow 200 or 'maxfuncdepth', whatever is larger.
if (call_depth >= 200
#ifdef FEAT_EVAL
&& call_depth >= p_mfd
@@ -669,8 +669,8 @@ do_cmdline(
{
emsg(_("E169: Command too recursive"));
#ifdef FEAT_EVAL
- /* When converting to an exception, we do not include the command name
- * since this is not an error of the specific command. */
+ // When converting to an exception, we do not include the command name
+ // since this is not an error of the specific command.
do_errthrow((struct condstack *)NULL, (char_u *)NULL);
msg_list = saved_msg_list;
#endif
@@ -688,13 +688,13 @@ do_cmdline(
real_cookie = getline_cookie(fgetline, cookie);
- /* Inside a function use a higher nesting level. */
+ // Inside a function use a higher nesting level.
getline_is_func = getline_equal(fgetline, cookie, get_func_line);
if (getline_is_func && ex_nesting_level == func_level(real_cookie))
++ex_nesting_level;
- /* Get the function or script name and the address where the next breakpoint
- * line and the debug tick for a function or script are stored. */
+ // Get the function or script name and the address where the next breakpoint
+ // line and the debug tick for a function or script are stored.
if (getline_is_func)
{
fname = func_name(real_cookie);
@@ -762,7 +762,7 @@ do_cmdline(
getline_is_func = getline_equal(fgetline, cookie, get_func_line);
#endif
- /* stop skipping cmds for an error msg after all endif/while/for */
+ // stop skipping cmds for an error msg after all endif/while/for
if (next_cmdline == NULL
#ifdef FEAT_EVAL
&& !force_abort
@@ -779,15 +779,15 @@ do_cmdline(
*/
#ifdef FEAT_EVAL
- /* 1. If repeating, get a previous line from lines_ga. */
+ // 1. If repeating, get a previous line from lines_ga.
if (cstack.cs_looplevel > 0 && current_line < lines_ga.ga_len)
{
- /* Each '|' separated command is stored separately in lines_ga, to
- * be able to jump to it. Don't use next_cmdline now. */
+ // Each '|' separated command is stored separately in lines_ga, to
+ // be able to jump to it. Don't use next_cmdline now.
VIM_CLEAR(cmdline_copy);
- /* Check if a function has returned or, unless it has an unclosed
- * try conditional, aborted. */
+ // Check if a function has returned or, unless it has an unclosed
+ // try conditional, aborted.
if (getline_is_func)
{
# ifdef FEAT_PROFILE
@@ -806,14 +806,14 @@ do_cmdline(
script_line_end();
#endif
- /* Check if a sourced file hit a ":finish" command. */
+ // Check if a sourced file hit a ":finish" command.
if (source_finished(fgetline, cookie))
{
retval = FAIL;
break;
}
- /* If breakpoints have been added/deleted need to check for it. */
+ // If breakpoints have been added/deleted need to check for it.
if (breakpoint != NULL && dbg_tick != NULL
&& *dbg_tick != debug_tick)
{
@@ -826,12 +826,12 @@ do_cmdline(
next_cmdline = ((wcmd_T *)(lines_ga.ga_data))[current_line].line;
sourcing_lnum = ((wcmd_T *)(lines_ga.ga_data))[current_line].lnum;
- /* Did we encounter a breakpoint? */
+ // Did we encounter a breakpoint?
if (breakpoint != NULL && *breakpoint != 0
&& *breakpoint <= sourcing_lnum)
{
dbg_breakpoint(fname, sourcing_lnum);
- /* Find next breakpoint. */
+ // Find next breakpoint.
*breakpoint = dbg_find_breakpoint(
getline_equal(fgetline, cookie, getsourceline),
fname, sourcing_lnum);
@@ -850,11 +850,11 @@ do_cmdline(
if (cstack.cs_looplevel > 0)
{
- /* Inside a while/for loop we need to store the lines and use them
- * again. Pass a different "fgetline" function to do_one_cmd()
- * below, so that it stores lines in or reads them from
- * "lines_ga". Makes it possible to define a function inside a
- * while/for loop. */
+ // Inside a while/for loop we need to store the lines and use them
+ // again. Pass a different "fgetline" function to do_one_cmd()
+ // below, so that it stores lines in or reads them from
+ // "lines_ga". Makes it possible to define a function inside a
+ // while/for loop.
cmd_getline = get_loop_line;
cmd_cookie = (void *)&cmd_loop_cookie;
cmd_loop_cookie.lines_gap = &lines_ga;
@@ -870,7 +870,7 @@ do_cmdline(
}
#endif
- /* 2. If no line given, get an allocated line with fgetline(). */
+ // 2. If no line given, get an allocated line with fgetline().
if (next_cmdline == NULL)
{
/*
@@ -887,9 +887,9 @@ do_cmdline(
#endif
, TRUE)) == NULL)
{
- /* Don't call wait_return for aborted command line. The NULL
- * returned for the end of a sourced file or executed function
- * doesn't do this. */
+ // Don't call wait_return for aborted command line. The NULL
+ // returned for the end of a sourced file or executed function
+ // doesn't do this.
if (KeyTyped && !(flags & DOCMD_REPEAT))
need_wait_return = FALSE;
retval = FAIL;
@@ -910,7 +910,7 @@ do_cmdline(
}
}
- /* 3. Make a copy of the command so we can mess with it. */
+ // 3. Make a copy of the command so we can mess with it.
else if (cmdline_copy == NULL)
{
next_cmdline = vim_strsave(next_cmdline);
@@ -954,10 +954,10 @@ do_cmdline(
if (!(flags & DOCMD_NOWAIT) && !recursive)
{
msg_didout_before_start = msg_didout;
- msg_didany = FALSE; /* no output yet */
+ msg_didany = FALSE; // no output yet
msg_start();
- msg_scroll = TRUE; /* put messages below each other */
- ++no_wait_return; /* don't wait for return until finished */
+ msg_scroll = TRUE; // put messages below each other
+ ++no_wait_return; // don't wait for return until finished
++RedrawingDisabled;
did_inc = TRUE;
}
@@ -981,8 +981,8 @@ do_cmdline(
#ifdef FEAT_EVAL
if (cmd_cookie == (void *)&cmd_loop_cookie)
- /* Use "current_line" from "cmd_loop_cookie", it may have been
- * incremented when defining a function. */
+ // Use "current_line" from "cmd_loop_cookie", it may have been
+ // incremented when defining a function.
current_line = cmd_loop_cookie.current_line;
#endif
@@ -1004,15 +1004,15 @@ do_cmdline(
}
else
{
- /* need to copy the command after the '|' to cmdline_copy, for the
- * next do_one_cmd() */
+ // need to copy the command after the '|' to cmdline_copy, for the
+ // next do_one_cmd()
STRMOVE(cmdline_copy, next_cmdline);
next_cmdline = cmdline_copy;
}
#ifdef FEAT_EVAL
- /* reset did_emsg for a function that is not aborted by an error */
+ // reset did_emsg for a function that is not aborted by an error
if (did_emsg && !force_abort
&& getline_equal(fgetline, cookie, get_func_line)
&& !func_has_abort(real_cookie))
@@ -1032,10 +1032,10 @@ do_cmdline(
{
cstack.cs_lflags &= ~(CSL_HAD_CONT | CSL_HAD_ENDLOOP);
- /* Jump back to the matching ":while" or ":for". Be careful
- * not to use a cs_line[] from an entry that isn't a ":while"
- * or ":for": It would make "current_line" invalid and can
- * cause a crash. */
+ // Jump back to the matching ":while" or ":for". Be careful
+ // not to use a cs_line[] from an entry that isn't a ":while"
+ // or ":for": It would make "current_line" invalid and can
+ // cause a crash.
if (!did_emsg && !got_int && !did_throw
&& cstack.cs_idx >= 0
&& (cstack.cs_flags[cstack.cs_idx]
@@ -1044,12 +1044,12 @@ do_cmdline(
&& (cstack.cs_flags[cstack.cs_idx] & CSF_ACTIVE))
{
current_line = cstack.cs_line[cstack.cs_idx];
- /* remember we jumped there */
+ // remember we jumped there
cstack.cs_lflags |= CSL_HAD_LOOP;
- line_breakcheck(); /* check if CTRL-C typed */
+ line_breakcheck(); // check if CTRL-C typed
- /* Check for the next breakpoint at or after the ":while"
- * or ":for". */
+ // Check for the next breakpoint at or after the ":while"
+ // or ":for".
if (breakpoint != NULL)
{
*breakpoint = dbg_find_breakpoint(
@@ -1061,7 +1061,7 @@ do_cmdline(
}
else
{
- /* can only get here with ":endwhile" or ":endfor" */
+ // can only get here with ":endwhile" or ":endfor"
if (cstack.cs_idx >= 0)
rewind_conditionals(&cstack, cstack.cs_idx - 1,
CSF_WHILE | CSF_FOR, &cstack.cs_looplevel);
@@ -1078,7 +1078,7 @@ do_cmdline(
}
}
- /* Check for the next breakpoint after a watchexpression */
+ // Check for the next breakpoint after a watchexpression
if (breakpoint != NULL && has_watchexpr())
{
*breakpoint = dbg_find_breakpoint(FALSE, fname, sourcing_lnum);
@@ -1116,8 +1116,8 @@ do_cmdline(
cstack.cs_flags[cstack.cs_idx] |= CSF_ACTIVE | CSF_FINALLY;
}
- /* Update global "trylevel" for recursive calls to do_cmdline() from
- * within this loop. */
+ // Update global "trylevel" for recursive calls to do_cmdline() from
+ // within this loop.
trylevel = initial_trylevel + cstack.cs_trylevel;
/*
@@ -1130,9 +1130,9 @@ do_cmdline(
if (trylevel == 0 && !did_emsg && !got_int && !did_throw)
force_abort = FALSE;
- /* Convert an interrupt to an exception if appropriate. */
+ // Convert an interrupt to an exception if appropriate.
(void)do_intthrow(&cstack);
-#endif /* FEAT_EVAL */
+#endif // FEAT_EVAL
}
/*
@@ -1155,9 +1155,9 @@ do_cmdline(
)
&& !(did_emsg
#ifdef FEAT_EVAL
- /* Keep going when inside try/catch, so that the error can be
- * deal with, except when it is a syntax error, it may cause
- * the :endtry to be missed. */
+ // Keep going when inside try/catch, so that the error can be
+ // deal with, except when it is a syntax error, it may cause
+ // the :endtry to be missed.
&& (cstack.cs_trylevel == 0 || did_emsg_syntax)
#endif
&& used_getline
@@ -1209,7 +1209,7 @@ do_cmdline(
int idx = cleanup_conditionals(&cstack, 0, TRUE);
if (idx >= 0)
- --idx; /* remove try block not in its finally clause */
+ --idx; // remove try block not in its finally clause
rewind_conditionals(&cstack, idx, CSF_WHILE | CSF_FOR,
&cstack.cs_looplevel);
}
@@ -1217,9 +1217,9 @@ do_cmdline(
trylevel = initial_trylevel;
}
- /* If a missing ":endtry", ":endwhile", ":endfor", or ":endif" or a memory
- * lack was reported above and the error message is to be converted to an
- * exception, do this now after rewinding the cstack. */
+ // If a missing ":endtry", ":endwhile", ":endfor", or ":endif" or a memory
+ // lack was reported above and the error message is to be converted to an
+ // exception, do this now after rewinding the cstack.
do_errthrow(&cstack, getline_equal(fgetline, cookie, get_func_line)
? (char_u *)"endfunction" : (char_u *)NULL);
@@ -1266,7 +1266,7 @@ do_cmdline(
sourcing_lnum = current_exception->throw_lnum;
current_exception->throw_name = NULL;
- discard_current_exception(); /* uses IObuff if 'verbose' */
+ discard_current_exception(); // uses IObuff if 'verbose'
suppress_errthrow = TRUE;
force_abort = TRUE;
@@ -1323,7 +1323,7 @@ do_cmdline(
}
else
{
- /* When leaving a function, reduce nesting level. */
+ // When leaving a function, reduce nesting level.
if (getline_equal(fgetline, cookie, get_func_line))
--ex_nesting_level;
/*
@@ -1346,7 +1346,7 @@ do_cmdline(
restore_dbg_stuff(&debug_saved);
msg_list = saved_msg_list;
-#endif /* FEAT_EVAL */
+#endif // FEAT_EVAL
/*
* If there was too much output to fit on the command line, ask the user to
@@ -1370,7 +1370,7 @@ do_cmdline(
)
{
need_wait_return = FALSE;
- msg_didany = FALSE; /* don't wait when restarting edit */
+ msg_didany = FALSE; // don't wait when restarting edit
}
else if (need_wait_return)
{
@@ -1385,7 +1385,7 @@ do_cmdline(
}
#ifdef FEAT_EVAL
- did_endif = FALSE; /* in case do_cmdline used recursively */
+ did_endif = FALSE; // in case do_cmdline used recursively
#else
/*
* Reset if_level, in case a sourced script file contains more ":if" than
@@ -1412,9 +1412,9 @@ get_loop_line(int c, void *cookie, int indent, int do_concat)
if (cp->current_line + 1 >= cp->lines_gap->ga_len)
{
if (cp->repeating)
- return NULL; /* trying to read past ":endwhile"/":endfor" */
+ return NULL; // trying to read past ":endwhile"/":endfor"
- /* First time inside the ":while"/":for": get line normally. */
+ // First time inside the ":while"/":for": get line normally.
if (cp->getline == NULL)
line = getcmdline(c, 0L, indent, do_concat);
else
@@ -1467,16 +1467,16 @@ free_cmdlines(garray_T *gap)
int
getline_equal(
char_u *(*fgetline)(int, void *, int, int),
- void *cookie UNUSED, /* argument for fgetline() */
+ void *cookie UNUSED, // argument for fgetline()
char_u *(*func)(int, void *, int, int))
{
#ifdef FEAT_EVAL
char_u *(*gp)(int, void *, int, int);
struct loop_cookie *cp;
- /* When "fgetline" is "get_loop_line()" use the "cookie" to find the
- * function that's originally used to obtain the lines. This may be
- * nested several levels. */
+ // When "fgetline" is "get_loop_line()" use the "cookie" to find the
+ // function that's originally used to obtain the lines. This may be
+ // nested several levels.
gp = fgetline;
cp = (struct loop_cookie *)cookie;
while (gp == get_loop_line)
@@ -1497,15 +1497,15 @@ getline_equal(
void *
getline_cookie(
char_u *(*fgetline)(int, void *, int, int) UNUSED,
- void *cookie) /* argument for fgetline() */
+ void *cookie) // argument for fgetline()
{
#ifdef FEAT_EVAL
char_u *(*gp)(int, void *, int, int);
struct loop_cookie *cp;
- /* When "fgetline" is "get_loop_line()" use the "cookie" to find the
- * cookie that's originally used to obtain the lines. This may be nested
- * several levels. */
+ // When "fgetline" is "get_loop_line()" use the "cookie" to find the
+ // cookie that's originally used to obtain the lines. This may be nested
+ // several levels.
gp = fgetline;
cp = (struct loop_cookie *)cookie;
while (gp == get_loop_line)
@@ -1543,7 +1543,7 @@ compute_buffer_local_count(int addr_type, int lnum, int offset)
break;
buf = nextbuf;
if (addr_type == ADDR_LOADED_BUFFERS)
- /* skip over unloaded buffers */
+ // skip over unloaded buffers
while (buf->b_ml.ml_mfp == NULL)
{
nextbuf = (offset < 0) ? buf->b_prev : buf->b_next;
@@ -1552,7 +1552,7 @@ compute_buffer_local_count(int addr_type, int lnum, int offset)
buf = nextbuf;
}
}
- /* we might have gone too far, last buffer is not loadedd */
+ // we might have gone too far, last buffer is not loadedd
if (addr_type == ADDR_LOADED_BUFFERS)
while (buf->b_ml.ml_mfp == NULL)
{
@@ -1634,18 +1634,18 @@ do_one_cmd(
struct condstack *cstack,
#endif
char_u *(*fgetline)(int, void *, int, int),
- void *cookie) /* argument for fgetline() */
+ void *cookie) // argument for fgetline()
{
char_u *p;
linenr_T lnum;
long n;
- char *errormsg = NULL; /* error message */
+ char *errormsg = NULL; // error message
char_u *after_modifier = NULL;
- exarg_T ea; /* Ex command arguments */
+ exarg_T ea; // Ex command arguments
int save_msg_scroll = msg_scroll;
cmdmod_T save_cmdmod;
int save_reg_executing = reg_executing;
- int ni; /* set when Not Implemented */
+ int ni; // set when Not Implemented
char_u *cmd;
vim_memset(&ea, 0, sizeof(ea));
@@ -1655,13 +1655,13 @@ do_one_cmd(
++ex_nesting_level;
#endif
- /* When the last file has not been edited :q has to be typed twice. */
+ // When the last file has not been edited :q has to be typed twice.
if (quitmore
#ifdef FEAT_EVAL
- /* avoid that a function call in 'statusline' does this */
+ // avoid that a function call in 'statusline' does this
&& !getline_equal(fgetline, cookie, get_func_line)
#endif
- /* avoid that an autocommand, e.g. QuitPre, does this */
+ // avoid that an autocommand, e.g. QuitPre, does this
&& !getline_equal(fgetline, cookie, getnextac))
--quitmore;
@@ -1671,7 +1671,7 @@ do_one_cmd(
*/
save_cmdmod = cmdmod;
- /* "#!anything" is handled like a comment. */
+ // "#!anything" is handled like a comment.
if ((*cmdlinep)[0] == '#' && (*cmdlinep)[1] == '!')
goto doend;
@@ -1748,8 +1748,8 @@ do_one_cmd(
}
# endif
- /* May go to debug mode. If this happens and the ">quit" debug command is
- * used, throw an interrupt exception and skip the next command. */
+ // May go to debug mode. If this happens and the ">quit" debug command is
+ // used, throw an interrupt exception and skip the next command.
dbg_check_breakpoint(&ea);
if (!ea.skip && got_int)
{
@@ -1821,7 +1821,7 @@ do_one_cmd(
* ":3|..." prints line 3
* ":|" prints current line
*/
- if (ea.skip) /* skip this if inside :if */
+ if (ea.skip) // skip this if inside :if
goto doend;
if (*ea.cmd == '|' || (exmode_active && ea.line1 != ea.line2))
{
@@ -1837,8 +1837,8 @@ do_one_cmd(
{
if (ea.line2 > curbuf->b_ml.ml_line_count)
{
- /* With '-' in 'cpoptions' a line number past the file is an
- * error, otherwise put it at the end of the file. */
+ // With '-' in 'cpoptions' a line number past the file is an
+ // error, otherwise put it at the end of the file.
if (vim_strchr(p_cpo, CPO_MINUS) != NULL)
ea.line2 = -1;
else
@@ -1859,8 +1859,8 @@ do_one_cmd(
goto doend;
}
- /* If this looks like an undefined user command and there are CmdUndefined
- * autocommands defined, trigger the matching autocommands. */
+ // If this looks like an undefined user command and there are CmdUndefined
+ // autocommands defined, trigger the matching autocommands.
if (p != NULL && ea.cmdidx == CMD_SIZE && !ea.skip
&& ASCII_ISUPPER(*ea.cmd)
&& has_cmdundefined())
@@ -1873,8 +1873,8 @@ do_one_cmd(
p = vim_strnsave(ea.cmd, (int)(p - ea.cmd));
ret = apply_autocmds(EVENT_CMDUNDEFINED, p, p, TRUE, NULL);
vim_free(p);
- /* If the autocommands did something and didn't cause an error, try
- * finding the command again. */
+ // If the autocommands did something and didn't cause an error, try
+ // finding the command again.
p = (ret
#ifdef FEAT_EVAL
&& !aborting()
@@ -1903,8 +1903,8 @@ do_one_cmd(
STRCPY(IObuff, _("E492: Not an editor command"));
if (!sourcing)
{
- /* If the modifier was parsed OK the error must be in the
- * following command */
+ // If the modifier was parsed OK the error must be in the
+ // following command
if (after_modifier != NULL)
append_command(after_modifier);
else
@@ -1939,7 +1939,7 @@ do_one_cmd(
#endif
- /* forced commands */
+ // forced commands
if (*p == '!' && ea.cmdidx != CMD_substitute
&& ea.cmdidx != CMD_smagic && ea.cmdidx != CMD_snomagic)
{
@@ -1972,7 +1972,7 @@ do_one_cmd(
}
if (!curbuf->b_p_ma && (ea.argt & EX_MODIFY))
{
- /* Command not allowed in non-'modifiable' buffer */
+ // Command not allowed in non-'modifiable' buffer
errormsg = _(e_modifiable);
goto doend;
}
@@ -1980,15 +1980,15 @@ do_one_cmd(
if (text_locked() && !(ea.argt & EX_CMDWIN)
&& !IS_USER_CMDIDX(ea.cmdidx))
{
- /* Command not allowed when editing the command line. */
+ // Command not allowed when editing the command line.
errormsg = _(get_text_locked_msg());
goto doend;
}
- /* Disallow editing another buffer when "curbuf_lock" is set.
- * Do allow ":checktime" (it is postponed).
- * Do allow ":edit" (check for an argument later).
- * Do allow ":file" with no arguments (check for an argument later). */
+ // Disallow editing another buffer when "curbuf_lock" is set.
+ // Do allow ":checktime" (it is postponed).
+ // Do allow ":edit" (check for an argument later).
+ // Do allow ":file" with no arguments (check for an argument later).
if (!(ea.argt & EX_CMDWIN)
&& ea.cmdidx != CMD_checktime
&& ea.cmdidx != CMD_edit
@@ -1999,7 +1999,7 @@ do_one_cmd(
if (!ni && !(ea.argt & EX_RANGE) && ea.addr_count > 0)
{
- /* no range allowed */
+ // no range allowed
errormsg = _(e_norange);
goto doend;
}
@@ -2053,8 +2053,8 @@ do_one_cmd(
if (((ea.argt & EX_WHOLEFOLD) || ea.addr_count >= 2) && !global_busy
&& ea.addr_type == ADDR_LINES)
{
- /* Put the first line at the start of a closed fold, put the last line
- * at the end of a closed fold. */
+ // Put the first line at the start of a closed fold, put the last line
+ // at the end of a closed fold.
(void)hasFolding(ea.line1, &ea.line1, NULL);
(void)hasFolding(ea.line2, NULL, &ea.line2);
}
@@ -2097,9 +2097,9 @@ do_one_cmd(
if (ea.cmdidx == CMD_write || ea.cmdidx == CMD_update)
{
- if (*ea.arg == '>') /* append */
+ if (*ea.arg == '>') // append
{
- if (*++ea.arg != '>') /* typed wrong */
+ if (*++ea.arg != '>') // typed wrong
{
errormsg = _("E494: Use w or w>>");
goto doend;
@@ -2107,7 +2107,7 @@ do_one_cmd(
ea.arg = skipwhite(ea.arg + 1);
ea.append = TRUE;
}
- else if (*ea.arg == '!' && ea.cmdidx == CMD_write) /* :w !filter */
+ else if (*ea.arg == '!' && ea.cmdidx == CMD_write) // :w !filter
{
++ea.arg;
ea.usefilter = TRUE;
@@ -2118,10 +2118,10 @@ do_one_cmd(
{
if (ea.forceit)
{
- ea.usefilter = TRUE; /* :r! filter if ea.forceit */
+ ea.usefilter = TRUE; // :r! filter if ea.forceit
ea.forceit = FALSE;
}
- else if (*ea.arg == '!') /* :r !filter */
+ else if (*ea.arg == '!') // :r !filter
{
++ea.arg;
ea.usefilter = TRUE;
@@ -2131,7 +2131,7 @@ do_one_cmd(
if (ea.cmdidx == CMD_lshift || ea.cmdidx == CMD_rshift)
{
ea.amount = 1;
- while (*ea.arg == *ea.cmd) /* count number of '>' or '<' */
+ while (*ea.arg == *ea.cmd) // count number of '>' or '<'
{
++ea.arg;
++ea.amount;
@@ -2166,12 +2166,12 @@ do_one_cmd(
{
for (p = ea.arg; *p; ++p)
{
- /* Remove one backslash before a newline, so that it's possible to
- * pass a newline to the shell and also a newline that is preceded
- * with a backslash. This makes it impossible to end a shell
- * command in a backslash, but that doesn't appear useful.
- * Halving the number of backslashes is incompatible with previous
- * versions. */
+ // Remove one backslash before a newline, so that it's possible to
+ // pass a newline to the shell and also a newline that is preceded
+ // with a backslash. This makes it impossible to end a shell
+ // command in a backslash, but that doesn't appear useful.
+ // Halving the number of backslashes is incompatible with previous
+ // versions.
if (*p == '\\' && p[1] == '\n')
STRMOVE(p, p + 1);
else if (*p == '\n')
@@ -2238,15 +2238,15 @@ do_one_cmd(
}
}
- /* accept numbered register only when no count allowed (:put) */
+ // accept numbered register only when no count allowed (:put)
if ( (ea.argt & EX_REGSTR)
&& *ea.arg != NUL
- /* Do not allow register = for user commands */
+ // Do not allow register = for user commands
&& (!IS_USER_CMDIDX(ea.cmdidx) || *ea.arg != '=')
&& !((ea.argt & EX_COUNT) && VIM_ISDIGIT(*ea.arg)))
{
#ifndef FEAT_CLIPBOARD
- /* check these explicitly for a more specific error message */
+ // check these explicitly for a more specific error message
if (*ea.arg == '*' || *ea.arg == '+')
{
errormsg = _(e_invalidreg);
@@ -2258,7 +2258,7 @@ do_one_cmd(
{
ea.regname = *ea.arg++;
#ifdef FEAT_EVAL
- /* for '=' register: accept the rest of the line as an expression */
+ // for '=' register: accept the rest of the line as an expression
if (ea.arg[-1] == '=' && ea.arg[0] != NUL)
{
set_expr_line(vim_strsave(ea.arg));
@@ -2333,7 +2333,7 @@ do_one_cmd(
{
switch (ea.cmdidx)
{
- /* commands that need evaluation */
+ // commands that need evaluation
case CMD_while:
case CMD_endwhile:
case CMD_for:
@@ -2349,9 +2349,9 @@ do_one_cmd(
case CMD_function:
break;
- /* Commands that handle '|' themselves. Check: A command should
- * either have the EX_TRLBAR flag, appear in this list or appear in
- * the list at ":help :bar". */
+ // Commands that handle '|' themselves. Check: A command should
+ // either have the EX_TRLBAR flag, appear in this list or appear in
+ // the list at ":help :bar".
case CMD_aboveleft:
case CMD_and:
case CMD_belowright:
@@ -2449,14 +2449,14 @@ do_one_cmd(
}
ea.line2 = buflist_findpat(ea.arg, p, (ea.argt & EX_BUFUNL) != 0,
FALSE, FALSE);
- if (ea.line2 < 0) /* failed */
+ if (ea.line2 < 0) // failed
goto doend;
ea.addr_count = 1;
ea.arg = skipwhite(p);
}
- /* The :try command saves the emsg_silent flag, reset it here when
- * ":silent! try" was used, it should only apply to :try itself. */
+ // The :try command saves the emsg_silent flag, reset it here when
+ // ":silent! try" was used, it should only apply to :try itself.
if (ea.cmdidx == CMD_try && ea.did_esilent > 0)
{
emsg_silent -= ea.did_esilent;
@@ -2509,7 +2509,7 @@ do_one_cmd(
#endif
doend:
- if (curwin->w_cursor.lnum == 0) /* can happen with zero line number */
+ if (curwin->w_cursor.lnum == 0) // can happen with zero line number
{
curwin->w_cursor.lnum = 1;
curwin->w_cursor.col = 0;
@@ -2543,19 +2543,19 @@ doend:
if (ea.save_msg_silent != -1)
{
- /* messages could be enabled for a serious error, need to check if the
- * counters don't become negative */
+ // messages could be enabled for a serious error, need to check if the
+ // counters don't become negative
if (!did_emsg || msg_silent > ea.save_msg_silent)
msg_silent = ea.save_msg_silent;
emsg_silent -= ea.did_esilent;
if (emsg_silent < 0)
emsg_silent = 0;
- /* Restore msg_scroll, it's set by file I/O commands, even when no
- * message is actually displayed. */
+ // Restore msg_scroll, it's set by file I/O commands, even when no
+ // message is actually displayed.
msg_scroll = save_msg_scroll;
- /* "silent reg" or "silent echo x" inside "redir" leaves msg_col
- * somewhere in the line. Put it back in the first column. */
+ // "silent reg" or "silent echo x" inside "redir" leaves msg_col
+ // somewhere in the line. Put it back in the first column.
if (redirecting())
msg_col = 0;
}
@@ -2565,7 +2565,7 @@ doend:
--sandbox;
#endif
- if (ea.nextcmd && *ea.nextcmd == NUL) /* not really a next command */
+ if (ea.nextcmd && *ea.nextcmd == NUL) // not really a next command
ea.nextcmd = NULL;
#ifdef FEAT_EVAL
@@ -2607,7 +2607,7 @@ parse_command_modifiers(exarg_T *eap, char **errormsg, int skip_only)
while (*eap->cmd == ' ' || *eap->cmd == '\t' || *eap->cmd == ':')
++eap->cmd;
- /* in ex mode, an empty line works like :+ */
+ // in ex mode, an empty line works like :+
if (*eap->cmd == NUL && exmode_active
&& (getline_equal(eap->getline, eap->cookie, getexmodeline)
|| getline_equal(eap->getline, eap->cookie, getexline))
@@ -2618,7 +2618,7 @@ parse_command_modifiers(exarg_T *eap, char **errormsg, int skip_only)
ex_pressedreturn = TRUE;
}
- /* ignore comment and empty lines */
+ // ignore comment and empty lines
if (*eap->cmd == '"')
return FAIL;
if (*eap->cmd == NUL)
@@ -2631,7 +2631,7 @@ parse_command_modifiers(exarg_T *eap, char **errormsg, int skip_only)
p = skip_range(eap->cmd, NULL);
switch (*p)
{
- /* When adding an entry, also modify cmd_exists(). */
+ // When adding an entry, also modify cmd_exists().
case 'a': if (!checkforcmd(&eap->cmd, "aboveleft", 3))
break;
cmdmod.split |= WSP_ABOVE;
@@ -2681,7 +2681,7 @@ parse_command_modifiers(exarg_T *eap, char **errormsg, int skip_only)
cmdmod.keepjumps = TRUE;
continue;
- case 'f': /* only accept ":filter {pat} cmd" */
+ case 'f': // only accept ":filter {pat} cmd"
{
char_u *reg_pat;
@@ -2713,7 +2713,7 @@ parse_command_modifiers(exarg_T *eap, char **errormsg, int skip_only)
continue;
}
- /* ":hide" and ":hide | cmd" are not modifiers */
+ // ":hide" and ":hide | cmd" are not modifiers
case 'h': if (p != eap->cmd || !checkforcmd(&p, "hide", 3)
|| *p == NUL || ends_excmd(*p))
break;
@@ -2736,8 +2736,8 @@ parse_command_modifiers(exarg_T *eap, char **errormsg, int skip_only)
{
if (cmdmod.save_ei == NULL && !skip_only)
{
- /* Set 'eventignore' to "all". Restore the
- * existing option value later. */
+ // Set 'eventignore' to "all". Restore the
+ // existing option value later.
cmdmod.save_ei = vim_strsave(p_ei);
set_string_option_direct((char_u *)"ei", -1,
(char_u *)"all", OPT_FREE, SID_NONE);
@@ -2776,7 +2776,7 @@ parse_command_modifiers(exarg_T *eap, char **errormsg, int skip_only)
}
if (*eap->cmd == '!' && !VIM_ISWHITE(eap->cmd[-1]))
{
- /* ":silent!", but not "silent !cmd" */
+ // ":silent!", but not "silent !cmd"
eap->cmd = skipwhite(eap->cmd + 1);
if (!skip_only)
{
@@ -2856,7 +2856,7 @@ free_cmdmod(void)
{
if (cmdmod.save_ei != NULL)
{
- /* Restore 'eventignore' to the value before ":noautocmd". */
+ // Restore 'eventignore' to the value before ":noautocmd".
set_string_option_direct((char_u *)"ei", -1, cmdmod.save_ei,
OPT_FREE, SID_NONE);
free_string_option(cmdmod.save_ei);
@@ -3062,9 +3062,9 @@ parse_cmd_address(exarg_T *eap, char **errormsg, int silent)
*/
int
checkforcmd(
- char_u **pp, /* start of command */
- char *cmd, /* name of command */
- int len) /* required length */
+ char_u **pp, // start of command
+ char *cmd, // name of command
+ int len) // required length
{
int i;
@@ -3150,19 +3150,19 @@ find_command(exarg_T *eap, int *full UNUSED)
{
while (ASCII_ISALPHA(*p))
++p;
- /* for python 3.x support ":py3", ":python3", ":py3file", etc. */
+ // for python 3.x support ":py3", ":python3", ":py3file", etc.
if (eap->cmd[0] == 'p' && eap->cmd[1] == 'y')
while (ASCII_ISALNUM(*p))
++p;
- /* check for non-alpha command */
+ // check for non-alpha command
if (p == eap->cmd && vim_strchr((char_u *)"@*!=><&~#", *p) != NULL)
++p;
len = (int)(p - eap->cmd);
if (*eap->cmd == 'd' && (p[-1] == 'l' || p[-1] == 'p'))
{
- /* Check for ":dl", ":dell", etc. to ":deletel": that's
- * :delete with the 'l' flag. Same for 'p'. */
+ // Check for ":dl", ":dell", etc. to ":deletel": that's
+ // :delete with the 'l' flag. Same for 'p'.
for (i = 0; i < len; ++i)
if (eap->cmd[i] != ((char_u *)"delete")[i])
break;
@@ -3187,8 +3187,8 @@ find_command(exarg_T *eap, int *full UNUSED)
getout(1);
}
- /* Use a precomputed index for fast look-up in cmdnames[]
- * taking into account the first 2 letters of eap->cmd. */
+ // Use a precomputed index for fast look-up in cmdnames[]
+ // taking into account the first 2 letters of eap->cmd.
eap->cmdidx = cmdidxs1[CharOrdLow(c1)];
if (ASCII_ISLOWER(c2))
eap->cmdidx += cmdidxs2[CharOrdLow(c1)][CharOrdLow(c2)];
@@ -3231,7 +3231,7 @@ static struct cmdmod
{
char *name;
int minlen;
- int has_count; /* :123verbose :3tab */
+ int has_count; // :123verbose :3tab
} cmdmods[] = {
{"aboveleft", 3, FALSE},
{"belowright", 3, FALSE},
@@ -3296,7 +3296,7 @@ cmd_exists(char_u *name)
int j;
char_u *p;
- /* Check command modifiers. */
+ // Check command modifiers.
for (i = 0; i < (int)(sizeof(cmdmods) / sizeof(struct cmdmod)); ++i)
{
for (j = 0; name[j] != NUL; ++j)
@@ -3306,8 +3306,8 @@ cmd_exists(char_u *name)
return (cmdmods[i].name[j] == NUL ? 2 : 1);
}
- /* Check built-in commands and user defined commands.
- * For ":2match" and ":3match" we need to skip the number. */
+ // Check built-in commands and user defined commands.
+ // For ":2match" and ":3match" we need to skip the number.
ea.cmd = (*name == '2' || *name == '3') ? name + 1 : name;
ea.cmdidx = (cmdidx_T)0;
p = find_command(&ea, &full);
@@ -3316,7 +3316,7 @@ cmd_exists(char_u *name)
if (vim_isdigit(*name) && ea.cmdidx != CMD_match)
return 0;
if (*skipwhite(p) != NUL)
- return 0; /* trailing garbage */
+ return 0; // trailing garbage
return (ea.cmdidx == CMD_SIZE ? 0 : (full ? 2 : 1));
}
#endif
@@ -3352,7 +3352,7 @@ excmd_get_argt(cmdidx_T idx)
char_u *
skip_range(
char_u *cmd,
- int *ctx) /* pointer to xp_context or NULL */
+ int *ctx) // pointer to xp_context or NULL
{
unsigned delim;
@@ -3383,7 +3383,7 @@ skip_range(
++cmd;
}
- /* Skip ":" and white space. */
+ // Skip ":" and white space.
while (*cmd == ':')
cmd = skipwhite(cmd + 1);
@@ -3434,7 +3434,7 @@ get_address(
{
switch (*cmd)
{
- case '.': /* '.' - Cursor position */
+ case '.': // '.' - Cursor position
++cmd;
switch (addr_type)
{
@@ -3475,7 +3475,7 @@ get_address(
}
break;
- case '$': /* '$' - last line */
+ case '$': // '$' - last line
++cmd;
switch (addr_type)
{
@@ -3529,7 +3529,7 @@ get_address(
}
break;
- case '\'': /* ''' - mark */
+ case '\'': // ''' - mark
if (*++cmd == NUL)
{
cmd = NULL;
@@ -3545,12 +3545,12 @@ get_address(
++cmd;
else
{
- /* Only accept a mark in another file when it is
- * used by itself: ":'M". */
+ // Only accept a mark in another file when it is
+ // used by itself: ":'M".
fp = getmark(*cmd, to_other_file && cmd[1] == NUL);
++cmd;
if (fp == (pos_T *)-1)
- /* Jumped to another file. */
+ // Jumped to another file.
lnum = curwin->w_cursor.lnum;
else
{
@@ -3565,7 +3565,7 @@ get_address(
break;
case '/':
- case '?': /* '/' or '?' - search */
+ case '?': // '/' or '?' - search
c = *cmd++;
if (addr_type != ADDR_LINES)
{
@@ -3573,7 +3573,7 @@ get_address(
cmd = NULL;
goto error;
}
- if (skip) /* skip "/pat/" */
+ if (skip) // skip "/pat/"
{
cmd = skip_regexp(cmd, c, (int)p_magic, NULL);
if (*cmd == c)
@@ -3610,12 +3610,12 @@ get_address(
}
lnum = curwin->w_cursor.lnum;
curwin->w_cursor = pos;
- /* adjust command string pointer */
+ // adjust command string pointer
cmd += searchcmdlen;
}
break;
- case '\\': /* "\?", "\/" or "\&", repeat search */
+ case '\\': // "\?", "\/" or "\&", repeat search
++cmd;
if (addr_type != ADDR_LINES)
{
@@ -3668,7 +3668,7 @@ get_address(
break;
default:
- if (VIM_ISDIGIT(*cmd)) /* absolute line number */
+ if (VIM_ISDIGIT(*cmd)) // absolute line number
lnum = getdigits(&cmd);
}
@@ -3721,10 +3721,10 @@ get_address(
}
if (VIM_ISDIGIT(*cmd))
- i = '+'; /* "number" is same as "+number" */
+ i = '+'; // "number" is same as "+number"
else
i = *cmd++;
- if (!VIM_ISDIGIT(*cmd)) /* '+' is '+1', but '+0' is not '+1' */
+ if (!VIM_ISDIGIT(*cmd)) // '+' is '+1', but '+0' is not '+1'
n = 1;
else
n = getdigits(&cmd);
@@ -3742,8 +3742,8 @@ get_address(
else
{
#ifdef FEAT_FOLDING
- /* Relative line addressing, need to adjust for folded lines
- * now, but only do it after the first address. */
+ // Relative line addressing, need to adjust for folded lines
+ // now, but only do it after the first address.
if (addr_type == ADDR_LINES && (i == '-' || i == '+')
&& address_count >= 2)
(void)hasFolding(lnum, NULL, &lnum);
@@ -3831,7 +3831,7 @@ invalid_range(exarg_T *eap)
return _(e_invrange);
break;
case ADDR_ARGUMENTS:
- /* add 1 if ARGCOUNT is 0 */
+ // add 1 if ARGCOUNT is 0
if (eap->line2 > ARGCOUNT + (!ARGCOUNT))
return _(e_invrange);
break;
@@ -3979,14 +3979,14 @@ replace_makeprg(exarg_T *eap, char_u *p, char_u **cmdlinep)
if ((pos = (char_u *)strstr((char *)program, "$*")) != NULL)
{
- /* replace $* by given arguments */
+ // replace $* by given arguments
i = 1;
while ((pos = (char_u *)strstr((char *)pos + 2, "$*")) != NULL)
++i;
len = (int)STRLEN(p);
new_cmdline = alloc(STRLEN(program) + i * (len - 2) + 1);
if (new_cmdline == NULL)
- return NULL; /* out of memory */
+ return NULL; // out of memory
ptr = new_cmdline;
while ((pos = (char_u *)strstr((char *)program, "$*")) != NULL)
{
@@ -4002,14 +4002,14 @@ replace_makeprg(exarg_T *eap, char_u *p, char_u **cmdlinep)
{
new_cmdline = alloc(STRLEN(program) + STRLEN(p) + 2);
if (new_cmdline == NULL)
- return NULL; /* out of memory */
+ return NULL; // out of memory
STRCPY(new_cmdline, program);
STRCAT(new_cmdline, " ");
STRCAT(new_cmdline, p);
}
msg_make(p);
- /* 'eap->cmd' is not set here, because it is not used at CMD_make */
+ // 'eap->cmd' is not set here, because it is not used at CMD_make
vim_free(*cmdlinep);
*cmdlinep = new_cmdline;
p = new_cmdline;
@@ -4029,7 +4029,7 @@ expand_filename(
char_u **cmdlinep,
char **errormsgp)
{
- int has_wildcards; /* need to expand wildcards */
+ int has_wildcards; // need to expand wildcards
char_u *repl;
int srclen;
char_u *p;
@@ -4037,7 +4037,7 @@ expand_filename(
int escaped;
#ifdef FEAT_QUICKFIX
- /* Skip a regexp pattern for ":vimgrep[add] pat file..." */
+ // Skip a regexp pattern for ":vimgrep[add] pat file..."
p = skip_grep_pat(eap);
#else
p = eap->arg;
@@ -4052,7 +4052,7 @@ expand_filename(
while (*p != NUL)
{
#ifdef FEAT_EVAL
- /* Skip over `=expr`, wildcards in it are not expanded. */
+ // Skip over `=expr`, wildcards in it are not expanded.
if (p[0] == '`' && p[1] == '=')
{
p += 2;
@@ -4077,16 +4077,16 @@ expand_filename(
*/
repl = eval_vars(p, eap->arg, &srclen, &(eap->do_ecmd_lnum),
errormsgp, &escaped);
- if (*errormsgp != NULL) /* error detected */
+ if (*errormsgp != NULL) // error detected
return FAIL;
- if (repl == NULL) /* no match found */
+ if (repl == NULL) // no match found
{
p += srclen;
continue;
}
- /* Wildcards won't be expanded below, the replacement is taken
- * literally. But do expand "~/file", "~user/file" and "$HOME/file". */
+ // Wildcards won't be expanded below, the replacement is taken
+ // literally. But do expand "~/file", "~user/file" and "$HOME/file".
if (vim_strchr(repl, '$') != NULL || vim_strchr(repl, '~') != NULL)
{
char_u *l = repl;
@@ -4095,13 +4095,12 @@ expand_filename(
vim_free(l);
}
- /* Need to escape white space et al. with a backslash.
- * Don't do this for:
- * - replacement that already has been escaped: "##"
- * - shell commands (may have to use quotes instead).
- * - non-unix systems when there is a single argument (spaces don't
- * separate arguments then).
- */
+ // Need to escape white space et al. with a backslash.
+ // Don't do this for:
+ // - replacement that already has been escaped: "##"
+ // - shell commands (may have to use quotes instead).
+ // - non-unix systems when there is a single argument (spaces don't
+ // separate arguments then).
if (!eap->usefilter
&& !escaped
&& eap->cmdidx != CMD_bang
@@ -4120,8 +4119,8 @@ expand_filename(
{
char_u *l;
#ifdef BACKSLASH_IN_FILENAME
- /* Don't escape a backslash here, because rem_backslash() doesn't
- * remove it later. */
+ // Don't escape a backslash here, because rem_backslash() doesn't
+ // remove it later.
static char_u *nobslash = (char_u *)" \t\"|";
# define ESCAPE_CHARS nobslash
#else
@@ -4141,7 +4140,7 @@ expand_filename(
}
}
- /* For a shell command a '!' must be escaped. */
+ // For a shell command a '!' must be escaped.
if ((eap->usefilter || eap->cmdidx == CMD_bang
|| eap->cmdidx == CMD_terminal)
&& vim_strpbrk(repl, (char_u *)"!") != NULL)
@@ -4210,7 +4209,7 @@ expand_filename(
else
p = NULL;
}
- else /* n == 2 */
+ else // n == 2
{
expand_T xpc;
int options = WILD_LIST_NOTFOUND
@@ -4229,7 +4228,7 @@ expand_filename(
{
(void)repl_cmdline(eap, eap->arg, (int)STRLEN(eap->arg),
p, cmdlinep);
- if (n == 2) /* p came from ExpandOne() */
+ if (n == 2) // p came from ExpandOne()
vim_free(p);
}
}
@@ -4266,9 +4265,9 @@ repl_cmdline(
len = (int)STRLEN(repl);
i = (int)(src - *cmdlinep) + (int)STRLEN(src + srclen) + len + 3;
if (eap->nextcmd != NULL)
- i += (int)STRLEN(eap->nextcmd);/* add space for next command */
+ i += (int)STRLEN(eap->nextcmd);// add space for next command
if ((new_cmdline = alloc(i)) == NULL)
- return NULL; /* out of memory! */
+ return NULL; // out of memory!
/*
* Copy the stuff before the expanded part.
@@ -4276,15 +4275,15 @@ repl_cmdline(
* Copy what came after the expanded part.
* Copy the next commands, if there are any.
*/
- i = (int)(src - *cmdlinep); /* length of part before match */
+ i = (int)(src - *cmdlinep); // length of part before match
mch_memmove(new_cmdline, *cmdlinep, (size_t)i);
mch_memmove(new_cmdline + i, repl, (size_t)len);
- i += len; /* remember the end of the string */
+ i += len; // remember the end of the string
STRCPY(new_cmdline + i, src + srclen);
- src = new_cmdline + i; /* remember where to continue */
+ src = new_cmdline + i; // remember where to continue
- if (eap->nextcmd != NULL) /* append next command */
+ if (eap->nextcmd != NULL) // append next command
{
i = (int)STRLEN(new_cmdline) + 1;
STRCPY(new_cmdline + i, eap->nextcmd);
@@ -4319,16 +4318,16 @@ separate_nextcmd(exarg_T *eap)
if (*p == Ctrl_V)
{
if (eap->argt & (EX_CTRLV | EX_XFILE))
- ++p; /* skip CTRL-V and next char */
+ ++p; // skip CTRL-V and next char
else
- /* remove CTRL-V and skip next char */
+ // remove CTRL-V and skip next char
STRMOVE(p, p + 1);
- if (*p == NUL) /* stop at NUL after CTRL-V */
+ if (*p == NUL) // stop at NUL after CTRL-V
break;
}
#ifdef FEAT_EVAL
- /* Skip over `=expr` when wildcards are expanded. */
+ // Skip over `=expr` when wildcards are expanded.
else if (p[0] == '`' && p[1] == '=' && (eap->argt & EX_XFILE))
{
p += 2;
@@ -4336,9 +4335,9 @@ separate_nextcmd(exarg_T *eap)
}
#endif
- /* Check for '"': start of comment or '|': next command */
- /* :@" and :*" do not start a comment!
- * :redir @" doesn't either. */
+ // Check for '"': start of comment or '|': next command
+ // :@" and :*" do not start a comment!
+ // :redir @" doesn't either.
else if ((*p == '"' && !(eap->argt & EX_NOTRLCOM)
&& ((eap->cmdidx != CMD_at && eap->cmdidx != CMD_star)
|| p != eap->arg)
@@ -4353,7 +4352,7 @@ separate_nextcmd(exarg_T *eap)
if ((vim_strchr(p_cpo, CPO_BAR) == NULL
|| !(eap->argt & EX_CTRLV)) && *(p - 1) == '\\')
{
- STRMOVE(p - 1, p); /* remove the '\' */
+ STRMOVE(p - 1, p); // remove the '\'
--p;
}
else
@@ -4365,7 +4364,7 @@ separate_nextcmd(exarg_T *eap)
}
}
- if (!(eap->argt & EX_NOTRLCOM)) /* remove trailing spaces */
+ if (!(eap->argt & EX_NOTRLCOM)) // remove trailing spaces
del_trailing_spaces(eap->arg);
}
@@ -4378,7 +4377,7 @@ getargcmd(char_u **argp)
char_u *arg = *argp;
char_u *command = NULL;
- if (*arg == '+') /* +[command] */
+ if (*arg == '+') // +[command]
{
++arg;
if (vim_isspace(*arg) || *arg == NUL)
@@ -4388,10 +4387,10 @@ getargcmd(char_u **argp)
command = arg;
arg = skip_cmd_arg(command, TRUE);
if (*arg != NUL)
- *arg++ = NUL; /* terminate command with NUL */
+ *arg++ = NUL; // terminate command with NUL
}
- arg = skipwhite(arg); /* skip over spaces */
+ arg = skipwhite(arg); // skip over spaces
*argp = arg;
}
return command;
@@ -4403,7 +4402,7 @@ getargcmd(char_u **argp)
char_u *
skip_cmd_arg(
char_u *p,
- int rembs) /* TRUE to halve the number of backslashes */
+ int rembs) // TRUE to halve the number of backslashes
{
while (*p && !vim_isspace(*p))
{
@@ -4445,7 +4444,7 @@ getargopt(exarg_T *eap)
int bad_char_idx;
char_u *p;
- /* ":edit ++[no]bin[ary] file" */
+ // ":edit ++[no]bin[ary] file"
if (STRNCMP(arg, "bin", 3) == 0 || STRNCMP(arg, "nobin", 5) == 0)
{
if (*arg == 'n')
@@ -4461,7 +4460,7 @@ getargopt(exarg_T *eap)
return OK;
}
- /* ":read ++edit file" */
+ // ":read ++edit file"
if (STRNCMP(arg, "edit", 4) == 0)
{
eap->read_edit = TRUE;
@@ -4510,14 +4509,14 @@ getargopt(exarg_T *eap)
}
else if (pp == &eap->force_enc)
{
- /* Make 'fileencoding' lower case. */
+ // Make 'fileencoding' lower case.
for (p = eap->cmd + eap->force_enc; *p != NUL; ++p)
*p = TOLOWER_ASC(*p);
}
else
{
- /* Check ++bad= argument. Must be a single-byte character, "keep" or
- * "drop". */
+ // Check ++bad= argument. Must be a single-byte character, "keep" or
+ // "drop".
if (get_bad_opt(eap->cmd + bad_char_idx, eap) == FAIL)
return FAIL;
}
@@ -4554,7 +4553,7 @@ ex_doautocmd(exarg_T *eap)
int did_aucmd;
(void)do_doautocmd(arg, TRUE, &did_aucmd);
- /* Only when there is no <nomodeline>. */
+ // Only when there is no <nomodeline>.
if (call_do_modelines && did_aucmd)
do_modelines(0);
}
@@ -4589,7 +4588,7 @@ ex_buffer(exarg_T *eap)
eap->errmsg = e_trailing;
else
{
- if (eap->addr_count == 0) /* default is current buffer */
+ if (eap->addr_count == 0) // default is current buffer
goto_buffer(eap, DOBUF_CURRENT, FORWARD, 0);
else
goto_buffer(eap, DOBUF_FIRST, FORWARD, (int)eap->line2);
@@ -4712,7 +4711,7 @@ check_nextcmd(char_u *p)
*/
static int
check_more(
- int message, /* when FALSE check only, no messages */
+ int message, // when FALSE check only, no messages
int forceit)
{
int n = ARGCOUNT - curwin->w_arg_idx - 1;
@@ -4737,7 +4736,7 @@ check_more(
#endif
semsg(NGETTEXT("E173: %d more file to edit",
"E173: %d more files to edit", n), n);
- quitmore = 2; /* next try to quit is allowed */
+ quitmore = 2; // next try to quit is allowed
}
return FAIL;
}
@@ -4859,7 +4858,7 @@ ex_quit(exarg_T *eap)
return;
}
#endif
- /* Don't quit while editing the command line. */
+ // Don't quit while editing the command line.
if (text_locked())
{
text_locked_msg();
@@ -4876,11 +4875,11 @@ ex_quit(exarg_T *eap)
else
wp = curwin;
- /* Refuse to quit when locked. */
+ // Refuse to quit when locked.
if (curbuf_locked())
return;
- /* Trigger QuitPre and maybe ExitPre */
+ // Trigger QuitPre and maybe ExitPre
if (before_quit_autocmds(wp, FALSE, eap->forceit))
return;
@@ -4904,20 +4903,19 @@ ex_quit(exarg_T *eap)
}
else
{
- /* quit last window
- * Note: only_one_window() returns true, even so a help window is
- * still open. In that case only quit, if no address has been
- * specified. Example:
- * :h|wincmd w|1q - don't quit
- * :h|wincmd w|q - quit
- */
+ // quit last window
+ // Note: only_one_window() returns true, even so a help window is
+ // still open. In that case only quit, if no address has been
+ // specified. Example:
+ // :h|wincmd w|1q - don't quit
+ // :h|wincmd w|q - quit
if (only_one_window() && (ONE_WINDOW || eap->addr_count == 0))
getout(0);
not_exiting();
#ifdef FEAT_GUI
need_mouse_correct = TRUE;
#endif
- /* close window; may free buffer */
+ // close window; may free buffer
win_close(wp, !buf_hide(wp->w_buffer) || eap->forceit);
}
}
@@ -4928,8 +4926,8 @@ ex_quit(exarg_T *eap)
static void
ex_cquit(exarg_T *eap UNUSED)
{
- getout(1); /* this does not always pass on the exit code to the Manx
- compiler. why? */
+ getout(1); // this does not always pass on the exit code to the Manx
+ // compiler. why?
}
/*
@@ -4942,14 +4940,14 @@ ex_quit_all(exarg_T *eap)
if (cmdwin_type != 0)
{
if (eap->forceit)
- cmdwin_result = K_XF1; /* ex_window() takes care of this */
+ cmdwin_result = K_XF1; // ex_window() takes care of this
else
cmdwin_result = K_XF2;
return;
}
# endif
- /* Don't quit while editing the command line. */
+ // Don't quit while editing the command line.
if (text_locked())
{
text_locked_msg();
@@ -5028,7 +5026,7 @@ ex_pclose(exarg_T *eap)
ex_win_close(
int forceit,
win_T *win,
- tabpage_T *tp) /* NULL or the tab page "win" is in */
+ tabpage_T *tp) // NULL or the tab page "win" is in
{
int need_hide;
buf_T *buf = win->w_buffer;
@@ -5059,7 +5057,7 @@ ex_win_close(
need_mouse_correct = TRUE;
#endif
- /* free buffer when not hiding it or when it's a scratch buffer */
+ // free buffer when not hiding it or when it's a scratch buffer
if (tp == NULL)
win_close(win, !need_hide && !buf_hide(buf));
else
@@ -5081,8 +5079,8 @@ get_tabpage_arg(exarg_T *eap)
{
char_u *p = eap->arg;
char_u *p_save;
- int relative = 0; /* argument +N/-N means: go to N places to the
- * right/left relative to the current position. */
+ int relative = 0; // argument +N/-N means: go to N places to the
+ // right/left relative to the current position.
if (*p == '-')
{
@@ -5105,7 +5103,7 @@ get_tabpage_arg(exarg_T *eap)
else if (p == p_save || *p_save == '-' || *p != NUL
|| tab_number > LAST_TAB_NR)
{
- /* No numbers as argument. */
+ // No numbers as argument.
eap->errmsg = e_invarg;
goto theend;
}
@@ -5117,7 +5115,7 @@ get_tabpage_arg(exarg_T *eap)
else if (p == p_save || *p_save == '-' || *p != NUL
|| tab_number == 0)
{
- /* No numbers as argument. */
+ // No numbers as argument.
eap->errmsg = e_invarg;
goto theend;
}
@@ -5229,18 +5227,18 @@ ex_tabonly(exarg_T *eap)
if (eap->errmsg == NULL)
{
goto_tabpage(tab_number);
- /* Repeat this up to a 1000 times, because autocommands may
- * mess up the lists. */
+ // Repeat this up to a 1000 times, because autocommands may
+ // mess up the lists.
for (done = 0; done < 1000; ++done)
{
FOR_ALL_TABPAGES(tp)
if (tp->tp_topframe != topframe)
{
tabpage_close_other(tp, eap->forceit);
- /* if we failed to close it quit */
+ // if we failed to close it quit
if (valid_tabpage(tp))
done = 1000;
- /* start over, "tp" is now invalid */
+ // start over, "tp" is now invalid
break;
}
if (first_tabpage->tp_next == NULL)
@@ -5256,8 +5254,8 @@ ex_tabonly(exarg_T *eap)
void
tabpage_close(int forceit)
{
- /* First close all the windows but the current one. If that worked then
- * close the last window in this tab, that will close it. */
+ // First close all the windows but the current one. If that worked then
+ // close the last window in this tab, that will close it.
if (!ONE_WINDOW)
close_others(TRUE, forceit);
if (ONE_WINDOW)
@@ -5280,15 +5278,15 @@ tabpage_close_other(tabpage_T *tp, int forceit)
win_T *wp;
int h = tabline_height();
- /* Limit to 1000 windows, autocommands may add a window while we close
- * one. OK, so I'm paranoid... */
+ // Limit to 1000 windows, autocommands may add a window while we close
+ // one. OK, so I'm paranoid...
while (++done < 1000)
{
wp = tp->tp_firstwin;
ex_win_close(forceit, wp, tp);
- /* Autocommands may delete the tab page under our fingers and we may
- * fail to close a window with a modified buffer. */
+ // Autocommands may delete the tab page under our fingers and we may
+ // fail to close a window with a modified buffer.
if (!valid_tabpage(tp) || tp->tp_firstwin == wp)
break;
}
@@ -5329,14 +5327,14 @@ ex_only(exarg_T *eap)
static void
ex_hide(exarg_T *eap UNUSED)
{
- /* ":hide" or ":hide | cmd": hide current window */
+ // ":hide" or ":hide | cmd": hide current window
if (!eap->skip)
{
#ifdef FEAT_GUI
need_mouse_correct = TRUE;
#endif
if (eap->addr_count == 0)
- win_close(curwin, FALSE); /* don't free buffer */
+ win_close(curwin, FALSE); // don't free buffer
else
{
int winnr = 0;
@@ -5372,19 +5370,19 @@ ex_stop(exarg_T *eap)
out_char('\n');
out_flush();
stoptermcap();
- out_flush(); /* needed for SUN to restore xterm buffer */
+ out_flush(); // needed for SUN to restore xterm buffer
#ifdef FEAT_TITLE
- mch_restore_title(SAVE_RESTORE_BOTH); /* restore window titles */
+ mch_restore_title(SAVE_RESTORE_BOTH); // restore window titles
#endif
- ui_suspend(); /* call machine specific function */
+ ui_suspend(); // call machine specific function
#ifdef FEAT_TITLE
maketitle();
- resettitle(); /* force updating the title */
+ resettitle(); // force updating the title
#endif
starttermcap();
- scroll_start(); /* scroll screen before redrawing */
+ scroll_start(); // scroll screen before redrawing
redraw_later_clear();
- shell_resized(); /* may have resized window */
+ shell_resized(); // may have resized window
}
}
@@ -5401,7 +5399,7 @@ ex_exit(exarg_T *eap)
return;
}
#endif
- /* Don't quit while editing the command line. */
+ // Don't quit while editing the command line.
if (text_locked())
{
text_locked_msg();
@@ -5426,13 +5424,13 @@ ex_exit(exarg_T *eap)
}
else
{
- if (only_one_window()) /* quit last window, exit Vim */
+ if (only_one_window()) // quit last window, exit Vim
getout(0);
not_exiting();
# ifdef FEAT_GUI
need_mouse_correct = TRUE;
# endif
- /* Quit current window, may free the buffer. */
+ // Quit current window, may free the buffer.
win_close(curwin, !buf_hide(curwin->w_buffer));
}
}
@@ -5455,10 +5453,10 @@ ex_print(exarg_T *eap)
eap->cmdidx == CMD_list || (eap->flags & EXFLAG_LIST));
if (++eap->line1 > eap->line2)
break;
- out_flush(); /* show one line at a time */
+ out_flush(); // show one line at a time
}
setpcmark();
- /* put cursor at last line */
+ // put cursor at last line
curwin->w_cursor.lnum = eap->line2;
beginline(BL_SOL | BL_FIX);
}
@@ -5502,11 +5500,10 @@ handle_drop_internal(void)
// recursively. Avoid that by setting drop_busy.
drop_busy = TRUE;
- /* Check whether the current buffer is changed. If so, we will need
- * to split the current window or data could be lost.
- * We don't need to check if the 'hidden' option is set, as in this
- * case the buffer won't be lost.
- */
+ // Check whether the current buffer is changed. If so, we will need
+ // to split the current window or data could be lost.
+ // We don't need to check if the 'hidden' option is set, as in this
+ // case the buffer won't be lost.
if (!buf_hide(curbuf) && !drop_split)
{
++emsg_off;
@@ -5519,8 +5516,8 @@ handle_drop_internal(void)
return;
RESET_BINDING(curwin);
- /* When splitting the window, create a new alist. Otherwise the
- * existing one is overwritten. */
+ // When splitting the window, create a new alist. Otherwise the
+ // existing one is overwritten.
alist_unlink(curwin->w_alist);
alist_new();
}
@@ -5533,18 +5530,18 @@ handle_drop_internal(void)
/*
* Move to the first file.
*/
- /* Fake up a minimal "next" command for do_argfile() */
+ // Fake up a minimal "next" command for do_argfile()
vim_memset(&ea, 0, sizeof(ea));
ea.cmd = (char_u *)"next";
do_argfile(&ea, 0);
- /* do_ecmd() may set need_start_insertmode, but since we never left Insert
- * mode that is not needed here. */
+ // do_ecmd() may set need_start_insertmode, but since we never left Insert
+ // mode that is not needed here.
need_start_insertmode = FALSE;
- /* Restore msg_scroll, otherwise a following command may cause scrolling
- * unexpectedly. The screen will be redrawn by the caller, thus
- * msg_scroll being set by displaying a message is irrelevant. */
+ // Restore msg_scroll, otherwise a following command may cause scrolling
+ // unexpectedly. The screen will be redrawn by the caller, thus
+ // msg_scroll being set by displaying a message is irrelevant.
msg_scroll = save_msg_scroll;
if (drop_callback != NULL)
@@ -5637,7 +5634,7 @@ ex_preserve(exarg_T *eap UNUSED)
static void
ex_recover(exarg_T *eap)
{
- /* Set recoverymode right away to avoid the ATTENTION prompt. */
+ // Set recoverymode right away to avoid the ATTENTION prompt.
recoverymode = TRUE;
if (!check_changed(curbuf, (p_awa ? CCGD_AW : 0)
| CCGD_MULTWIN
@@ -5694,8 +5691,8 @@ ex_splitview(exarg_T *eap)
#endif
#ifdef FEAT_QUICKFIX
- /* A ":split" in the quickfix window works like ":new". Don't want two
- * quickfix windows. But it's OK when doing ":tab split". */
+ // A ":split" in the quickfix window works like ":new". Don't want two
+ // quickfix windows. But it's OK when doing ":tab split".
if (bt_quickfix(curbuf) && cmdmod.tab == 0)
{
if (eap->cmdidx == CMD_split)
@@ -5729,8 +5726,8 @@ ex_splitview(exarg_T *eap)
# endif
au_has_group((char_u *)"FileExplorer"))
{
- /* No browsing supported but we do have the file explorer:
- * Edit the directory. */
+ // No browsing supported but we do have the file explorer:
+ // Edit the directory.
if (*eap->arg == NUL || !mch_isdir(eap->arg))
eap->arg = (char_u *)".";
}
@@ -5745,7 +5742,7 @@ ex_splitview(exarg_T *eap)
eap->arg = fname;
}
}
- cmdmod.browse = FALSE; /* Don't browse again in do_ecmd(). */
+ cmdmod.browse = FALSE; // Don't browse again in do_ecmd().
#endif
/*
@@ -5759,7 +5756,7 @@ ex_splitview(exarg_T *eap)
{
do_exedit(eap, old_curwin);
- /* set the alternate buffer for the window we came from */
+ // set the alternate buffer for the window we came from
if (curwin != old_curwin
&& win_valid(old_curwin)
&& old_curwin->w_buffer != curbuf
@@ -5770,8 +5767,8 @@ ex_splitview(exarg_T *eap)
else if (win_split(eap->addr_count > 0 ? (int)eap->line2 : 0,
*eap->cmd == 'v' ? WSP_VERT : 0) != FAIL)
{
- /* Reset 'scrollbind' when editing another file, but keep it when
- * doing ":split" without arguments. */
+ // Reset 'scrollbind' when editing another file, but keep it when
+ // doing ":split" without arguments.
if (*eap->arg != NUL
# ifdef FEAT_BROWSE
|| cmdmod.browse
@@ -5838,7 +5835,7 @@ ex_tabnext(exarg_T *eap)
if (p == p_save || *p_save == '-' || *p != NUL
|| tab_number == 0)
{
- /* No numbers as argument. */
+ // No numbers as argument.
eap->errmsg = e_invarg;
return;
}
@@ -5859,7 +5856,7 @@ ex_tabnext(exarg_T *eap)
}
goto_tabpage(-tab_number);
break;
- default: /* CMD_tabnext */
+ default: // CMD_tabnext
tab_number = get_tabpage_arg(eap);
if (eap->errmsg == NULL)
goto_tabpage(tab_number);
@@ -5897,7 +5894,7 @@ ex_tabs(exarg_T *eap UNUSED)
msg_putchar('\n');
vim_snprintf((char *)IObuff, IOSIZE, _("Tab page %d"), tabcount++);
msg_outtrans_attr(IObuff, HL_ATTR(HLF_T));
- out_flush(); /* output one line at a time */
+ out_flush(); // output one line at a time
ui_breakcheck();
if (tp == curtab)
@@ -5917,7 +5914,7 @@ ex_tabs(exarg_T *eap UNUSED)
home_replace(wp->w_buffer, wp->w_buffer->b_fname,
IObuff, IOSIZE, TRUE);
msg_outtrans(IObuff);
- out_flush(); /* output one line at a time */
+ out_flush(); // output one line at a time
ui_breakcheck();
}
}
@@ -5961,7 +5958,7 @@ ex_resize(exarg_T *eap)
{
if (*eap->arg == '-' || *eap->arg == '+')
n += curwin->w_width;
- else if (n == 0 && eap->arg[0] == NUL) /* default is very wide */
+ else if (n == 0 && eap->arg[0] == NUL) // default is very wide
n = 9999;
win_setwidth_win((int)n, wp);
}
@@ -5969,7 +5966,7 @@ ex_resize(exarg_T *eap)
{
if (*eap->arg == '-' || *eap->arg == '+')
n += curwin->w_height;
- else if (n == 0 && eap->arg[0] == NUL) /* default is very high */
+ else if (n == 0 && eap->arg[0] == NUL) // default is very high
n = 9999;
win_setheight_win((int)n, wp);
}
@@ -5989,8 +5986,8 @@ ex_find(exarg_T *eap)
TRUE, curbuf->b_ffname);
if (eap->addr_count > 0)
{
- /* Repeat finding the file "count" times. This matters when it
- * appears several times in the path. */
+ // Repeat finding the file "count" times. This matters when it
+ // appears several times in the path.
count = eap->line2;
while (fname != NULL && --count > 0)
{
@@ -6024,7 +6021,7 @@ ex_open(exarg_T *eap)
beginline(BL_SOL | BL_FIX);
if (*eap->arg == '/')
{
- /* ":open /pattern/": put cursor in column found with pattern */
+ // ":open /pattern/": put cursor in column found with pattern
++eap->arg;
p = skip_regexp(eap->arg, '/', p_magic, NULL);
*p = NUL;
@@ -6039,7 +6036,7 @@ ex_open(exarg_T *eap)
emsg(_(e_nomatch));
vim_regfree(regmatch.regprog);
}
- /* Move to the NUL, ignore any other arguments. */
+ // Move to the NUL, ignore any other arguments.
eap->arg += STRLEN(eap->arg);
}
check_cursor();
@@ -6063,7 +6060,7 @@ ex_edit(exarg_T *eap)
void
do_exedit(
exarg_T *eap,
- win_T *old_curwin) /* curwin before doing a split or NULL */
+ win_T *old_curwin) // curwin before doing a split or NULL
{
int n;
int need_hide;
@@ -6080,7 +6077,7 @@ do_exedit(
exmode_active = FALSE;
if (*eap->arg == NUL)
{
- /* Special case: ":global/pat/visual\NLvi-commands" */
+ // Special case: ":global/pat/visual\NLvi-commands"
if (global_busy)
{
int rd = RedrawingDisabled;
@@ -6125,7 +6122,7 @@ do_exedit(
|| eap->cmdidx == CMD_tabedit
|| eap->cmdidx == CMD_vnew) && *eap->arg == NUL)
{
- /* ":new" or ":tabnew" without argument: edit an new empty buffer */
+ // ":new" or ":tabnew" without argument: edit an new empty buffer
setpcmark();
(void)do_ecmd(0, NULL, NULL, eap, ECMD_ONE,
ECMD_HIDE + (eap->forceit ? ECMD_FORCEIT : 0),
@@ -6138,8 +6135,8 @@ do_exedit(
#endif
)
{
- /* Can't edit another file when "curbuf_lock" is set. Only ":edit"
- * can bring us here, others are stopped earlier. */
+ // Can't edit another file when "curbuf_lock" is set. Only ":edit"
+ // can bring us here, others are stopped earlier.
if (*eap->arg != NUL && curbuf_locked())
return;
@@ -6147,23 +6144,23 @@ do_exedit(
if (eap->cmdidx == CMD_view || eap->cmdidx == CMD_sview)
readonlymode = TRUE;
else if (eap->cmdidx == CMD_enew)
- readonlymode = FALSE; /* 'readonly' doesn't make sense in an
- empty buffer */
+ readonlymode = FALSE; // 'readonly' doesn't make sense in an
+ // empty buffer
setpcmark();
if (do_ecmd(0, (eap->cmdidx == CMD_enew ? NULL : eap->arg),
NULL, eap,
- /* ":edit" goes to first line if Vi compatible */
+ // ":edit" goes to first line if Vi compatible
(*eap->arg == NUL && eap->do_ecmd_lnum == 0
&& vim_strchr(p_cpo, CPO_GOTO1) != NULL)
? ECMD_ONE : eap->do_ecmd_lnum,
(buf_hide(curbuf) ? ECMD_HIDE : 0)
+ (eap->forceit ? ECMD_FORCEIT : 0)
- /* after a split we can use an existing buffer */
+ // after a split we can use an existing buffer
+ (old_curwin != NULL ? ECMD_OLDBUF : 0)
+ (eap->cmdidx == CMD_badd ? ECMD_ADDBUF : 0 )
, old_curwin == NULL ? curwin : NULL) == FAIL)
{
- /* Editing the file failed. If the window was split, close it. */
+ // Editing the file failed. If the window was split, close it.
if (old_curwin != NULL)
{
need_hide = (curbufIsChanged() && curbuf->b_nwindows <= 1);
@@ -6172,8 +6169,8 @@ do_exedit(
#if defined(FEAT_EVAL)
cleanup_T cs;
- /* Reset the error/interrupt/exception state here so that
- * aborting() returns FALSE when closing a window. */
+ // Reset the error/interrupt/exception state here so that
+ // aborting() returns FALSE when closing a window.
enter_cleanup(&cs);
#endif
#ifdef FEAT_GUI
@@ -6182,9 +6179,9 @@ do_exedit(
win_close(curwin, !need_hide && !buf_hide(curbuf));
#if defined(FEAT_EVAL)
- /* Restore the error/interrupt/exception state if not
- * discarded by a new aborting error, interrupt, or
- * uncaught exception. */
+ // Restore the error/interrupt/exception state if not
+ // discarded by a new aborting error, interrupt, or
+ // uncaught exception.
leave_cleanup(&cs);
#endif
}
@@ -6192,10 +6189,10 @@ do_exedit(
}
else if (readonlymode && curbuf->b_nwindows == 1)
{
- /* When editing an already visited buffer, 'readonly' won't be set
- * but the previous value is kept. With ":view" and ":sview" we
- * want the file to be readonly, except when another window is
- * editing the same buffer. */
+ // When editing an already visited buffer, 'readonly' won't be set
+ // but the previous value is kept. With ":view" and ":sview" we
+ // want the file to be readonly, except when another window is
+ // editing the same buffer.
curbuf->b_p_ro = TRUE;
}
readonlymode = n;
@@ -6360,7 +6357,7 @@ ex_read(exarg_T *eap)
int empty = (curbuf->b_ml.ml_flags & ML_EMPTY);
linenr_T lnum;
- if (eap->usefilter) /* :r!cmd */
+ if (eap->usefilter) // :r!cmd
do_bang(1, eap, FALSE, FALSE, TRUE);
else
{
@@ -6387,7 +6384,7 @@ ex_read(exarg_T *eap)
#endif
if (*eap->arg == NUL)
{
- if (check_fname() == FAIL) /* check for no file name */
+ if (check_fname() == FAIL) // check for no file name
return;
i = readfile(curbuf->b_ffname, curbuf->b_fname,
eap->line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, 0);
@@ -6411,8 +6408,8 @@ ex_read(exarg_T *eap)
{
if (empty && exmode_active)
{
- /* Delete the empty line that remains. Historically ex does
- * this but vi doesn't. */
+ // Delete the empty line that remains. Historically ex does
+ // this but vi doesn't.
if (eap->line2 == 0)
lnum = curbuf->b_ml.ml_line_count;
else
@@ -6456,11 +6453,11 @@ post_chdir(cdscope_T scope)
VIM_CLEAR(curwin->w_localdir);
if (scope != CDSCOPE_GLOBAL)
{
- /* If still in global directory, need to remember current
- * directory as global directory. */
+ // If still in global directory, need to remember current
+ // directory as global directory.
if (globaldir == NULL && prev_dir != NULL)
globaldir = vim_strsave(prev_dir);
- /* Remember this local directory for the window. */
+ // Remember this local directory for the window.
if (mch_dirname(NameBuff, MAXPATHL) == OK)
{
if (scope == CDSCOPE_TABPAGE)
@@ -6471,8 +6468,8 @@ post_chdir(cdscope_T scope)
}
else
{
- /* We are now in the global directory, no need to remember its
- * name. */
+ // We are now in the global directory, no need to remember its
+ // name.
VIM_CLEAR(globaldir);
}
@@ -6747,7 +6744,7 @@ ex_wincmd(exarg_T *eap)
if (*eap->arg == 'g' || *eap->arg == Ctrl_G)
{
- /* CTRL-W g and CTRL-W CTRL-G have an extra command character */
+ // CTRL-W g and CTRL-W CTRL-G have an extra command character
if (eap->arg[1] == NUL)
{
emsg(_(e_invarg));
@@ -6765,7 +6762,7 @@ ex_wincmd(exarg_T *eap)
emsg(_(e_invarg));
else if (!eap->skip)
{
- /* Pass flags on for ":vertical wincmd ]". */
+ // Pass flags on for ":vertical wincmd ]".
postponed_split_flags = cmdmod.split;
postponed_split_tab = cmdmod.tab;
do_window(*eap->arg, eap->addr_count > 0 ? eap->line2 : 0L, xchar);
@@ -6820,7 +6817,7 @@ ex_winpos(exarg_T *eap)
gui_mch_set_winpos(x, y);
else if (gui.starting)
{
- /* Remember the coordinates for when the window is opened. */
+ // Remember the coordinates for when the window is opened.
gui_win_x = x;
gui_win_y = y;
}
@@ -6854,7 +6851,7 @@ ex_operators(exarg_T *eap)
oa.line_count = eap->line2 - eap->line1 + 1;
oa.motion_type = MLINE;
virtual_op = FALSE;
- if (eap->cmdidx != CMD_yank) /* position cursor for undo */
+ if (eap->cmdidx != CMD_yank) // position cursor for undo
{
setpcmark();
curwin->w_cursor.lnum = eap->line1;
@@ -6876,7 +6873,7 @@ ex_operators(exarg_T *eap)
(void)op_yank(&oa, FALSE, TRUE);
break;
- default: /* CMD_rshift or CMD_lshift */
+ default: // CMD_rshift or CMD_lshift
if (
#ifdef FEAT_RIGHTLEFT
(eap->cmdidx == CMD_rshift) ^ curwin->w_p_rl
@@ -6900,7 +6897,7 @@ ex_operators(exarg_T *eap)
static void
ex_put(exarg_T *eap)
{
- /* ":0put" works like ":1put!". */
+ // ":0put" works like ":1put!".
if (eap->line2 == 0)
{
eap->line2 = 1;
@@ -6920,7 +6917,7 @@ ex_copymove(exarg_T *eap)
long n;
n = get_address(eap, &eap->arg, eap->addr_type, FALSE, FALSE, FALSE, 1);
- if (eap->arg == NULL) /* error detected */
+ if (eap->arg == NULL) // error detected
{
eap->nextcmd = NULL;
return;
@@ -6984,7 +6981,7 @@ ex_join(exarg_T *eap)
curwin->w_cursor.lnum = eap->line1;
if (eap->line1 == eap->line2)
{
- if (eap->addr_count >= 2) /* :2,2join does nothing */
+ if (eap->addr_count >= 2) // :2,2join does nothing
return;
if (eap->line2 == curbuf->b_ml.ml_line_count)
{
@@ -7011,14 +7008,14 @@ ex_at(exarg_T *eap)
check_cursor_col();
#ifdef USE_ON_FLY_SCROLL
- dont_scroll = TRUE; /* disallow scrolling here */
+ dont_scroll = TRUE; // disallow scrolling here
#endif
- /* get the register name. No name means to use the previous one */
+ // get the register name. No name means to use the previous one
c = *eap->arg;
if (c == NUL || (c == '*' && *eap->cmd == '*'))
c = '@';
- /* Put the register in the typeahead buffer with the "silent" flag. */
+ // Put the register in the typeahead buffer with the "silent" flag.
if (do_execreg(c, TRUE, vim_strchr(p_cpo, CPO_EXECBUF) != NULL, TRUE)
== FAIL)
{
@@ -7057,7 +7054,7 @@ ex_bang(exarg_T *eap)
static void
ex_undo(exarg_T *eap)
{
- if (eap->addr_count == 1) /* :undo 123 */
+ if (eap->addr_count == 1) // :undo 123
undo_time(eap->line2, FALSE, FALSE, TRUE);
else
u_undo(1);
@@ -7161,7 +7158,7 @@ ex_redir(exarg_T *eap)
close_redir();
- /* Expand environment variables and "~/". */
+ // Expand environment variables and "~/".
fname = expand_env_save(arg);
if (fname == NULL)
return;
@@ -7175,10 +7172,10 @@ ex_redir(exarg_T *eap)
fname, NULL, NULL,
(char_u *)_(BROWSE_FILTER_ALL_FILES), curbuf);
if (browseFile == NULL)
- return; /* operation cancelled */
+ return; // operation cancelled
vim_free(fname);
fname = browseFile;
- eap->forceit = TRUE; /* since dialog already asked */
+ eap->forceit = TRUE; // since dialog already asked
}
#endif
@@ -7188,7 +7185,7 @@ ex_redir(exarg_T *eap)
#ifdef FEAT_EVAL
else if (*arg == '@')
{
- /* redirect to a register a-z (resp. A-Z for appending) */
+ // redirect to a register a-z (resp. A-Z for appending)
close_redir();
++arg;
if (ASCII_ISALPHA(*arg)
@@ -7199,15 +7196,15 @@ ex_redir(exarg_T *eap)
|| *arg == '"')
{
redir_reg = *arg++;
- if (*arg == '>' && arg[1] == '>') /* append */
+ if (*arg == '>' && arg[1] == '>') // append
arg += 2;
else
{
- /* Can use both "@a" and "@a>". */
+ // Can use both "@a" and "@a>".
if (*arg == '>')
arg++;
- /* Make register empty when not using @A-@Z and the
- * command is valid. */
+ // Make register empty when not using @A-@Z and the
+ // command is valid.
if (*arg == NUL && !isupper(redir_reg))
write_reg_contents(redir_reg, (char_u *)"", -1, FALSE);
}
@@ -7222,7 +7219,7 @@ ex_redir(exarg_T *eap)
{
int append;
- /* redirect to a variable */
+ // redirect to a variable
close_redir();
arg += 2;
@@ -7239,14 +7236,14 @@ ex_redir(exarg_T *eap)
}
#endif
- /* TODO: redirect to a buffer */
+ // TODO: redirect to a buffer
else
semsg(_(e_invarg2), eap->arg);
}
- /* Make sure redirection is not off. Can happen for cmdline completion
- * that indirectly invokes a command to catch its output. */
+ // Make sure redirection is not off. Can happen for cmdline completion
+ // that indirectly invokes a command to catch its output.
if (redir_fd != NULL
#ifdef FEAT_EVAL
|| redir_reg || redir_vname
@@ -7282,11 +7279,11 @@ ex_redraw(exarg_T *eap)
RedrawingDisabled = r;
p_lz = p;
- /* Reset msg_didout, so that a message that's there is overwritten. */
+ // Reset msg_didout, so that a message that's there is overwritten.
msg_didout = FALSE;
msg_col = 0;
- /* No need to wait after an intentional redraw. */
+ // No need to wait after an intentional redraw.
need_wait_return = FALSE;
out_flush();
@@ -7371,12 +7368,12 @@ vim_mkdir_emsg(char_u *name, int prot UNUSED)
open_exfile(
char_u *fname,
int forceit,
- char *mode) /* "w" for create new file or "a" for append */
+ char *mode) // "w" for create new file or "a" for append
{
FILE *fd;
#ifdef UNIX
- /* with Unix it is possible to open a directory */
+ // with Unix it is possible to open a directory
if (mch_isdir(fname))
{
semsg(_(e_isadir2), fname);
@@ -7403,18 +7400,18 @@ ex_mark(exarg_T *eap)
{
pos_T pos;
- if (*eap->arg == NUL) /* No argument? */
+ if (*eap->arg == NUL) // No argument?
emsg(_(e_argreq));
- else if (eap->arg[1] != NUL) /* more than one character? */
+ else if (eap->arg[1] != NUL) // more than one character?
emsg(_(e_trailing));
else
{
- pos = curwin->w_cursor; /* save curwin->w_cursor */
+ pos = curwin->w_cursor; // save curwin->w_cursor
curwin->w_cursor.lnum = eap->line2;
beginline(BL_WHITE | BL_FIX);
- if (setmark(*eap->arg) == FAIL) /* set mark */
+ if (setmark(*eap->arg) == FAIL) // set mark
emsg(_("E191: Argument must be a letter or forward/backward quote"));
- curwin->w_cursor = pos; /* restore curwin->w_cursor */
+ curwin->w_cursor = pos; // restore curwin->w_cursor
}
}
@@ -7424,7 +7421,7 @@ ex_mark(exarg_T *eap)
void
update_topline_cursor(void)
{
- check_cursor(); /* put cursor on valid line */
+ check_cursor(); // put cursor on valid line
update_topline();
if (!curwin->w_p_wrap)
validate_cursor();
@@ -7447,9 +7444,9 @@ save_current_state(save_state_T *sst)
sst->save_opcount = opcount;
sst->save_reg_executing = reg_executing;
- msg_scroll = FALSE; /* no msg scrolling in Normal mode */
- restart_edit = 0; /* don't go to Insert mode */
- p_im = FALSE; /* don't use 'insertmode' */
+ msg_scroll = FALSE; // no msg scrolling in Normal mode
+ restart_edit = 0; // don't go to Insert mode
+ p_im = FALSE; // don't use 'insertmode'
/*
* Save the current typeahead. This is required to allow using ":normal"
@@ -7463,7 +7460,7 @@ save_current_state(save_state_T *sst)
void
restore_current_state(save_state_T *sst)
{
- /* Restore the previous typeahead. */
+ // Restore the previous typeahead.
restore_typeahead(&sst->tabuf);
msg_scroll = sst->save_msg_scroll;
@@ -7472,13 +7469,13 @@ restore_current_state(save_state_T *sst)
finish_op = sst->save_finish_op;
opcount = sst->save_opcount;
reg_executing = sst->save_reg_executing;
- msg_didout |= sst->save_msg_didout; /* don't reset msg_didout now */
+ msg_didout |= sst->save_msg_didout; // don't reset msg_didout now
- /* Restore the state (needed when called from a function executed for
- * 'indentexpr'). Update the mouse and cursor, they may have changed. */
+ // Restore the state (needed when called from a function executed for
+ // 'indentexpr'). Update the mouse and cursor, they may have changed.
State = sst->save_State;
#ifdef CURSOR_SHAPE
- ui_cursor_shape(); /* may show different cursor shape */
+ ui_cursor_shape(); // may show different cursor shape
#endif
}
@@ -7513,15 +7510,15 @@ ex_normal(exarg_T *eap)
{
int len = 0;
- /* Count the number of characters to be escaped. */
+ // Count the number of characters to be escaped.
for (p = eap->arg; *p != NUL; ++p)
{
#ifdef FEAT_GUI
- if (*p == CSI) /* leadbyte CSI */
+ if (*p == CSI) // leadbyte CSI
len += 2;
#endif
for (l = (*mb_ptr2len)(p) - 1; l > 0; --l)
- if (*++p == K_SPECIAL /* trailbyte K_SPECIAL or CSI */
+ if (*++p == K_SPECIAL // trailbyte K_SPECIAL or CSI
#ifdef FEAT_GUI
|| *p == CSI
#endif
@@ -7590,14 +7587,14 @@ ex_normal(exarg_T *eap)
while (eap->addr_count > 0 && eap->line1 <= eap->line2 && !got_int);
}
- /* Might not return to the main loop when in an event handler. */
+ // Might not return to the main loop when in an event handler.
update_topline_cursor();
restore_current_state(&save_state);
--ex_normal_busy;
setmouse();
#ifdef CURSOR_SHAPE
- ui_cursor_shape(); /* may show different cursor shape */
+ ui_cursor_shape(); // may show different cursor shape
#endif
vim_free(arg);
@@ -7655,7 +7652,7 @@ ex_stopinsert(exarg_T *eap UNUSED)
void
exec_normal_cmd(char_u *cmd, int remap, int silent)
{
- /* Stuff the argument into the typeahead buffer. */
+ // Stuff the argument into the typeahead buffer.
ins_typebuf(cmd, remap, 0, TRUE, silent);
exec_normal(FALSE, FALSE, FALSE);
}
@@ -7685,15 +7682,15 @@ exec_normal(int was_typed, int use_vpeekc, int may_use_terminal_loop UNUSED)
&& oa.op_type == OP_NOP && oa.regname == NUL
&& !VIsual_active)
{
- /* If terminal_loop() returns OK we got a key that is handled
- * in Normal model. With FAIL we first need to position the
- * cursor and the screen needs to be redrawn. */
+ // If terminal_loop() returns OK we got a key that is handled
+ // in Normal model. With FAIL we first need to position the
+ // cursor and the screen needs to be redrawn.
if (terminal_loop(TRUE) == OK)
normal_cmd(&oa, TRUE);
}
else
#endif
- /* execute a Normal mode cmd */
+ // execute a Normal mode cmd
normal_cmd(&oa, TRUE);
}
}
@@ -7730,30 +7727,30 @@ ex_findpat(exarg_T *eap)
switch (cmdnames[eap->cmdidx].cmd_name[2])
{
- case 'e': /* ":psearch", ":isearch" and ":dsearch" */
+ case 'e': // ":psearch", ":isearch" and ":dsearch"
if (cmdnames[eap->cmdidx].cmd_name[0] == 'p')
action = ACTION_GOTO;
else
action = ACTION_SHOW;
break;
- case 'i': /* ":ilist" and ":dlist" */
+ case 'i': // ":ilist" and ":dlist"
action = ACTION_SHOW_ALL;
break;
- case 'u': /* ":ijump" and ":djump" */
+ case 'u': // ":ijump" and ":djump"
action = ACTION_GOTO;
break;
- default: /* ":isplit" and ":dsplit" */
+ default: // ":isplit" and ":dsplit"
action = ACTION_SPLIT;
break;
}
n = 1;
- if (vim_isdigit(*eap->arg)) /* get count */
+ if (vim_isdigit(*eap->arg)) // get count
{
n = getdigits(&eap->arg);
eap->arg = skipwhite(eap->arg);
}
- if (*eap->arg == '/') /* Match regexp, not just whole words */
+ if (*eap->arg == '/') // Match regexp, not just whole words
{
whole = FALSE;
++eap->arg;
@@ -7763,7 +7760,7 @@ ex_findpat(exarg_T *eap)
*p++ = NUL;
p = skipwhite(p);
- /* Check for trailing illegal characters */
+ // Check for trailing illegal characters
if (!ends_excmd(*p))
eap->errmsg = e_trailing;
else
@@ -7786,7 +7783,7 @@ ex_findpat(exarg_T *eap)
static void
ex_ptag(exarg_T *eap)
{
- g_do_tagpreview = p_pvh; /* will be reset to 0 in ex_tag_cmd() */
+ g_do_tagpreview = p_pvh; // will be reset to 0 in ex_tag_cmd()
ex_tag_cmd(eap, cmdnames[eap->cmdidx].cmd_name + 1);
}
@@ -7853,24 +7850,24 @@ ex_tag_cmd(exarg_T *eap, char_u *name)
switch (name[1])
{
- case 'j': cmd = DT_JUMP; /* ":tjump" */
+ case 'j': cmd = DT_JUMP; // ":tjump"
break;
- case 's': cmd = DT_SELECT; /* ":tselect" */
+ case 's': cmd = DT_SELECT; // ":tselect"
break;
- case 'p': cmd = DT_PREV; /* ":tprevious" */
+ case 'p': cmd = DT_PREV; // ":tprevious"
break;
- case 'N': cmd = DT_PREV; /* ":tNext" */
+ case 'N': cmd = DT_PREV; // ":tNext"
break;
- case 'n': cmd = DT_NEXT; /* ":tnext" */
+ case 'n': cmd = DT_NEXT; // ":tnext"
break;
- case 'o': cmd = DT_POP; /* ":pop" */
+ case 'o': cmd = DT_POP; // ":pop"
break;
- case 'f': /* ":tfirst" */
- case 'r': cmd = DT_FIRST; /* ":trewind" */
+ case 'f': // ":tfirst"
+ case 'r': cmd = DT_FIRST; // ":trewind"
break;
- case 'l': cmd = DT_LAST; /* ":tlast" */
+ case 'l': cmd = DT_LAST; // ":tlast"
break;
- default: /* ":tag" */
+ default: // ":tag"
#ifdef FEAT_CSCOPE
if (p_cst && *eap->arg != NUL)
{
@@ -7911,25 +7908,25 @@ find_cmdline_var(char_u *src, int *usedlen)
#define SPEC_PERC 0
"#",
#define SPEC_HASH (SPEC_PERC + 1)
- "<cword>", /* cursor word */
+ "<cword>", // cursor word
#define SPEC_CWORD (SPEC_HASH + 1)
- "<cWORD>", /* cursor WORD */
+ "<cWORD>", // cursor WORD
#define SPEC_CCWORD (SPEC_CWORD + 1)
- "<cexpr>", /* expr under cursor */
+ "<cexpr>", // expr under cursor
#define SPEC_CEXPR (SPEC_CCWORD + 1)
- "<cfile>", /* cursor path name */
+ "<cfile>", // cursor path name
#define SPEC_CFILE (SPEC_CEXPR + 1)
- "<sfile>", /* ":so" file name */
+ "<sfile>", // ":so" file name
#define SPEC_SFILE (SPEC_CFILE + 1)
- "<slnum>", /* ":so" file line number */
+ "<slnum>", // ":so" file line number
#define SPEC_SLNUM (SPEC_SFILE + 1)
- "<afile>", /* autocommand file name */
+ "<afile>", // autocommand file name
#define SPEC_AFILE (SPEC_SLNUM + 1)
- "<abuf>", /* autocommand buffer number */
+ "<abuf>", // autocommand buffer number
#define SPEC_ABUF (SPEC_AFILE + 1)
- "<amatch>", /* autocommand match name */
+ "<amatch>", // autocommand match name
#define SPEC_AMATCH (SPEC_ABUF + 1)
- "<sflnum>", /* script file line number */
+ "<sflnum>", // script file line number
#define SPEC_SFLNUM (SPEC_AMATCH + 1)
#ifdef FEAT_CLIENTSERVER
"<client>"
@@ -7972,13 +7969,13 @@ find_cmdline_var(char_u *src, int *usedlen)
*/
char_u *
eval_vars(
- char_u *src, /* pointer into commandline */
- char_u *srcstart, /* beginning of valid memory for src */
- int *usedlen, /* characters after src that are used */
- linenr_T *lnump, /* line number for :e command, or NULL */
- char **errormsg, /* pointer to error message */
- int *escaped) /* return value has escaped white space (can
- * be NULL) */
+ char_u *src, // pointer into commandline
+ char_u *srcstart, // beginning of valid memory for src
+ int *usedlen, // characters after src that are used
+ linenr_T *lnump, // line number for :e command, or NULL
+ char **errormsg, // pointer to error message
+ int *escaped) // return value has escaped white space (can
+ // be NULL)
{
int i;
char_u *s;
@@ -7986,7 +7983,7 @@ eval_vars(
char_u *resultbuf = NULL;
int resultlen;
buf_T *buf;
- int valid = VALID_HEAD + VALID_PATH; /* assume valid result */
+ int valid = VALID_HEAD + VALID_PATH; // assume valid result
int spec_idx;
int tilde_file = FALSE;
int skip_mod = FALSE;
@@ -8000,7 +7997,7 @@ eval_vars(
* Check if there is something to do.
*/
spec_idx = find_cmdline_var(src, usedlen);
- if (spec_idx < 0) /* no match */
+ if (spec_idx < 0) // no match
{
*usedlen = 1;
return NULL;
@@ -8013,7 +8010,7 @@ eval_vars(
if (src > srcstart && src[-1] == '\\')
{
*usedlen = 0;
- STRMOVE(src - 1, src); /* remove backslash */
+ STRMOVE(src - 1, src); // remove backslash
return NULL;
}
@@ -8045,11 +8042,11 @@ eval_vars(
{
switch (spec_idx)
{
- case SPEC_PERC: /* '%': current file */
+ case SPEC_PERC: // '%': current file
if (curbuf->b_fname == NULL)
{
result = (char_u *)"";
- valid = 0; /* Must have ":p:h" to be valid */
+ valid = 0; // Must have ":p:h" to be valid
}
else
{
@@ -8058,8 +8055,8 @@ eval_vars(
}
break;
- case SPEC_HASH: /* '#' or "#99": alternate file */
- if (src[1] == '#') /* "##": the argument list */
+ case SPEC_HASH: // '#' or "#99": alternate file
+ if (src[1] == '#') // "##": the argument list
{
result = arg_all();
resultbuf = result;
@@ -8070,19 +8067,19 @@ eval_vars(
break;
}
s = src + 1;
- if (*s == '<') /* "#<99" uses v:oldfiles */
+ if (*s == '<') // "#<99" uses v:oldfiles
++s;
i = (int)getdigits(&s);
if (s == src + 2 && src[1] == '-')
- /* just a minus sign, don't skip over it */
+ // just a minus sign, don't skip over it
s--;
- *usedlen = (int)(s - src); /* length of what we expand */
+ *usedlen = (int)(s - src); // length of what we expand
if (src[1] == '<' && i != 0)
{
if (*usedlen < 2)
{
- /* Should we give an error message for #<text? */
+ // Should we give an error message for #<text?
*usedlen = 1;
return NULL;
}
@@ -8114,7 +8111,7 @@ eval_vars(
if (buf->b_fname == NULL)
{
result = (char_u *)"";
- valid = 0; /* Must have ":p:h" to be valid */
+ valid = 0; // Must have ":p:h" to be valid
}
else
{
@@ -8125,23 +8122,23 @@ eval_vars(
break;
#ifdef FEAT_SEARCHPATH
- case SPEC_CFILE: /* file name under cursor */
+ case SPEC_CFILE: // file name under cursor
result = file_name_at_cursor(FNAME_MESS|FNAME_HYP, 1L, NULL);
if (result == NULL)
{
*errormsg = "";
return NULL;
}
- resultbuf = result; /* remember allocated string */
+ resultbuf = result; // remember allocated string
break;
#endif
- case SPEC_AFILE: /* file name for autocommand */
+ case SPEC_AFILE: // file name for autocommand
result = autocmd_fname;
if (result != NULL && !autocmd_fname_full)
{
- /* Still need to turn the fname into a full path. It is
- * postponed to avoid a delay when <afile> is not used. */
+ // Still need to turn the fname into a full path. It is
+ // postponed to avoid a delay when <afile> is not used.
autocmd_fname_full = TRUE;
result = FullName_save(autocmd_fname, FALSE);
vim_free(autocmd_fname);
@@ -8155,7 +8152,7 @@ eval_vars(
result = shorten_fname1(result);
break;
- case SPEC_ABUF: /* buffer number for autocommand */
+ case SPEC_ABUF: // buffer number for autocommand
if (autocmd_bufnr <= 0)
{
*errormsg = _("E496: no autocommand buffer number to substitute for \"<abuf>\"");
@@ -8165,7 +8162,7 @@ eval_vars(
result = strbuf;
break;
- case SPEC_AMATCH: /* match name for autocommand */
+ case SPEC_AMATCH: // match name for autocommand
result = autocmd_match;
if (result == NULL)
{
@@ -8174,7 +8171,7 @@ eval_vars(
}
break;
- case SPEC_SFILE: /* file name for ":so" command */
+ case SPEC_SFILE: // file name for ":so" command
result = sourcing_name;
if (result == NULL)
{
@@ -8183,7 +8180,7 @@ eval_vars(
}
break;
- case SPEC_SLNUM: /* line in file for ":so" command */
+ case SPEC_SLNUM: // line in file for ":so" command
if (sourcing_name == NULL || sourcing_lnum == 0)
{
*errormsg = _("E842: no line number to use for \"<slnum>\"");
@@ -8194,7 +8191,7 @@ eval_vars(
break;
#ifdef FEAT_EVAL
- case SPEC_SFLNUM: /* line in script file */
+ case SPEC_SFLNUM: // line in script file
if (current_sctx.sc_lnum + sourcing_lnum == 0)
{
*errormsg = _("E961: no line number to use for \"<sflnum>\"");
@@ -8207,7 +8204,7 @@ eval_vars(
#endif
#ifdef FEAT_CLIENTSERVER
- case SPEC_CLIENT: /* Source of last submitted input */
+ case SPEC_CLIENT: // Source of last submitted input
sprintf((char *)strbuf, PRINTF_HEX_LONG_U,
(long_u)clientWindow);
result = strbuf;
@@ -8215,12 +8212,12 @@ eval_vars(
#endif
default:
- result = (char_u *)""; /* avoid gcc warning */
+ result = (char_u *)""; // avoid gcc warning
break;
}
- resultlen = (int)STRLEN(result); /* length of new string */
- if (src[*usedlen] == '<') /* remove the file name extension */
+ resultlen = (int)STRLEN(result); // length of new string
+ if (src[*usedlen] == '<') // remove the file name extension
{
++*usedlen;
if ((s = vim_strrchr(result, '.')) != NULL && s >= gettail(result))
@@ -8241,7 +8238,7 @@ eval_vars(
if (resultlen == 0 || valid != VALID_HEAD + VALID_PATH)
{
if (valid != VALID_HEAD + VALID_PATH)
- /* xgettext:no-c-format */
+ // xgettext:no-c-format
*errormsg = _("E499: Empty file name for '%' or '#', only works with \":p:h\"");
else
*errormsg = _("E500: Evaluates to an empty string");
@@ -8279,7 +8276,7 @@ expand_sfile(char_u *arg)
++p;
else
{
- /* replace "<sfile>" with the sourced file name, and do ":" stuff */
+ // replace "<sfile>" with the sourced file name, and do ":" stuff
repl = eval_vars(p, result, &srclen, NULL, &errormsg, NULL);
if (errormsg != NULL)
{
@@ -8288,7 +8285,7 @@ expand_sfile(char_u *arg)
vim_free(result);
return NULL;
}
- if (repl == NULL) /* no match (cannot happen) */
+ if (repl == NULL) // no match (cannot happen)
{
p += srclen;
continue;
@@ -8308,7 +8305,7 @@ expand_sfile(char_u *arg)
vim_free(repl);
vim_free(result);
result = newres;
- p = newres + len; /* continue after the match */
+ p = newres + len; // continue after the match
}
}
@@ -8376,7 +8373,7 @@ ex_filetype(exarg_T *eap)
if (*eap->arg == NUL)
{
- /* Print current status. */
+ // Print current status.
smsg("filetype detection:%s plugin:%s indent:%s",
filetype_detect ? "ON" : "OFF",
filetype_plugin ? (filetype_detect ? "ON" : "(on)") : "OFF",
@@ -8384,7 +8381,7 @@ ex_filetype(exarg_T *eap)
return;
}
- /* Accept "plugin" and "indent" in any order. */
+ // Accept "plugin" and "indent" in any order.
for (;;)
{
if (STRNCMP(arg, "plugin", 6) == 0)
@@ -8555,14 +8552,14 @@ ex_folddo(exarg_T *eap)
start_global_changes();
# endif
- /* First set the marks for all lines closed/open. */
+ // First set the marks for all lines closed/open.
for (lnum = eap->line1; lnum <= eap->line2; ++lnum)
if (hasFolding(lnum, NULL, NULL) == (eap->cmdidx == CMD_folddoclosed))
ml_setmarked(lnum);
- /* Execute the command on the marked lines. */
+ // Execute the command on the marked lines.
global_exe(eap->arg);
- ml_clearmarked(); /* clear rest of the marks */
+ ml_clearmarked(); // clear rest of the marks
# ifdef FEAT_CLIPBOARD
end_global_changes();
# endif