summaryrefslogtreecommitdiffstats
path: root/src/ex_cmds.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-12-01 21:41:28 +0100
committerBram Moolenaar <Bram@vim.org>2019-12-01 21:41:28 +0100
commit217e1b8359447f5550dcb0d1ee43380a90c253c5 (patch)
tree137e8b7d6f27848c95caa47e2fc13a4dc4c50d29 /src/ex_cmds.c
parent5d18efecfd6c45d69f55268948a22cd0465bb955 (diff)
patch 8.1.2379: using old C style commentsv8.1.2379
Problem: Using old C style comments. Solution: Use // comments where appropriate.
Diffstat (limited to 'src/ex_cmds.c')
-rw-r--r--src/ex_cmds.c1205
1 files changed, 600 insertions, 605 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index a1eecc505b..45c733bbae 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -57,10 +57,10 @@ do_ascii(exarg_T *eap UNUSED)
IObuff[0] = NUL;
if (!has_mbyte || (enc_dbcs != 0 && c < 0x100) || c < 0x80)
{
- if (c == NL) /* NUL is stored as NL */
+ if (c == NL) // NUL is stored as NL
c = NUL;
if (c == CAR && get_fileformat(curbuf) == EOL_MAC)
- cval = NL; /* NL is stored as CR */
+ cval = NL; // NL is stored as CR
else
cval = c;
if (vim_isprintc_strict(c) && (c < ' '
@@ -98,11 +98,11 @@ do_ascii(exarg_T *eap UNUSED)
c = 0;
}
- /* Repeat for combining characters. */
+ // Repeat for combining characters.
while (has_mbyte && (c >= 0x100 || (enc_utf8 && c >= 0x80)))
{
len = (int)STRLEN(IObuff);
- /* This assumes every multi-byte char is printable... */
+ // This assumes every multi-byte char is printable...
if (len > 0)
IObuff[len++] = ' ';
IObuff[len++] = '<';
@@ -111,7 +111,7 @@ do_ascii(exarg_T *eap UNUSED)
&& !gui.in_use
# endif
)
- IObuff[len++] = ' '; /* draw composing char on top of a space */
+ IObuff[len++] = ' '; // draw composing char on top of a space
len += (*mb_char2bytes)(c, IObuff + len);
#ifdef FEAT_DIGRAPHS
dig = get_digraph_for_char(c);
@@ -153,7 +153,7 @@ ex_align(exarg_T *eap)
#ifdef FEAT_RIGHTLEFT
if (curwin->w_p_rl)
{
- /* switch left and right aligning */
+ // switch left and right aligning
if (eap->cmdidx == CMD_right)
eap->cmdidx = CMD_left;
else if (eap->cmdidx == CMD_left)
@@ -163,7 +163,7 @@ ex_align(exarg_T *eap)
width = atoi((char *)eap->arg);
save_curpos = curwin->w_cursor;
- if (eap->cmdidx == CMD_left) /* width is used for new indent */
+ if (eap->cmdidx == CMD_left) // width is used for new indent
{
if (width >= 0)
indent = width;
@@ -189,22 +189,22 @@ ex_align(exarg_T *eap)
for (curwin->w_cursor.lnum = eap->line1;
curwin->w_cursor.lnum <= eap->line2; ++curwin->w_cursor.lnum)
{
- if (eap->cmdidx == CMD_left) /* left align */
+ if (eap->cmdidx == CMD_left) // left align
new_indent = indent;
else
{
- has_tab = FALSE; /* avoid uninit warnings */
+ has_tab = FALSE; // avoid uninit warnings
len = linelen(eap->cmdidx == CMD_right ? &has_tab
: NULL) - get_indent();
- if (len <= 0) /* skip blank lines */
+ if (len <= 0) // skip blank lines
continue;
if (eap->cmdidx == CMD_center)
new_indent = (width - len) / 2;
else
{
- new_indent = width - len; /* right align */
+ new_indent = width - len; // right align
/*
* Make sure that embedded TABs don't make the text go too far
@@ -232,7 +232,7 @@ ex_align(exarg_T *eap)
}
if (new_indent < 0)
new_indent = 0;
- (void)set_indent(new_indent, 0); /* set indent */
+ (void)set_indent(new_indent, 0); // set indent
}
changed_lines(eap->line1, 0, eap->line2 + 1, 0L);
curwin->w_cursor = save_curpos;
@@ -274,21 +274,21 @@ linelen(int *has_tab)
return len;
}
-/* Buffer for two lines used during sorting. They are allocated to
- * contain the longest line being sorted. */
+// Buffer for two lines used during sorting. They are allocated to
+// contain the longest line being sorted.
static char_u *sortbuf1;
static char_u *sortbuf2;
-static int sort_ic; /* ignore case */
-static int sort_nr; /* sort on number */
-static int sort_rx; /* sort on regex instead of skipping it */
+static int sort_ic; // ignore case
+static int sort_nr; // sort on number
+static int sort_rx; // sort on regex instead of skipping it
#ifdef FEAT_FLOAT
-static int sort_flt; /* sort on floating number */
+static int sort_flt; // sort on floating number
#endif
-static int sort_abort; /* flag to indicate if sorting has been interrupted */
+static int sort_abort; // flag to indicate if sorting has been interrupted
-/* Struct to store info to be sorted. */
+// Struct to store info to be sorted.
typedef struct
{
linenr_T lnum; // line number
@@ -318,9 +318,9 @@ sort_compare(const void *s1, const void *s2)
sorti_T l2 = *(sorti_T *)s2;
int result = 0;
- /* If the user interrupts, there's no way to stop qsort() immediately, but
- * if we return 0 every time, qsort will assume it's done sorting and
- * exit. */
+ // If the user interrupts, there's no way to stop qsort() immediately, but
+ // if we return 0 every time, qsort will assume it's done sorting and
+ // exit.
if (sort_abort)
return 0;
fast_breakcheck();
@@ -342,9 +342,9 @@ sort_compare(const void *s1, const void *s2)
#endif
else
{
- /* We need to copy one line into "sortbuf1", because there is no
- * guarantee that the first pointer becomes invalid when obtaining the
- * second one. */
+ // We need to copy one line into "sortbuf1", because there is no
+ // guarantee that the first pointer becomes invalid when obtaining the
+ // second one.
STRNCPY(sortbuf1, ml_get(l1.lnum) + l1.st_u.line.start_col_nr,
l1.st_u.line.end_col_nr - l1.st_u.line.start_col_nr + 1);
sortbuf1[l1.st_u.line.end_col_nr - l1.st_u.line.start_col_nr] = 0;
@@ -356,7 +356,7 @@ sort_compare(const void *s1, const void *s2)
: STRCMP(sortbuf1, sortbuf2);
}
- /* If two lines have the same value, preserve the original line order. */
+ // If two lines have the same value, preserve the original line order.
if (result == 0)
return (int)(l1.lnum - l2.lnum);
return result;
@@ -378,7 +378,7 @@ ex_sort(exarg_T *eap)
char_u *p;
char_u *s;
char_u *s2;
- char_u c; /* temporary character storage */
+ char_u c; // temporary character storage
int unique = FALSE;
long deleted;
colnr_T start_col;
@@ -387,7 +387,7 @@ ex_sort(exarg_T *eap)
int format_found = 0;
int change_occurred = FALSE; // Buffer contents changed.
- /* Sorting one line is really quick! */
+ // Sorting one line is really quick!
if (count <= 1)
return;
@@ -442,7 +442,7 @@ ex_sort(exarg_T *eap)
}
else if (*p == 'u')
unique = TRUE;
- else if (*p == '"') /* comment start */
+ else if (*p == '"') // comment start
break;
else if (check_nextcmd(p) != NULL)
{
@@ -458,7 +458,7 @@ ex_sort(exarg_T *eap)
goto sortend;
}
*s = NUL;
- /* Use last search pattern if sort pattern is empty. */
+ // Use last search pattern if sort pattern is empty.
if (s == p + 1)
{
if (last_search_pat() == NULL)
@@ -472,7 +472,7 @@ ex_sort(exarg_T *eap)
regmatch.regprog = vim_regcomp(p + 1, RE_MAGIC);
if (regmatch.regprog == NULL)
goto sortend;
- p = s; /* continue after the regexp */
+ p = s; // continue after the regexp
regmatch.rm_ic = p_ic;
}
else
@@ -482,15 +482,15 @@ ex_sort(exarg_T *eap)
}
}
- /* Can only have one of 'n', 'b', 'o' and 'x'. */
+ // Can only have one of 'n', 'b', 'o' and 'x'.
if (format_found > 1)
{
emsg(_(e_invarg));
goto sortend;
}
- /* From here on "sort_nr" is used as a flag for any integer number
- * sorting. */
+ // From here on "sort_nr" is used as a flag for any integer number
+ // sorting.
sort_nr += sort_what;
/*
@@ -530,12 +530,12 @@ ex_sort(exarg_T *eap)
#endif
)
{
- /* Make sure vim_str2nr doesn't read any digits past the end
- * of the match, by temporarily terminating the string there */
+ // Make sure vim_str2nr doesn't read any digits past the end
+ // of the match, by temporarily terminating the string there
s2 = s + end_col;
c = *s2;
*s2 = NUL;
- /* Sorting on number: Store the number itself. */
+ // Sorting on number: Store the number itself.
p = s + start_col;
if (sort_nr)
{
@@ -546,10 +546,10 @@ ex_sort(exarg_T *eap)
else
s = skiptodigit(p);
if (s > p && s[-1] == '-')
- --s; /* include preceding negative sign */
+ --s; // include preceding negative sign
if (*s == NUL)
{
- /* line without number should sort before any number */
+ // line without number should sort before any number
nrs[lnum - eap->line1].st_u.num.is_number = FALSE;
nrs[lnum - eap->line1].st_u.num.value = 0;
}
@@ -569,7 +569,7 @@ ex_sort(exarg_T *eap)
s = skipwhite(s + 1);
if (*s == NUL)
- /* empty line should sort before any number */
+ // empty line should sort before any number
nrs[lnum - eap->line1].st_u.value_flt = -DBL_MAX;
else
nrs[lnum - eap->line1].st_u.value_flt =
@@ -580,7 +580,7 @@ ex_sort(exarg_T *eap)
}
else
{
- /* Store the column to sort at. */
+ // Store the column to sort at.
nrs[lnum - eap->line1].st_u.line.start_col_nr = start_col;
nrs[lnum - eap->line1].st_u.line.end_col_nr = end_col;
}
@@ -593,7 +593,7 @@ ex_sort(exarg_T *eap)
goto sortend;
}
- /* Allocate a buffer that can hold the longest line. */
+ // Allocate a buffer that can hold the longest line.
sortbuf1 = alloc(maxlen + 1);
if (sortbuf1 == NULL)
goto sortend;
@@ -601,13 +601,13 @@ ex_sort(exarg_T *eap)
if (sortbuf2 == NULL)
goto sortend;
- /* Sort the array of line numbers. Note: can't be interrupted! */
+ // Sort the array of line numbers. Note: can't be interrupted!
qsort((void *)nrs, count, sizeof(sorti_T), sort_compare);
if (sort_abort)
goto sortend;
- /* Insert the lines in the sorted order below the last one. */
+ // Insert the lines in the sorted order below the last one.
lnum = eap->line2;
for (i = 0; i < count; ++i)
{
@@ -633,14 +633,14 @@ ex_sort(exarg_T *eap)
goto sortend;
}
- /* delete the original lines if appending worked */
+ // delete the original lines if appending worked
if (i == count)
for (i = 0; i < count; ++i)
ml_delete(eap->line1, FALSE);
else
count = 0;
- /* Adjust marks for deleted (or added) lines and prepare for displaying. */
+ // Adjust marks for deleted (or added) lines and prepare for displaying.
deleted = (long)(count - (lnum - eap->line2));
if (deleted > 0)
{
@@ -844,15 +844,15 @@ ex_copy(linenr_T line1, linenr_T line2, linenr_T n)
curwin->w_cursor.lnum = n;
while (line1 <= line2)
{
- /* need to use vim_strsave() because the line will be unlocked within
- * ml_append() */
+ // need to use vim_strsave() because the line will be unlocked within
+ // ml_append()
p = vim_strsave(ml_get(line1));
if (p != NULL)
{
ml_append(curwin->w_cursor.lnum, p, (colnr_T)0, FALSE);
vim_free(p);
}
- /* situation 2: skip already copied lines */
+ // situation 2: skip already copied lines
if (line1 == n)
line1 = curwin->w_cursor.lnum;
++line1;
@@ -868,7 +868,7 @@ ex_copy(linenr_T line1, linenr_T line2, linenr_T n)
msgmore((long)count);
}
-static char_u *prevcmd = NULL; /* the previous command */
+static char_u *prevcmd = NULL; // the previous command
#if defined(EXITFREE) || defined(PROTO)
void
@@ -891,11 +891,11 @@ do_bang(
int do_in,
int do_out)
{
- char_u *arg = eap->arg; /* command */
- linenr_T line1 = eap->line1; /* start of range */
- linenr_T line2 = eap->line2; /* end of range */
- char_u *newcmd = NULL; /* the new command */
- int free_newcmd = FALSE; /* need to free() newcmd */
+ char_u *arg = eap->arg; // command
+ linenr_T line1 = eap->line1; // start of range
+ linenr_T line2 = eap->line2; // end of range
+ char_u *newcmd = NULL; // the new command
+ int free_newcmd = FALSE; // need to free() newcmd
int ins_prevcmd;
char_u *t;
char_u *p;
@@ -911,9 +911,9 @@ do_bang(
if (check_restricted() || check_secure())
return;
- if (addr_count == 0) /* :! */
+ if (addr_count == 0) // :!
{
- msg_scroll = FALSE; /* don't scroll here */
+ msg_scroll = FALSE; // don't scroll here
autowrite_all();
msg_scroll = scroll_save;
}
@@ -980,11 +980,11 @@ do_bang(
vim_free(prevcmd);
prevcmd = newcmd;
- if (bangredo) /* put cmd in redo buffer for ! command */
+ if (bangredo) // put cmd in redo buffer for ! command
{
- /* If % or # appears in the command, it must have been escaped.
- * Reescape them, so that redoing them does not substitute them by the
- * buffername. */
+ // If % or # appears in the command, it must have been escaped.
+ // Reescape them, so that redoing them does not substitute them by the
+ // buffername.
char_u *cmd = vim_strsave_escaped(prevcmd, (char_u *)"%#");
if (cmd != NULL)
@@ -1010,9 +1010,9 @@ do_bang(
STRCAT(newcmd, p_shq);
free_newcmd = TRUE;
}
- if (addr_count == 0) /* :! */
+ if (addr_count == 0) // :!
{
- /* echo the command */
+ // echo the command
msg_start();
msg_putchar(':');
msg_putchar('!');
@@ -1022,10 +1022,10 @@ do_bang(
do_shell(newcmd, 0);
}
- else /* :range! */
+ else // :range!
{
- /* Careful: This may recursively call do_bang() again! (because of
- * autocommands) */
+ // Careful: This may recursively call do_bang() again! (because of
+ // autocommands)
do_filter(line1, line2, eap, newcmd, do_in, do_out);
apply_autocmds(EVENT_SHELLFILTERPOST, NULL, NULL, FALSE, curbuf);
}
@@ -1052,7 +1052,7 @@ do_bang(
do_filter(
linenr_T line1,
linenr_T line2,
- exarg_T *eap, /* for forced 'ff' and 'fenc' */
+ exarg_T *eap, // for forced 'ff' and 'fenc'
char_u *cmd,
int do_in,
int do_out)
@@ -1072,7 +1072,7 @@ do_filter(
int stmp = p_stmp;
#endif
- if (*cmd == NUL) /* no filter command */
+ if (*cmd == NUL) // no filter command
return;
// Temporarily disable lockmarks since that's needed to propagate changed
@@ -1110,21 +1110,21 @@ do_filter(
if (!do_in && do_out && !stmp)
{
- /* Use a pipe to fetch stdout of the command, do not use a temp file. */
+ // Use a pipe to fetch stdout of the command, do not use a temp file.
shell_flags |= SHELL_READ;
curwin->w_cursor.lnum = line2;
}
else if (do_in && !do_out && !stmp)
{
- /* Use a pipe to write stdin of the command, do not use a temp file. */
+ // Use a pipe to write stdin of the command, do not use a temp file.
shell_flags |= SHELL_WRITE;
curbuf->b_op_start.lnum = line1;
curbuf->b_op_end.lnum = line2;
}
else if (do_in && do_out && !stmp)
{
- /* Use a pipe to write stdin and fetch stdout of the command, do not
- * use a temp file. */
+ // Use a pipe to write stdin and fetch stdout of the command, do not
+ // use a temp file.
shell_flags |= SHELL_READ|SHELL_WRITE;
curbuf->b_op_start.lnum = line1;
curbuf->b_op_end.lnum = line2;
@@ -1143,16 +1143,16 @@ do_filter(
* The writing and reading of temp files will not be shown.
* Vi also doesn't do this and the messages are not very informative.
*/
- ++no_wait_return; /* don't call wait_return() while busy */
+ ++no_wait_return; // don't call wait_return() while busy
if (itmp != NULL && buf_write(curbuf, itmp, NULL, line1, line2, eap,
FALSE, FALSE, FALSE, TRUE) == FAIL)
{
- msg_putchar('\n'); /* keep message from buf_write() */
+ msg_putchar('\n'); // keep message from buf_write()
--no_wait_return;
#if defined(FEAT_EVAL)
if (!aborting())
#endif
- (void)semsg(_(e_notcreate), itmp); /* will call wait_return */
+ (void)semsg(_(e_notcreate), itmp); // will call wait_return
goto filterend;
}
if (curbuf != old_curbuf)
@@ -1161,7 +1161,7 @@ do_filter(
if (!do_out)
msg_putchar('\n');
- /* Create the shell command in allocated memory. */
+ // Create the shell command in allocated memory.
cmd_buf = make_filter_cmd(cmd, itmp, otmp);
if (cmd_buf == NULL)
goto filterend;
@@ -1209,9 +1209,9 @@ do_filter(
did_check_timestamps = FALSE;
need_check_timestamps = TRUE;
- /* When interrupting the shell command, it may still have produced some
- * useful output. Reset got_int here, so that readfile() won't cancel
- * reading. */
+ // When interrupting the shell command, it may still have produced some
+ // useful output. Reset got_int here, so that readfile() won't cancel
+ // reading.
ui_breakcheck();
got_int = FALSE;
@@ -1249,12 +1249,12 @@ do_filter(
if (cmdmod.keepmarks || vim_strchr(p_cpo, CPO_REMMARK) == NULL)
{
if (read_linecount >= linecount)
- /* move all marks from old lines to new lines */
+ // move all marks from old lines to new lines
mark_adjust(line1, line2, linecount, 0L);
else
{
- /* move marks from old lines to new lines, delete marks
- * that are in deleted lines */
+ // move marks from old lines to new lines, delete marks
+ // that are in deleted lines
mark_adjust(line1, line1 + read_linecount - 1,
linecount, 0L);
mark_adjust(line1 + read_linecount, line2, MAXLNUM, 0L);
@@ -1267,10 +1267,10 @@ do_filter(
*/
curwin->w_cursor.lnum = line1;
del_lines(linecount, TRUE);
- curbuf->b_op_start.lnum -= linecount; /* adjust '[ */
- curbuf->b_op_end.lnum -= linecount; /* adjust '] */
- write_lnum_adjust(-linecount); /* adjust last line
- for next write */
+ curbuf->b_op_start.lnum -= linecount; // adjust '[
+ curbuf->b_op_end.lnum -= linecount; // adjust ']
+ write_lnum_adjust(-linecount); // adjust last line
+ // for next write
#ifdef FEAT_FOLDING
foldUpdate(curwin, curbuf->b_op_start.lnum, curbuf->b_op_end.lnum);
#endif
@@ -1284,7 +1284,7 @@ do_filter(
curwin->w_cursor.lnum = curbuf->b_op_end.lnum;
}
- beginline(BL_WHITE | BL_FIX); /* cursor on first non-blank */
+ beginline(BL_WHITE | BL_FIX); // cursor on first non-blank
--no_wait_return;
if (linecount > p_report)
@@ -1294,7 +1294,7 @@ do_filter(
vim_snprintf(msg_buf, sizeof(msg_buf),
_("%ld lines filtered"), (long)linecount);
if (msg(msg_buf) && !msg_scroll)
- /* save message to display it after redraw */
+ // save message to display it after redraw
set_keep_msg((char_u *)msg_buf, 0);
}
else
@@ -1304,7 +1304,7 @@ do_filter(
else
{
error:
- /* put cursor back in same position for ":w !cmd" */
+ // put cursor back in same position for ":w !cmd"
curwin->w_cursor = cursor_save;
--no_wait_return;
wait_return(FALSE);
@@ -1339,7 +1339,7 @@ filterend:
void
do_shell(
char_u *cmd,
- int flags) /* may be SHELL_DOOUT when output is redirected */
+ int flags) // may be SHELL_DOOUT when output is redirected
{
buf_T *buf;
#if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL)
@@ -1473,7 +1473,7 @@ do_shell(
no_wait_return = save_nwr;
}
}
-#endif /* FEAT_GUI_MSWIN */
+#endif // FEAT_GUI_MSWIN
#ifdef MSWIN
if (!keep_termcap) // if keep_termcap is TRUE didn't stop termcap
@@ -1488,23 +1488,23 @@ do_shell(
* but it saves an extra redraw.
*/
#ifdef AMIGA
- if (skip_redraw) /* ':' hit in wait_return() */
+ if (skip_redraw) // ':' hit in wait_return()
{
if (msg_silent == 0)
redraw_later_clear();
}
else if (term_console)
{
- OUT_STR(IF_EB("\033[0 q", ESC_STR "[0 q")); /* get window size */
+ OUT_STR(IF_EB("\033[0 q", ESC_STR "[0 q")); // get window size
if (got_int && msg_silent == 0)
- redraw_later_clear(); /* if got_int is TRUE, redraw needed */
+ redraw_later_clear(); // if got_int is TRUE, redraw needed
else
- must_redraw = 0; /* no extra redraw needed */
+ must_redraw = 0; // no extra redraw needed
}
#endif
}
- /* display any error messages now */
+ // display any error messages now
display_errors();
apply_autocmds(EVENT_SHELLCMDPOST, NULL, NULL, FALSE, curbuf);
@@ -1537,9 +1537,9 @@ find_pipe(char_u *cmd)
*/
char_u *
make_filter_cmd(
- char_u *cmd, /* command */
- char_u *itmp, /* NULL or name of input file */
- char_u *otmp) /* NULL or name of output file */
+ char_u *cmd, // command
+ char_u *itmp, // NULL or name of input file
+ char_u *otmp) // NULL or name of output file
{
char_u *buf;
long_u len;
@@ -1548,18 +1548,18 @@ make_filter_cmd(
int is_fish_shell;
char_u *shell_name = get_isolated_shell_name();
- /* Account for fish's different syntax for subshells */
+ // Account for fish's different syntax for subshells
is_fish_shell = (fnamecmp(shell_name, "fish") == 0);
vim_free(shell_name);
if (is_fish_shell)
- len = (long_u)STRLEN(cmd) + 13; /* "begin; " + "; end" + NUL */
+ len = (long_u)STRLEN(cmd) + 13; // "begin; " + "; end" + NUL
else
#endif
- len = (long_u)STRLEN(cmd) + 3; /* "()" + NUL */
+ len = (long_u)STRLEN(cmd) + 3; // "()" + NUL
if (itmp != NULL)
- len += (long_u)STRLEN(itmp) + 9; /* " { < " + " } " */
+ len += (long_u)STRLEN(itmp) + 9; // " { < " + " } "
if (otmp != NULL)
- len += (long_u)STRLEN(otmp) + (long_u)STRLEN(p_srr) + 2; /* " " */
+ len += (long_u)STRLEN(otmp) + (long_u)STRLEN(p_srr) + 2; // " "
buf = alloc(len);
if (buf == NULL)
return NULL;
@@ -1720,7 +1720,7 @@ print_line_no_prefix(
{
vim_snprintf(numbuf, sizeof(numbuf),
"%*ld ", number_width(curwin), (long)lnum);
- msg_puts_attr(numbuf, HL_ATTR(HLF_N)); /* Highlight line nrs */
+ msg_puts_attr(numbuf, HL_ATTR(HLF_N)); // Highlight line nrs
}
msg_prt_line(ml_get(lnum), list);
}
@@ -1733,18 +1733,18 @@ print_line(linenr_T lnum, int use_number, int list)
{
int save_silent = silent_mode;
- /* apply :filter /pat/ */
+ // apply :filter /pat/
if (message_filtered(ml_get(lnum)))
return;
msg_start();
silent_mode = FALSE;
- info_message = TRUE; /* use mch_msg(), not mch_errmsg() */
+ info_message = TRUE; // use mch_msg(), not mch_errmsg()
print_line_no_prefix(lnum, use_number, list);
if (save_silent)
{
msg_putchar('\n');
- cursor_on(); /* msg_start() switches it off */
+ cursor_on(); // msg_start() switches it off
out_flush();
silent_mode = save_silent;
}
@@ -1759,11 +1759,11 @@ rename_buffer(char_u *new_fname)
buf = curbuf;
apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, curbuf);
- /* buffer changed, don't change name now */
+ // buffer changed, don't change name now
if (buf != curbuf)
return FAIL;
#ifdef FEAT_EVAL
- if (aborting()) /* autocmds may abort script processing */
+ if (aborting()) // autocmds may abort script processing
return FAIL;
#endif
/*
@@ -1795,7 +1795,7 @@ rename_buffer(char_u *new_fname)
vim_free(sfname);
apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, curbuf);
- /* Change directories when the 'acd' option is set. */
+ // Change directories when the 'acd' option is set.
DO_AUTOCHDIR;
return OK;
}
@@ -1806,8 +1806,8 @@ rename_buffer(char_u *new_fname)
void
ex_file(exarg_T *eap)
{
- /* ":0file" removes the file name. Check for illegal uses ":3file",
- * "0file name", etc. */
+ // ":0file" removes the file name. Check for illegal uses ":3file",
+ // "0file name", etc.
if (eap->addr_count > 0
&& (*eap->arg != NUL
|| eap->line2 > 0
@@ -1852,7 +1852,7 @@ ex_write(exarg_T *eap)
eap->line2 = curbuf->b_ml.ml_line_count;
}
- if (eap->usefilter) /* input lines to shell command */
+ if (eap->usefilter) // input lines to shell command
do_bang(1, eap, FALSE, TRUE, FALSE);
else
(void)do_write(eap);
@@ -1870,7 +1870,7 @@ ex_write(exarg_T *eap)
do_write(exarg_T *eap)
{
int other;
- char_u *fname = NULL; /* init to shut up gcc */
+ char_u *fname = NULL; // init to shut up gcc
char_u *ffname;
int retval = FAIL;
char_u *free_fname = NULL;
@@ -1880,7 +1880,7 @@ do_write(exarg_T *eap)
buf_T *alt_buf = NULL;
int name_was_missing;
- if (not_writing()) /* check 'write' option */
+ if (not_writing()) // check 'write' option
return FAIL;
ffname = eap->arg;
@@ -1928,8 +1928,8 @@ do_write(exarg_T *eap)
alt_buf = buflist_findname(ffname);
if (alt_buf != NULL && alt_buf->b_ml.ml_mfp != NULL)
{
- /* Overwriting a file that is loaded in another buffer is not a
- * good idea. */
+ // Overwriting a file that is loaded in another buffer is not a
+ // good idea.
emsg(_(e_bufloaded));
goto theend;
}
@@ -1991,15 +1991,15 @@ do_write(exarg_T *eap)
if (curbuf != was_curbuf)
#endif
{
- /* buffer changed, don't change name now */
+ // buffer changed, don't change name now
retval = FAIL;
goto theend;
}
- /* Exchange the file names for the current and the alternate
- * buffer. This makes it look like we are now editing the buffer
- * under the new name. Must be done before buf_write(), because
- * if there is no file name and 'cpo' contains 'F', it will set
- * the file name. */
+ // Exchange the file names for the current and the alternate
+ // buffer. This makes it look like we are now editing the buffer
+ // under the new name. Must be done before buf_write(), because
+ // if there is no file name and 'cpo' contains 'F', it will set
+ // the file name.
fname = alt_buf->b_fname;
alt_buf->b_fname = curbuf->b_fname;
curbuf->b_fname = fname;
@@ -2024,12 +2024,12 @@ do_write(exarg_T *eap)
if (curbuf != was_curbuf)
#endif
{
- /* buffer changed, don't write the file */
+ // buffer changed, don't write the file
retval = FAIL;
goto theend;
}
- /* If 'filetype' was empty try detecting it now. */
+ // If 'filetype' was empty try detecting it now.
if (*curbuf->b_p_ft == NUL)
{
if (au_has_group((char_u *)"filetypedetect"))
@@ -2038,8 +2038,8 @@ do_write(exarg_T *eap)
do_modelines(0);
}
- /* Autocommands may have changed buffer names, esp. when
- * 'autochdir' is set. */
+ // Autocommands may have changed buffer names, esp. when
+ // 'autochdir' is set.
fname = curbuf->b_sfname;
}
@@ -2048,7 +2048,7 @@ do_write(exarg_T *eap)
retval = buf_write(curbuf, ffname, fname, eap->line1, eap->line2,
eap, eap->append, eap->forceit, TRUE, FALSE);
- /* After ":saveas fname" reset 'readonly'. */
+ // After ":saveas fname" reset 'readonly'.
if (eap->cmdidx == CMD_saveas)
{
if (retval == OK)
@@ -2058,8 +2058,8 @@ do_write(exarg_T *eap)
}
}
- /* Change directories when the 'acd' option is set and the file name
- * got changed or set. */
+ // Change directories when the 'acd' option is set and the file name
+ // got changed or set.
if (eap->cmdidx == CMD_saveas || name_was_missing)
DO_AUTOCHDIR;
}
@@ -2082,10 +2082,10 @@ theend:
check_overwrite(
exarg_T *eap,
buf_T *buf,
- char_u *fname, /* file name to be used (can differ from
- buf->ffname) */
- char_u *ffname, /* full path version of fname */
- int other) /* writing under other name */
+ char_u *fname, // file name to be used (can differ from
+ // buf->ffname)
+ char_u *ffname, // full path version of fname
+ int other) // writing under other name
{
/*
* write to other file or b_flags set or not writing the whole file:
@@ -2105,7 +2105,7 @@ check_overwrite(
if (!eap->forceit && !eap->append)
{
#ifdef UNIX
- /* with UNIX it is possible to open a directory */
+ // with UNIX it is possible to open a directory
if (mch_isdir(ffname))
{
semsg(_(e_isadir2), ffname);
@@ -2130,7 +2130,7 @@ check_overwrite(
}
}
- /* For ":w! filename" check that no swap file exists for "filename". */
+ // For ":w! filename" check that no swap file exists for "filename".
if (other && !emsg_silent)
{
char_u *dir;
@@ -2138,11 +2138,11 @@ check_overwrite(
int r;
char_u *swapname;
- /* We only try the first entry in 'directory', without checking if
- * it's writable. If the "." directory is not writable the write
- * will probably fail anyway.
- * Use 'shortname' of the current buffer, since there is no buffer
- * for the written file. */
+ // We only try the first entry in 'directory', without checking if
+ // it's writable. If the "." directory is not writable the write
+ // will probably fail anyway.
+ // Use 'shortname' of the current buffer, since there is no buffer
+ // for the written file.
if (*p_dir == NUL)
{
dir = alloc(5);
@@ -2250,7 +2250,7 @@ do_wqall(exarg_T *eap)
break;
}
#ifdef FEAT_BROWSE
- /* ":browse wall": ask for file name if there isn't one */
+ // ":browse wall": ask for file name if there isn't one
if (buf->b_ffname == NULL && cmdmod.browse)
browse_save_fname(buf);
#endif
@@ -2272,17 +2272,17 @@ do_wqall(exarg_T *eap)
set_bufref(&bufref, buf);
if (buf_write_all(buf, eap->forceit) == FAIL)
++error;
- /* an autocommand may have deleted the buffer */
+ // an autocommand may have deleted the buffer
if (!bufref_valid(&bufref))
buf = firstbuf;
}
- eap->forceit = save_forceit; /* check_overwrite() may set it */
+ eap->forceit = save_forceit; // check_overwrite() may set it
}
}
if (exiting)
{
if (!error)
- getout(0); /* exit Vim */
+ getout(0); // exit Vim
not_exiting();
}
}
@@ -2310,10 +2310,10 @@ check_readonly(int *forceit, buf_T *buf)
{
stat_T st;
- /* Handle a file being readonly when the 'readonly' option is set or when
- * the file exists and permissions are read-only.
- * We will send 0777 to check_file_readonly(), as the "perm" variable is
- * important for device checks but not here. */
+ // Handle a file being readonly when the 'readonly' option is set or when
+ // the file exists and permissions are read-only.
+ // We will send 0777 to check_file_readonly(), as the "perm" variable is
+ // important for device checks but not here.
if (!*forceit && (buf->b_p_ro
|| (mch_stat((char *)buf->b_ffname, &st) >= 0
&& check_file_readonly(buf->b_ffname, 0777))))
@@ -2332,7 +2332,7 @@ check_readonly(int *forceit, buf_T *buf)
if (vim_dialog_yesno(VIM_QUESTION, NULL, buff, 2) == VIM_YES)
{
- /* Set forceit, to force the writing of a readonly file */
+ // Set forceit, to force the writing of a readonly file
*forceit = TRUE;
return FALSE;
}
@@ -2385,16 +2385,16 @@ getfile(
if (fnum == 0)
{
- /* make ffname full path, set sfname */
+ // make ffname full path, set sfname
fname_expand(curbuf, &ffname, &sfname);
other = otherfile(ffname);
- free_me = ffname; /* has been allocated, free() later */
+ free_me = ffname; // has been allocated, free() later
}
else
other = (fnum != curbuf->b_fnum);
if (other)
- ++no_wait_return; /* don't wait for autowrite message */
+ ++no_wait_return; // don't wait for autowrite message
if (other && !forceit && curbuf->b_nwindows == 1 && !buf_hide(curbuf)
&& curbufIsChanged() && autowrite(curbuf, forceit) == FAIL)
{
@@ -2407,7 +2407,7 @@ getfile(
if (other)
--no_wait_return;
no_write_message();
- retval = GETFILE_NOT_WRITTEN; /* file has been changed */
+ retval = GETFILE_NOT_WRITTEN; // file has been changed
goto theend;
}
}
@@ -2421,14 +2421,14 @@ getfile(
curwin->w_cursor.lnum = lnum;
check_cursor_lnum();
beginline(BL_SOL | BL_FIX);
- retval = GETFILE_SAME_FILE; /* it's in the same file */
+ retval = GETFILE_SAME_FILE; // it's in the same file
}
else if (do_ecmd(fnum, ffname, sfname, NULL, lnum,
(buf_hide(curbuf) ? ECMD_HIDE : 0) + (forceit ? ECMD_FORCEIT : 0),
curwin) == OK)
- retval = GETFILE_OPEN_OTHER; /* opened another file */
+ retval = GETFILE_OPEN_OTHER; // opened another file
else
- retval = GETFILE_ERROR; /* error encountered */
+ retval = GETFILE_ERROR; // error encountered
theend:
vim_free(free_me);
@@ -2469,15 +2469,15 @@ do_ecmd(
int fnum,
char_u *ffname,
char_u *sfname,
- exarg_T *eap, /* can be NULL! */
+ exarg_T *eap, // can be NULL!
linenr_T newlnum,
int flags,
win_T *oldwin)
{
- int other_file; /* TRUE if editing another file */
- int oldbuf; /* TRUE if using existing buffer */
- int auto_buf = FALSE; /* TRUE if autocommands brought us
- into the buffer unexpectedly */
+ int other_file; // TRUE if editing another file
+ int oldbuf; // TRUE if using existing buffer
+ int auto_buf = FALSE; // TRUE if autocommands brought us
+ // into the buffer unexpectedly
char_u *new_name = NULL;
#if defined(FEAT_EVAL)
int did_set_swapcommand = FALSE;
@@ -2510,8 +2510,8 @@ do_ecmd(
if (fnum != 0)
{
- if (fnum == curbuf->b_fnum) /* file is already being edited */
- return OK; /* nothing to do */
+ if (fnum == curbuf->b_fnum) // file is already being edited
+ return OK; // nothing to do
other_file = TRUE;
}
else
@@ -2525,8 +2525,8 @@ do_ecmd(
# 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 (ffname == NULL || !mch_isdir(ffname))
ffname = (char_u *)".";
}
@@ -2540,12 +2540,12 @@ do_ecmd(
}
}
#endif
- /* if no short name given, use ffname for short name */
+ // if no short name given, use ffname for short name
if (sfname == NULL)
sfname = ffname;
#ifdef USE_FNAME_CASE
if (sfname != NULL)
- fname_case(sfname, 0); /* set correct case for sfname */
+ fname_case(sfname, 0); // set correct case for sfname
#endif
if ((flags & ECMD_ADDBUF) && (ffname == NULL || *ffname == NUL))
@@ -2553,17 +2553,17 @@ do_ecmd(
if (ffname == NULL)
other_file = TRUE;
- /* there is no file name */
+ // there is no file name
else if (*ffname == NUL && curbuf->b_ffname == NULL)
other_file = FALSE;
else
{
- if (*ffname == NUL) /* re-edit with same file name */
+ if (*ffname == NUL) // re-edit with same file name
{
ffname = curbuf->b_ffname;
sfname = curbuf->b_fname;
}
- free_fname = fix_fname(ffname); /* may expand to full path name */
+ free_fname = fix_fname(ffname); // may expand to full path name
if (free_fname != NULL)
ffname = free_fname;
other_file = otherfile(ffname);
@@ -2601,7 +2601,7 @@ do_ecmd(
int len;
char_u *p;
- /* Set v:swapcommand for the SwapExists autocommands. */
+ // Set v:swapcommand for the SwapExists autocommands.
if (command != NULL)
len = (int)STRLEN(command) + 3;
else
@@ -2654,34 +2654,34 @@ do_ecmd(
buf = buflist_new(ffname, sfname, 0L,
BLN_CURBUF | ((flags & ECMD_SET_HELP) ? 0 : BLN_LISTED));
- /* autocommands may change curwin and curb