aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/clint.py2
-rw-r--r--src/nvim/api/vim.c6
-rw-r--r--src/nvim/autocmd.c4
-rw-r--r--src/nvim/buffer.c2
-rw-r--r--src/nvim/buffer_defs.h2
-rw-r--r--src/nvim/change.c5
-rw-r--r--src/nvim/charset.c298
-rw-r--r--src/nvim/cursor.c1
-rw-r--r--src/nvim/edit.c7
-rw-r--r--src/nvim/eval/funcs.c7
-rw-r--r--src/nvim/ex_cmds.c7
-rw-r--r--src/nvim/ex_cmds2.c2
-rw-r--r--src/nvim/ex_getln.c8
-rw-r--r--src/nvim/fold.c1
-rw-r--r--src/nvim/generators/gen_options.lua6
-rw-r--r--src/nvim/getchar.c28
-rw-r--r--src/nvim/indent.c1
-rw-r--r--src/nvim/main.c4
-rw-r--r--src/nvim/map.c1
-rw-r--r--src/nvim/map.h1
-rw-r--r--src/nvim/misc1.c172
-rw-r--r--src/nvim/mouse.c31
-rw-r--r--src/nvim/move.c117
-rw-r--r--src/nvim/normal.c9
-rw-r--r--src/nvim/ops.c1
-rw-r--r--src/nvim/options.lua731
-rw-r--r--src/nvim/plines.c481
-rw-r--r--src/nvim/plines.h9
-rw-r--r--src/nvim/regexp.c1
-rw-r--r--src/nvim/screen.c51
-rw-r--r--src/nvim/search.c2
-rw-r--r--src/nvim/syntax.c90
-rw-r--r--src/nvim/testdir/setup.vim9
-rw-r--r--src/nvim/testdir/test42.inbin2373 -> 2387 bytes
-rw-r--r--src/nvim/testdir/test_autocmd.vim3
-rw-r--r--src/nvim/testdir/test_command_count.vim2
-rw-r--r--src/nvim/testdir/test_cursorline.vim22
-rw-r--r--src/nvim/testdir/test_diffmode.vim35
-rw-r--r--src/nvim/testdir/test_filetype.vim2
-rw-r--r--src/nvim/testdir/test_gf.vim2
-rw-r--r--src/nvim/testdir/test_ins_complete.vim2
-rw-r--r--src/nvim/testdir/test_join.vim2
-rw-r--r--src/nvim/testdir/test_match.vim5
-rw-r--r--src/nvim/testdir/test_mksession.vim2
-rw-r--r--src/nvim/testdir/test_options.vim2
-rw-r--r--src/nvim/testdir/test_quickfix.vim2
-rw-r--r--src/nvim/testdir/test_tagjump.vim2
-rw-r--r--src/nvim/testdir/test_window_cmd.vim2
-rw-r--r--src/nvim/undo.c24
-rw-r--r--src/nvim/window.c348
50 files changed, 1339 insertions, 1215 deletions
diff --git a/src/clint.py b/src/clint.py
index 4a5e435bbd..e7d76366b0 100755
--- a/src/clint.py
+++ b/src/clint.py
@@ -264,7 +264,7 @@ _error_suppressions_2 = set()
# The allowed line length of files.
# This is set by --linelength flag.
-_line_length = 80
+_line_length = 100
# The allowed extensions for file names
# This is set by --extensions flag.
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index 58ee53a408..400dbb126c 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -2301,7 +2301,7 @@ Dictionary nvim_parse_expression(String expr, String flags, Boolean highlight,
}
}
}
- ParserLine plines[] = {
+ ParserLine parser_lines[] = {
{
.data = expr.data,
.size = expr.size,
@@ -2309,7 +2309,7 @@ Dictionary nvim_parse_expression(String expr, String flags, Boolean highlight,
},
{ NULL, 0, false },
};
- ParserLine *plines_p = plines;
+ ParserLine *plines_p = parser_lines;
ParserHighlight colors;
kvi_init(colors);
ParserHighlight *const colors_p = (highlight ? &colors : NULL);
@@ -2335,7 +2335,7 @@ Dictionary nvim_parse_expression(String expr, String flags, Boolean highlight,
ret.items[ret.size++] = (KeyValuePair) {
.key = STATIC_CSTR_TO_STRING("len"),
.value = INTEGER_OBJ((Integer)(pstate.pos.line == 1
- ? plines[0].size
+ ? parser_lines[0].size
: pstate.pos.col)),
};
if (east.err.msg != NULL) {
diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c
index 145f6f5601..bec9808183 100644
--- a/src/nvim/autocmd.c
+++ b/src/nvim/autocmd.c
@@ -1724,7 +1724,7 @@ BYPASS_AU:
void block_autocmds(void)
{
// Remember the value of v:termresponse.
- if (is_autocmd_blocked()) {
+ if (!is_autocmd_blocked()) {
old_termresponse = get_vim_var_str(VV_TERMRESPONSE);
}
autocmd_blocked++;
@@ -1737,7 +1737,7 @@ void unblock_autocmds(void)
// When v:termresponse was set while autocommands were blocked, trigger
// the autocommands now. Esp. useful when executing a shell command
// during startup (nvim -d).
- if (is_autocmd_blocked()
+ if (!is_autocmd_blocked()
&& get_vim_var_str(VV_TERMRESPONSE) != old_termresponse) {
apply_autocmds(EVENT_TERMRESPONSE, NULL, NULL, false, curbuf);
}
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 587ef74b35..29d4fc786a 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -4253,7 +4253,7 @@ int build_stl_str_hl(
if (*fmt_p == '#') {
stl_items[curitem].type = Highlight;
stl_items[curitem].start = out_p;
- stl_items[curitem].minwid = -syn_namen2id(t, (int)(fmt_p - t));
+ stl_items[curitem].minwid = -syn_name2id_len(t, (size_t)(fmt_p - t));
curitem++;
fmt_p++;
}
diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h
index 1247e48c5f..b03d69a04c 100644
--- a/src/nvim/buffer_defs.h
+++ b/src/nvim/buffer_defs.h
@@ -1298,7 +1298,7 @@ struct window_S {
/*
* w_cline_height is the number of physical lines taken by the buffer line
- * that the cursor is on. We use this to avoid extra calls to plines().
+ * that the cursor is on. We use this to avoid extra calls to plines_win().
*/
int w_cline_height; // current size of cursor line
bool w_cline_folded; // cursor line is folded
diff --git a/src/nvim/change.c b/src/nvim/change.c
index 49e403425a..41e1e3911b 100644
--- a/src/nvim/change.c
+++ b/src/nvim/change.c
@@ -22,6 +22,7 @@
#include "nvim/misc1.h"
#include "nvim/move.h"
#include "nvim/option.h"
+#include "nvim/plines.h"
#include "nvim/screen.h"
#include "nvim/search.h"
#include "nvim/state.h"
@@ -593,9 +594,9 @@ void ins_char_bytes(char_u *buf, size_t charlen)
// cells. May result in adding spaces to fill a gap.
colnr_T vcol;
getvcol(curwin, &curwin->w_cursor, NULL, &vcol, NULL);
- colnr_T new_vcol = vcol + chartabsize(buf, vcol);
+ colnr_T new_vcol = vcol + win_chartabsize(curwin, buf, vcol);
while (oldp[col + oldlen] != NUL && vcol < new_vcol) {
- vcol += chartabsize(oldp + col + oldlen, vcol);
+ vcol += win_chartabsize(curwin, oldp + col + oldlen, vcol);
// Don't need to remove a TAB that takes us to the right
// position.
if (vcol > new_vcol && oldp[col + oldlen] == TAB) {
diff --git a/src/nvim/charset.c b/src/nvim/charset.c
index e2d844a351..0252ef4e9c 100644
--- a/src/nvim/charset.c
+++ b/src/nvim/charset.c
@@ -25,6 +25,7 @@
#include "nvim/move.h"
#include "nvim/option.h"
#include "nvim/os_unix.h"
+#include "nvim/plines.h"
#include "nvim/state.h"
#include "nvim/strings.h"
#include "nvim/path.h"
@@ -733,80 +734,6 @@ int vim_strnsize(char_u *s, int len)
return size;
}
-/// Return the number of characters 'c' will take on the screen, taking
-/// into account the size of a tab.
-/// Use a define to make it fast, this is used very often!!!
-/// Also see getvcol() below.
-///
-/// @param p
-/// @param col
-///
-/// @return Number of characters.
-#define RET_WIN_BUF_CHARTABSIZE(wp, buf, p, col) \
- if (*(p) == TAB && (!(wp)->w_p_list || wp->w_p_lcs_chars.tab1)) { \
- return tabstop_padding(col, (buf)->b_p_ts, (buf)->b_p_vts_array); \
- } else { \
- return ptr2cells(p); \
- }
-
-int chartabsize(char_u *p, colnr_T col)
-{
- RET_WIN_BUF_CHARTABSIZE(curwin, curbuf, p, col)
-}
-
-static int win_chartabsize(win_T *wp, char_u *p, colnr_T col)
-{
- RET_WIN_BUF_CHARTABSIZE(wp, wp->w_buffer, p, col)
-}
-
-/// Return the number of characters the string 's' will take on the screen,
-/// taking into account the size of a tab.
-///
-/// @param s
-///
-/// @return Number of characters the string will take on the screen.
-int linetabsize(char_u *s)
-{
- return linetabsize_col(0, s);
-}
-
-/// Like linetabsize(), but starting at column "startcol".
-///
-/// @param startcol
-/// @param s
-///
-/// @return Number of characters the string will take on the screen.
-int linetabsize_col(int startcol, char_u *s)
-{
- colnr_T col = startcol;
- char_u *line = s; /* pointer to start of line, for breakindent */
-
- while (*s != NUL) {
- col += lbr_chartabsize_adv(line, &s, col);
- }
- return (int)col;
-}
-
-/// Like linetabsize(), but for a given window instead of the current one.
-///
-/// @param wp
-/// @param line
-/// @param len
-///
-/// @return Number of characters the string will take on the screen.
-unsigned int win_linetabsize(win_T *wp, char_u *line, colnr_T len)
-{
- colnr_T col = 0;
-
- for (char_u *s = line;
- *s != NUL && (len == MAXCOL || s < line + len);
- MB_PTR_ADV(s)) {
- col += win_lbr_chartabsize(wp, line, s, col, NULL);
- }
-
- return (unsigned int)col;
-}
-
/// Check that "c" is a normal identifier character:
/// Letters and characters from the 'isident' option.
///
@@ -936,229 +863,6 @@ bool vim_isprintc_strict(int c)
return c > 0 && (g_chartab[c] & CT_PRINT_CHAR);
}
-/// like chartabsize(), but also check for line breaks on the screen
-///
-/// @param line
-/// @param s
-/// @param col
-///
-/// @return The number of characters taken up on the screen.
-int lbr_chartabsize(char_u *line, unsigned char *s, colnr_T col)
-{
- if (!curwin->w_p_lbr && (*p_sbr == NUL) && !curwin->w_p_bri) {
- if (curwin->w_p_wrap) {
- return win_nolbr_chartabsize(curwin, s, col, NULL);
- }
- RET_WIN_BUF_CHARTABSIZE(curwin, curbuf, s, col)
- }
- return win_lbr_chartabsize(curwin, line == NULL ? s: line, s, col, NULL);
-}
-
-/// Call lbr_chartabsize() and advance the pointer.
-///
-/// @param line
-/// @param s
-/// @param col
-///
-/// @return The number of characters take up on the screen.
-int lbr_chartabsize_adv(char_u *line, char_u **s, colnr_T col)
-{
- int retval;
-
- retval = lbr_chartabsize(line, *s, col);
- MB_PTR_ADV(*s);
- return retval;
-}
-
-/// This function is used very often, keep it fast!!!!
-///
-/// If "headp" not NULL, set *headp to the size of what we for 'showbreak'
-/// string at start of line. Warning: *headp is only set if it's a non-zero
-/// value, init to 0 before calling.
-///
-/// @param wp
-/// @param line
-/// @param s
-/// @param col
-/// @param headp
-///
-/// @return The number of characters taken up on the screen.
-int win_lbr_chartabsize(win_T *wp, char_u *line, char_u *s, colnr_T col, int *headp)
-{
- colnr_T col2;
- colnr_T col_adj = 0; /* col + screen size of tab */
- colnr_T colmax;
- int added;
- int mb_added = 0;
- int numberextra;
- char_u *ps;
- int n;
-
- // No 'linebreak', 'showbreak' and 'breakindent': return quickly.
- if (!wp->w_p_lbr && !wp->w_p_bri && (*p_sbr == NUL)) {
- if (wp->w_p_wrap) {
- return win_nolbr_chartabsize(wp, s, col, headp);
- }
- RET_WIN_BUF_CHARTABSIZE(wp, wp->w_buffer, s, col)
- }
-
- // First get normal size, without 'linebreak'
- int size = win_chartabsize(wp, s, col);
- int c = *s;
- if (*s == TAB) {
- col_adj = size - 1;
- }
-
- // If 'linebreak' set check at a blank before a non-blank if the line
- // needs a break here
- if (wp->w_p_lbr
- && vim_isbreak(c)
- && !vim_isbreak((int)s[1])
- && wp->w_p_wrap
- && (wp->w_width_inner != 0)) {
- // Count all characters from first non-blank after a blank up to next
- // non-blank after a blank.
- numberextra = win_col_off(wp);
- col2 = col;
- colmax = (colnr_T)(wp->w_width_inner - numberextra - col_adj);
-
- if (col >= colmax) {
- colmax += col_adj;
- n = colmax + win_col_off2(wp);
-
- if (n > 0) {
- colmax += (((col - colmax) / n) + 1) * n - col_adj;
- }
- }
-
- for (;;) {
- ps = s;
- MB_PTR_ADV(s);
- c = *s;
-
- if (!(c != NUL
- && (vim_isbreak(c) || col2 == col || !vim_isbreak((int)(*ps))))) {
- break;
- }
-
- col2 += win_chartabsize(wp, s, col2);
-
- if (col2 >= colmax) { /* doesn't fit */
- size = colmax - col + col_adj;
- break;
- }
- }
- } else if ((size == 2)
- && (MB_BYTE2LEN(*s) > 1)
- && wp->w_p_wrap
- && in_win_border(wp, col)) {
- // Count the ">" in the last column.
- ++size;
- mb_added = 1;
- }
-
- // May have to add something for 'breakindent' and/or 'showbreak'
- // string at start of line.
- // Set *headp to the size of what we add.
- added = 0;
-
- if ((*p_sbr != NUL || wp->w_p_bri) && wp->w_p_wrap && (col != 0)) {
- colnr_T sbrlen = 0;
- int numberwidth = win_col_off(wp);
-
- numberextra = numberwidth;
- col += numberextra + mb_added;
-
- if (col >= (colnr_T)wp->w_width_inner) {
- col -= wp->w_width_inner;
- numberextra = wp->w_width_inner - (numberextra - win_col_off2(wp));
- if (col >= numberextra && numberextra > 0) {
- col %= numberextra;
- }
- if (*p_sbr != NUL) {
- sbrlen = (colnr_T)MB_CHARLEN(p_sbr);
- if (col >= sbrlen) {
- col -= sbrlen;
- }
- }
- if (col >= numberextra && numberextra > 0) {
- col %= numberextra;
- } else if (col > 0 && numberextra > 0) {
- col += numberwidth - win_col_off2(wp);
- }
-
- numberwidth -= win_col_off2(wp);
- }
-
- if (col == 0 || (col + size + sbrlen > (colnr_T)wp->w_width_inner)) {
- if (*p_sbr != NUL) {
- if (size + sbrlen + numberwidth > (colnr_T)wp->w_width_inner) {
- // Calculate effective window width.
- int width = (colnr_T)wp->w_width_inner - sbrlen - numberwidth;
- int prev_width = col ? ((colnr_T)wp->w_width_inner - (sbrlen + col))
- : 0;
-
- if (width <= 0) {
- width = 1;
- }
- added += ((size - prev_width) / width) * vim_strsize(p_sbr);
- if ((size - prev_width) % width) {
- // Wrapped, add another length of 'sbr'.
- added += vim_strsize(p_sbr);
- }
- } else {
- added += vim_strsize(p_sbr);
- }
- }
-
- if (wp->w_p_bri)
- added += get_breakindent_win(wp, line);
-
- size += added;
- if (col != 0) {
- added = 0;
- }
- }
- }
-
- if (headp != NULL) {
- *headp = added + mb_added;
- }
- return size;
-}
-
-/// Like win_lbr_chartabsize(), except that we know 'linebreak' is off and
-/// 'wrap' is on. This means we need to check for a double-byte character that
-/// doesn't fit at the end of the screen line.
-///
-/// @param wp
-/// @param s
-/// @param col
-/// @param headp
-///
-/// @return The number of characters take up on the screen.
-static int win_nolbr_chartabsize(win_T *wp, char_u *s, colnr_T col, int *headp)
-{
- int n;
-
- if ((*s == TAB) && (!wp->w_p_list || wp->w_p_lcs_chars.tab1)) {
- return tabstop_padding(col,
- wp->w_buffer->b_p_ts,
- wp->w_buffer->b_p_vts_array);
- }
- n = ptr2cells(s);
-
- // Add one cell for a double-width character in the last column of the
- // window, displayed with a ">".
- if ((n == 2) && (MB_BYTE2LEN(*s) > 1) && in_win_border(wp, col)) {
- if (headp != NULL) {
- *headp = 1;
- }
- return 3;
- }
- return n;
-}
-
/// Check that virtual column "vcol" is in the rightmost column of window "wp".
///
/// @param wp window
diff --git a/src/nvim/cursor.c b/src/nvim/cursor.c
index 5d2210dc7d..d4a68adeda 100644
--- a/src/nvim/cursor.c
+++ b/src/nvim/cursor.c
@@ -13,6 +13,7 @@
#include "nvim/memory.h"
#include "nvim/misc1.h"
#include "nvim/move.h"
+#include "nvim/plines.h"
#include "nvim/screen.h"
#include "nvim/extmark.h"
#include "nvim/state.h"
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 2305faa20c..fec8da2c3c 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -41,6 +41,7 @@
#include "nvim/option.h"
#include "nvim/path.h"
#include "nvim/popupmnu.h"
+#include "nvim/plines.h"
#include "nvim/quickfix.h"
#include "nvim/regexp.h"
#include "nvim/screen.h"
@@ -7187,7 +7188,7 @@ static void replace_do_bs(int limit_col)
// Get the number of screen cells used by the character we are
// going to delete.
getvcol(curwin, &curwin->w_cursor, NULL, &start_vcol, NULL);
- orig_vcols = chartabsize(get_cursor_pos_ptr(), start_vcol);
+ orig_vcols = win_chartabsize(curwin, get_cursor_pos_ptr(), start_vcol);
}
(void)del_char_after_col(limit_col);
if (l_State & VREPLACE_FLAG) {
@@ -7201,8 +7202,8 @@ static void replace_do_bs(int limit_col)
p = get_cursor_pos_ptr();
ins_len = (int)STRLEN(p) - orig_len;
vcol = start_vcol;
- for (i = 0; i < ins_len; ++i) {
- vcol += chartabsize(p + i, vcol);
+ for (i = 0; i < ins_len; i++) {
+ vcol += win_chartabsize(curwin, p + i, vcol);
i += (*mb_ptr2len)(p) - 1;
}
vcol -= start_vcol;
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c
index 21c858373c..4e409cca50 100644
--- a/src/nvim/eval/funcs.c
+++ b/src/nvim/eval/funcs.c
@@ -47,6 +47,7 @@
#include "nvim/os/input.h"
#include "nvim/os/shell.h"
#include "nvim/path.h"
+#include "nvim/plines.h"
#include "nvim/popupmnu.h"
#include "nvim/quickfix.h"
#include "nvim/regexp.h"
@@ -1055,8 +1056,10 @@ static void f_col(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (virtual_active() && fp == &curwin->w_cursor) {
char_u *p = get_cursor_pos_ptr();
- if (curwin->w_cursor.coladd >= (colnr_T)chartabsize(p,
- curwin->w_virtcol - curwin->w_cursor.coladd)) {
+ if (curwin->w_cursor.coladd
+ >= (colnr_T)win_chartabsize(curwin, p,
+ (curwin->w_virtcol
+ - curwin->w_cursor.coladd))) {
int l;
if (*p != NUL && p[(l = (*mb_ptr2len)(p))] == NUL)
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 3ad1fb1adc..0c099085a0 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -55,6 +55,7 @@
#include "nvim/option.h"
#include "nvim/os_unix.h"
#include "nvim/path.h"
+#include "nvim/plines.h"
#include "nvim/quickfix.h"
#include "nvim/regexp.h"
#include "nvim/screen.h"
@@ -828,7 +829,7 @@ void ex_retab(exarg_T *eap)
}
if (ptr[col] == NUL)
break;
- vcol += chartabsize(ptr + col, (colnr_T)vcol);
+ vcol += win_chartabsize(curwin, ptr + col, (colnr_T)vcol);
col += utfc_ptr2len(ptr + col);
}
if (new_line == NULL) /* out of memory */
@@ -2762,8 +2763,8 @@ int do_ecmd(
}
}
- /* Check if cursors in other windows on the same buffer are still valid */
- check_lnums(FALSE);
+ // Check if cursors in other windows on the same buffer are still valid
+ check_lnums(false);
/*
* Did not read the file, need to show some info about the file.
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c
index a49b0c15e1..e06a62e0f6 100644
--- a/src/nvim/ex_cmds2.c
+++ b/src/nvim/ex_cmds2.c
@@ -1460,7 +1460,7 @@ bool dialog_close_terminal(buf_T *buf)
int ret = vim_dialog_yesnocancel(VIM_QUESTION, NULL, buff, 1);
- return (ret == VIM_YES) ? true : false;
+ return ret == VIM_YES;
}
/// Return true if the buffer "buf" can be abandoned, either by making it
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 2b3d773ca4..7cab3eb650 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -2593,7 +2593,7 @@ static void color_expr_cmdline(const CmdlineInfo *const colored_ccline,
ColoredCmdline *const ret_ccline_colors)
FUNC_ATTR_NONNULL_ALL
{
- ParserLine plines[] = {
+ ParserLine parser_lines[] = {
{
.data = (const char *)colored_ccline->cmdbuff,
.size = STRLEN(colored_ccline->cmdbuff),
@@ -2601,7 +2601,7 @@ static void color_expr_cmdline(const CmdlineInfo *const colored_ccline,
},
{ NULL, 0, false },
};
- ParserLine *plines_p = plines;
+ ParserLine *plines_p = parser_lines;
ParserHighlight colors;
kvi_init(colors);
ParserState pstate;
@@ -6259,8 +6259,8 @@ static int open_cmdwin(void)
const int histtype = hist_char2type(cmdwin_type);
if (histtype == HIST_CMD || histtype == HIST_DEBUG) {
if (p_wc == TAB) {
- add_map((char_u *)"<buffer> <Tab> <C-X><C-V>", INSERT);
- add_map((char_u *)"<buffer> <Tab> a<C-X><C-V>", NORMAL);
+ add_map((char_u *)"<buffer> <Tab> <C-X><C-V>", INSERT, false);
+ add_map((char_u *)"<buffer> <Tab> a<C-X><C-V>", NORMAL, false);
}
set_option_value("ft", 0L, "vim", OPT_LOCAL);
}
diff --git a/src/nvim/fold.c b/src/nvim/fold.c
index ad8418034a..6989c29d57 100644
--- a/src/nvim/fold.c
+++ b/src/nvim/fold.c
@@ -29,6 +29,7 @@
#include "nvim/memory.h"
#include "nvim/message.h"
#include "nvim/misc1.h"
+#include "nvim/plines.h"
#include "nvim/garray.h"
#include "nvim/move.h"
#include "nvim/option.h"
diff --git a/src/nvim/generators/gen_options.lua b/src/nvim/generators/gen_options.lua
index 9f91160034..0454c54faf 100644
--- a/src/nvim/generators/gen_options.lua
+++ b/src/nvim/generators/gen_options.lua
@@ -119,10 +119,10 @@ local get_value = function(v)
end
local get_defaults = function(d,n)
- if (d.vi == nil and d.vim == nil) or (d.vi ~= nil and d.vim ~= nil) then
- error("option '"..n.."' should have one and only one default value")
+ if d == nil then
+ error("option '"..n.."' should have a default value")
end
- return get_value(d.vim or d.vi)
+ return get_value(d)
end
local defines = {}
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c
index b0d06b7a30..2b6c5b9f37 100644
--- a/src/nvim/getchar.c
+++ b/src/nvim/getchar.c
@@ -34,6 +34,7 @@
#include "nvim/memory.h"
#include "nvim/message.h"
#include "nvim/misc1.h"
+#include "nvim/plines.h"
#include "nvim/keymap.h"
#include "nvim/garray.h"
#include "nvim/move.h"
@@ -840,6 +841,14 @@ static void init_typebuf(void)
}
}
+void init_default_mappings(void)
+{
+ add_map((char_u *)"Y y$", NORMAL, true);
+ add_map((char_u *)"<C-L> <Cmd>nohlsearch<Bar>diffupdate<CR><C-L>", NORMAL, true);
+ add_map((char_u *)"<C-U> <C-G>u<C-U>", INSERT, true);
+ add_map((char_u *)"<C-W> <C-G>u<C-W>", INSERT, true);
+}
+
// Insert a string in position 'offset' in the typeahead buffer (for "@r"
// and ":normal" command, vgetorpeek() and check_termcode())
//
@@ -1161,7 +1170,7 @@ void may_sync_undo(void)
{
if ((!(State & (INSERT + CMDLINE)) || arrow_used)
&& scriptin[curscript] == NULL)
- u_sync(FALSE);
+ u_sync(false);
}
/*
@@ -4356,18 +4365,23 @@ check_map (
}
-/*
- * Add a mapping "map" for mode "mode".
- * Need to put string in allocated memory, because do_map() will modify it.
- */
-void add_map(char_u *map, int mode)
+/// Add a mapping. Unlike @ref do_map this copies the {map} argument, so
+/// static or read-only strings can be used.
+///
+/// @param map C-string containing the arguments of the map/abbrev command,
+/// i.e. everything except the initial `:[X][nore]map`.
+/// @param mode Bitflags representing the mode in which to set the mapping.
+/// See @ref get_map_mode.
+/// @param nore If true, make a non-recursive mapping.
+void add_map(char_u *map, int mode, bool nore)
{
char_u *s;
char_u *cpo_save = p_cpo;
p_cpo = (char_u *)""; // Allow <> notation
+ // Need to put string in allocated memory, because do_map() will modify it.
s = vim_strsave(map);
- (void)do_map(0, s, mode, FALSE);
+ (void)do_map(nore ? 2 : 0, s, mode, false);
xfree(s);
p_cpo = cpo_save;
}
diff --git a/src/nvim/indent.c b/src/nvim/indent.c
index bfb77688b0..a6df0e97e6 100644
--- a/src/nvim/indent.c
+++ b/src/nvim/indent.c
@@ -19,6 +19,7 @@
#include "nvim/misc1.h"
#include "nvim/move.h"
#include "nvim/option.h"
+#include "nvim/plines.h"
#include "nvim/regexp.h"
#include "nvim/screen.h"
#include "nvim/search.h"
diff --git a/src/nvim/main.c b/src/nvim/main.c
index 252aa81825..136608afdf 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -166,6 +166,7 @@ void early_init(mparm_T *paramp)
init_path(argv0 ? argv0 : "nvim");
init_normal_cmds(); // Init the table of Normal mode commands.
highlight_init();
+ syntax_init();
#ifdef WIN32
OSVERSIONINFO ovi;
@@ -314,6 +315,9 @@ int main(int argc, char **argv)
init_highlight(true, false); // Default highlight groups.
TIME_MSG("init highlight");
+ init_default_mappings(); // Default mappings.
+ TIME_MSG("init default mappings");
+
// Set the break level after the terminal is initialized.
debug_break_level = params.use_debug_break_level;
diff --git a/src/nvim/map.c b/src/nvim/map.c
index 7d97b7f13d..86dc257e40 100644
--- a/src/nvim/map.c
+++ b/src/nvim/map.c
@@ -194,6 +194,7 @@ static inline bool ColorKey_eq(ColorKey ae1, ColorKey ae2)
MAP_IMPL(int, int, DEFAULT_INITIALIZER)
MAP_IMPL(cstr_t, ptr_t, DEFAULT_INITIALIZER)
+MAP_IMPL(cstr_t, int, DEFAULT_INITIALIZER)
MAP_IMPL(ptr_t, ptr_t, DEFAULT_INITIALIZER)
MAP_IMPL(uint64_t, ptr_t, DEFAULT_INITIALIZER)
MAP_IMPL(uint64_t, ssize_t, SSIZE_INITIALIZER)
diff --git a/src/nvim/map.h b/src/nvim/map.h
index 7bd3d31330..a35a2c1672 100644
--- a/src/nvim/map.h
+++ b/src/nvim/map.h
@@ -36,6 +36,7 @@
//
MAP_DECLS(int, int)
MAP_DECLS(cstr_t, ptr_t)
+MAP_DECLS(cstr_t, int)
MAP_DECLS(ptr_t, ptr_t)
MAP_DECLS(uint64_t, ptr_t)
MAP_DECLS(uint64_t, ssize_t)
diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c
index 771174b854..6d94632687 100644
--- a/src/nvim/misc1.c
+++ b/src/nvim/misc1.c
@@ -349,178 +349,6 @@ int get_last_leader_offset(char_u *line, char_u **flags)
return result;
}
-/*
- * Return the number of window lines occupied by buffer line "lnum".
- */
-int plines(const linenr_T lnum)
-{
- return plines_win(curwin, lnum, true);
-}
-
-int plines_win(
- win_T *const wp,
- const linenr_T lnum,
- const bool winheight // when true limit to window height
-)
-{
- /* Check for filler lines above this buffer line. When folded the result
- * is one line anyway. */
- return plines_win_nofill(wp, lnum, winheight) + diff_check_fill(wp, lnum);
-}
-
-int plines_nofill(const linenr_T lnum)
-{
- return plines_win_nofill(curwin, lnum, true);
-}
-
-int plines_win_nofill(
- win_T *const wp,
- const linenr_T lnum,
- const bool winheight // when true limit to window height
-)
-{
- if (!wp->w_p_wrap) {
- return 1;
- }
-
- if (wp->w_width_inner == 0) {
- return 1;
- }
-
- // A folded lines is handled just like an empty line.
- if (lineFolded(wp, lnum)) {
- return 1;
- }
-
- const int lines = plines_win_nofold(wp, lnum);
- if (winheight && lines > wp->w_height_inner) {
- return wp->w_height_inner;
- }
- return lines;
-}
-
-/*
- * Return number of window lines physical line "lnum" will occupy in window
- * "wp". Does not care about folding, 'wrap' or 'diff'.
- */
-int plines_win_nofold(win_T *wp, linenr_T lnum)
-{
- char_u *s;
- unsigned int col;
- int width;
-
- s = ml_get_buf(wp->w_buffer, lnum, FALSE);
- if (*s == NUL) /* empty line */
- return 1;
- col = win_linetabsize(wp, s, MAXCOL);
-
- // If list mode is on, then the '$' at the end of the line may take up one
- // extra column.
- if (wp->w_p_list && wp->w_p_lcs_chars.eol != NUL) {
- col += 1;
- }
-
- /*
- * Add column offset for 'number', 'relativenumber' and 'foldcolumn'.
- */
- width = wp->w_width_inner - win_col_off(wp);
- if (width <= 0 || col > 32000) {
- return 32000; // bigger than the number of screen columns
- }
- if (col <= (unsigned int)width) {
- return 1;
- }
- col -= (unsigned int)width;
- width += win_col_off2(wp);
- assert(col <= INT_MAX && (int)col < INT_MAX - (width -1));
- return ((int)col + (width - 1)) / width + 1;
-}
-
-/*
- * Like plines_win(), but only reports the number of physical screen lines
- * used from the start of the line to the given column number.
- */
-int plines_win_col(win_T *wp, linenr_T lnum, long column)
-{
- // Check for filler lines above this buffer line. When folded the result
- // is one line anyway.
- int lines = diff_check_fill(wp, lnum);
-
- if (!wp->w_p_wrap)
- return lines + 1;
-
- if (wp->w_width_inner == 0) {
- return lines + 1;
- }
-
- char_u *line = ml_get_buf(wp->w_buffer, lnum, false);
- char_u *s = line;
-
- colnr_T col = 0;
- while (*s != NUL && --column >= 0) {
- col += win_lbr_chartabsize(wp, line, s, col, NULL);
- MB_PTR_ADV(s);
- }
-
- // If *s is a TAB, and the TAB is not displayed as ^I, and we're not in
- // INSERT mode, then col must be adjusted so that it represents the last
- // screen position of the TAB. This only fixes an error when the TAB wraps
- // from one screen line to the next (when 'columns' is not a multiple of
- // 'ts') -- webb.
- if (*s == TAB && (State & NORMAL)
- && (!wp->w_p_list || wp->w_p_lcs_chars.tab1)) {
- col += win_lbr_chartabsize(wp, line, s, col, NULL) - 1;
- }
-
- // Add column offset for 'number', 'relativenumber', 'foldcolumn', etc.
- int width = wp->w_width_inner - win_col_off(wp);
- if (width <= 0) {
- return 9999;
- }
-
- lines += 1;
- if (col > width)
- lines += (col - width) / (width + win_col_off2(wp)) + 1;
- return lines;
-}
-
-/// Get the number of screen lines lnum takes up. This takes care of
-/// both folds and topfill, and limits to the current window height.
-///
-/// @param[in] wp window line is in
-/// @param[in] lnum line number
-/// @param[out] nextp if not NULL, the line after a fold
-/// @param[out] foldedp if not NULL, whether lnum is on a fold
-/// @param[in] cache whether to use the window's cache for folds
-///
-/// @return the total number of screen lines
-int plines_win_full(win_T *wp, linenr_T lnum, linenr_T *const nextp,
- bool *const foldedp, const bool cache)
-{
- bool folded = hasFoldingWin(wp, lnum, NULL, nextp, cache, NULL);
- if (foldedp) {
- *foldedp = folded;
- }
- if (folded) {
- return 1;
- } else if (lnum == wp->w_topline) {
- return plines_win_nofill(wp, lnum, true) + wp->w_topfill;
- }
- return plines_win(wp, lnum, true);
-}
-
-int plines_m_win(win_T *wp, linenr_T first, linenr_T last)
-{
- int count = 0;
-
- while (first <= last) {
- linenr_T next = first;
- count += plines_win_full(wp, first, &next, NULL, false);
- first = next + 1;
- }
- return count;
-}
-
int gchar_pos(pos_T *pos)
FUNC_ATTR_NONNULL_ARG(1)
{
diff --git a/src/nvim/mouse.c b/src/nvim/mouse.c
index f1ad0ed105..6c25525936 100644
--- a/src/nvim/mouse.c
+++ b/src/nvim/mouse.c
@@ -18,6 +18,7 @@
#include "nvim/diff.h"
#include "nvim/move.h"
#include "nvim/misc1.h"
+#include "nvim/plines.h"
#include "nvim/cursor.h"
#include "nvim/buffer_defs.h"
#include "nvim/memline.h"
@@ -236,12 +237,14 @@ retnomove:
if (row < 0) {
count = 0;
for (first = true; curwin->w_topline > 1; ) {
- if (curwin->w_topfill < diff_check(curwin, curwin->w_topline))
- ++count;
- else
- count += plines(curwin->w_topline - 1);
- if (!first && count > -row)
+ if (curwin->w_topfill < diff_check(curwin, curwin->w_topline)) {
+ count++;
+ } else {
+ count += plines_win(curwin, curwin->w_topline - 1, true);
+ }
+ if (!first && count > -row) {
break;
+ }
first = false;
(void)hasFolding(curwin->w_topline, &curwin->w_topline, NULL);
if (curwin->w_topfill < diff_check(curwin, curwin->w_topline)) {
@@ -262,7 +265,7 @@ retnomove:
if (curwin->w_topfill > 0) {
++count;
} else {
- count += plines(curwin->w_topline);
+ count += plines_win(curwin, curwin->w_topline, true);
}
if (!first && count > row - curwin->w_height_inner + 1) {
@@ -522,7 +525,7 @@ static colnr_T scroll_line_len(linenr_T lnum)
char_u *line = ml_get(lnum);
if (*line != NUL) {
for (;;) {
- int numchar = chartabsize(line, col);
+ int numchar = win_chartabsize(curwin, line, col);
MB_PTR_ADV(line);
if (*line == NUL) { // don't count the last character
break;
@@ -618,10 +621,10 @@ static int mouse_adjust_click(win_T *wp, int row, int col)
// scanned *up to* `col`, nudging it left or right when concealed characters
// are encountered.
//
- // chartabsize() is used to keep track of the virtual column position relative
- // to the line's bytes. For example: if col == 9 and the line starts with a
- // tab that's 8 columns wide, we would want the cursor to be highlighting the
- // second byte, not the ninth.
+ // win_chartabsize() is used to keep track of the virtual column position
+ // relative to the line's bytes. For example: if col == 9 and the line
+ // starts with a tab that's 8 columns wide, we would want the cursor to be
+ // highlighting the second byte, not the ninth.
linenr_T lnum = wp->w_cursor.lnum;
char_u *line = ml_get(lnum);
@@ -645,7 +648,7 @@ static int mouse_adjust_click(win_T *wp, int row, int col)
// checked for concealed characters.
vcol = 0;
while (vcol < offset && *ptr != NUL) {
- vcol += chartabsize(ptr, vcol);
+ vcol += win_chartabsize(curwin, ptr, vcol);
ptr += utfc_ptr2len(ptr);
}
@@ -656,7 +659,7 @@ static int mouse_adjust_click(win_T *wp, int row, int col)
vcol = offset;
ptr_end = ptr_row_offset;
while (vcol < col && *ptr_end != NUL) {
- vcol += chartabsize(ptr_end, vcol);
+ vcol += win_chartabsize(curwin, ptr_end, vcol);
ptr_end += utfc_ptr2len(ptr_end);
}
@@ -671,7 +674,7 @@ static int mouse_adjust_click(win_T *wp, int row, int col)
#define decr() nudge--; ptr_end -= utfc_ptr2len(ptr_end)
while (ptr < ptr_end && *ptr != NUL) {
- cwidth = chartabsize(ptr, vcol);
+ cwidth = win_chartabsize(curwin, ptr, vcol);
vcol += cwidth;
if (cwidth > 1 && *ptr == '\t' && nudge > 0) {
// A tab will "absorb" any previous adjustments.
diff --git a/src/nvim/move.c b/src/nvim/move.c
index 293f51f2d9..09815d1e6a 100644
--- a/src/nvim/move.c
+++ b/src/nvim/move.c
@@ -27,6 +27,7 @@
#include "nvim/mbyte.h"
#include "nvim/memline.h"
#include "nvim/misc1.h"
+#include "nvim/plines.h"
#include "nvim/option.h"
#include "nvim/popupmnu.h"
#include "nvim/screen.h"
@@ -1055,8 +1056,9 @@ bool scrolldown(long line_count, int byfold)
line_count -= curwin->w_topline - first - 1;
curwin->w_botline -= curwin->w_topline - first;
curwin->w_topline = first;
- } else
- done += plines_nofill(curwin->w_topline);
+ } else {
+ done += plines_win_nofill(curwin, curwin->w_topline, true);
+ }
}
--curwin->w_botline; /* approximate w_botline */
invalidate_botline();
@@ -1090,8 +1092,9 @@ bool scrolldown(long line_count, int byfold)
curwin->w_cursor.lnum = 1;
else
curwin->w_cursor.lnum = first - 1;
- } else
- wrow -= plines(curwin->w_cursor.lnum--);
+ } else {
+ wrow -= plines_win(curwin, curwin->w_cursor.lnum--, true);
+ }
curwin->w_valid &=
~(VALID_WROW|VALID_WCOL|VALID_CHEIGHT|VALID_CROW|VALID_VIRTCOL);
moved = true;
@@ -1194,7 +1197,7 @@ check_topfill (
*/
static void max_topfill(void)
{
- int n = plines_nofill(curwin->w_topline);
+ int n = plines_win_nofill(curwin, curwin->w_topline, true);
if (n >= curwin->w_height_inner) {
curwin->w_topfill = 0;
} else {
@@ -1221,19 +1224,16 @@ void scrolldown_clamp(void)
validate_cursor(); /* w_wrow needs to be valid */
- /*
- * Compute the row number of the last row of the cursor line
- * and make sure it doesn't go off the screen. Make sure the cursor
- * doesn't go past 'scrolloff' lines from the screen end.
- */
+ // Compute the row number of the last row of the cursor line
+ // and make sure it doesn't go off the screen. Make sure the cursor
+ // doesn't go past 'scrolloff' lines from the screen end.
int end_row = curwin->w_wrow;
- if (can_fill)
- ++end_row;
- else
- end_row += plines_nofill(curwin->w_topline - 1);
- if (curwin->w_p_wrap
- && curwin->w_width_inner != 0
- ) {
+ if (can_fill) {
+ end_row++;
+ } else {
+ end_row += plines_win_nofill(curwin, curwin->w_topline - 1, true);
+ }
+ if (curwin->w_p_wrap && curwin->w_width_inner != 0) {
validate_cheight();
validate_virtcol();
end_row += curwin->w_cline_height - 1 -
@@ -1266,16 +1266,13 @@ void scrollup_clamp(void)
validate_cursor(); /* w_wrow needs to be valid */
- /*
- * Compute the row number of the first row of the cursor line
- * and make sure it doesn't go off the screen. Make sure the cursor
- * doesn't go before 'scrolloff' lines from the screen start.
- */
- int start_row = curwin->w_wrow - plines_nofill(curwin->w_topline)
- - curwin->w_topfill;
- if (curwin->w_p_wrap
- && curwin->w_width_inner != 0
- ) {
+ // Compute the row number of the first row of the cursor line
+ // and make sure it doesn't go off the screen. Make sure the cursor
+ // doesn't go before 'scrolloff' lines from the screen start.
+ int start_row = (curwin->w_wrow
+ - plines_win_nofill(curwin, curwin->w_topline, true)
+ - curwin->w_topfill);
+ if (curwin->w_p_wrap && curwin->w_width_inner != 0) {
validate_virtcol();
start_row -= curwin->w_virtcol / curwin->w_width_inner;
}
@@ -1422,14 +1419,15 @@ void scroll_cursor_top(int min_scroll, int always)
while (top > 0) {
int i = hasFolding(top, &top, NULL)
? 1 // count one logical line for a sequence of folded lines
- : plines_nofill(top);
+ : plines_win_nofill(curwin, top, true);
used += i;
if (extra + i <= off && bot < curbuf->b_ml.ml_line_count) {
- if (hasFolding(bot, NULL, &bot))
- /* count one logical line for a sequence of folded lines */
- ++used;
- else
- used += plines(bot);
+ if (hasFolding(bot, NULL, &bot)) {
+ // count one logical line for a sequence of folded lines
+ used++;
+ } else {
+ used += plines_win(curwin, bot, true);
+ }
}
if (used > curwin->w_height_inner) {
break;
@@ -1555,12 +1553,12 @@ void scroll_cursor_bot(int min_scroll, int set_topbot)
validate_botline(curwin);
}
- /* The lines of the cursor line itself are always used. */
- used = plines_nofill(cln);
+ // The lines of the cursor line itself are always used.
+ used = plines_win_nofill(curwin, cln, true);
- /* If the cursor is below botline, we will at least scroll by the height
- * of the cursor line. Correct for empty lines, which are really part of
- * botline. */
+ // If the cursor is below botline, we will at least scroll by the height
+ // of the cursor line. Correct for empty lines, which are really part of
+ // botline.
if (cln >= curwin->w_botline) {
scrolled = used;
if (cln == curwin->w_botline)
@@ -1704,7 +1702,7 @@ void scroll_cursor_halfway(int atend)
loff.lnum = boff.lnum = curwin->w_cursor.lnum;
(void)hasFolding(loff.lnum, &loff.lnum, &boff.lnum);
- int used = plines_nofill(loff.lnum);
+ int used = plines_win_nofill(curwin, loff.lnum, true);
loff.fill = 0;
boff.fill = 0;
linenr_T topline = loff.lnum;
@@ -1809,17 +1807,19 @@ void cursor_correct(void)
int below = curwin->w_filler_rows; /* screen lines below botline */
while ((above < above_wanted || below < below_wanted) && topline < botline) {
if (below < below_wanted && (below <= above || above >= above_wanted)) {
- if (hasFolding(botline, &botline, NULL))
- ++below;
- else
- below += plines(botline);
- --botline;
+ if (hasFolding(botline, &botline, NULL)) {
+ below++;
+ } else {
+ below += plines_win(curwin, botline, true);
+ }
+ botline--;
}
if (above < above_wanted && (above < below || below >= below_wanted)) {
- if (hasFolding(topline, NULL, &topline))
- ++above;
- else
- above += plines_nofill(topline);
+ if (hasFolding(topline, NULL, &topline)) {
+ above++;
+ } else {
+ above += plines_win_nofill(curwin, topline, true);
+ }
/* Count filler lines below this line as context. */
if (topline < botline)
@@ -2047,10 +2047,11 @@ static void get_scroll_overlap(lineoff_T *lp, int dir)
{
int min_height = curwin->w_height_inner - 2;
- if (lp->fill > 0)
+ if (lp->fill > 0) {
lp->height = 1;
- else
- lp->height = plines_nofill(lp->lnum);
+ } else {
+ lp->height = plines_win_nofill(curwin, lp->lnum, true);
+ }
int h1 = lp->height;
if (h1 > min_height)
return; /* no overlap */
@@ -2120,7 +2121,7 @@ void halfpage(bool flag, linenr_T Prenum)
n--;
curwin->w_topfill--;
} else {
- i = plines_nofill(curwin->w_topline);
+ i = plines_win_nofill(curwin, curwin->w_topline, true);
n -= i;
if (n < 0 && scrolled > 0)
break;
@@ -2146,12 +2147,12 @@ void halfpage(bool flag, linenr_T Prenum)
else {
room += i;
do {
- i = plines(curwin->w_botline);
- if (i > room)
+ i = plines_win(curwin, curwin->w_botline, true);
+ if (i > room) {
break;
- (void)hasFolding(curwin->w_botline, NULL,
- &curwin->w_botline);
- ++curwin->w_botline;
+ }
+ (void)hasFolding(curwin->w_botline, NULL, &curwin->w_botline);
+ curwin->w_botline++;
room -= i;
} while (curwin->w_botline <= curbuf->b_ml.ml_line_count);
}
@@ -2180,7 +2181,7 @@ void halfpage(bool flag, linenr_T Prenum)
n--;
curwin->w_topfill++;
} else {
- i = plines_nofill(curwin->w_topline - 1);
+ i = plines_win_nofill(curwin, curwin->w_topline - 1, true);
n -= i;
if (n < 0 && scrolled > 0)
break;
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index 54ca216a53..2a530db934 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -45,6 +45,7 @@
#include "nvim/mouse.h"
#include "nvim/ops.h"
#include "nvim/option.h"
+#include "nvim/plines.h"
#include "nvim/quickfix.h"
#include "nvim/screen.h"
#include "nvim/search.h"
@@ -5122,11 +5123,13 @@ static void nv_scroll(cmdarg_T *cap)
--n;
break;
}
- used += plines(curwin->w_topline + n);
- if (used >= half)
+ used += plines_win(curwin, curwin->w_topline + n, true);
+ if (used >= half) {
break;
- if (hasFolding(curwin->w_topline + n, NULL, &lnum))
+ }
+ if (hasFolding(curwin->w_topline + n, NULL, &lnum)) {
n = lnum - curwin->w_topline;
+ }
}
if (n > 0 && used > curwin->w_height_inner) {
n--;
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index c51dd09d40..a6eda26d75 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -41,6 +41,7 @@
#include "nvim/normal.h"
#include "nvim/option.h"
#include "nvim/path.h"
+#include "nvim/plines.h"
#include "nvim/screen.h"
#include "nvim/search.h"
#include "nvim/state.h"
diff --git a/src/nvim/options.lua b/src/nvim/options.lua
index 8a45cb69fa..df2a8edc04 100644
--- a/src/nvim/options.lua
+++ b/src/nvim/options.lua
@@ -6,7 +6,7 @@
-- type='number', list=nil, scope={'global'},
-- deny_duplicates=nil,
-- enable_if=nil,
--- defaults={condition=nil, if_true={vi=224, vim=0}, if_false=nil},
+-- defaults={condition=nil, if_true=224, if_false=nil},
-- secure=nil, gettext=nil, noglob=nil, normal_fname_chars=nil,
-- pri_mkrc=nil, deny_in_modelines=nil, normal_dname_chars=nil,
-- modelineexpr=nil,
@@ -21,7 +21,6 @@
-- scopes: global, buffer, window
-- redraw options: statuslines, current_window, curent_window_only,
-- current_buffer, all_windows, everything, curswant
--- default: {vi=…[, vim=…]}
-- defaults: {condition=#if condition, if_true=default, if_false=default}
-- #if condition:
-- string: #ifdef string
@@ -57,14 +56,14 @@ return {
type='number', scope={'global'},
redraw={'curswant'},
varname='p_aleph',
- defaults={if_true={vi=224}}
+ defaults={if_true=224}
},
{
full_name='arabic', abbreviation='arab',
short_desc=N_("Arabic as a default second language"),
type='bool', scope={'window'},
redraw={'curswant'},
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='arabicshape', abbreviation='arshape',
@@ -73,14 +72,14 @@ return {
redraw={'all_windows', 'ui_option'},
varname='p_arshape',
- defaults={if_true={vi=true}}
+ defaults={if_true=true}
},
{
full_name='allowrevins', abbreviation='ari',
short_desc=N_("allow CTRL-_ in Insert and Command-line mode"),
type='bool', scope={'global'},
varname='p_ari',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='ambiwidth', abbreviation='ambw',
@@ -88,42 +87,42 @@ return {
type='string', scope={'global'},
redraw={'all_windows', 'ui_option'},
varname='p_ambw',
- defaults={if_true={vi="single"}}
+ defaults={if_true="single"}
},
{
full_name='autochdir', abbreviation='acd',
short_desc=N_("change directory to the file in the current window"),
type='bool', scope={'global'},
varname='p_acd',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='autoindent', abbreviation='ai',
short_desc=N_("take indent for new line from previous line"),
type='bool', scope={'buffer'},
varname='p_ai',
- defaults={if_true={vim=true}}
+ defaults={if_true=true}
},
{
full_name='autoread', abbreviation='ar',
short_desc=N_("autom. read file when changed outside of Vim"),
type='bool', scope={'global', 'buffer'},
varname='p_ar',
- defaults={if_true={vim=true}}
+ defaults={if_true=true}
},
{
full_name='autowrite', abbreviation='aw',
short_desc=N_("automatically write file if changed"),
type='bool', scope={'global'},
varname='p_aw',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='autowriteall', abbreviation='awa',
short_desc=N_("as 'autowrite', but works with more commands"),
type='bool', scope={'global'},
varname='p_awa',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='background', abbreviation='bg',
@@ -131,7 +130,7 @@ return {
type='string', scope={'global'},
redraw={'all_windows'},
varname='p_bg',
- defaults={if_true={vim="dark"}}
+ defaults={if_true="dark"}
},
{
full_name='backspace', abbreviation='bs',
@@ -139,14 +138,14 @@ return {
type='string', list='onecomma', scope={'global'},
deny_duplicates=true,
varname='p_bs',
- defaults={if_true={vim="indent,eol,start"}}
+ defaults={if_true="indent,eol,start"}
},
{
full_name='backup', abbreviation='bk',
short_desc=N_("keep backup file after overwriting a file"),
type='bool', scope={'global'},
varname='p_bk',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='backupcopy', abbreviation='bkc',
@@ -156,8 +155,8 @@ return {
varname='p_bkc',
defaults={
condition='UNIX',
- if_true={vim="auto"},
- if_false={vim="auto"}
+ if_true="auto",
+ if_false="auto"
},
},
{
@@ -168,7 +167,7 @@ return {
secure=true,
expand='nodefault',
varname='p_bdir',
- defaults={if_true={vi=''}}
+ defaults={if_true=''}
},
{
full_name='backupext', abbreviation='bex',
@@ -176,7 +175,7 @@ return {
type='string', scope={'global'},
normal_fname_chars=true,
varname='p_bex',
- defaults={if_true={vi="~"}}
+ defaults={if_true="~"}
},
{
full_name='backupskip', abbreviation='bsk',
@@ -184,7 +183,7 @@ return {
type='string', list='onecomma', scope={'global'},
deny_duplicates=true,
varname='p_bsk',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='belloff', abbreviation='bo',
@@ -192,7 +191,7 @@ return {
type='string', list='comma', scope={'global'},
deny_duplicates=true,
varname='p_bo',
- defaults={if_true={vi="all"}}
+ defaults={if_true="all"}
},
{
full_name='binary', abbreviation='bin',
@@ -200,7 +199,7 @@ return {
type='bool', scope={'buffer'},
redraw={'statuslines'},
varname='p_bin',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='bomb',
@@ -209,7 +208,7 @@ return {
no_mkrc=true,
redraw={'statuslines'},
varname='p_bomb',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='breakat', abbreviation='brk',
@@ -217,14 +216,14 @@ return {
type='string', list='flags', scope={'global'},
redraw={'all_windows'},
varname='p_breakat',
- defaults={if_true={vi=" \t!@*-+;:,./?"}}
+ defaults={if_true=" \t!@*-+;:,./?"}
},
{
full_name='breakindent', abbreviation='bri',
short_desc=N_("wrapped line repeats indent"),
type='bool', scope={'window'},
redraw={'current_window'},
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='breakindentopt', abbreviation='briopt',
@@ -233,7 +232,7 @@ return {
deny_duplicates=true,
alloced=true,
redraw={'current_buffer'},
- defaults={if_true={vi=""}},
+ defaults={if_true=""},
},
{
full_name='browsedir', abbreviation='bsdir',
@@ -248,7 +247,7 @@ return {
noglob=true,
alloced=true,
varname='p_bh',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='buflisted', abbreviation='bl',
@@ -256,7 +255,7 @@ return {
type='bool', scope={'buffer'},
noglob=true,
varname='p_bl',
- defaults={if_true={vi=1}}
+ defaults={if_true=1}
},
{
full_name='buftype', abbreviation='bt',
@@ -265,7 +264,7 @@ return {
noglob=true,
alloced=true,
varname='p_bt',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='casemap', abbreviation='cmp',
@@ -273,7 +272,7 @@ return {
type='string', list='onecomma', scope={'global'},
deny_duplicates=true,
varname='p_cmp',
- defaults={if_true={vi="internal,keepascii"}}
+ defaults={if_true="internal,keepascii"}
},
{
full_name='cdpath', abbreviation='cd',
@@ -283,14 +282,14 @@ return {
expand=true,
secure=true,
varname='p_cdpath',
- defaults={if_true={vi=",,"}}
+ defaults={if_true=",,"}
},
{
full_name='cedit',
short_desc=N_("used to open the command-line window"),
type='string', scope={'global'},
varname='p_cedit',
- defaults={if_true={vim=macros('CTRL_F_STR')}}
+ defaults={if_true=macros('CTRL_F_STR')}
},
{
full_name='channel',
@@ -299,7 +298,7 @@ return {
no_mkrc=true,
nodefault=true,
varname='p_channel',
- defaults={if_true={vi=0}}
+ defaults={if_true=0}
},
{
full_name='charconvert', abbreviation='ccv',
@@ -307,14 +306,14 @@ return {
type='string', scope={'global'},
secure=true,
varname='p_ccv',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='cindent', abbreviation='cin',
short_desc=N_("do C program indenting"),
type='bool', scope={'buffer'},
varname='p_cin',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='cinkeys', abbreviation='cink',
@@ -323,7 +322,7 @@ return {
deny_duplicates=true,
alloced=true,
varname='p_cink',
- defaults={if_true={vi=indentkeys_default}}
+ defaults={if_true=indentkeys_default}
},
{
full_name='cinoptions', abbreviation='cino',
@@ -332,7 +331,7 @@ return {
deny_duplicates=true,
alloced=true,
varname='p_cino',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='cinwords', abbreviation='cinw',
@@ -341,7 +340,7 @@ return {
deny_duplicates=true,
alloced=true,
varname='p_cinw',
- defaults={if_true={vi="if,else,while,do,for,switch"}}
+ defaults={if_true="if,else,while,do,for,switch"}
},
{
full_name='clipboard', abbreviation='cb',
@@ -349,7 +348,7 @@ return {
type='string', list='onecomma', scope={'global'},
deny_duplicates=true,
varname='p_cb',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='cmdheight', abbreviation='ch',
@@ -357,14 +356,14 @@ return {
type='number', scope={'global'},
redraw={'all_windows'},
varname='p_ch',
- defaults={if_true={vi=1}}
+ defaults={if_true=1}
},
{
full_name='cmdwinheight', abbreviation='cwh',
short_desc=N_("height of the command-line window"),
type='number', scope={'global'},
varname='p_cwh',
- defaults={if_true={vi=7}}
+ defaults={if_true=7}
},
{
full_name='colorcolumn', abbreviation='cc',
@@ -372,7 +371,7 @@ return {
type='string', list='onecomma', scope={'window'},
deny_duplicates=true,
redraw={'current_window'},
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='columns', abbreviation='co',
@@ -381,7 +380,7 @@ return {
no_mkrc=true,
redraw={'everything'},
varname='p_columns',
- defaults={if_true={vi=macros('DFLT_COLS')}}
+ defaults={if_true=macros('DFLT_COLS')}
},
{
full_name='comments', abbreviation='com',
@@ -391,7 +390,7 @@ return {
alloced=true,
redraw={'curswant'},
varname='p_com',
- defaults={if_true={vi="s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-"}}
+ defaults={if_true="s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-"}
},
{
full_name='commentstring', abbreviation='cms',
@@ -400,7 +399,7 @@ return {
alloced=true,
redraw={'curswant'},
varname='p_cms',
- defaults={if_true={vi="/*%s*/"}}
+ defaults={if_true="/*%s*/"}
},
{
full_name='compatible', abbreviation='cp',
@@ -410,7 +409,7 @@ return {
varname='p_force_off',
-- pri_mkrc isn't needed here, optval_default()
-- always returns TRUE for 'compatible'
- defaults={if_true={vim=false}}
+ defaults={if_true=false}
},
{
full_name='complete', abbreviation='cpt',
@@ -419,7 +418,7 @@ return {
deny_duplicates=true,
alloced=true,
varname='p_cpt',
- defaults={if_true={vim=".,w,b,u,t"}}
+ defaults={if_true=".,w,b,u,t"}
},
{
full_name='concealcursor', abbreviation='cocu',
@@ -427,14 +426,14 @@ return {
type='string', scope={'window'},
alloced=true,
redraw={'current_window'},
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='conceallevel', abbreviation='cole',
short_desc=N_("whether concealable text is shown or hidden"),
type='number', scope={'window'},
redraw={'current_window'},
- defaults={if_true={vi=0}}
+ defaults={if_true=0}
},
{
full_name='completefunc', abbreviation='cfu',
@@ -443,7 +442,7 @@ return {
secure=true,
alloced=true,
varname='p_cfu',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='completeopt', abbreviation='cot',
@@ -451,28 +450,28 @@ return {
type='string', list='onecomma', scope={'global'},
deny_duplicates=true,
varname='p_cot',
- defaults={if_true={vi="menu,preview"}}
+ defaults={if_true="menu,preview"}
},
{
full_name='completeslash', abbreviation='csl',
type='string', scope={'buffer'},
varname='p_csl',
enable_if='BACKSLASH_IN_FILENAME',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='confirm', abbreviation='cf',
short_desc=N_("ask what to do about unsaved/read-only files"),
type='bool', scope={'global'},
varname='p_confirm',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='copyindent', abbreviation='ci',
short_desc=N_("make 'autoindent' use existing indent structure"),
type='bool', scope={'buffer'},
varname='p_ci',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='cpoptions', abbreviation='cpo',
@@ -480,14 +479,14 @@ return {
type='string', list='flags', scope={'global'},
redraw={'all_windows'},
varname='p_cpo',
- defaults={if_true={vim=macros('CPO_VIM')}}
+ defaults={if_true=macros('CPO_VIM')}
},
{
full_name='cscopepathcomp', abbreviation='cspc',
short_desc=N_("how many components of the path to show"),
type='number', scope={'global'},
varname='p_cspc',
- defaults={if_true={vi=0}}
+ defaults={if_true=0}
},
{
full_name='cscopeprg', abbreviation='csprg',
@@ -496,7 +495,7 @@ return {
secure=true,
expand=true,
varname='p_csprg',
- defaults={if_true={vi="cscope"}}
+ defaults={if_true="cscope"}
},
{
full_name='cscopequickfix', abbreviation='csqf',
@@ -504,56 +503,56 @@ return {
type='string', list='onecomma', scope={'global'},
deny_duplicates=true,
varname='p_csqf',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='cscoperelative', abbreviation='csre',
short_desc=N_("Use cscope.out path basename as prefix"),
type='bool', scope={'global'},
varname='p_csre',
- defaults={if_true={vi=0}}
+ defaults={if_true=0}
},
{
full_name='cscopetag', abbreviation='cst',
short_desc=N_("use cscope for tag commands"),
type='bool', scope={'global'},
varname='p_cst',
- defaults={if_true={vi=0}}
+ defaults={if_true=0}
},
{
full_name='cscopetagorder', abbreviation='csto',
short_desc=N_("determines \":cstag\" search order"),
type='number', scope={'global'},
varname='p_csto',
- defaults={if_true={vi=0}}
+ defaults={if_true=0}
},
{
full_name='cscopeverbose', abbreviation='csverb',
short_desc=N_("give messages when adding a cscope database"),
type='bool', scope={'global'},
varname='p_csverbose',
- defaults={if_true={vi=1}}
+ defaults={if_true=1}
},
{
full_name='cursorbind', abbreviation='crb',
short_desc=N_("move cursor in window as it moves in other windows"),
type='bool', scope={'window'},
pv_name='p_crbind',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='cursorcolumn', abbreviation='cuc',
short_desc=N_("highlight the screen column of the cursor"),
type='bool', scope={'window'},
redraw={'current_window_only'},
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='cursorline', abbreviation='cul',
short_desc=N_("highlight the screen line of the cursor"),
type='bool', scope={'window'},
redraw={'current_window_only'},
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='cursorlineopt', abbreviation='culopt',
@@ -561,14 +560,14 @@ return {
type='string', list='onecomma', scope={'window'},
deny_duplicates=true,
redraw={'current_window_only'},
- defaults={if_true={vi="both"}}
+ defaults={if_true="both"}
},
{
full_name='debug',
short_desc=N_("to \"msg\" to see all error messages"),
type='string', scope={'global'},
varname='p_debug',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='define', abbreviation='def',
@@ -577,14 +576,14 @@ return {
alloced=true,
redraw={'curswant'},
varname='p_def',
- defaults={if_true={vi="^\\s*#\\s*define"}}
+ defaults={if_true="^\\s*#\\s*define"}
},
{
full_name='delcombine', abbreviation='deco',
short_desc=N_("delete combining characters on their own"),
type='bool', scope={'global'},
varname='p_deco',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='dictionary', abbreviation='dict',
@@ -594,7 +593,7 @@ return {
normal_dname_chars=true,
expand=true,
varname='p_dict',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='diff',
@@ -602,7 +601,7 @@ return {
type='bool', scope={'window'},
noglob=true,
redraw={'current_window'},
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='diffexpr', abbreviation='dex',
@@ -611,7 +610,7 @@ return {
secure=true,
redraw={'curswant'},
varname='p_dex',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='diffopt', abbreviation='dip',
@@ -621,14 +620,14 @@ return {
alloced=true,
redraw={'current_window'},
varname='p_dip',
- defaults={if_true={vi="internal,filler,closeoff"}}
+ defaults={if_true="internal,filler,closeoff"}
},
{
full_name='digraph', abbreviation='dg',
short_desc=N_("enable the entering of digraphs in Insert mode"),
type='bool', scope={'global'},
varname='p_dg',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='directory', abbreviation='dir',
@@ -638,7 +637,7 @@ return {
secure=true,
expand='nodefault',
varname='p_dir',
- defaults={if_true={vi=''}}
+ defaults={if_true=''}
},
{
full_name='display', abbreviation='dy',
@@ -647,21 +646,21 @@ return {
deny_duplicates=true,
redraw={'all_windows'},
varname='p_dy',
- defaults={if_true={vim="lastline,msgsep"}}
+ defaults={if_true="lastline,msgsep"}
},
{
full_name='eadirection', abbreviation='ead',
short_desc=N_("in which direction 'equalalways' works"),
type='string', scope={'global'},
varname='p_ead',
- defaults={if_true={vi="both"}}
+ defaults={if_true="both"}
},
{
full_name='edcompatible', abbreviation='ed',
short_desc=N_("No description"),
type='bool', scope={'global'},
varname='p_force_off',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='emoji', abbreviation='emo',
@@ -669,7 +668,7 @@ return {
type='bool', scope={'global'},
redraw={'all_windows', 'ui_option'},
varname='p_emoji',
- defaults={if_true={vi=true}}
+ defaults={if_true=true}
},
{
full_name='encoding', abbreviation='enc',
@@ -677,7 +676,7 @@ return {
type='string', scope={'global'},
deny_in_modelines=true,
varname='p_enc',
- defaults={if_true={vi=macros('ENC_DFLT')}}
+ defaults={if_true=macros('ENC_DFLT')}
},
{
full_name='endofline', abbreviation='eol',
@@ -686,7 +685,7 @@ return {
no_mkrc=true,
redraw={'statuslines'},
varname='p_eol',
- defaults={if_true={vi=true}}
+ defaults={if_true=true}
},
{
full_name='equalalways', abbreviation='ea',
@@ -694,7 +693,7 @@ return {
type='bool', scope={'global'},
redraw={'all_windows'},
varname='p_ea',
- defaults={if_true={vi=true}}
+ defaults={if_true=true}
},
{
full_name='equalprg', abbreviation='ep',
@@ -703,14 +702,14 @@ return {
secure=true,
expand=true,
varname='p_ep',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='errorbells', abbreviation='eb',
short_desc=N_("ring the bell for error messages"),
type='bool', scope={'global'},
varname='p_eb',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='errorfile', abbreviation='ef',
@@ -719,7 +718,7 @@ return {
secure=true,
expand=true,
varname='p_ef',
- defaults={if_true={vi=macros('DFLT_ERRORFILE')}}
+ defaults={if_true=macros('DFLT_ERRORFILE')}
},
{
full_name='errorformat', abbreviation='efm',
@@ -727,7 +726,7 @@ return {
type='string', list='onecomma', scope={'global', 'buffer'},
deny_duplicates=true,
varname='p_efm',
- defaults={if_true={vi=macros('DFLT_EFM')}}
+ defaults={if_true=macros('DFLT_EFM')}
},
{
full_name='eventignore', abbreviation='ei',
@@ -735,14 +734,14 @@ return {
type='string', list='onecomma', scope={'global'},
deny_duplicates=true,
varname='p_ei',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='expandtab', abbreviation='et',
short_desc=N_("use spaces when <Tab> is inserted"),
type='bool', scope={'buffer'},
varname='p_et',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='exrc', abbreviation='ex',
@@ -750,7 +749,7 @@ return {
type='bool', scope={'global'},
secure=true,
varname='p_exrc',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='fileencoding', abbreviation='fenc',
@@ -760,7 +759,7 @@ return {
alloced=true,
redraw={'statuslines', 'current_buffer'},
varname='p_fenc',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='fileencodings', abbreviation='fencs',
@@ -768,7 +767,7 @@ return {
type='string', list='onecomma', scope={'global'},
deny_duplicates=true,
varname='p_fencs',
- defaults={if_true={vi="ucs-bom,utf-8,default,latin1"}}
+ defaults={if_true="ucs-bom,utf-8,default,latin1"}
},
{
full_name='fileformat', abbreviation='ff',
@@ -778,7 +777,7 @@ return {
alloced=true,
redraw={'curswant', 'statuslines'},
varname='p_ff',
- defaults={if_true={vi=macros('DFLT_FF')}}
+ defaults={if_true=macros('DFLT_FF')}
},
{
full_name='fileformats', abbreviation='ffs',
@@ -786,7 +785,7 @@ return {
type='string', list='onecomma', scope={'global'},
deny_duplicates=true,
varname='p_ffs',
- defaults={if_true={vim=macros('DFLT_FFS_VIM')}}
+ defaults={if_true=macros('DFLT_FFS_VIM')}
},
{
full_name='fileignorecase', abbreviation='fic',
@@ -795,8 +794,8 @@ return {
varname='p_fic',
defaults={
condition='CASE_INSENSITIVE_FILENAME',
- if_true={vi=true},
- if_false={vi=false},
+ if_true=true,
+ if_false=false,
}
},
{
@@ -808,7 +807,7 @@ return {
alloced=true,
expand=true,
varname='p_ft',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='fillchars', abbreviation='fcs',
@@ -818,7 +817,7 @@ return {
alloced=true,
redraw={'current_window'},
varname='p_fcs',
- defaults={if_true={vi=''}}
+ defaults={if_true=''}
},
{
full_name='fixendofline', abbreviation='fixeol',
@@ -826,7 +825,7 @@ return {
type='bool', scope={'buffer'},
redraw={'statuslines'},
varname='p_fixeol',
- defaults={if_true={vi=true}}
+ defaults={if_true=true}
},
{
full_name='foldclose', abbreviation='fcl',
@@ -835,7 +834,7 @@ return {
deny_duplicates=true,
redraw={'current_window'},
varname='p_fcl',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='foldcolumn', abbreviation='fdc',
@@ -843,14 +842,14 @@ return {
type='string', scope={'window'},
alloced=true,
redraw={'current_window'},
- defaults={if_true={vi="0"}}
+ defaults={if_true="0"}
},
{
full_name='foldenable', abbreviation='fen',
short_desc=N_("set to display all folds open"),
type='bool', scope={'window'},
redraw={'current_window'},
- defaults={if_true={vi=true}}
+ defaults={if_true=true}
},
{
full_name='foldexpr', abbreviation='fde',
@@ -859,7 +858,7 @@ return {
modelineexpr=true,
alloced=true,
redraw={'current_window'},
- defaults={if_true={vi="0"}}
+ defaults={if_true="0"}
},
{
full_name='foldignore', abbreviation='fdi',
@@ -867,14 +866,14 @@ return {
type='string', scope={'window'},
alloced=true,
redraw={'current_window'},
- defaults={if_true={vi="#"}}
+ defaults={if_true="#"}
},
{
full_name='foldlevel', abbreviation='fdl',
short_desc=N_("close folds with a level higher than this"),
type='number', scope={'window'},
redraw={'current_window'},
- defaults={if_true={vi=0}}
+ defaults={if_true=0}
},
{
full_name='foldlevelstart', abbreviation='fdls',
@@ -882,7 +881,7 @@ return {
type='number', scope={'global'},
redraw={'curswant'},
varname='p_fdls',
- defaults={if_true={vi=-1}}
+ defaults={if_true=-1}
},
{
full_name='foldmarker', abbreviation='fmr',
@@ -891,7 +890,7 @@ return {
deny_duplicates=true,
alloced=true,
redraw={'current_window'},
- defaults={if_true={vi="{{{,}}}"}}
+ defaults={if_true="{{{,}}}"}
},
{
full_name='foldmethod', abbreviation='fdm',
@@ -899,21 +898,21 @@ return {
type='string', scope={'window'},
alloced=true,
redraw={'current_window'},
- defaults={if_true={vi="manual"}}
+ defaults={if_true="manual"}
},
{
full_name='foldminlines', abbreviation='fml',
short_desc=N_("minimum number of lines for a fold to be closed"),
type='number', scope={'window'},
redraw={'current_window'},
- defaults={if_true={vi=1}}
+ defaults={if_true=1}
},
{
full_name='foldnestmax', abbreviation='fdn',
short_desc=N_("maximum fold depth"),
type='number', scope={'window'},
redraw={'current_window'},
- defaults={if_true={vi=20}}
+ defaults={if_true=20}
},
{
full_name='foldopen', abbreviation='fdo',
@@ -922,7 +921,7 @@ return {
deny_duplicates=true,
redraw={'curswant'},
varname='p_fdo',
- defaults={if_true={vi="block,hor,mark,percent,quickfix,search,tag,undo"}}
+ defaults={if_true="block,hor,mark,percent,quickfix,search,tag,undo"}
},
{
full_name='foldtext', abbreviation='fdt',
@@ -931,7 +930,7 @@ return {
modelineexpr=true,
alloced=true,
redraw={'current_window'},
- defaults={if_true={vi="foldtext()"}}
+ defaults={if_true="foldtext()"}
},
{
full_name='formatexpr', abbreviation='fex',
@@ -940,7 +939,7 @@ return {
modelineexpr=true,
alloced=true,
varname='p_fex',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='formatoptions', abbreviation='fo',
@@ -948,7 +947,7 @@ return {
type='string', list='flags', scope={'buffer'},
alloced=true,
varname='p_fo',
- defaults={if_true={vim=macros('DFLT_FO_VIM')}}
+ defaults={if_true=macros('DFLT_FO_VIM')}
},
{
full_name='formatlistpat', abbreviation='flp',
@@ -956,7 +955,7 @@ return {
type='string', scope={'buffer'},
alloced=true,
varname='p_flp',
- defaults={if_true={vi="^\\s*\\d\\+[\\]:.)}\\t ]\\s*"}}
+ defaults={if_true="^\\s*\\d\\+[\\]:.)}\\t ]\\s*"}
},
{
full_name='formatprg', abbreviation='fp',
@@ -965,7 +964,7 @@ return {
secure=true,
expand=true,
varname='p_fp',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='fsync', abbreviation='fs',
@@ -973,14 +972,14 @@ return {
type='bool', scope={'global'},
secure=true,
varname='p_fs',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='gdefault', abbreviation='gd',
short_desc=N_("the \":substitute\" flag 'g' is default on"),
type='bool', scope={'global'},
varname='p_gd',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='grepformat', abbreviation='gfm',
@@ -988,7 +987,7 @@ return {
type='string', list='onecomma', scope={'global'},
deny_duplicates=true,
varname='p_gefm',
- defaults={if_true={vi=macros('DFLT_GREPFORMAT')}}
+ defaults={if_true=macros('DFLT_GREPFORMAT')}
},
{
full_name='grepprg', abbreviation='gp',
@@ -1001,8 +1000,8 @@ return {
condition='WIN32',
-- Add an extra file name so that grep will always
-- insert a file name in the match line. */
- if_true={vi="findstr /n $* nul"},
- if_false={vi="grep -n $* /dev/null"}
+ if_true="findstr /n $* nul",
+ if_false="grep -n $* /dev/null"
}
},
{
@@ -1011,7 +1010,7 @@ return {
type='string', list='onecomma', scope={'global'},
deny_duplicates=true,
varname='p_guicursor',
- defaults={if_true={vi="n-v-c-sm:block,i-ci-ve:ver25,r-cr-o:hor20"}}
+ defaults={if_true="n-v-c-sm:block,i-ci-ve:ver25,r-cr-o:hor20"}
},
{
full_name='guifont', abbreviation='gfn',
@@ -1020,7 +1019,7 @@ return {
deny_duplicates=true,
varname='p_guifont',
redraw={'ui_option'},
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='guifontwide', abbreviation='gfw',
@@ -1029,7 +1028,7 @@ return {
deny_duplicates=true,
redraw={'ui_option'},
varname='p_guifontwide',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='guioptions', abbreviation='go',
@@ -1060,14 +1059,14 @@ return {
secure=true,
expand=true,
varname='p_hf',
- defaults={if_true={vi=macros('DFLT_HELPFILE')}}
+ defaults={if_true=macros('DFLT_HELPFILE')}
},
{
full_name='helpheight', abbreviation='hh',
short_desc=N_("minimum height of a new help window"),
type='number', scope={'global'},
varname='p_hh',
- defaults={if_true={vi=20}}
+ defaults={if_true=20}
},
{
full_name='helplang', abbreviation='hlg',
@@ -1075,14 +1074,14 @@ return {
type='string', list='onecomma', scope={'global'},
deny_duplicates=true,
varname='p_hlg',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='hidden', abbreviation='hid',
short_desc=N_("don't unload buffer when it is |abandon|ed"),
type='bool', scope={'global'},
varname='p_hid',
- defaults={if_true={vi=false}}
+ defaults={if_true=true}
},
{
full_name='highlight', abbreviation='hl',
@@ -1090,28 +1089,28 @@ return {
type='string', list='onecomma', scope={'global'},
deny_duplicates=true,
varname='p_hl',
- defaults={if_true={vi=macros('HIGHLIGHT_INIT')}}
+ defaults={if_true=macros('HIGHLIGHT_INIT')}
},
{
full_name='history', abbreviation='hi',
short_desc=N_("number of command-lines that are remembered"),
type='number', scope={'global'},
varname='p_hi',
- defaults={if_true={vim=10000}}
+ defaults={if_true=10000}
},
{
full_name='hkmap', abbreviation='hk',
short_desc=N_("Hebrew keyboard mapping"),
type='bool', scope={'global'},
varname='p_hkmap',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='hkmapp', abbreviation='hkp',
short_desc=N_("phonetic Hebrew keyboard mapping"),
type='bool', scope={'global'},
varname='p_hkmapp',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='hlsearch', abbreviation='hls',
@@ -1119,14 +1118,14 @@ return {
type='bool', scope={'global'},
redraw={'all_windows'},
varname='p_hls',
- defaults={if_true={vim=true}}
+ defaults={if_true=true}
},
{
full_name='icon',
short_desc=N_("Vim set the text of the window icon"),
type='bool', scope={'global'},
varname='p_icon',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='iconstring',
@@ -1134,28 +1133,28 @@ return {
type='string', scope={'global'},
modelineexpr=true,
varname='p_iconstring',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='ignorecase', abbreviation='ic',
short_desc=N_("ignore case in search patterns"),
type='bool', scope={'global'},
varname='p_ic',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='imcmdline', abbreviation='imc',
short_desc=N_("use IM when starting to edit a command line"),
type='bool', scope={'global'},
enable_if=false,
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='imdisable', abbreviation='imd',
short_desc=N_("do not use the IM in any mode"),
type='bool', scope={'global'},
enable_if=false,
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='iminsert', abbreviation='imi',
@@ -1163,7 +1162,7 @@ return {
type='number', scope={'buffer'},
varname='p_iminsert', pv_name='p_imi',
defaults={
- if_true={vi=macros('B_IMODE_NONE')},
+ if_true=macros('B_IMODE_NONE'),
}
},
{
@@ -1172,7 +1171,7 @@ return {
type='number', scope={'buffer'},
varname='p_imsearch', pv_name='p_ims',
defaults={
- if_true={vi=macros('B_IMODE_USE_INSERT')},
+ if_true=macros('B_IMODE_USE_INSERT'),
}
},
{
@@ -1181,7 +1180,7 @@ return {
type='string', scope={'global'},
redraw={'all_windows'},
varname='p_icm',
- defaults={if_true={vi=""}}
+ defaults={if_true="nosplit"}
},
{
full_name='include', abbreviation='inc',
@@ -1189,7 +1188,7 @@ return {
type='string', scope={'global', 'buffer'},
alloced=true,
varname='p_inc',
- defaults={if_true={vi="^\\s*#\\s*include"}}
+ defaults={if_true="^\\s*#\\s*include"}
},
{
full_name='includeexpr', abbreviation='inex',
@@ -1198,14 +1197,14 @@ return {
modelineexpr=true,
alloced=true,
varname='p_inex',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='incsearch', abbreviation='is',
short_desc=N_("highlight match while typing search pattern"),
type='bool', scope={'global'},
varname='p_is',
- defaults={if_true={vim=true}}
+ defaults={if_true=true}
},
{
full_name='indentexpr', abbreviation='inde',
@@ -1214,7 +1213,7 @@ return {
modelineexpr=true,
alloced=true,
varname='p_inde',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='indentkeys', abbreviation='indk',
@@ -1223,21 +1222,21 @@ return {
deny_duplicates=true,
alloced=true,
varname='p_indk',
- defaults={if_true={vi=indentkeys_default}}
+ defaults={if_true=indentkeys_default}
},
{
full_name='infercase', abbreviation='inf',
short_desc=N_("adjust case of match for keyword completion"),
type='bool', scope={'buffer'},
varname='p_inf',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='insertmode', abbreviation='im',
short_desc=N_("start the edit of a file in Insert mode"),
type='bool', scope={'global'},
varname='p_im',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='isfname', abbreviation='isf',
@@ -1249,8 +1248,8 @@ return {
condition='BACKSLASH_IN_FILENAME',
-- Excluded are: & and ^ are special in cmd.exe
-- ( and ) are used in text separating fnames */
- if_true={vi="@,48-57,/,\\,.,-,_,+,,,#,$,%,{,},[,],:,@-@,!,~,="},
- if_false={vi="@,48-57,/,.,-,_,+,,,#,$,%,~,="}
+ if_true="@,48-57,/,\\,.,-,_,+,,,#,$,%,{,},[,],:,@-@,!,~,=",
+ if_false="@,48-57,/,.,-,_,+,,,#,$,%,~,="
}
},
{
@@ -1261,8 +1260,8 @@ return {
varname='p_isi',
defaults={
condition='WIN32',
- if_true={vi="@,48-57,_,128-167,224-235"},
- if_false={vi="@,48-57,_,192-255"}
+ if_true="@,48-57,_,128-167,224-235",
+ if_false="@,48-57,_,192-255"
}
},
{
@@ -1272,7 +1271,7 @@ return {
deny_duplicates=true,
alloced=true,
varname='p_isk',
- defaults={if_true={vim="@,48-57,_,192-255"}}
+ defaults={if_true="@,48-57,_,192-255"}
},
{
full_name='isprint', abbreviation='isp',
@@ -1281,7 +1280,7 @@ return {
deny_duplicates=true,
redraw={'all_windows'},
varname='p_isp',
- defaults={if_true={vi="@,161-255"}
+ defaults={if_true="@,161-255"
}
},
{
@@ -1289,7 +1288,7 @@ return {
short_desc=N_("two spaces after a period with a join command"),
type='bool', scope={'global'},
varname='p_js',
- defaults={if_true={vi=true}}
+ defaults={if_true=false}
},
{
full_name='jumpoptions', abbreviation='jop',
@@ -1297,7 +1296,7 @@ return {
type='string', list='onecomma', scope={'global'},
deny_duplicates=true,
varname='p_jop',
- defaults={if_true={vim=''}}
+ defaults={if_true=''}
},
{
full_name='keymap', abbreviation='kmp',
@@ -1308,7 +1307,7 @@ return {
alloced=true,
redraw={'statuslines', 'current_buffer'},
varname='p_keymap', pv_name='p_kmap',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='keymodel', abbreviation='km',
@@ -1316,7 +1315,7 @@ return {
type='string', list='onecomma', scope={'global'},
deny_duplicates=true,
varname='p_km',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='keywordprg', abbreviation='kp',
@@ -1326,7 +1325,7 @@ return {
expand=true,
varname='p_kp',
defaults={
- if_true={vi=":Man"},
+ if_true=":Man",
}
},
{
@@ -1336,7 +1335,7 @@ return {
deny_duplicates=true,
secure=true,
varname='p_langmap',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='langmenu', abbreviation='lm',
@@ -1344,21 +1343,21 @@ return {
type='string', scope={'global'},
normal_fname_chars=true,
varname='p_lm',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='langnoremap', abbreviation='lnr',
short_desc=N_("do not apply 'langmap' to mapped characters"),
type='bool', scope={'global'},
varname='p_lnr',
- defaults={if_true={vim=true}}
+ defaults={if_true=true}
},
{
full_name='langremap', abbreviation='lrm',
short_desc=N_('No description'),
type='bool', scope={'global'},
varname='p_lrm',
- defaults={if_true={vim=false}}
+ defaults={if_true=false}
},
{
full_name='laststatus', abbreviation='ls',
@@ -1366,21 +1365,21 @@ return {
type='number', scope={'global'},
redraw={'all_windows'},
varname='p_ls',
- defaults={if_true={vim=2}}
+ defaults={if_true=2}
},
{
full_name='lazyredraw', abbreviation='lz',
short_desc=N_("don't redraw while executing macros"),
type='bool', scope={'global'},
varname='p_lz',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='linebreak', abbreviation='lbr',
short_desc=N_("wrap long lines at a blank"),
type='bool', scope={'window'},
redraw={'current_window'},
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='lines',
@@ -1389,7 +1388,7 @@ return {
no_mkrc=true,
redraw={'everything'},
varname='p_lines',
- defaults={if_true={vi=macros('DFLT_ROWS')}}
+ defaults={if_true=macros('DFLT_ROWS')}
},
{
full_name='linespace', abbreviation='lsp',
@@ -1397,14 +1396,14 @@ return {
type='number', scope={'global'},
redraw={'ui_option'},
varname='p_linespace',
- defaults={if_true={vi=0}}
+ defaults={if_true=0}
},
{
full_name='lisp',
short_desc=N_("indenting for Lisp"),
type='bool', scope={'buffer'},
varname='p_lisp',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='lispwords', abbreviation='lw',
@@ -1412,14 +1411,14 @@ return {
type='string', list='onecomma', scope={'global', 'buffer'},
deny_duplicates=true,
varname='p_lispwords', pv_name='p_lw',
- defaults={if_true={vi=macros('LISPWORD_VALUE')}}
+ defaults={if_true=macros('LISPWORD_VALUE')}
},
{
full_name='list',
short_desc=N_("<Tab> and <EOL>"),
type='bool', scope={'window'},
redraw={'current_window'},
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='listchars', abbreviation='lcs',
@@ -1429,21 +1428,21 @@ return {
alloced=true,
redraw={'current_window'},
varname='p_lcs',
- defaults={if_true={vim="tab:> ,trail:-,nbsp:+"}}
+ defaults={if_true="tab:> ,trail:-,nbsp:+"}
},
{
full_name='loadplugins', abbreviation='lpl',
short_desc=N_("load plugin scripts when starting up"),
type='bool', scope={'global'},
varname='p_lpl',
- defaults={if_true={vi=true}}
+ defaults={if_true=true}
},
{
full_name='magic',
short_desc=N_("special characters in search patterns"),
type='bool', scope={'global'},
varname='p_magic',
- defaults={if_true={vi=true}}
+ defaults={if_true=true}
},
{
full_name='makeef', abbreviation='mef',
@@ -1452,14 +1451,14 @@ return {
secure=true,
expand=true,
varname='p_mef',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='makeencoding', abbreviation='menc',
short_desc=N_("Converts the output of external commands"),
type='string', scope={'global', 'buffer'},
varname='p_menc',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='makeprg', abbreviation='mp',
@@ -1468,7 +1467,7 @@ return {
secure=true,
expand=true,
varname='p_mp',
- defaults={if_true={vi="make"}}
+ defaults={if_true="make"}
},
{
full_name='matchpairs', abbreviation='mps',
@@ -1477,49 +1476,49 @@ return {
deny_duplicates=true,
alloced=true,
varname='p_mps',
- defaults={if_true={vi="(:),{:},[:]"}}
+ defaults={if_true="(:),{:},[:]"}
},
{
full_name='matchtime', abbreviation='mat',
short_desc=N_("tenths of a second to show matching paren"),
type='number', scope={'global'},
varname='p_mat',
- defaults={if_true={vi=5}}
+ defaults={if_true=5}
},
{
full_name='maxcombine', abbreviation='mco',
short_desc=N_("maximum nr of combining characters displayed"),
type='number', scope={'global'},
varname='p_mco',
- defaults={if_true={vi=6}}
+ defaults={if_true=6}
},
{
full_name='maxfuncdepth', abbreviation='mfd',
short_desc=N_("maximum recursive depth for user functions"),
type='number', scope={'global'},
varname='p_mfd',
- defaults={if_true={vi=100}}
+ defaults={if_true=100}
},
{
full_name='maxmapdepth', abbreviation='mmd',
short_desc=N_("maximum recursive depth for mapping"),
type='number', scope={'global'},
varname='p_mmd',
- defaults={if_true={vi=1000}}
+ defaults={if_true=1000}
},
{
full_name='maxmempattern', abbreviation='mmp',
short_desc=N_("maximum memory (in Kbyte) used for pattern search"),
type='number', scope={'global'},
varname='p_mmp',
- defaults={if_true={vi=1000}}
+ defaults={if_true=1000}
},
{
full_name='menuitems', abbreviation='mis',
short_desc=N_("maximum number of items in a menu"),
type='number', scope={'global'},
varname='p_mis',
- defaults={if_true={vi=25}}
+ defaults={if_true=25}
},
{
full_name='mkspellmem', abbreviation='msm',
@@ -1528,14 +1527,14 @@ return {
secure=true,
expand=true,
varname='p_msm',
- defaults={if_true={vi="460000,2000,500"}}
+ defaults={if_true="460000,2000,500"}
},
{
full_name='modeline', abbreviation='ml',
short_desc=N_("recognize modelines at start or end of file"),
type='bool', scope={'buffer'},
varname='p_ml',
- defaults={if_true={vim=true}}
+ defaults={if_true=true}
},
{
full_name='modelineexpr', abbreviation='mle',
@@ -1543,14 +1542,14 @@ return {
type='bool', scope={'global'},
secure=true,
varname='p_mle',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='modelines', abbreviation='mls',
short_desc=N_("number of lines checked for modelines"),
type='number', scope={'global'},
varname='p_mls',
- defaults={if_true={vi=5}}
+ defaults={if_true=5}
},
{
full_name='modifiable', abbreviation='ma',
@@ -1558,7 +1557,7 @@ return {
type='bool', scope={'buffer'},
noglob=true,
varname='p_ma',
- defaults={if_true={vi=true}}
+ defaults={if_true=true}
},
{
full_name='modified', abbreviation='mod',
@@ -1567,21 +1566,21 @@ return {
no_mkrc=true,
redraw={'statuslines'},
varname='p_mod',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='more',
short_desc=N_("listings when the whole screen is filled"),
type='bool', scope={'global'},
varname='p_more',
- defaults={if_true={vim=true}}
+ defaults={if_true=true}
},
{
full_name='mouse',
short_desc=N_("the use of mouse clicks"),
type='string', list='flags', scope={'global'},
varname='p_mouse',
- defaults={if_true={vim=""}}
+ defaults={if_true=""}
},
{
full_name='mousefocus', abbreviation='mousef',
@@ -1589,21 +1588,21 @@ return {
type='bool', scope={'global'},
redraw={'ui_option'},
varname='p_mousef',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='mousehide', abbreviation='mh',
short_desc=N_("hide mouse pointer while typing"),
type='bool', scope={'global'},
enable_if=false,
- defaults={if_true={vi=true}}
+ defaults={if_true=true}
},
{
full_name='mousemodel', abbreviation='mousem',
short_desc=N_("changes meaning of mouse buttons"),
type='string', scope={'global'},
varname='p_mousem',
- defaults={if_true={vi="extend"}}
+ defaults={if_true="extend"}
},
{
full_name='mouseshape', abbreviation='mouses',
@@ -1617,7 +1616,7 @@ return {
short_desc=N_("max time between mouse double-click"),
type='number', scope={'global'},
varname='p_mouset',
- defaults={if_true={vi=500}}
+ defaults={if_true=500}
},
{
full_name='nrformats', abbreviation='nf',
@@ -1626,21 +1625,21 @@ return {
deny_duplicates=true,
alloced=true,
varname='p_nf',
- defaults={if_true={vim="bin,hex"}}
+ defaults={if_true="bin,hex"}
},
{
full_name='number', abbreviation='nu',
short_desc=N_("print the line number in front of each line"),
type='bool', scope={'window'},
redraw={'current_window'},
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='numberwidth', abbreviation='nuw',
short_desc=N_("number of columns used for the line number"),
type='number', scope={'window'},
redraw={'current_window'},
- defaults={if_true={vim=4}}
+ defaults={if_true=4}
},
{
full_name='omnifunc', abbreviation='ofu',
@@ -1649,14 +1648,14 @@ return {
secure=true,
alloced=true,
varname='p_ofu',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='opendevice', abbreviation='odev',
short_desc=N_("allow reading/writing devices on MS-Windows"),
type='bool', scope={'global'},
enable_if=false,
- defaults={if_true={vim=false}}
+ defaults={if_true=false}
},
{
full_name='operatorfunc', abbreviation='opfunc',
@@ -1664,7 +1663,7 @@ return {
type='string', scope={'global'},
secure=true,
varname='p_opfunc',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='packpath', abbreviation='pp',
@@ -1674,14 +1673,14 @@ return {
secure=true,
expand=true,
varname='p_pp',
- defaults={if_true={vi=''}}
+ defaults={if_true=''}
},
{
full_name='paragraphs', abbreviation='para',
short_desc=N_("nroff macros that separate paragraphs"),
type='string', scope={'global'},
varname='p_para',
- defaults={if_true={vi="IPLPPPQPP TPHPLIPpLpItpplpipbp"}}
+ defaults={if_true="IPLPPPQPP TPHPLIPpLpItpplpipbp"}
},
{
full_name='paste',
@@ -1689,14 +1688,14 @@ return {
type='bool', scope={'global'},
pri_mkrc=true,
varname='p_paste',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='pastetoggle', abbreviation='pt',
short_desc=N_("key code that causes 'paste' to toggle"),
type='string', scope={'global'},
varname='p_pt',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='patchexpr', abbreviation='pex',
@@ -1704,7 +1703,7 @@ return {
type='string', scope={'global'},
secure=true,
varname='p_pex',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='patchmode', abbreviation='pm',
@@ -1712,7 +1711,7 @@ return {
type='string', scope={'global'},
normal_fname_chars=true,
varname='p_pm',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='path', abbreviation='pa',
@@ -1721,21 +1720,21 @@ return {
deny_duplicates=true,
expand=true,
varname='p_path',
- defaults={if_true={vi=".,/usr/include,,"}}
+ defaults={if_true=".,/usr/include,,"}
},
{
full_name='preserveindent', abbreviation='pi',
short_desc=N_("preserve the indent structure when reindenting"),
type='bool', scope={'buffer'},
varname='p_pi',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='previewheight', abbreviation='pvh',
short_desc=N_("height of the preview window"),
type='number', scope={'global'},
varname='p_pvh',
- defaults={if_true={vi=12}}
+ defaults={if_true=12}
},
{
full_name='previewwindow', abbreviation='pvw',
@@ -1743,7 +1742,7 @@ return {
type='bool', scope={'window'},
noglob=true,
redraw={'statuslines'},
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='printdevice', abbreviation='pdev',
@@ -1751,14 +1750,14 @@ return {
type='string', scope={'global'},
secure=true,
varname='p_pdev',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='printencoding', abbreviation='penc',
short_desc=N_("encoding to be used for printing"),
type='string', scope={'global'},
varname='p_penc',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='printexpr', abbreviation='pexpr',
@@ -1766,35 +1765,35 @@ return {
type='string', scope={'global'},
secure=true,
varname='p_pexpr',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='printfont', abbreviation='pfn',
short_desc=N_("name of the font to be used for :hardcopy"),
type='string', scope={'global'},
varname='p_pfn',
- defaults={if_true={vi="courier"}}
+ defaults={if_true="courier"}
},
{
full_name='printheader', abbreviation='pheader',
short_desc=N_("format of the header used for :hardcopy"),
type='string', scope={'global'},
varname='p_header',
- defaults={if_true={vi="%<%f%h%m%=Page %N"}}
+ defaults={if_true="%<%f%h%m%=Page %N"}
},
{
full_name='printmbcharset', abbreviation='pmbcs',
short_desc=N_("CJK character set to be used for :hardcopy"),
type='string', scope={'global'},
varname='p_pmcs',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='printmbfont', abbreviation='pmbfn',
short_desc=N_("font names to be used for CJK output of :hardcopy"),
type='string', scope={'global'},
varname='p_pmfn',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='printoptions', abbreviation='popt',
@@ -1802,14 +1801,14 @@ return {
type='string', list='onecomma', scope={'global'},
deny_duplicates=true,
varname='p_popt',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='prompt',
short_desc=N_("enable prompt in Ex mode"),
type='bool', scope={'global'},
varname='p_force_on',
- defaults={if_true={vi=true}}
+ defaults={if_true=true}
},
{
full_name='pumblend', abbreviation='pb',
@@ -1817,21 +1816,21 @@ return {
type='number', scope={'global'},
redraw={'ui_option'},
varname='p_pb',
- defaults={if_true={vi=0}}
+ defaults={if_true=0}
},
{
full_name='pumheight', abbreviation='ph',
short_desc=N_("maximum height of the popup menu"),
type='number', scope={'global'},
varname='p_ph',
- defaults={if_true={vi=0}}
+ defaults={if_true=0}
},
{
full_name='pumwidth', abbreviation='pw',
short_desc=N_("minimum width of the popup menu"),
type='number', scope={'global'},
varname='p_pw',
- defaults={if_true={vi=15}}
+ defaults={if_true=15}
},
{
full_name='pyxversion', abbreviation='pyx',
@@ -1839,14 +1838,14 @@ return {
type='number', scope={'global'},
secure=true,
varname='p_pyx',
- defaults={if_true={vi=0}}
+ defaults={if_true=0}
},
{
full_name='quickfixtextfunc', abbreviation='qftf',
short_desc=N_("customize the quickfix window"),
type='string', scope={'global'},
varname='p_qftf',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='quoteescape', abbreviation='qe',
@@ -1854,7 +1853,7 @@ return {
type='string', scope={'buffer'},
alloced=true,
varname='p_qe',
- defaults={if_true={vi="\\"}}
+ defaults={if_true="\\"}
},
{
full_name='readonly', abbreviation='ro',
@@ -1863,63 +1862,63 @@ return {
noglob=true,
redraw={'statuslines'},
varname='p_ro',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='redrawdebug', abbreviation='rdb',
short_desc=N_("Changes the way redrawing works (debug)"),
type='string', list='onecomma', scope={'global'},
varname='p_rdb',
- defaults={if_true={vi=''}}
+ defaults={if_true=''}
},
{
full_name='redrawtime', abbreviation='rdt',
short_desc=N_("timeout for 'hlsearch' and |:match| highlighting"),
type='number', scope={'global'},
varname='p_rdt',
- defaults={if_true={vi=2000}}
+ defaults={if_true=2000}
},
{
full_name='regexpengine', abbreviation='re',
short_desc=N_("default regexp engine to use"),
type='number', scope={'global'},
varname='p_re',
- defaults={if_true={vi=0}}
+ defaults={if_true=0}
},
{
full_name='relativenumber', abbreviation='rnu',
short_desc=N_("show relative line number in front of each line"),
type='bool', scope={'window'},
redraw={'current_window'},
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='remap',
short_desc=N_("mappings to work recursively"),
type='bool', scope={'global'},
varname='p_remap',
- defaults={if_true={vi=true}}
+ defaults={if_true=true}
},
{
full_name='report',
short_desc=N_("for reporting nr. of lines changed"),
type='number', scope={'global'},
varname='p_report',
- defaults={if_true={vi=2}}
+ defaults={if_true=2}
},
{
full_name='revins', abbreviation='ri',
short_desc=N_("inserting characters will work backwards"),
type='bool', scope={'global'},
varname='p_ri',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='rightleft', abbreviation='rl',
short_desc=N_("window is right-to-left oriented"),
type='bool', scope={'window'},
redraw={'current_window'},
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='rightleftcmd', abbreviation='rlc',
@@ -1927,7 +1926,7 @@ return {
type='string', scope={'window'},
alloced=true,
redraw={'current_window'},
- defaults={if_true={vi="search"}}
+ defaults={if_true="search"}
},
{
full_name='ruler', abbreviation='ru',
@@ -1935,7 +1934,7 @@ return {
type='bool', scope={'global'},
redraw={'statuslines'},
varname='p_ru',
- defaults={if_true={vi=true}}
+ defaults={if_true=true}
},
{
full_name='rulerformat', abbreviation='ruf',
@@ -1945,7 +1944,7 @@ return {
modelineexpr=true,
redraw={'statuslines'},
varname='p_ruf',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='runtimepath', abbreviation='rtp',
@@ -1955,7 +1954,7 @@ return {
secure=true,
expand='nodefault',
varname='p_rtp',
- defaults={if_true={vi=''}}
+ defaults={if_true=''}
},
{
full_name='scroll', abbreviation='scr',
@@ -1963,7 +1962,7 @@ return {
type='number', scope={'window'},
no_mkrc=true,
pv_name='p_scroll',
- defaults={if_true={vi=0}}
+ defaults={if_true=0}
},
{
full_name='scrollback', abbreviation='scbk',
@@ -1971,21 +1970,21 @@ return {
type='number', scope={'buffer'},
varname='p_scbk',
redraw={'current_buffer'},
- defaults={if_true={vi=-1}}
+ defaults={if_true=-1}
},
{
full_name='scrollbind', abbreviation='scb',
short_desc=N_("scroll in window as other windows scroll"),
type='bool', scope={'window'},
pv_name='p_scbind',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='scrolljump', abbreviation='sj',
short_desc=N_("minimum number of lines to scroll"),
type='number', scope={'global'},
varname='p_sj',
- defaults={if_true={vi=1}}
+ defaults={if_true=1}
},
{
full_name='scrolloff', abbreviation='so',
@@ -1993,7 +1992,7 @@ return {
type='number', scope={'global', 'window'},
redraw={'all_windows'},
varname='p_so',
- defaults={if_true={vi=0}}
+ defaults={if_true=0}
},
{
full_name='scrollopt', abbreviation='sbo',
@@ -2001,14 +2000,14 @@ return {
type='string', list='onecomma', scope={'global'},
deny_duplicates=true,
varname='p_sbo',
- defaults={if_true={vi="ver,jump"}}
+ defaults={if_true="ver,jump"}
},
{
full_name='sections', abbreviation='sect',
short_desc=N_("nroff macros that separate sections"),
type='string', scope={'global'},
varname='p_sections',
- defaults={if_true={vi="SHNHH HUnhsh"}}
+ defaults={if_true="SHNHH HUnhsh"}
},
{
full_name='secure',
@@ -2016,14 +2015,14 @@ return {
type='bool', scope={'global'},
secure=true,
varname='p_secure',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='selection', abbreviation='sel',
short_desc=N_("what type of selection to use"),
type='string', scope={'global'},
varname='p_sel',
- defaults={if_true={vi="inclusive"}}
+ defaults={if_true="inclusive"}
},
{
full_name='selectmode', abbreviation='slm',
@@ -2031,7 +2030,7 @@ return {
type='string', list='onecomma', scope={'global'},
deny_duplicates=true,
varname='p_slm',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='sessionoptions', abbreviation='ssop',
@@ -2039,9 +2038,7 @@ return {
type='string', list='onecomma', scope={'global'},
deny_duplicates=true,
varname='p_ssop',
- defaults={if_true={
- vim="blank,buffers,curdir,folds,help,tabpages,winsize"
- }}
+ defaults={if_true="blank,buffers,curdir,folds,help,tabpages,winsize"}
},
{
full_name='shada', abbreviation='sd',
@@ -2050,7 +2047,7 @@ return {
deny_duplicates=true,
secure=true,
varname='p_shada',
- defaults={if_true={vim="!,'100,<50,s10,h"}}
+ defaults={if_true="!,'100,<50,s10,h"}
},
{
full_name='shadafile', abbreviation='sdf',
@@ -2060,7 +2057,7 @@ return {
secure=true,
expand=true,
varname='p_shadafile',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='shell', abbreviation='sh',
@@ -2071,8 +2068,8 @@ return {
varname='p_sh',
defaults={
condition='WIN32',
- if_true={vi="cmd.exe"},
- if_false={vi="sh"}
+ if_true="cmd.exe",
+ if_false="sh"
}
},
{
@@ -2083,8 +2080,8 @@ return {
varname='p_shcf',
defaults={
condition='WIN32',
- if_true={vi="/s /c"},
- if_false={vi="-c"}
+ if_true="/s /c",
+ if_false="-c"
}
},
{
@@ -2095,8 +2092,8 @@ return {
varname='p_sp',
defaults={
condition='WIN32',
- if_true={vi=">%s 2>&1"},
- if_false={vi="| tee"},
+ if_true=">%s 2>&1",
+ if_false="| tee",
}
},
{
@@ -2105,7 +2102,7 @@ return {
type='string', scope={'global'},
secure=true,
varname='p_shq',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='shellredir', abbreviation='srr',
@@ -2115,8 +2112,8 @@ return {
varname='p_srr',
defaults={
condition='WIN32',
- if_true={vi=">%s 2>&1"},
- if_false={vi=">"}
+ if_true=">%s 2>&1",
+ if_false=">"
}
},
{
@@ -2125,14 +2122,14 @@ return {
type='bool', scope={'global'},
varname='p_ssl',
enable_if='BACKSLASH_IN_FILENAME',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='shelltemp', abbreviation='stmp',
short_desc=N_("whether to use a temp file for shell commands"),
type='bool', scope={'global'},
varname='p_stmp',
- defaults={if_true={vim=true}}
+ defaults={if_true=true}
},
{
full_name='shellxquote', abbreviation='sxq',
@@ -2142,8 +2139,8 @@ return {
varname='p_sxq',
defaults={
condition='WIN32',
- if_true={vi="\""},
- if_false={vi=""},
+ if_true="\"",
+ if_false="",
}
},
{
@@ -2152,28 +2149,28 @@ return {
type='string', scope={'global'},
secure=true,
varname='p_sxe',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='shiftround', abbreviation='sr',
short_desc=N_("round indent to multiple of shiftwidth"),
type='bool', scope={'global'},
varname='p_sr',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='shiftwidth', abbreviation='sw',
short_desc=N_("number of spaces to use for (auto)indent step"),
type='number', scope={'buffer'},
varname='p_sw',
- defaults={if_true={vi=8}}
+ defaults={if_true=8}
},
{
full_name='shortmess', abbreviation='shm',
short_desc=N_("list of flags, reduce length of messages"),
type='string', list='flags', scope={'global'},
varname='p_shm',
- defaults={if_true={vim="filnxtToOF"}}
+ defaults={if_true="filnxtToOF"}
},
{
full_name='showbreak', abbreviation='sbr',
@@ -2181,35 +2178,35 @@ return {
type='string', scope={'global'},
redraw={'all_windows'},
varname='p_sbr',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='showcmd', abbreviation='sc',
short_desc=N_("show (partial) command in status line"),
type='bool', scope={'global'},
varname='p_sc',
- defaults={if_true={vim=true}}
+ defaults={if_true=true}
},
{
full_name='showfulltag', abbreviation='sft',
short_desc=N_("show full tag pattern when completing tag"),
type='bool', scope={'global'},
varname='p_sft',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='showmatch', abbreviation='sm',
short_desc=N_("briefly jump to matching bracket if insert one"),
type='bool', scope={'global'},
varname='p_sm',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='showmode', abbreviation='smd',
short_desc=N_("message on status line to show current mode"),
type='bool', scope={'global'},
varname='p_smd',
- defaults={if_true={vim=true}}
+ defaults={if_true=true}
},
{
full_name='showtabline', abbreviation='stal',
@@ -2217,14 +2214,14 @@ return {
type='number', scope={'global'},
redraw={'all_windows', 'ui_option'},
varname='p_stal',
- defaults={if_true={vi=1}}
+ defaults={if_true=1}
},
{
full_name='sidescroll', abbreviation='ss',
short_desc=N_("minimum number of columns to scroll horizontal"),
type='number', scope={'global'},
varname='p_ss',
- defaults={if_true={vi=1}}
+ defaults={if_true=1}
},
{
full_name='sidescrolloff', abbreviation='siso',
@@ -2232,7 +2229,7 @@ return {
type='number', scope={'global', 'window'},
redraw={'all_windows'},
varname='p_siso',
- defaults={if_true={vi=0}}
+ defaults={if_true=0}
},
{
full_name='signcolumn', abbreviation='scl',
@@ -2240,42 +2237,42 @@ return {
type='string', scope={'window'},
alloced=true,
redraw={'current_window'},
- defaults={if_true={vi="auto"}}
+ defaults={if_true="auto"}
},
{
full_name='smartcase', abbreviation='scs',
short_desc=N_("no ignore case when pattern has uppercase"),
type='bool', scope={'global'},
varname='p_scs',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='smartindent', abbreviation='si',
short_desc=N_("smart autoindenting for C programs"),
type='bool', scope={'buffer'},
varname='p_si',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='smarttab', abbreviation='sta',
short_desc=N_("use 'shiftwidth' when inserting <Tab>"),
type='bool', scope={'global'},
varname='p_sta',
- defaults={if_true={vim=true}}
+ defaults={if_true=true}
},
{
full_name='softtabstop', abbreviation='sts',
short_desc=N_("number of spaces that <Tab> uses while editing"),
type='number', scope={'buffer'},
varname='p_sts',
- defaults={if_true={vi=0}}
+ defaults={if_true=0}
},
{
full_name='spell',
short_desc=N_("spell checking"),
type='bool', scope={'window'},
redraw={'current_window'},
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='spellcapcheck', abbreviation='spc',
@@ -2284,7 +2281,7 @@ return {
alloced=true,
redraw={'current_buffer'},
varname='p_spc',
- defaults={if_true={vi="[.?!]\\_[\\])'\" ]\\+"}}
+ defaults={if_true="[.?!]\\_[\\])'\" ]\\+"}
},
{
full_name='spellfile', abbreviation='spf',
@@ -2295,7 +2292,7 @@ return {
alloced=true,
expand=true,
varname='p_spf',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='spelllang', abbreviation='spl',
@@ -2306,7 +2303,7 @@ return {
expand=true,
redraw={'current_buffer'},
varname='p_spl',
- defaults={if_true={vi="en"}}
+ defaults={if_true="en"}
},
{
full_name='spellsuggest', abbreviation='sps',
@@ -2316,7 +2313,7 @@ return {
secure=true,
expand=true,
varname='p_sps',
- defaults={if_true={vi="best"}}
+ defaults={if_true="best"}
},
{
full_name='spelloptions', abbreviation='spo',
@@ -2325,21 +2322,21 @@ return {
secure=true,
expand=true,
varname='p_spo',
- defaults={if_true={vim=""}}
+ defaults={if_true=""}
},
{
full_name='splitbelow', abbreviation='sb',
short_desc=N_("new window from split is below the current one"),
type='bool', scope={'global'},
varname='p_sb',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='splitright', abbreviation='spr',
short_desc=N_("new window is put right of the current one"),
type='bool', scope={'global'},
varname='p_spr',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='startofline', abbreviation='sol',
@@ -2347,7 +2344,7 @@ return {
type='bool', scope={'global'},
vim=false,
varname='p_sol',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='statusline', abbreviation='stl',
@@ -2357,7 +2354,7 @@ return {
modelineexpr=true,
redraw={'statuslines'},
varname='p_stl',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='suffixes', abbreviation='su',
@@ -2365,7 +2362,7 @@ return {
type='string', list='onecomma', scope={'global'},
deny_duplicates=true,
varname='p_su',
- defaults={if_true={vi=".bak,~,.o,.h,.info,.swp,.obj"}}
+ defaults={if_true=".bak,~,.o,.h,.info,.swp,.obj"}
},
{
full_name='suffixesadd', abbreviation='sua',
@@ -2374,7 +2371,7 @@ return {
deny_duplicates=true,
alloced=true,
varname='p_sua',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='swapfile', abbreviation='swf',
@@ -2382,7 +2379,7 @@ return {
type='bool', scope={'buffer'},
redraw={'statuslines'},
varname='p_swf',
- defaults={if_true={vi=true}}
+ defaults={if_true=true}
},
{
full_name='switchbuf', abbreviation='swb',
@@ -2390,7 +2387,7 @@ return {
type='string', list='onecomma', scope={'global'},
deny_duplicates=true,
varname='p_swb',
- defaults={if_true={vi=""}}
+ defaults={if_true="uselast"}
},
{
full_name='synmaxcol', abbreviation='smc',
@@ -2398,7 +2395,7 @@ return {
type='number', scope={'buffer'},
redraw={'current_buffer'},
varname='p_smc',
- defaults={if_true={vi=3000}}
+ defaults={if_true=3000}
},
{
full_name='syntax', abbreviation='syn',
@@ -2408,14 +2405,14 @@ return {
normal_fname_chars=true,
alloced=true,
varname='p_syn',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='tagfunc', abbreviation='tfu',
short_desc=N_("function used to perform tag searches"),
type='string', scope={'buffer'},
varname='p_tfu',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='tabline', abbreviation='tal',
@@ -2424,14 +2421,14 @@ return {
modelineexpr=true,
redraw={'all_windows'},
varname='p_tal',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='tabpagemax', abbreviation='tpm',
short_desc=N_("maximum number of tab pages for |-p| and \"tab all\""),
type='number', scope={'global'},
varname='p_tpm',
- defaults={if_true={vim=50}}
+ defaults={if_true=50}
},
{
full_name='tabstop', abbreviation='ts',
@@ -2439,35 +2436,35 @@ return {
type='number', scope={'buffer'},
redraw={'current_buffer'},
varname='p_ts',
- defaults={if_true={vi=8}}
+ defaults={if_true=8}
},
{
full_name='tagbsearch', abbreviation='tbs',
short_desc=N_("use binary searching in tags files"),
type='bool', scope={'global'},
varname='p_tbs',
- defaults={if_true={vi=true}}
+ defaults={if_true=true}
},
{
full_name='tagcase', abbreviation='tc',
short_desc=N_("how to handle case when searching in tags files"),
type='string', scope={'global', 'buffer'},
varname='p_tc',
- defaults={if_true={vim="followic"}}
+ defaults={if_true="followic"}
},
{
full_name='taglength', abbreviation='tl',
short_desc=N_("number of significant characters for a tag"),
type='number', scope={'global'},
varname='p_tl',
- defaults={if_true={vi=0}}
+ defaults={if_true=0}
},
{
full_name='tagrelative', abbreviation='tr',
short_desc=N_("file names in tag file are relative"),
type='bool', scope={'global'},
varname='p_tr',
- defaults={if_true={vim=true}}
+ defaults={if_true=true}
},
{
full_name='tags', abbreviation='tag',
@@ -2476,27 +2473,27 @@ return {
deny_duplicates=true,
expand=true,
varname='p_tags',
- defaults={if_true={vi="./tags;,tags"}}
+ defaults={if_true="./tags;,tags"}
},
{
full_name='tagstack', abbreviation='tgst',
short_desc=N_("push tags onto the tag stack"),
type='bool', scope={'global'},
varname='p_tgst',
- defaults={if_true={vi=true}}
+ defaults={if_true=true}
},
{
full_name='termbidi', abbreviation='tbidi',
short_desc=N_("terminal takes care of bi-directionality"),
type='bool', scope={'global'},
varname='p_tbidi',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='termencoding', abbreviation='tenc',
short_desc=N_("Terminal encodig"),
type='string', scope={'global'},
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='termguicolors', abbreviation='tgc',
@@ -2504,21 +2501,21 @@ return {
type='bool', scope={'global'},
redraw={'ui_option'},
varname='p_tgc',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='termpastefilter', abbreviation='tpf',
type='string', list='onecomma', scope={'global'},
deny_duplicates=true,
varname='p_tpf',
- defaults={if_true={vim="BS,HT,ESC,DEL"}}
+ defaults={if_true="BS,HT,ESC,DEL"}
},
{
full_name='terse',
short_desc=N_("hides notification of search wrap"),
type='bool', scope={'global'},
varname='p_terse',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='textwidth', abbreviation='tw',
@@ -2526,7 +2523,7 @@ return {
type='number', scope={'buffer'},
redraw={'current_buffer'},
varname='p_tw',
- defaults={if_true={vi=0}}
+ defaults={if_true=0}
},
{
full_name='thesaurus', abbreviation='tsr',
@@ -2536,42 +2533,42 @@ return {
normal_dname_chars=true,
expand=true,
varname='p_tsr',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='tildeop', abbreviation='top',
short_desc=N_("tilde command \"~\" behaves like an operator"),
type='bool', scope={'global'},
varname='p_to',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='timeout', abbreviation='to',
short_desc=N_("time out on mappings and key codes"),
type='bool', scope={'global'},
varname='p_timeout',
- defaults={if_true={vi=true}}
+ defaults={if_true=true}
},
{
full_name='timeoutlen', abbreviation='tm',
short_desc=N_("time out time in milliseconds"),
type='number', scope={'global'},
varname='p_tm',
- defaults={if_true={vi=1000}}
+ defaults={if_true=1000}
},
{
full_name='title',
short_desc=N_("Vim set the title of the window"),
type='bool', scope={'global'},
varname='p_title',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='titlelen',
short_desc=N_("of 'columns' used for window title"),
type='number', scope={'global'},
varname='p_titlelen',
- defaults={if_true={vi=85}}
+ defaults={if_true=85}
},
{
full_name='titleold',
@@ -2580,7 +2577,7 @@ return {
secure=true,
no_mkrc=true,
varname='p_titleold',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='titlestring',
@@ -2588,7 +2585,7 @@ return {
type='string', scope={'global'},
modelineexpr=true,
varname='p_titlestring',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='ttimeout',
@@ -2596,7 +2593,7 @@ return {
type='bool', scope={'global'},
redraw={'ui_option'},
varname='p_ttimeout',
- defaults={if_true={vi=true}}
+ defaults={if_true=true}
},
{
full_name='ttimeoutlen', abbreviation='ttm',
@@ -2604,7 +2601,7 @@ return {
type='number', scope={'global'},
redraw={'ui_option'},
varname='p_ttm',
- defaults={if_true={vi=50}}
+ defaults={if_true=50}
},
{
full_name='ttyfast', abbreviation='tf',
@@ -2612,7 +2609,7 @@ return {
type='bool', scope={'global'},
no_mkrc=true,
varname='p_force_on',
- defaults={if_true={vi=true}}
+ defaults={if_true=true}
},
{
full_name='undodir', abbreviation='udir',
@@ -2622,49 +2619,49 @@ return {
secure=true,
expand='nodefault',
varname='p_udir',
- defaults={if_true={vi=''}}
+ defaults={if_true=''}
},
{
full_name='undofile', abbreviation='udf',
short_desc=N_("save undo information in a file"),
type='bool', scope={'buffer'},
varname='p_udf',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='undolevels', abbreviation='ul',
short_desc=N_("maximum number of changes that can be undone"),
type='number', scope={'global', 'buffer'},
varname='p_ul',
- defaults={if_true={vi=1000}}
+ defaults={if_true=1000}
},
{
full_name='undoreload', abbreviation='ur',
short_desc=N_("max nr of lines to save for undo on a buffer reload"),
type='number', scope={'global'},
varname='p_ur',
- defaults={if_true={vi=10000}}
+ defaults={if_true=10000}
},
{
full_name='updatecount', abbreviation='uc',
short_desc=N_("after this many characters flush swap file"),
type='number', scope={'global'},
varname='p_uc',
- defaults={if_true={vi=200}}
+ defaults={if_true=200}
},
{
full_name='updatetime', abbreviation='ut',
short_desc=N_("after this many milliseconds flush swap file"),
type='number', scope={'global'},
varname='p_ut',
- defaults={if_true={vi=4000}}
+ defaults={if_true=4000}
},
{
full_name='varsofttabstop', abbreviation='vsts',
short_desc=N_("list of numbers of spaces that <Tab> uses while editing"),
type='string', list='comma', scope={'buffer'},
varname='p_vsts',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='vartabstop', abbreviation='vts',
@@ -2672,14 +2669,14 @@ return {
type='string', list='comma', scope={'buffer'},
varname='p_vts',
redraw={'current_buffer'},
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='verbose', abbreviation='vbs',
short_desc=N_("give informative messages"),
type='number', scope={'global'},
varname='p_verbose',
- defaults={if_true={vi=0}}
+ defaults={if_true=0}
},
{
full_name='verbosefile', abbreviation='vfile',
@@ -2688,7 +2685,7 @@ return {
secure=true,
expand=true,
varname='p_vfile',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='viewdir', abbreviation='vdir',
@@ -2697,7 +2694,7 @@ return {
secure=true,
expand='nodefault',
varname='p_vdir',
- defaults={if_true={vi=''}}
+ defaults={if_true=''}
},
{
full_name='viewoptions', abbreviation='vop',
@@ -2705,7 +2702,7 @@ return {
type='string', list='onecomma', scope={'global'},
deny_duplicates=true,
varname='p_vop',
- defaults={if_true={vi="folds,options,cursor,curdir"}}
+ defaults={if_true="folds,cursor,curdir"}
},
{
-- Alias for "shada".
@@ -2726,42 +2723,42 @@ return {
deny_duplicates=true,
redraw={'curswant'},
varname='p_ve',
- defaults={if_true={vim=""}}
+ defaults={if_true=""}
},
{
full_name='visualbell', abbreviation='vb',
short_desc=N_("use visual bell instead of beeping"),
type='bool', scope={'global'},
varname='p_vb',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='warn',
short_desc=N_("for shell command when buffer was changed"),
type='bool', scope={'global'},
varname='p_warn',
- defaults={if_true={vi=true}}
+ defaults={if_true=true}
},
{
full_name='whichwrap', abbreviation='ww',
short_desc=N_("allow specified keys to cross line boundaries"),
type='string', list='flagscomma', scope={'global'},
varname='p_ww',
- defaults={if_true={vim="b,s"}}
+ defaults={if_true="b,s"}
},
{
full_name='wildchar', abbreviation='wc',
short_desc=N_("command-line character for wildcard expansion"),
type='number', scope={'global'},
varname='p_wc',
- defaults={if_true={vim=imacros('TAB')}}
+ defaults={if_true=imacros('TAB')}
},
{
full_name='wildcharm', abbreviation='wcm',
short_desc=N_("like 'wildchar' but also works when mapped"),
type='number', scope={'global'},
varname='p_wcm',
- defaults={if_true={vi=0}}
+ defaults={if_true=0}
},
{
full_name='wildignore', abbreviation='wig',
@@ -2769,21 +2766,21 @@ return {
type='string', list='onecomma', scope={'global'},
deny_duplicates=true,
varname='p_wig',
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='wildignorecase', abbreviation='wic',
short_desc=N_("ignore case when completing file names"),
type='bool', scope={'global'},
varname='p_wic',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='wildmenu', abbreviation='wmnu',
short_desc=N_("use menu for command line completion"),
type='bool', scope={'global'},
varname='p_wmnu',
- defaults={if_true={vim=true}}
+ defaults={if_true=true}
},
{
full_name='wildmode', abbreviation='wim',
@@ -2791,7 +2788,7 @@ return {
type='string', list='onecomma', scope={'global'},
deny_duplicates=false,
varname='p_wim',
- defaults={if_true={vim="full"}}
+ defaults={if_true="full"}
},
{
full_name='wildoptions', abbreviation='wop',
@@ -2799,21 +2796,21 @@ return {
type='string', list='onecomma', scope={'global'},
deny_duplicates=true,
varname='p_wop',
- defaults={if_true={vim='pum,tagfile'}}
+ defaults={if_true='pum,tagfile'}
},
{
full_name='winaltkeys', abbreviation='wak',
short_desc=N_("when the windows system handles ALT keys"),
type='string', scope={'global'},
varname='p_wak',
- defaults={if_true={vi="menu"}}
+ defaults={if_true="menu"}
},
{
full_name='winblend', abbreviation='winbl',
short_desc=N_("Controls transparency level for floating windows"),
type='number', scope={'window'},
redraw={'current_window'},
- defaults={if_true={vi=0}}
+ defaults={if_true=0}
},
{
full_name='winhighlight', abbreviation='winhl',
@@ -2821,105 +2818,105 @@ return {
type='string', scope={'window'},
alloced=true,
redraw={'current_window'},
- defaults={if_true={vi=""}}
+ defaults={if_true=""}
},
{
full_name='window', abbreviation='wi',
short_desc=N_("nr of lines to scroll for CTRL-F and CTRL-B"),
type='number', scope={'global'},
varname='p_window',
- defaults={if_true={vi=0}}
+ defaults={if_true=0}
},
{
full_name='winheight', abbreviation='wh',
short_desc=N_("minimum number of lines for the current window"),
type='number', scope={'global'},
varname='p_wh',
- defaults={if_true={vi=1}}
+ defaults={if_true=1}
},
{
full_name='winfixheight', abbreviation='wfh',
short_desc=N_("keep window height when opening/closing windows"),
type='bool', scope={'window'},
redraw={'statuslines'},
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='winfixwidth', abbreviation='wfw',
short_desc=N_("keep window width when opening/closing windows"),
type='bool', scope={'window'},
redraw={'statuslines'},
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='winminheight', abbreviation='wmh',
short_desc=N_("minimum number of lines for any window"),
type='number', scope={'global'},
varname='p_wmh',
- defaults={if_true={vi=1}}
+ defaults={if_true=1}
},
{
full_name='winminwidth', abbreviation='wmw',
short_desc=N_("minimal number of columns for any window"),
type='number', scope={'global'},
varname='p_wmw',
- defaults={if_true={vi=1}}
+ defaults={if_true=1}
},
{
full_name='winwidth', abbreviation='wiw',
short_desc=N_("minimal number of columns for current window"),
type='number', scope={'global'},
varname='p_wiw',
- defaults={if_true={vi=20}}
+ defaults={if_true=20}
},
{
full_name='wrap',
short_desc=N_("lines wrap and continue on the next line"),
type='bool', scope={'window'},
redraw={'current_window'},
- defaults={if_true={vi=true}}
+ defaults={if_true=true}
},
{
full_name='wrapmargin', abbreviation='wm',
short_desc=N_("chars from the right where wrapping starts"),
type='number', scope={'buffer'},
varname='p_wm',
- defaults={if_true={vi=0}}
+ defaults={if_true=0}
},
{
full_name='wrapscan', abbreviation='ws',
short_desc=N_("searches wrap around the end of the file"),
type='bool', scope={'global'},
varname='p_ws',
- defaults={if_true={vi=true}}
+ defaults={if_true=true}
},
{
full_name='write',
short_desc=N_("to a file is allowed"),
type='bool', scope={'global'},
varname='p_write',
- defaults={if_true={vi=true}}
+ defaults={if_true=true}
},
{
full_name='writeany', abbreviation='wa',
short_desc=N_("write to file with no need for \"!\" override"),
type='bool', scope={'global'},
varname='p_wa',
- defaults={if_true={vi=false}}
+ defaults={if_true=false}
},
{
full_name='writebackup', abbreviation='wb',
short_desc=N_("make a backup before overwriting a file"),
type='bool', scope={'global'},
varname='p_wb',
- defaults={if_true={vi=true}}
+ defaults={if_true=true}
},
{
full_name='writedelay', abbreviation='wd',
short_desc=N_("delay this many msec for each char (for debug)"),
type='number', scope={'global'},
varname='p_wd',
- defaults={if_true={vi=0}}
+ defaults={if_true=0}
},
}
}
diff --git a/src/nvim/plines.c b/src/nvim/plines.c
new file mode 100644
index 0000000000..6718b7f7a4
--- /dev/null
+++ b/src/nvim/plines.c
@@ -0,0 +1,481 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
+// plines.c: calculate the vertical and horizontal size of text in a window
+
+#include <assert.h>
+#include <inttypes.h>
+#include <stdbool.h>
+#include <string.h>
+#include <limits.h>
+
+#include "nvim/vim.h"
+#include "nvim/ascii.h"
+#include "nvim/plines.h"
+#include "nvim/charset.h"
+#include "nvim/cursor.h"
+#include "nvim/diff.h"
+#include "nvim/func_attr.h"
+#include "nvim/fold.h"
+#include "nvim/indent.h"
+#include "nvim/main.h"
+#include "nvim/mbyte.h"
+#include "nvim/memline.h"
+#include "nvim/memory.h"
+#include "nvim/move.h"
+#include "nvim/option.h"
+#include "nvim/screen.h"
+#include "nvim/strings.h"
+#include "nvim/window.h"
+#include "nvim/buffer.h"
+
+#ifdef INCLUDE_GENERATED_DECLARATIONS
+# include "plines.c.generated.h"
+#endif
+
+/// Functions calculating vertical size of text when displayed inside a window.
+/// Calls horizontal size functions defined below.
+
+/// @param winheight when true limit to window height
+int plines_win(win_T *wp, linenr_T lnum, bool winheight)
+{
+ // Check for filler lines above this buffer line. When folded the result
+ // is one line anyway.
+ return plines_win_nofill(wp, lnum, winheight) + diff_check_fill(wp, lnum);
+}
+
+/// @param winheight when true limit to window height
+int plines_win_nofill(win_T *wp, linenr_T lnum, bool winheight)
+{
+ if (!wp->w_p_wrap) {
+ return 1;
+ }
+
+ if (wp->w_width_inner == 0) {
+ return 1;
+ }
+
+ // A folded lines is handled just like an empty line.
+ if (lineFolded(wp, lnum)) {
+ return 1;
+ }
+
+ const int lines = plines_win_nofold(wp, lnum);
+ if (winheight && lines > wp->w_height_inner) {
+ return wp->w_height_inner;
+ }
+ return lines;
+}
+
+/// @Return number of window lines physical line "lnum" will occupy in window
+/// "wp". Does not care about folding, 'wrap' or 'diff'.
+int plines_win_nofold(win_T *wp, linenr_T lnum)
+{
+ char_u *s;
+ unsigned int col;
+ int width;
+
+ s = ml_get_buf(wp->w_buffer, lnum, false);
+ if (*s == NUL) { // empty line
+ return 1;
+ }
+ col = win_linetabsize(wp, s, MAXCOL);
+
+ // If list mode is on, then the '$' at the end of the line may take up one
+ // extra column.
+ if (wp->w_p_list && wp->w_p_lcs_chars.eol != NUL) {
+ col += 1;
+ }
+
+ // Add column offset for 'number', 'relativenumber' and 'foldcolumn'.
+ width = wp->w_width_inner - win_col_off(wp);
+ if (width <= 0 || col > 32000) {
+ return 32000; // bigger than the number of screen columns
+ }
+ if (col <= (unsigned int)width) {
+ return 1;
+ }
+ col -= (unsigned int)width;
+ width += win_col_off2(wp);
+ assert(col <= INT_MAX && (int)col < INT_MAX - (width -1));
+ return ((int)col + (width - 1)) / width + 1;
+}
+
+/// Like plines_win(), but only reports the number of physical screen lines
+/// used from the start of the line to the given column number.
+int plines_win_col(win_T *wp, linenr_T lnum, long column)
+{
+ // Check for filler lines above this buffer line. When folded the result
+ // is one line anyway.
+ int lines = diff_check_fill(wp, lnum);
+
+ if (!wp->w_p_wrap) {
+ return lines + 1;
+ }
+
+ if (wp->w_width_inner == 0) {
+ return lines + 1;
+ }
+
+ char_u *line = ml_get_buf(wp->w_buffer, lnum, false);
+ char_u *s = line;
+
+ colnr_T col = 0;
+ while (*s != NUL && --column >= 0) {
+ col += win_lbr_chartabsize(wp, line, s, col, NULL);
+ MB_PTR_ADV(s);
+ }
+
+ // If *s is a TAB, and the TAB is not displayed as ^I, and we're not in
+ // INSERT mode, then col must be adjusted so that it represents the last
+ // screen position of the TAB. This only fixes an error when the TAB wraps
+ // from one screen line to the next (when 'columns' is not a multiple of
+ // 'ts') -- webb.
+ if (*s == TAB && (State & NORMAL)
+ && (!wp->w_p_list || wp->w_p_lcs_chars.tab1)) {
+ col += win_lbr_chartabsize(wp, line, s, col, NULL) - 1;
+ }
+
+ // Add column offset for 'number', 'relativenumber', 'foldcolumn', etc.
+ int width = wp->w_width_inner - win_col_off(wp);
+ if (width <= 0) {
+ return 9999;
+ }
+
+ lines += 1;
+ if (col > width) {
+ lines += (col - width) / (width + win_col_off2(wp)) + 1;
+ }
+ return lines;
+}
+
+/// Get the number of screen lines lnum takes up. This takes care of
+/// both folds and topfill, and limits to the current window height.
+///
+/// @param[in] wp window line is in
+/// @param[in] lnum line number
+/// @param[out] nextp if not NULL, the line after a fold
+/// @param[out] foldedp if not NULL, whether lnum is on a fold
+/// @param[in] cache whether to use the window's cache for folds
+///
+/// @return the total number of screen lines
+int plines_win_full(win_T *wp, linenr_T lnum, linenr_T *const nextp,
+ bool *const foldedp, const bool cache)
+{
+ bool folded = hasFoldingWin(wp, lnum, NULL, nextp, cache, NULL);
+ if (foldedp) {
+ *foldedp = folded;
+ }
+ if (folded) {
+ return 1;
+ } else if (lnum == wp->w_topline) {
+ return plines_win_nofill(wp, lnum, true) + wp->w_topfill;
+ }
+ return plines_win(wp, lnum, true);
+}
+
+int plines_m_win(win_T *wp, linenr_T first, linenr_T last)
+{
+ int count = 0;
+
+ while (first <= last) {
+ linenr_T next = first;
+ count += plines_win_full(wp, first, &next, NULL, false);
+ first = next + 1;
+ }
+ return count;
+}
+
+/// Functions calculating horizontal size of text, when displayed in a window.
+
+/// Return the number of characters 'c' will take on the screen, taking
+/// into account the size of a tab.
+/// Also see getvcol()
+///
+/// @param p
+/// @param col
+///
+/// @return Number of characters.
+int win_chartabsize(win_T *wp, char_u *p, colnr_T col)
+{
+ buf_T *buf = wp->w_buffer;
+ if (*p == TAB && (!wp->w_p_list || wp->w_p_lcs_chars.tab1)) {
+ return tabstop_padding(col, buf->b_p_ts, buf->b_p_vts_array);
+ } else {
+ return ptr2cells(p);
+ }
+}
+
+/// Return the number of characters the string 's' will take on the screen,
+/// taking into account the size of a tab.
+///
+/// @param s
+///
+/// @return Number of characters the string will take on the screen.
+int linetabsize(char_u *s)
+{
+ return linetabsize_col(0, s);
+}
+
+/// Like linetabsize(), but starting at column "startcol".
+///
+/// @param startcol
+/// @param s
+///
+/// @return Number of characters the string will take on the screen.
+int linetabsize_col(int startcol, char_u *s)
+{
+ colnr_T col = startcol;
+ char_u *line = s; // pointer to start of line, for breakindent
+
+ while (*s != NUL) {
+ col += lbr_chartabsize_adv(line, &s, col);
+ }
+ return (int)col;
+}
+
+/// Like linetabsize(), but for a given window instead of the current one.
+///
+/// @param wp
+/// @param line
+/// @param len
+///
+/// @return Number of characters the string will take on the screen.
+unsigned int win_linetabsize(win_T *wp, char_u *line, colnr_T len)
+{
+ colnr_T col = 0;
+
+ for (char_u *s = line;
+ *s != NUL && (len == MAXCOL || s < line + len);
+ MB_PTR_ADV(s)) {
+ col += win_lbr_chartabsize(wp, line, s, col, NULL);
+ }
+
+ return (unsigned int)col;
+}
+
+/// like win_chartabsize(), but also check for line breaks on the screen
+///
+/// @param line
+/// @param s
+/// @param col
+///
+/// @return The number of characters taken up on the screen.
+int lbr_chartabsize(char_u *line, unsigned char *s, colnr_T col)
+{
+ if (!curwin->w_p_lbr && (*p_sbr == NUL) && !curwin->w_p_bri) {
+ if (curwin->w_p_wrap) {
+ return win_nolbr_chartabsize(curwin, s, col, NULL);
+ }
+ return win_chartabsize(curwin, s, col);
+ }
+ return win_lbr_chartabsize(curwin, line == NULL ? s: line, s, col, NULL);
+}
+
+/// Call lbr_chartabsize() and advance the pointer.
+///
+/// @param line
+/// @param s
+/// @param col
+///
+/// @return The number of characters take up on the screen.
+int lbr_chartabsize_adv(char_u *line, char_u **s, colnr_T col)
+{
+ int retval;
+
+ retval = lbr_chartabsize(line, *s, col);
+ MB_PTR_ADV(*s);
+ return retval;
+}
+
+/// This function is used very often, keep it fast!!!!
+///
+/// If "headp" not NULL, set *headp to the size of what we for 'showbreak'
+/// string at start of line. Warning: *headp is only set if it's a non-zero
+/// value, init to 0 before calling.
+///
+/// @param wp
+/// @param line
+/// @param s
+/// @param col
+/// @param headp
+///
+/// @return The number of characters taken up on the screen.
+int win_lbr_chartabsize(win_T *wp, char_u *line, char_u *s,
+ colnr_T col, int *headp)
+{
+ colnr_T col2;
+ colnr_T col_adj = 0; // col + screen size of tab
+ colnr_T colmax;
+ int added;
+ int mb_added = 0;
+ int numberextra;
+ char_u *ps;
+ int n;
+
+ // No 'linebreak', 'showbreak' and 'breakindent': return quickly.
+ if (!wp->w_p_lbr && !wp->w_p_bri && (*p_sbr == NUL)) {
+ if (wp->w_p_wrap) {
+ return win_nolbr_chartabsize(wp, s, col, headp);
+ }
+ return win_chartabsize(wp, s, col);
+ }
+
+ // First get normal size, without 'linebreak'
+ int size = win_chartabsize(wp, s, col);
+ int c = *s;
+ if (*s == TAB) {
+ col_adj = size - 1;
+ }
+
+ // If 'linebreak' set check at a blank before a non-blank if the line
+ // needs a break here
+ if (wp->w_p_lbr
+ && vim_isbreak(c)
+ && !vim_isbreak((int)s[1])
+ && wp->w_p_wrap
+ && (wp->w_width_inner != 0)) {
+ // Count all characters from first non-blank after a blank up to next
+ // non-blank after a blank.
+ numberextra = win_col_off(wp);
+ col2 = col;
+ colmax = (colnr_T)(wp->w_width_inner - numberextra - col_adj);
+
+ if (col >= colmax) {
+ colmax += col_adj;
+ n = colmax + win_col_off2(wp);
+
+ if (n > 0) {
+ colmax += (((col - colmax) / n) + 1) * n - col_adj;
+ }
+ }
+
+ for (;;) {
+ ps = s;
+ MB_PTR_ADV(s);
+ c = *s;
+
+ if (!(c != NUL
+ && (vim_isbreak(c) || col2 == col || !vim_isbreak((int)(*ps))))) {
+ break;
+ }
+
+ col2 += win_chartabsize(wp, s, col2);
+
+ if (col2 >= colmax) { // doesn't fit
+ size = colmax - col + col_adj;
+ break;
+ }
+ }
+ } else if ((size == 2)
+ && (MB_BYTE2LEN(*s) > 1)
+ && wp->w_p_wrap
+ && in_win_border(wp, col)) {
+ // Count the ">" in the last column.
+ size++;
+ mb_added = 1;
+ }
+
+ // May have to add something for 'breakindent' and/or 'showbreak'
+ // string at start of line.
+ // Set *headp to the size of what we add.
+ added = 0;
+
+ if ((*p_sbr != NUL || wp->w_p_bri) && wp->w_p_wrap && (col != 0)) {
+ colnr_T sbrlen = 0;
+ int numberwidth = win_col_off(wp);
+
+ numberextra = numberwidth;
+ col += numberextra + mb_added;
+
+ if (col >= (colnr_T)wp->w_width_inner) {
+ col -= wp->w_width_inner;
+ numberextra = wp->w_width_inner - (numberextra - win_col_off2(wp));
+ if (col >= numberextra && numberextra > 0) {
+ col %= numberextra;
+ }
+ if (*p_sbr != NUL) {
+ sbrlen = (colnr_T)MB_CHARLEN(p_sbr);
+ if (col >= sbrlen) {
+ col -= sbrlen;
+ }
+ }
+ if (col >= numberextra && numberextra > 0) {
+ col %= numberextra;
+ } else if (col > 0 && numberextra > 0) {
+ col += numberwidth - win_col_off2(wp);
+ }
+
+ numberwidth -= win_col_off2(wp);
+ }
+
+ if (col == 0 || (col + size + sbrlen > (colnr_T)wp->w_width_inner)) {
+ if (*p_sbr != NUL) {
+ if (size + sbrlen + numberwidth > (colnr_T)wp->w_width_inner) {
+ // Calculate effective window width.
+ int width = (colnr_T)wp->w_width_inner - sbrlen - numberwidth;
+ int prev_width = col ? ((colnr_T)wp->w_width_inner - (sbrlen + col))
+ : 0;
+
+ if (width <= 0) {
+ width = 1;
+ }
+ added += ((size - prev_width) / width) * vim_strsize(p_sbr);
+ if ((size - prev_width) % width) {
+ // Wrapped, add another length of 'sbr'.
+ added += vim_strsize(p_sbr);
+ }
+ } else {
+ added += vim_strsize(p_sbr);
+ }
+ }
+
+ if (wp->w_p_bri) {
+ added += get_breakindent_win(wp, line);
+ }
+
+ size += added;
+ if (col != 0) {
+ added = 0;
+ }
+ }
+ }
+
+ if (headp != NULL) {
+ *headp = added + mb_added;
+ }
+ return size;
+}
+
+/// Like win_lbr_chartabsize(), except that we know 'linebreak' is off and
+/// 'wrap' is on. This means we need to check for a double-byte character that
+/// doesn't fit at the end of the screen line.
+///
+/// @param wp
+/// @param s
+/// @param col
+/// @param headp
+///
+/// @return The number of characters take up on the screen.
+static int win_nolbr_chartabsize(win_T *wp, char_u *s, colnr_T col, int *headp)
+{
+ int n;
+
+ if ((*s == TAB) && (!wp->w_p_list || wp->w_p_lcs_chars.tab1)) {
+ return tabstop_padding(col,
+ wp->w_buffer->b_p_ts,
+ wp->w_buffer->b_p_vts_array);
+ }
+ n = ptr2cells(s);
+
+ // Add one cell for a double-width character in the last column of the
+ // window, displayed with a ">".
+ if ((n == 2) && (MB_BYTE2LEN(*s) > 1) && in_win_border(wp, col)) {
+ if (headp != NULL) {
+ *headp = 1;
+ }
+ return 3;
+ }
+ return n;
+}
+
diff --git a/src/nvim/plines.h b/src/nvim/plines.h
new file mode 100644
index 0000000000..32778b69f1
--- /dev/null
+++ b/src/nvim/plines.h
@@ -0,0 +1,9 @@
+#ifndef NVIM_PLINES_H
+#define NVIM_PLINES_H
+
+#include "nvim/vim.h"
+
+#ifdef INCLUDE_GENERATED_DECLARATIONS
+# include "plines.h.generated.h"
+#endif
+#endif // NVIM_PLINES_H
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c
index c2ef217638..6379174938 100644
--- a/src/nvim/regexp.c
+++ b/src/nvim/regexp.c
@@ -63,6 +63,7 @@
#include "nvim/memory.h"
#include "nvim/message.h"
#include "nvim/misc1.h"
+#include "nvim/plines.h"
#include "nvim/garray.h"
#include "nvim/strings.h"
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 2fc5777937..e4030b76a3 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -101,6 +101,7 @@
#include "nvim/option.h"
#include "nvim/os_unix.h"
#include "nvim/path.h"
+#include "nvim/plines.h"
#include "nvim/popupmnu.h"
#include "nvim/quickfix.h"
#include "nvim/regexp.h"
@@ -1694,7 +1695,7 @@ static void win_update(win_T *wp, Providers *providers)
/*
* There is a trick with w_botline. If we invalidate it on each
* change that might modify it, this will cause a lot of expensive
- * calls to plines() in update_topline() each time. Therefore the
+ * calls to plines_win() in update_topline() each time. Therefore the
* value of w_botline is often approximated, and this value is used to
* compute the value of w_topline. If the value of w_botline was
* wrong, check that the value of w_topline is correct (cursor is on
@@ -2380,13 +2381,12 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow,
&& wp->w_p_culopt_flags != CULOPT_NBR) {
cul_screenline = (wp->w_p_wrap
&& (wp->w_p_culopt_flags & CULOPT_SCRLINE));
- cul_attr = win_hl_attr(wp, HLF_CUL);
- HlAttrs ae = syn_attr2entry(cul_attr);
-
- // We make a compromise here (#7383):
- // * low-priority CursorLine if fg is not set
- // * high-priority ("same as Vim" priority) CursorLine if fg is set
if (!cul_screenline) {
+ cul_attr = win_hl_attr(wp, HLF_CUL);
+ HlAttrs ae = syn_attr2entry(cul_attr);
+ // We make a compromise here (#7383):
+ // * low-priority CursorLine if fg is not set
+ // * high-priority ("same as Vim" priority) CursorLine if fg is set
if (ae.rgb_fg_color == -1 && ae.cterm_fg_color == 0) {
line_attr_lowprio = cul_attr;
} else {
@@ -2398,7 +2398,6 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow,
}
}
} else {
- cul_attr = 0;
margin_columns_win(wp, &left_curline_col, &right_curline_col);
}
area_highlighting = true;
@@ -2699,6 +2698,12 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow,
// Skip this quickly when working on the text.
if (draw_state != WL_LINE) {
+ if (cul_screenline) {
+ cul_attr = 0;
+ line_attr = line_attr_save;
+ line_attr_lowprio = line_attr_lowprio_save;
+ }
+
if (draw_state == WL_CMDLINE - 1 && n_extra == 0) {
draw_state = WL_CMDLINE;
if (cmdwin_type != 0 && wp == curwin) {
@@ -2854,9 +2859,6 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow,
if (diff_hlf != (hlf_T)0) {
char_attr = win_hl_attr(wp, diff_hlf);
- if (cul_attr) {
- char_attr = hl_combine_attr(char_attr, cul_attr);
- }
}
p_extra = NULL;
c_extra = ' ';
@@ -2942,21 +2944,20 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow,
}
}
- if (cul_screenline) {
- if (draw_state == WL_LINE
- && vcol >= left_curline_col
- && vcol < right_curline_col) {
- cul_attr = win_hl_attr(wp, HLF_CUL);
- HlAttrs ae = syn_attr2entry(cul_attr);
- if (ae.rgb_fg_color == -1 && ae.cterm_fg_color == 0) {
- line_attr_lowprio = cul_attr;
+ if (cul_screenline && draw_state == WL_LINE
+ && vcol >= left_curline_col
+ && vcol < right_curline_col) {
+ cul_attr = win_hl_attr(wp, HLF_CUL);
+ HlAttrs ae = syn_attr2entry(cul_attr);
+ if (ae.rgb_fg_color == -1 && ae.cterm_fg_color == 0) {
+ line_attr_lowprio = cul_attr;
+ } else {
+ if (!(State & INSERT) && bt_quickfix(wp->w_buffer)
+ && qf_current_entry(wp) == lnum) {
+ line_attr = hl_combine_attr(cul_attr, line_attr);
} else {
line_attr = cul_attr;
}
- } else {
- cul_attr = 0;
- line_attr = line_attr_save;
- line_attr_lowprio = line_attr_lowprio_save;
}
}
@@ -4119,7 +4120,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow,
/*
* Update w_cline_height and w_cline_folded if the cursor line was
- * updated (saves a call to plines() later).
+ * updated (saves a call to plines_win() later).
*/
if (wp == curwin && lnum == curwin->w_cursor.lnum) {
curwin->w_cline_row = startrow;
@@ -5089,7 +5090,7 @@ win_redr_status_matches (
save_p_wmh = p_wmh;
p_ls = 2;
p_wmh = 0;
- last_status(FALSE);
+ last_status(false);
}
wild_menu_showing = WM_SHOWN;
}
diff --git a/src/nvim/search.c b/src/nvim/search.c
index e5d545b185..b712e09861 100644
--- a/src/nvim/search.c
+++ b/src/nvim/search.c
@@ -1620,7 +1620,7 @@ static bool check_prevcol(char_u *linep, int col, int ch, int *prevcol)
if (prevcol) {
*prevcol = col;
}
- return (col >= 0 && linep[col] == ch) ? true : false;
+ return col >= 0 && linep[col] == ch;
}
/*
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index e9ee63970c..1d45df8ebd 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -53,9 +53,9 @@ static bool did_syntax_onoff = false;
/// Structure that stores information about a highlight group.
/// The ID of a highlight group is also called group ID. It is the index in
/// the highlight_ga array PLUS ONE.
-struct hl_group {
+typedef struct hl_group {
char_u *sg_name; ///< highlight group name
- char_u *sg_name_u; ///< uppercase of sg_name
+ char *sg_name_u; ///< uppercase of sg_name
bool sg_cleared; ///< "hi clear" was used
int sg_attr; ///< Screen attr @see ATTR_ENTRY
int sg_link; ///< link to this highlight group ID
@@ -80,7 +80,7 @@ struct hl_group {
char *sg_rgb_sp_name; ///< RGB special color name
int sg_blend; ///< blend level (0-100 inclusive), -1 if unset
-};
+} HlGroup;
/// \addtogroup SG_SET
/// @{
@@ -91,6 +91,7 @@ struct hl_group {
// builtin |highlight-groups|
static garray_T highlight_ga = GA_EMPTY_INIT_VALUE;
+Map(cstr_t, int) *highlight_unames;
static inline struct hl_group * HL_TABLE(void)
{
@@ -384,6 +385,11 @@ static int current_line_id = 0; // unique number for current line
static int syn_time_on = FALSE;
# define IF_SYN_TIME(p) (p)
+void syntax_init(void)
+{
+ highlight_unames = map_new(cstr_t, int)();
+}
+
// Set the timeout used for syntax highlighting.
// Use NULL to reset, no timeout.
void syn_set_timeout(proftime_T *tm)
@@ -3372,7 +3378,7 @@ static void syn_cmd_clear(exarg_T *eap, int syncing)
XFREE_CLEAR(SYN_CLSTR(curwin->w_s)[scl_id].scl_list);
}
} else {
- id = syn_namen2id(arg, (int)(arg_end - arg));
+ id = syn_name2id_len(arg, (int)(arg_end - arg));
if (id == 0) {
EMSG2(_(e_nogroup), arg);
break;
@@ -3542,7 +3548,7 @@ syn_cmd_list(
else
syn_list_cluster(id - SYNID_CLUSTER);
} else {
- int id = syn_namen2id(arg, (int)(arg_end - arg));
+ int id = syn_name2id_len(arg, (int)(arg_end - arg));
if (id == 0) {
EMSG2(_(e_nogroup), arg);
} else {
@@ -6635,7 +6641,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
// ":highlight {group-name}": list highlighting for one group.
if (!doclear && !dolink && ends_excmd((uint8_t)(*linep))) {
- id = syn_namen2id((const char_u *)line, (int)(name_end - line));
+ id = syn_name2id_len((const char_u *)line, (int)(name_end - line));
if (id == 0) {
emsgf(_("E411: highlight group not found: %s"), line);
} else {
@@ -7113,6 +7119,7 @@ void free_highlight(void)
xfree(HL_TABLE()[i].sg_name_u);
}
ga_clear(&highlight_ga);
+ map_free(cstr_t, int)(highlight_unames);
}
#endif
@@ -7470,26 +7477,35 @@ static void set_hl_attr(int idx)
}
}
+int syn_name2id(const char_u *name)
+ FUNC_ATTR_NONNULL_ALL
+{
+ return syn_name2id_len(name, STRLEN(name));
+}
+
/// Lookup a highlight group name and return its ID.
///
/// @param highlight name e.g. 'Cursor', 'Normal'
/// @return the highlight id, else 0 if \p name does not exist
-int syn_name2id(const char_u *name)
+int syn_name2id_len(const char_u *name, size_t len)
FUNC_ATTR_NONNULL_ALL
{
- int i;
- char_u name_u[200];
-
- /* Avoid using stricmp() too much, it's slow on some systems */
- /* Avoid alloc()/free(), these are slow too. ID names over 200 chars
- * don't deserve to be found! */
- STRLCPY(name_u, name, 200);
- vim_strup(name_u);
- for (i = highlight_ga.ga_len; --i >= 0; )
- if (HL_TABLE()[i].sg_name_u != NULL
- && STRCMP(name_u, HL_TABLE()[i].sg_name_u) == 0)
- break;
- return i + 1;
+ char name_u[201];
+
+ if (len == 0 || len > 200) {
+ // ID names over 200 chars don't deserve to be found!
+ return 0;
+ }
+
+ // Avoid using stricmp() too much, it's slow on some systems */
+ // Avoid alloc()/free(), these are slow too.
+ memcpy(name_u, name, len);
+ name_u[len] = '\0';
+ vim_strup((char_u *)name_u);
+
+ // map_get(..., int) returns 0 when no key is present, which is
+ // the expected value for missing highlight group.
+ return map_get(cstr_t, int)(highlight_unames, name_u);
}
/// Lookup a highlight group name and return its attributes.
@@ -7524,17 +7540,6 @@ char_u *syn_id2name(int id)
return HL_TABLE()[id - 1].sg_name;
}
-/*
- * Like syn_name2id(), but take a pointer + length argument.
- */
-int syn_namen2id(const char_u *linep, int len)
-{
- char_u *name = vim_strnsave(linep, len);
- int id = syn_name2id(name);
- xfree(name);
-
- return id;
-}
/// Find highlight group name in the table and return its ID.
/// If it doesn't exist yet, a new entry is created.
@@ -7543,14 +7548,11 @@ int syn_namen2id(const char_u *linep, int len)
/// @param len length of \p pp
///
/// @return 0 for failure else the id of the group
-int syn_check_group(const char_u *pp, int len)
+int syn_check_group(const char_u *name, int len)
{
- char_u *name = vim_strnsave(pp, len);
- int id = syn_name2id(name);
+ int id = syn_name2id_len(name, len);
if (id == 0) { // doesn't exist yet
- id = syn_add_group(name);
- } else {
- xfree(name);
+ return syn_add_group(vim_strnsave(name, len));
}
return id;
}
@@ -7593,7 +7595,7 @@ static int syn_add_group(char_u *name)
return 0;
}
- char_u *const name_up = vim_strsave_up(name);
+ char *const name_up = (char *)vim_strsave_up(name);
// Append another syntax_highlight entry.
struct hl_group* hlgp = GA_APPEND_VIA_PTR(struct hl_group, &highlight_ga);
@@ -7605,7 +7607,11 @@ static int syn_add_group(char_u *name)
hlgp->sg_blend = -1;
hlgp->sg_name_u = name_up;
- return highlight_ga.ga_len; /* ID is index plus one */
+ int id = highlight_ga.ga_len; // ID is index plus one
+
+ map_put(cstr_t, int)(highlight_unames, name_up, id);
+
+ return id;
}
/// When, just after calling syn_add_group(), an error is discovered, this
@@ -7613,8 +7619,10 @@ static int syn_add_group(char_u *name)
static void syn_unadd_group(void)
{
highlight_ga.ga_len--;
- xfree(HL_TABLE()[highlight_ga.ga_len].sg_name);
- xfree(HL_TABLE()[highlight_ga.ga_len].sg_name_u);
+ HlGroup *item = &HL_TABLE()[highlight_ga.ga_len];
+ map_del(cstr_t, int)(highlight_unames, item->sg_name_u);
+ xfree(item->sg_name);
+ xfree(item->sg_name_u);
}
diff --git a/src/nvim/testdir/setup.vim b/src/nvim/testdir/setup.vim
index fcbc28fdc0..b3df8c63e6 100644
--- a/src/nvim/testdir/setup.vim
+++ b/src/nvim/testdir/setup.vim
@@ -12,6 +12,7 @@ set directory^=.
set fillchars=vert:\|,fold:-
set laststatus=1
set listchars=eol:$
+set joinspaces
set nohidden smarttab noautoindent noautoread complete-=i noruler noshowcmd
set nrformats+=octal
set shortmess-=F
@@ -21,6 +22,14 @@ set undodir^=.
set wildoptions=
set startofline
set sessionoptions+=options
+set viewoptions+=options
+set switchbuf=
+
+" Unmap Nvim default mappings.
+unmap Y
+unmap <C-L>
+iunmap <C-U>
+iunmap <C-W>
" Prevent Nvim log from writing to stderr.
let $NVIM_LOG_FILE = exists($NVIM_LOG_FILE) ? $NVIM_LOG_FILE : 'Xnvim.log'
diff --git a/src/nvim/testdir/test42.in b/src/nvim/testdir/test42.in
index d9057e72fb..456f9ddb07 100644
--- a/src/nvim/testdir/test42.in
+++ b/src/nvim/testdir/test42.in
Binary files differ
diff --git a/src/nvim/testdir/test_autocmd.vim b/src/nvim/testdir/test_autocmd.vim
index ad28118f16..015979e1be 100644
--- a/src/nvim/testdir/test_autocmd.vim
+++ b/src/nvim/testdir/test_autocmd.vim
@@ -998,6 +998,7 @@ func Test_bufunload_all()
endfunc
au BufUnload * call UnloadAllBufs()
au VimLeave * call writefile(['Test Finished'], 'Xout')
+ set nohidden
edit Xxx1
split Xxx2
q
@@ -1955,7 +1956,7 @@ func Test_autocmd_sigusr1()
let g:sigusr1_passed = 0
au Signal SIGUSR1 let g:sigusr1_passed = 1
- call system('/bin/kill -s usr1 ' . getpid())
+ call system('kill -s usr1 ' . getpid())
call WaitForAssert({-> assert_true(g:sigusr1_passed)})
au! Signal
diff --git a/src/nvim/testdir/test_command_count.vim b/src/nvim/testdir/test_command_count.vim
index 55b230373f..c7dddf4164 100644
--- a/src/nvim/testdir/test_command_count.vim
+++ b/src/nvim/testdir/test_command_count.vim
@@ -33,7 +33,7 @@ func Test_command_count_0()
delcommand RangeBuffers
delcommand RangeBuffersAll
- set hidden&
+ set nohidden
set swapfile&
endfunc
diff --git a/src/nvim/testdir/test_cursorline.vim b/src/nvim/testdir/test_cursorline.vim
index 4a0f2665fe..39d8b901ed 100644
--- a/src/nvim/testdir/test_cursorline.vim
+++ b/src/nvim/testdir/test_cursorline.vim
@@ -192,7 +192,29 @@ func Test_cursorline_screenline()
call term_sendkeys(buf, "gj")
call term_wait(buf)
call VerifyScreenDump(buf, 'Test_'. filename. '_18', {})
+ call term_sendkeys(buf, ":set breakindent& foldcolumn& signcolumn&\<cr>")
endif
+ " showbreak should not be highlighted with CursorLine when 'number' is off
+ call term_sendkeys(buf, "gg0")
+ call term_sendkeys(buf, ":set list cursorlineopt=screenline listchars=space:-\<cr>")
+ call term_sendkeys(buf, ":set nonumber\<cr>")
+ call VerifyScreenDump(buf, 'Test_'. filename. '_19', {})
+ call term_sendkeys(buf, "fagj")
+ call term_wait(buf)
+ call VerifyScreenDump(buf, 'Test_'. filename. '_20', {})
+ call term_sendkeys(buf, "gj")
+ call term_wait(buf)
+ call VerifyScreenDump(buf, 'Test_'. filename. '_21', {})
+ call term_sendkeys(buf, "gj")
+ call term_wait(buf)
+ call VerifyScreenDump(buf, 'Test_'. filename. '_22', {})
+ call term_sendkeys(buf, "gj")
+ call term_wait(buf)
+ call VerifyScreenDump(buf, 'Test_'. filename. '_23', {})
+ call term_sendkeys(buf, "gj")
+ call term_wait(buf)
+ call VerifyScreenDump(buf, 'Test_'. filename. '_24', {})
+ call term_sendkeys(buf, ":set list& cursorlineopt& listchars&\<cr>")
call StopVimInTerminal(buf)
call delete(filename)
diff --git a/src/nvim/testdir/test_diffmode.vim b/src/nvim/testdir/test_diffmode.vim
index 8592f48af7..f39cda7663 100644
--- a/src/nvim/testdir/test_diffmode.vim
+++ b/src/nvim/testdir/test_diffmode.vim
@@ -540,7 +540,7 @@ func Test_diffopt_hiddenoff()
bwipe!
bwipe!
- set hidden& diffopt&
+ set nohidden diffopt&
endfunc
func Test_diffoff_hidden()
@@ -577,7 +577,7 @@ func Test_diffoff_hidden()
bwipe!
bwipe!
- set hidden& diffopt&
+ set nohidden diffopt&
endfunc
func Test_setting_cursor()
@@ -990,6 +990,37 @@ func Test_diff_with_cursorline()
call delete('Xtest_diff_cursorline')
endfunc
+func Test_diff_with_cursorline_breakindent()
+ CheckScreendump
+
+ call writefile([
+ \ 'hi CursorLine ctermbg=red ctermfg=white',
+ \ 'set noequalalways wrap diffopt=followwrap cursorline breakindent',
+ \ '50vnew',
+ \ 'call setline(1, [" "," "," "," "])',
+ \ 'exe "norm 20Afoo\<Esc>j20Afoo\<Esc>j20Afoo\<Esc>j20Abar\<Esc>"',
+ \ 'vnew',
+ \ 'call setline(1, [" "," "," "," "])',
+ \ 'exe "norm 20Abee\<Esc>j20Afoo\<Esc>j20Afoo\<Esc>j20Abaz\<Esc>"',
+ \ 'windo diffthis',
+ \ '2wincmd w',
+ \ ], 'Xtest_diff_cursorline_breakindent')
+ let buf = RunVimInTerminal('-S Xtest_diff_cursorline_breakindent', {})
+
+ call term_sendkeys(buf, "gg0")
+ call VerifyScreenDump(buf, 'Test_diff_with_cul_bri_01', {})
+ call term_sendkeys(buf, "j")
+ call VerifyScreenDump(buf, 'Test_diff_with_cul_bri_02', {})
+ call term_sendkeys(buf, "j")
+ call VerifyScreenDump(buf, 'Test_diff_with_cul_bri_03', {})
+ call term_sendkeys(buf, "j")
+ call VerifyScreenDump(buf, 'Test_diff_with_cul_bri_04', {})
+
+ " clean up
+ call StopVimInTerminal(buf)
+ call delete('Xtest_diff_cursorline_breakindent')
+endfunc
+
func Test_diff_with_syntax()
CheckScreendump
diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim
index 4ab58cd084..c155dbad50 100644
--- a/src/nvim/testdir/test_filetype.vim
+++ b/src/nvim/testdir/test_filetype.vim
@@ -263,6 +263,7 @@ let s:filename_checks = {
\ 'json': ['file.json', 'file.jsonp', 'file.json-patch', 'file.webmanifest', 'Pipfile.lock', 'file.ipynb'],
\ 'jsonc': ['file.jsonc'],
\ 'jsp': ['file.jsp'],
+ \ 'julia': ['file.jl'],
\ 'kconfig': ['Kconfig', 'Kconfig.debug', 'Kconfig.file'],
\ 'kivy': ['file.kv'],
\ 'kix': ['file.kix'],
@@ -754,6 +755,7 @@ func Test_pp_file()
split Xfile.pp
call assert_equal('pascal', &filetype)
bwipe!
+ unlet g:filetype_pp
" Test dist#ft#FTpp()
call writefile(['{ pascal comment'], 'Xfile.pp')
diff --git a/src/nvim/testdir/test_gf.vim b/src/nvim/testdir/test_gf.vim
index ee548037ba..43efd6248e 100644
--- a/src/nvim/testdir/test_gf.vim
+++ b/src/nvim/testdir/test_gf.vim
@@ -145,7 +145,7 @@ func Test_gf_visual()
bwipe!
call delete('Xtest_gf_visual')
- set hidden&
+ set nohidden
endfunc
func Test_gf_error()
diff --git a/src/nvim/testdir/test_ins_complete.vim b/src/nvim/testdir/test_ins_complete.vim
index 3da3648fec..0fb026f6b0 100644
--- a/src/nvim/testdir/test_ins_complete.vim
+++ b/src/nvim/testdir/test_ins_complete.vim
@@ -95,7 +95,7 @@ func Test_ins_complete()
call delete('Xtest11.one')
call delete('Xtest11.two')
call delete('Xtestdata')
- set cpt& cot& def& tags& tagbsearch& hidden&
+ set cpt& cot& def& tags& tagbsearch& nohidden
cd ..
call delete('Xdir', 'rf')
endfunc
diff --git a/src/nvim/testdir/test_join.vim b/src/nvim/testdir/test_join.vim
index ac6ef8f29f..ecb969d10a 100644
--- a/src/nvim/testdir/test_join.vim
+++ b/src/nvim/testdir/test_join.vim
@@ -51,7 +51,7 @@ func Test_join_marks()
/^This line/;'}-join
call assert_equal([0, 4, 11, 0], getpos("'["))
- call assert_equal([0, 4, 67, 0], getpos("']"))
+ call assert_equal([0, 4, 66, 0], getpos("']"))
enew!
endfunc
diff --git a/src/nvim/testdir/test_match.vim b/src/nvim/testdir/test_match.vim
index 09448ca71b..0fd76a23ea 100644
--- a/src/nvim/testdir/test_match.vim
+++ b/src/nvim/testdir/test_match.vim
@@ -157,7 +157,10 @@ func Test_match_error()
endfunc
func Test_matchadd_error()
- call assert_fails("call matchadd('GroupDoesNotExist', 'X')", 'E28:')
+ call clearmatches()
+ " Nvim: not an error anymore:
+ call matchadd('GroupDoesNotExist', 'X')
+ call assert_equal([{'group': 'GroupDoesNotExist', 'pattern': 'X', 'priority': 10, 'id': 13}], getmatches())
call assert_fails("call matchadd('Search', '\\(')", 'E475:')
call assert_fails("call matchadd('Search', 'XXX', 1, 123, 1)", 'E715:')
call assert_fails("call matchadd('Error', 'XXX', 1, 3)", 'E798:')
diff --git a/src/nvim/testdir/test_mksession.vim b/src/nvim/testdir/test_mksession.vim
index fbe764bbf2..c96c6a9678 100644
--- a/src/nvim/testdir/test_mksession.vim
+++ b/src/nvim/testdir/test_mksession.vim
@@ -307,7 +307,7 @@ func Test_mksession_buffer_count()
call delete('Xbaz')
call delete('Xtest_mks.out')
%bwipe!
- set hidden&
+ set nohidden
endfunc
if has('extra_search')
diff --git a/src/nvim/testdir/test_options.vim b/src/nvim/testdir/test_options.vim
index 8796af7a20..72c151142d 100644
--- a/src/nvim/testdir/test_options.vim
+++ b/src/nvim/testdir/test_options.vim
@@ -539,7 +539,7 @@ func Test_copy_winopt()
call assert_equal(4,&numberwidth)
bw!
- set hidden&
+ set nohidden
endfunc
func Test_shortmess_F()
diff --git a/src/nvim/testdir/test_quickfix.vim b/src/nvim/testdir/test_quickfix.vim
index 5090584e41..283e7bbafe 100644
--- a/src/nvim/testdir/test_quickfix.vim
+++ b/src/nvim/testdir/test_quickfix.vim
@@ -1911,7 +1911,7 @@ func Test_switchbuf()
enew | only
set switchbuf=useopen
cexpr "Xqftestfile1:1:10"
- call assert_equal('', &switchbuf)
+ call assert_equal('uselast', &switchbuf)
call delete('Xqftestfile1')
call delete('Xqftestfile2')
diff --git a/src/nvim/testdir/test_tagjump.vim b/src/nvim/testdir/test_tagjump.vim
index 68dcfb6890..b6d9143bc9 100644
--- a/src/nvim/testdir/test_tagjump.vim
+++ b/src/nvim/testdir/test_tagjump.vim
@@ -170,7 +170,7 @@ func Test_tag_symbolic()
call assert_equal('Xtest.c', expand('%:t'))
call assert_equal(2, col('.'))
- set hidden&
+ set nohidden
set tags&
enew!
call delete('Xtags')
diff --git a/src/nvim/testdir/test_window_cmd.vim b/src/nvim/testdir/test_window_cmd.vim
index a522705238..039de0c623 100644
--- a/src/nvim/testdir/test_window_cmd.vim
+++ b/src/nvim/testdir/test_window_cmd.vim
@@ -608,7 +608,7 @@ func Test_window_prevwin()
" reset
q
call delete('tmp.txt')
- set hidden&vim autoread&vim
+ set nohidden autoread&vim
delfunc Fun_RenewFile
endfunc
diff --git a/src/nvim/undo.c b/src/nvim/undo.c
index 3096fe84c0..c4b48a6ee2 100644
--- a/src/nvim/undo.c
+++ b/src/nvim/undo.c
@@ -1297,8 +1297,8 @@ void u_write_undo(const char *const name, const bool forceit, buf_T *const buf,
goto theend;
}
- /* Undo must be synced. */
- u_sync(TRUE);
+ // Undo must be synced.
+ u_sync(true);
/*
* Write the header.
@@ -1783,7 +1783,7 @@ void u_undo(int count)
* be compatible.
*/
if (curbuf->b_u_synced == false) {
- u_sync(TRUE);
+ u_sync(true);
count = 1;
}
@@ -1943,9 +1943,10 @@ void undo_time(long step, bool sec, bool file, bool absolute)
bool above = false;
bool did_undo = true;
- /* First make sure the current undoable change is synced. */
- if (curbuf->b_u_synced == false)
- u_sync(TRUE);
+ // First make sure the current undoable change is synced.
+ if (curbuf->b_u_synced == false) {
+ u_sync(true);
+ }
u_newcount = 0;
u_oldcount = 0;
@@ -2601,13 +2602,10 @@ static void u_undo_end(
msgbuf);
}
-/*
- * u_sync: stop adding to the current entry list
- */
-void
-u_sync(
- int force // Also sync when no_u_sync is set.
-)
+/// u_sync: stop adding to the current entry list
+///
+/// @param force if true, also sync when no_u_sync is set.
+void u_sync(bool force)
{
// Skip it when already synced or syncing is disabled.
if (curbuf->b_u_synced || (!force && no_u_sync > 0)) {
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 2f43faef50..fefbab822e 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -31,6 +31,7 @@
#include "nvim/memory.h"
#include "nvim/message.h"
#include "nvim/misc1.h"
+#include "nvim/plines.h"
#include "nvim/file_search.h"
#include "nvim/garray.h"
#include "nvim/move.h"
@@ -904,7 +905,7 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir)
int new_size = size;
int i;
int need_status = 0;
- int do_equal = FALSE;
+ bool do_equal = false;
int needed;
int available;
int oldwin_height = 0;
@@ -990,9 +991,10 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir)
new_size = wmw1;
}
- /* if it doesn't fit in the current window, need win_equal() */
- if (oldwin->w_width - new_size - 1 < p_wmw)
- do_equal = TRUE;
+ // if it doesn't fit in the current window, need win_equal()
+ if (oldwin->w_width - new_size - 1 < p_wmw) {
+ do_equal = true;
+ }
// We don't like to take lines for the new window from a
// 'winfixwidth' window. Take them from a window to the left or right
@@ -1009,9 +1011,9 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir)
while (frp != NULL) {
if (frp->fr_win != oldwin && frp->fr_win != NULL
&& (frp->fr_win->w_width > new_size
- || frp->fr_win->w_width > oldwin->w_width
- - new_size - 1)) {
- do_equal = TRUE;
+ || frp->fr_win->w_width > (oldwin->w_width
+ - new_size - 1))) {
+ do_equal = true;
break;
}
frp = frp->fr_next;
@@ -1074,9 +1076,10 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir)
new_size = wmh1;
}
- /* if it doesn't fit in the current window, need win_equal() */
- if (oldwin_height - new_size - STATUS_HEIGHT < p_wmh)
- do_equal = TRUE;
+ // if it doesn't fit in the current window, need win_equal()
+ if (oldwin_height - new_size - STATUS_HEIGHT < p_wmh) {
+ do_equal = true;
+ }
/* We don't like to take lines for the new window from a
* 'winfixheight' window. Take them from a window above or below
@@ -1105,7 +1108,7 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir)
&& (frp->fr_win->w_height > new_size
|| frp->fr_win->w_height > oldwin_height - new_size
- STATUS_HEIGHT)) {
- do_equal = TRUE;
+ do_equal = true;
break;
}
frp = frp->fr_next;
@@ -1120,19 +1123,19 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir)
&& ((flags & WSP_BOT)
|| (flags & WSP_BELOW)
|| (!(flags & WSP_ABOVE)
- && (
- (flags & WSP_VERT) ? p_spr :
- p_sb)))) {
- /* new window below/right of current one */
- if (new_wp == NULL)
- wp = win_alloc(oldwin, FALSE);
- else
+ && ((flags & WSP_VERT) ? p_spr : p_sb)))) {
+ // new window below/right of current one
+ if (new_wp == NULL) {
+ wp = win_alloc(oldwin, false);
+ } else {
win_append(oldwin, wp);
+ }
} else {
- if (new_wp == NULL)
- wp = win_alloc(oldwin->w_prev, FALSE);
- else
+ if (new_wp == NULL) {
+ wp = win_alloc(oldwin->w_prev, false);
+ } else {
win_append(oldwin->w_prev, wp);
+ }
}
if (new_wp == NULL) {
@@ -1247,11 +1250,12 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir)
frame_add_vsep(curfrp);
/* Set width of neighbor frame */
frame_new_width(curfrp, curfrp->fr_width
- - (new_size + ((flags & WSP_TOP) != 0)), flags & WSP_TOP,
- FALSE);
- } else
+ - (new_size + ((flags & WSP_TOP) != 0)), flags & WSP_TOP,
+ false);
+ } else {
win_new_width(oldwin, oldwin->w_width - (new_size + 1));
- if (before) { /* new window left of current one */
+ }
+ if (before) { // new window left of current one
wp->w_wincol = oldwin->w_wincol;
oldwin->w_wincol += new_size + 1;
} else /* new window right of current one */
@@ -1438,7 +1442,7 @@ static void win_init_some(win_T *newp, win_T *oldp)
win_copy_options(oldp, newp);
}
-/// Return TRUE if "win" is floating window in the current tab page.
+/// Return true if "win" is floating window in the current tab page.
///
/// @param win window to check
bool win_valid_floating(const win_T *win)
@@ -1516,17 +1520,14 @@ int win_count(void)
return count;
}
-/*
- * Make "count" windows on the screen.
- * Return actual number of windows on the screen.
- * Must be called when there is just one window, filling the whole screen
- * (excluding the command line).
- */
-int
-make_windows (
- int count,
- int vertical /* split windows vertically if TRUE */
-)
+/// Make "count" windows on the screen.
+/// Must be called when there is just one window, filling the whole screen
+/// (excluding the command line).
+///
+/// @param vertical split windows vertically if true
+///
+/// @return actual number of windows on the screen.
+int make_windows(int count, bool vertical)
{
int maxcount;
int todo;
@@ -1551,8 +1552,9 @@ make_windows (
/*
* add status line now, otherwise first window will be too big
*/
- if (count > 1)
- last_status(TRUE);
+ if (count > 1) {
+ last_status(true);
+ }
/*
* Don't execute autocommands while creating the windows. Must do that
@@ -1785,8 +1787,8 @@ static void win_totop(int size, int flags)
(void)winframe_remove(curwin, &dir, NULL);
}
win_remove(curwin, NULL);
- last_status(FALSE); /* may need to remove last status line */
- (void)win_comp_pos(); /* recompute window positions */
+ last_status(false); // may need to remove last status line
+ (void)win_comp_pos(); // recompute window positions
/* Split a window on the desired side and put the window there. */
(void)win_split_ins(size, flags, curwin, dir);
@@ -1897,7 +1899,7 @@ static void win_equal_rec(
int room = 0;
int new_size;
int has_next_curwin = 0;
- int hnc;
+ bool hnc;
if (topfr->fr_layout == FR_LEAF) {
/* Set the width/height of this frame.
@@ -2001,17 +2003,20 @@ static void win_equal_rec(
wincount = (n + (fr->fr_next == NULL ? extra_sep : 0))
/ (p_wmw + 1);
m = frame_minwidth(fr, next_curwin);
- if (has_next_curwin)
+ if (has_next_curwin) {
hnc = frame_has_win(fr, next_curwin);
- else
- hnc = FALSE;
- if (hnc) /* don't count next_curwin */
- --wincount;
- if (totwincount == 0)
+ } else {
+ hnc = false;
+ }
+ if (hnc) { // don't count next_curwin
+ wincount--;
+ }
+ if (totwincount == 0) {
new_size = room;
- else
+ } else {
new_size = (wincount * room + (totwincount / 2)) / totwincount;
- if (hnc) { /* add next_curwin size */
+ }
+ if (hnc) { // add next_curwin size
next_curwin_size -= p_wiw - (m - n);
new_size += next_curwin_size;
room -= new_size - next_curwin_size;
@@ -2122,17 +2127,20 @@ static void win_equal_rec(
wincount = (n + (fr->fr_next == NULL ? extra_sep : 0))
/ (p_wmh + 1);
m = frame_minheight(fr, next_curwin);
- if (has_next_curwin)
+ if (has_next_curwin) {
hnc = frame_has_win(fr, next_curwin);
- else
- hnc = FALSE;
- if (hnc) /* don't count next_curwin */
- --wincount;
- if (totwincount == 0)
+ } else {
+ hnc = false;
+ }
+ if (hnc) { // don't count next_curwin
+ wincount--;
+ }
+ if (totwincount == 0) {
new_size = room;
- else
+ } else {
new_size = (wincount * room + (totwincount / 2)) / totwincount;
- if (hnc) { /* add next_curwin size */
+ }
+ if (hnc) { // add next_curwin size
next_curwin_size -= p_wh - (m - n);
new_size += next_curwin_size;
room -= new_size - next_curwin_size;
@@ -2310,8 +2318,8 @@ static bool close_last_window_tabpage(win_T *win, bool free_buf,
int win_close(win_T *win, bool free_buf)
{
win_T *wp;
- int other_buffer = FALSE;
- int close_curwin = FALSE;
+ bool other_buffer = false;
+ bool close_curwin = false;
int dir;
bool help_window = false;
tabpage_T *prev_curtab = curtab;
@@ -2376,7 +2384,7 @@ int win_close(win_T *win, bool free_buf)
* to be the last one left, return now.
*/
if (wp->w_buffer != curbuf) {
- other_buffer = TRUE;
+ other_buffer = true;
win->w_closing = true;
apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, FALSE, curbuf);
if (!win_valid(win))
@@ -2515,7 +2523,7 @@ int win_close(win_T *win, bool free_buf)
}
}
curbuf = curwin->w_buffer;
- close_curwin = TRUE;
+ close_curwin = true;
// The cursor position may be invalid if the buffer changed after last
// using the window.
@@ -2544,7 +2552,7 @@ int win_close(win_T *win, bool free_buf)
* If last window has a status line now and we don't want one,
* remove the status line.
*/
- last_status(FALSE);
+ last_status(false);
/* After closing the help window, try restoring the window layout from
* before it was opened. */
@@ -2797,7 +2805,7 @@ winframe_remove (
}
}
frame_new_height(frp2, frp2->fr_height + frp_close->fr_height,
- frp2 == frp_close->fr_next ? TRUE : FALSE, FALSE);
+ frp2 == frp_close->fr_next, false);
*dirp = 'v';
} else {
/* When 'winfixwidth' is set, try to find another frame in the column
@@ -2826,7 +2834,7 @@ winframe_remove (
}
}
frame_new_width(frp2, frp2->fr_width + frp_close->fr_width,
- frp2 == frp_close->fr_next ? TRUE : FALSE, FALSE);
+ frp2 == frp_close->fr_next, false);
*dirp = 'h';
}
@@ -2982,18 +2990,14 @@ static bool frame_has_win(const frame_T *frp, const win_T *wp)
return false;
}
-/*
- * Set a new height for a frame. Recursively sets the height for contained
- * frames and windows. Caller must take care of positions.
- */
-static void
-frame_new_height (
- frame_T *topfrp,
- int height,
- int topfirst, /* resize topmost contained frame first */
- int wfh /* obey 'winfixheight' when there is a choice;
- may cause the height not to be set */
-)
+/// Set a new height for a frame. Recursively sets the height for contained
+/// frames and windows. Caller must take care of positions.
+///
+/// @param topfirst resize topmost contained frame first.
+/// @param wfh obey 'winfixheight' when there is a choice;
+/// may cause the height not to be set.
+static void frame_new_height(frame_T *topfrp, int height, bool topfirst,
+ bool wfh)
FUNC_ATTR_NONNULL_ALL
{
frame_T *frp;
@@ -3169,18 +3173,14 @@ static void frame_add_statusline(frame_T *frp)
}
}
-/*
- * Set width of a frame. Handles recursively going through contained frames.
- * May remove separator line for windows at the right side (for win_close()).
- */
-static void
-frame_new_width (
- frame_T *topfrp,
- int width,
- int leftfirst, /* resize leftmost contained frame first */
- int wfw /* obey 'winfixwidth' when there is a choice;
- may cause the width not to be set */
-)
+/// Set width of a frame. Handles recursively going through contained frames.
+/// May remove separator line for windows at the right side (for win_close()).
+///
+/// @param leftfirst resize leftmost contained frame first.
+/// @param wfw obey 'winfixwidth' when there is a choice;
+/// may cause the width not to be set.
+static void frame_new_width(frame_T *topfrp, int width, bool leftfirst,
+ bool wfw)
{
frame_T *frp;
int extra_cols;
@@ -3537,7 +3537,7 @@ void win_alloc_aucmd_win(void)
*/
static int win_alloc_firstwin(win_T *oldwin)
{
- curwin = win_alloc(NULL, FALSE);
+ curwin = win_alloc(NULL, false);
if (oldwin == NULL) {
/* Very first window, need to create an empty buffer for it and
* initialize from scratch. */
@@ -4341,13 +4341,13 @@ void win_enter(win_T *wp, bool undo_sync)
win_enter_ext(wp, undo_sync, false, false, true, true);
}
-/*
- * Make window wp the current window.
- * Can be called with "curwin_invalid" TRUE, which means that curwin has just
- * been closed and isn't valid.
- */
-static void win_enter_ext(win_T *wp, bool undo_sync, int curwin_invalid,
- int trigger_new_autocmds, bool trigger_enter_autocmds,
+/// Make window wp the current window.
+///
+/// @param curwin_invalid curwin has just been closed and
+/// isn't valid when true.
+static void win_enter_ext(win_T *wp, bool undo_sync, bool curwin_invalid,
+ bool trigger_new_autocmds,
+ bool trigger_enter_autocmds,
bool trigger_leave_autocmds)
{
int other_buffer = FALSE;
@@ -4375,7 +4375,7 @@ static void win_enter_ext(win_T *wp, bool undo_sync, int curwin_invalid,
// sync undo before leaving the current buffer
if (undo_sync && curbuf != wp->w_buffer) {
- u_sync(FALSE);
+ u_sync(false);
}
// Might need to scroll the old window before switching, e.g., when the
@@ -4535,11 +4535,9 @@ win_T *buf_jump_open_tab(buf_T *buf)
return NULL;
}
-/*
- * Allocate a window structure and link it in the window list when "hidden" is
- * FALSE.
- */
-static win_T *win_alloc(win_T *after, int hidden)
+/// @param hidden allocate a window structure and link it in the window if
+// false.
+static win_T *win_alloc(win_T *after, bool hidden)
{
static int last_win_id = LOWEST_WIN_ID - 1;
@@ -4829,9 +4827,10 @@ void shell_new_rows(void)
/* First try setting the heights of windows with 'winfixheight'. If
* that doesn't result in the right height, forget about that option. */
- frame_new_height(topframe, h, FALSE, TRUE);
- if (!frame_check_height(topframe, h))
- frame_new_height(topframe, h, FALSE, FALSE);
+ frame_new_height(topframe, h, false, true);
+ if (!frame_check_height(topframe, h)) {
+ frame_new_height(topframe, h, false, false);
+ }
(void)win_comp_pos(); // recompute w_winrow and w_wincol
win_reconfig_floats(); // The size of floats might change
@@ -5077,8 +5076,9 @@ static void frame_setheight(frame_T *curfrp, int height)
/* topframe: can only change the command line */
if (height > ROWS_AVAIL)
height = ROWS_AVAIL;
- if (height > 0)
- frame_new_height(curfrp, height, FALSE, FALSE);
+ if (height > 0) {
+ frame_new_height(curfrp, height, false, false);
+ }
} else if (curfrp->fr_parent->fr_layout == FR_ROW) {
/* Row of frames: Also need to resize frames left and right of this
* one. First check for the minimal height of these. */
@@ -5160,7 +5160,7 @@ static void frame_setheight(frame_T *curfrp, int height)
/*
* set the current frame to the new height
*/
- frame_new_height(curfrp, height, FALSE, FALSE);
+ frame_new_height(curfrp, height, false, false);
/*
* First take lines from the frames after the current frame. If
@@ -5183,16 +5183,15 @@ static void frame_setheight(frame_T *curfrp, int height)
if (frp->fr_height - room_reserved > take)
room_reserved = frp->fr_height - take;
take -= frp->fr_height - room_reserved;
- frame_new_height(frp, room_reserved, FALSE, FALSE);
+ frame_new_height(frp, room_reserved, false, false);
room_reserved = 0;
}
} else {
if (frp->fr_height - take < h) {
take -= frp->fr_height - h;
- frame_new_height(frp, h, FALSE, FALSE);
+ frame_new_height(frp, h, false, false);
} else {
- frame_new_height(frp, frp->fr_height - take,
- FALSE, FALSE);
+ frame_new_height(frp, frp->fr_height - take, false, false);
take = 0;
}
}
@@ -5323,7 +5322,7 @@ static void frame_setwidth(frame_T *curfrp, int width)
/*
* set the current frame to the new width
*/
- frame_new_width(curfrp, width, FALSE, FALSE);
+ frame_new_width(curfrp, width, false, false);
/*
* First take lines from the frames right of the current frame. If
@@ -5346,16 +5345,15 @@ static void frame_setwidth(frame_T *curfrp, int width)
if (frp->fr_width - room_reserved > take)
room_reserved = frp->fr_width - take;
take -= frp->fr_width - room_reserved;
- frame_new_width(frp, room_reserved, FALSE, FALSE);
+ frame_new_width(frp, room_reserved, false, false);
room_reserved = 0;
}
} else {
if (frp->fr_width - take < w) {
take -= frp->fr_width - w;
- frame_new_width(frp, w, FALSE, FALSE);
+ frame_new_width(frp, w, false, false);
} else {
- frame_new_width(frp, frp->fr_width - take,
- FALSE, FALSE);
+ frame_new_width(frp, frp->fr_width - take, false, false);
take = 0;
}
}
@@ -5408,16 +5406,14 @@ void win_setminwidth(void)
}
}
-/*
- * Status line of dragwin is dragged "offset" lines down (negative is up).
- */
+/// Status line of dragwin is dragged "offset" lines down (negative is up).
void win_drag_status_line(win_T *dragwin, int offset)
{
frame_T *curfr;
frame_T *fr;
int room;
int row;
- int up; /* if TRUE, drag status line up, otherwise down */
+ bool up; // if true, drag status line up, otherwise down
int n;
fr = dragwin->w_frame;
@@ -5443,8 +5439,8 @@ void win_drag_status_line(win_T *dragwin, int offset)
fr = fr->fr_parent;
}
- if (offset < 0) { /* drag up */
- up = TRUE;
+ if (offset < 0) { // drag up
+ up = true;
offset = -offset;
/* sum up the room of the current frame and above it */
if (fr == curfr) {
@@ -5458,12 +5454,10 @@ void win_drag_status_line(win_T *dragwin, int offset)
break;
}
}
- fr = curfr->fr_next; /* put fr at frame that grows */
- } else { /* drag down */
- up = FALSE;
- /*
- * Only dragging the last status line can reduce p_ch.
- */
+ fr = curfr->fr_next; // put fr at frame that grows
+ } else { // drag down
+ up = false;
+ // Only dragging the last status line can reduce p_ch.
room = Rows - cmdline_row;
if (curfr->fr_next == NULL)
room -= 1;
@@ -5487,8 +5481,9 @@ void win_drag_status_line(win_T *dragwin, int offset)
* Grow frame fr by "offset" lines.
* Doesn't happen when dragging the last status line up.
*/
- if (fr != NULL)
- frame_new_height(fr, fr->fr_height + offset, up, FALSE);
+ if (fr != NULL) {
+ frame_new_height(fr, fr->fr_height + offset, up, false);
+ }
if (up)
fr = curfr; /* current frame gets smaller */
@@ -5502,9 +5497,9 @@ void win_drag_status_line(win_T *dragwin, int offset)
n = frame_minheight(fr, NULL);
if (fr->fr_height - offset <= n) {
offset -= fr->fr_height - n;
- frame_new_height(fr, n, !up, FALSE);
+ frame_new_height(fr, n, !up, false);
} else {
- frame_new_height(fr, fr->fr_height - offset, !up, FALSE);
+ frame_new_height(fr, fr->fr_height - offset, !up, false);
break;
}
if (up)
@@ -5534,7 +5529,7 @@ void win_drag_vsep_line(win_T *dragwin, int offset)
frame_T *curfr;
frame_T *fr;
int room;
- int left; /* if TRUE, drag separator line left, otherwise right */
+ bool left; // if true, drag separator line left, otherwise right
int n;
fr = dragwin->w_frame;
@@ -5563,8 +5558,8 @@ void win_drag_vsep_line(win_T *dragwin, int offset)
}
}
- if (offset < 0) { /* drag left */
- left = TRUE;
+ if (offset < 0) { // drag left
+ left = true;
offset = -offset;
/* sum up the room of the current frame and left of it */
room = 0;
@@ -5573,10 +5568,10 @@ void win_drag_vsep_line(win_T *dragwin, int offset)
if (fr == curfr)
break;
}
- fr = curfr->fr_next; /* put fr at frame that grows */
- } else { /* drag right */
- left = FALSE;
- /* sum up the room of frames right of the current one */
+ fr = curfr->fr_next; // put fr at frame that grows
+ } else { // drag right
+ left = false;
+ // sum up the room of frames right of the current one
room = 0;
FOR_ALL_FRAMES(fr, curfr->fr_next) {
room += fr->fr_width - frame_minwidth(fr, NULL);
@@ -5599,8 +5594,8 @@ void win_drag_vsep_line(win_T *dragwin, int offset)
return; // Safety check, should not happen.
}
- /* grow frame fr by offset lines */
- frame_new_width(fr, fr->fr_width + offset, left, FALSE);
+ // grow frame fr by offset lines
+ frame_new_width(fr, fr->fr_width + offset, left, false);
/* shrink other frames: current and at the left or at the right */
if (left)
@@ -5612,9 +5607,9 @@ void win_drag_vsep_line(win_T *dragwin, int offset)
n = frame_minwidth(fr, NULL);
if (fr->fr_width - offset <= n) {
offset -= fr->fr_width - n;
- frame_new_width(fr, n, !left, FALSE);
+ frame_new_width(fr, n, !left, false);
} else {
- frame_new_width(fr, fr->fr_width - offset, !left, FALSE);
+ frame_new_width(fr, fr->fr_width - offset, !left, false);
break;
}
if (left)
@@ -5926,7 +5921,7 @@ void command_height(void)
*/
static void frame_add_height(frame_T *frp, int n)
{
- frame_new_height(frp, frp->fr_height + n, FALSE, FALSE);
+ frame_new_height(frp, frp->fr_height + n, false, false);
for (;; ) {
frp = frp->fr_parent;
if (frp == NULL)
@@ -6091,21 +6086,18 @@ file_name_in_line (
return find_file_name_in_path(ptr, len, options, count, rel_fname);
}
-/*
- * Add or remove a status line for the bottom window(s), according to the
- * value of 'laststatus'.
- */
-void
-last_status (
- int morewin /* pretend there are two or more windows */
-)
+/// Add or remove a status line for the bottom window(s), according to the
+/// value of 'laststatus'.
+///
+/// @param morewin pretend there are two or more windows if true.
+void last_status(bool morewin)
{
/* Don't make a difference between horizontal or vertical split. */
last_status_rec(topframe, (p_ls == 2
|| (p_ls == 1 && (morewin || !one_window()))));
}
-static void last_status_rec(frame_T *fr, int statusline)
+static void last_status_rec(frame_T *fr, bool statusline)
{
frame_T *fp;
win_T *wp;
@@ -6134,7 +6126,7 @@ static void last_status_rec(frame_T *fr, int statusline)
}
wp->w_status_height = 1;
if (fp != fr) {
- frame_new_height(fp, fp->fr_height - 1, FALSE, FALSE);
+ frame_new_height(fp, fp->fr_height - 1, false, false);
frame_fix_height(wp);
(void)win_comp_pos();
} else
@@ -6213,12 +6205,11 @@ bool only_one_window(void) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
return count <= 1;
}
-/*
- * Correct the cursor line number in other windows. Used after changing the
- * current buffer, and before applying autocommands.
- * When "do_curwin" is TRUE, also check current window.
- */
-void check_lnums(int do_curwin)
+/// Correct the cursor line number in other windows. Used after changing the
+/// current buffer, and before applying autocommands.
+///
+/// @param do_curwin when true, also check current window.
+void check_lnums(bool do_curwin)
{
FOR_ALL_TAB_WINDOWS(tp, wp) {
if ((do_curwin || wp != curwin) && wp->w_buffer == curbuf) {
@@ -6366,8 +6357,8 @@ static win_T *restore_snapshot_rec(frame_T *sn, frame_T *fr)
fr->fr_height = sn->fr_height;
fr->fr_width = sn->fr_width;
if (fr->fr_layout == FR_LEAF) {
- frame_new_height(fr, fr->fr_height, FALSE, FALSE);
- frame_new_width(fr, fr->fr_width, FALSE, FALSE);
+ frame_new_height(fr, fr->fr_height, false, false);
+ frame_new_width(fr, fr->fr_width, false, false);
wp = sn->fr_win;
}
if (sn->fr_next != NULL) {
@@ -6405,15 +6396,16 @@ static win_T *get_snapshot_focus(int idx)
return win_valid(sn->fr_win) ? sn->fr_win : NULL;
}
-/*
- * Set "win" to be the curwin and "tp" to be the current tab page.
- * restore_win() MUST be called to undo, also when FAIL is returned.
- * No autocommands will be executed until restore_win() is called.
- * When "no_display" is TRUE the display won't be affected, no redraw is
- * triggered, another tabpage access is limited.
- * Returns FAIL if switching to "win" failed.
- */
-int switch_win(win_T **save_curwin, tabpage_T **save_curtab, win_T *win, tabpage_T *tp, int no_display)
+/// Set "win" to be the curwin and "tp" to be the current tab page.
+/// restore_win() MUST be called to undo, also when FAIL is returned.
+/// No autocommands will be executed until restore_win() is called.
+///
+/// @param no_display if true the display won't be affected, no redraw is
+/// triggered, another tabpage access is limited.
+///
+/// @return FAIL if switching to "win" failed.
+int switch_win(win_T **save_curwin, tabpage_T **save_curtab, win_T *win,
+ tabpage_T *tp, bool no_display)
{
block_autocmds();
return switch_win_noblock(save_curwin, save_curtab, win, tp, no_display);
@@ -6421,7 +6413,7 @@ int switch_win(win_T **save_curwin, tabpage_T **save_curtab, win_T *win, tabpage
// As switch_win() but without blocking autocommands.
int switch_win_noblock(win_T **save_curwin, tabpage_T **save_curtab,
- win_T *win, tabpage_T *tp, int no_display)
+ win_T *win, tabpage_T *tp, bool no_display)
{
*save_curwin = curwin;
if (tp != NULL) {
@@ -6542,8 +6534,7 @@ int match_add(win_T *wp, const char *const grp, const char *const pat,
cur = cur->next;
}
}
- if ((hlg_id = syn_name2id((const char_u *)grp)) == 0) {
- EMSG2(_(e_nogroup), grp);
+ if ((hlg_id = syn_check_group((const char_u *)grp, strlen(grp))) == 0) {
return -1;
}
if (pat != NULL && (regprog = vim_regcomp((char_u *)pat, RE_MAGIC)) == NULL) {
@@ -6694,8 +6685,9 @@ fail:
/// Delete match with ID 'id' in the match list of window 'wp'.
-/// Print error messages if 'perr' is TRUE.
-int match_delete(win_T *wp, int id, int perr)
+///
+/// @param perr print error messages if true.
+int match_delete(win_T *wp, int id, bool perr)
{
matchitem_T *cur = wp->w_match_head;
matchitem_T *prev = cur;