aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/buffer.c2
-rw-r--r--src/nvim/ex_cmds.c78
-rw-r--r--src/nvim/fileio.c55
-rw-r--r--src/nvim/undo.c4
4 files changed, 63 insertions, 76 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 190c281c76..75caf2223b 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -1339,7 +1339,7 @@ void do_autochdir(void)
// functions for dealing with the buffer list
//
-static int top_file_num = 1; /* highest file number */
+static int top_file_num = 1; ///< highest file number
/// Add a file name to the buffer list.
/// If the same file name already exists return a pointer to that buffer.
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 9f781c0f8e..1f75f3e5bc 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -92,7 +92,7 @@ typedef struct {
linenr_T lnum;
long nmatch;
char_u *line;
- kvec_t(colnr_T) cols; //< columns of in-line matches
+ kvec_t(colnr_T) cols; ///< columns of in-line matches
} MatchedLine;
typedef kvec_t(MatchedLine) MatchedLineVec;
@@ -2060,7 +2060,7 @@ theend:
/// info of the previous buffer for "oldwin" is stored.
///
/// @return FAIL for failure, OK otherwise
-int do_ecmd (
+int do_ecmd(
int fnum,
char_u *ffname,
char_u *sfname,
@@ -2201,7 +2201,7 @@ int do_ecmd (
goto theend;
}
buf = buflist_new(ffname, sfname, 0L,
- BLN_CURBUF | ((flags & ECMD_SET_HELP) ? 0 : BLN_LISTED));
+ BLN_CURBUF | (flags & ECMD_SET_HELP ? 0 : BLN_LISTED));
// Autocmds may change curwin and curbuf.
if (oldwin != NULL) {
oldwin = curwin;
@@ -3264,8 +3264,9 @@ buf_T *do_sub(exarg_T *eap)
}
}
- if (eap->skip) /* not executing commands, only parsing */
+ if (eap->skip) { // not executing commands, only parsing
return NULL;
+ }
if (!subflags.do_count && !MODIFIABLE(curbuf)) {
// Substitution is not allowed in non-'modifiable' buffer
@@ -5878,50 +5879,39 @@ static enum
EXP_SIGN_NAMES /* expand with name of placed signs */
} expand_what;
-/*
- * Function given to ExpandGeneric() to obtain the sign command
- * expansion.
- */
+/// Function given to ExpandGeneric() to obtain the sign command
+/// expansion.
char_u * get_sign_name(expand_T *xp, int idx)
{
- sign_T *sp;
- int current_idx;
-
- switch (expand_what)
- {
+ switch (expand_what)
+ {
case EXP_SUBCMD:
- return (char_u *)cmds[idx];
- case EXP_DEFINE:
- {
- char *define_arg[] =
- {
- "icon=", "linehl=", "text=", "texthl=", NULL
- };
- return (char_u *)define_arg[idx];
- }
- case EXP_PLACE:
- {
- char *place_arg[] =
- {
- "line=", "name=", "file=", "buffer=", NULL
- };
- return (char_u *)place_arg[idx];
- }
- case EXP_UNPLACE:
- {
- char *unplace_arg[] = { "file=", "buffer=", NULL };
- return (char_u *)unplace_arg[idx];
- }
- case EXP_SIGN_NAMES:
- /* Complete with name of signs already defined */
- current_idx = 0;
- for (sp = first_sign; sp != NULL; sp = sp->sn_next)
- if (current_idx++ == idx)
- return sp->sn_name;
- return NULL;
+ return (char_u *)cmds[idx];
+ case EXP_DEFINE: {
+ char *define_arg[] = { "icon=", "linehl=", "text=", "texthl=", NULL };
+ return (char_u *)define_arg[idx];
+ }
+ case EXP_PLACE: {
+ char *place_arg[] = { "line=", "name=", "file=", "buffer=", NULL };
+ return (char_u *)place_arg[idx];
+ }
+ case EXP_UNPLACE: {
+ char *unplace_arg[] = { "file=", "buffer=", NULL };
+ return (char_u *)unplace_arg[idx];
+ }
+ case EXP_SIGN_NAMES: {
+ // Complete with name of signs already defined
+ int current_idx = 0;
+ for (sign_T *sp = first_sign; sp != NULL; sp = sp->sn_next) {
+ if (current_idx++ == idx) {
+ return sp->sn_name;
+ }
+ }
+ }
+ return NULL;
default:
- return NULL;
- }
+ return NULL;
+ }
}
/*
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index e83e9f6b01..d6e669a67b 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -6343,27 +6343,24 @@ aucmd_prepbuf (
aco->new_curbuf = curbuf;
}
-/*
- * Cleanup after executing autocommands for a (hidden) buffer.
- * Restore the window as it was (if possible).
- */
-void
-aucmd_restbuf (
- aco_save_T *aco /* structure holding saved values */
-)
+/// Cleanup after executing autocommands for a (hidden) buffer.
+/// Restore the window as it was (if possible).
+///
+/// @param aco structure holding saved values
+void aucmd_restbuf(aco_save_T *aco)
{
int dummy;
if (aco->use_aucmd_win) {
- --curbuf->b_nwindows;
- /* Find "aucmd_win", it can't be closed, but it may be in another tab
- * page. Do not trigger autocommands here. */
+ curbuf->b_nwindows--;
+ // Find "aucmd_win", it can't be closed, but it may be in another tab page.
+ // Do not trigger autocommands here.
block_autocmds();
if (curwin != aucmd_win) {
FOR_ALL_TAB_WINDOWS(tp, wp) {
if (wp == aucmd_win) {
if (tp != curtab) {
- goto_tabpage_tp(tp, TRUE, TRUE);
+ goto_tabpage_tp(tp, true, true);
}
win_goto(aucmd_win);
goto win_found;
@@ -6372,39 +6369,39 @@ aucmd_restbuf (
}
win_found:
- /* Remove the window and frame from the tree of frames. */
+ // Remove the window and frame from the tree of frames.
(void)winframe_remove(curwin, &dummy, NULL);
win_remove(curwin, NULL);
- aucmd_win_used = FALSE;
- last_status(FALSE); /* may need to remove last status line */
- restore_snapshot(SNAP_AUCMD_IDX, FALSE);
- (void)win_comp_pos(); /* recompute window positions */
+ aucmd_win_used = false;
+ last_status(false); // may need to remove last status line
+ restore_snapshot(SNAP_AUCMD_IDX, false);
+ (void)win_comp_pos(); // recompute window positions
unblock_autocmds();
- if (win_valid(aco->save_curwin))
+ if (win_valid(aco->save_curwin)) {
curwin = aco->save_curwin;
- else
- /* Hmm, original window disappeared. Just use the first one. */
+ } else {
+ // Hmm, original window disappeared. Just use the first one.
curwin = firstwin;
- vars_clear(&aucmd_win->w_vars->dv_hashtab); /* free all w: variables */
- hash_init(&aucmd_win->w_vars->dv_hashtab); /* re-use the hashtab */
+ }
+ vars_clear(&aucmd_win->w_vars->dv_hashtab); // free all w: variables
+ hash_init(&aucmd_win->w_vars->dv_hashtab); // re-use the hashtab
curbuf = curwin->w_buffer;
xfree(globaldir);
globaldir = aco->globaldir;
- /* the buffer contents may have changed */
+ // the buffer contents may have changed
check_cursor();
if (curwin->w_topline > curbuf->b_ml.ml_line_count) {
curwin->w_topline = curbuf->b_ml.ml_line_count;
curwin->w_topfill = 0;
}
} else {
- /* restore curwin */
+ // restore curwin
if (win_valid(aco->save_curwin)) {
- /* Restore the buffer which was previously edited by curwin, if
- * it was changed, we are still the same window and the buffer is
- * valid. */
+ // Restore the buffer which was previously edited by curwin, if it was
+ // changed, we are still the same window and the buffer is valid.
if (curwin == aco->new_curwin
&& curbuf != aco->new_curbuf
&& buf_valid(aco->new_curbuf)
@@ -6412,10 +6409,10 @@ win_found:
if (curwin->w_s == &curbuf->b_s) {
curwin->w_s = &aco->new_curbuf->b_s;
}
- --curbuf->b_nwindows;
+ curbuf->b_nwindows--;
curbuf = aco->new_curbuf;
curwin->w_buffer = curbuf;
- ++curbuf->b_nwindows;
+ curbuf->b_nwindows++;
}
curwin = aco->save_curwin;
diff --git a/src/nvim/undo.c b/src/nvim/undo.c
index 20adf40012..2f4317980a 100644
--- a/src/nvim/undo.c
+++ b/src/nvim/undo.c
@@ -2344,8 +2344,8 @@ static void u_undoredo(int undo)
/// Otherwise, report the number of changes (this may be incorrect
/// in some cases, but it's better than nothing).
static void u_undo_end(
- int did_undo, //< just did an undo
- int absolute, //< used ":undo N"
+ int did_undo, ///< just did an undo
+ int absolute, ///< used ":undo N"
bool quiet)
{
char *msgstr;