diff options
72 files changed, 849 insertions, 1166 deletions
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index ae30f00f31..0000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -name: Bug report -about: Report a problem in Nvim -title: '' -labels: bug - ---- - -<!-- Before reporting: search existing issues and check the FAQ. --> - -- `nvim --version`: -- Operating system/version: -- Terminal name/version: -- `$TERM`: - -<!-- -If this report is about different behaviour between Nvim and Vim, make sure to -read `:h vim-differences` first. Otherwise remove the next line. ---> -[ ] `vim -u DEFAULTS` (version: ) behaves differently - -### Steps to reproduce using `nvim -u NORC` - -``` -nvim -u NORC -# Alternative for shell-related problems: -# env -i TERM=ansi-256color "$(which nvim)" - -``` - -### Actual behaviour - -### Expected behaviour - diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000000..e5530a1511 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,60 @@ +name: Bug Report +description: Report a problem in Neovim +labels: [bug] +body: + + - type: markdown + attributes: + value: | + Before reporting: search [existing issues](https://github.com/neovim/neovim/issues?q=is%3Aissue+is%3Aopen+label%3Abug) and check the [FAQ](https://github.com/neovim/neovim/wiki/FAQ). + + - type: input + attributes: + label: "Neovim Version" + description: "`nvim --version`:" + validations: + required: true + - type: input + attributes: + label: "Operating system/version:" + validations: + required: true + - type: input + attributes: + label: "Terminal name/version:" + validations: + required: true + - type: input + attributes: + label: "TERM environment variable" + description: "echo `$TERM`:" + validations: + required: true + + - type: input + attributes: + label: "Installation" + description: "How did you install neovim: build from repo / system package manager / appimage / homebrew / snap / chocolatey / other (please specify)?" + placeholder: "Arch User Repository (AUR)" + validations: + required: true + + - type: textarea + attributes: + label: "Steps to reproduce" + description: | + Steps to reproduce using `nvim -u NORC` and/or `nvim -u NONE` (please test both). + If you are reporting build failures, please list the exact sequence of steps including all CMake flags (if any). + + - type: input + attributes: + label: "Vim" + description: "Does Vim behave differently when called with `vim -u DEFAULTS`? If yes, which version of Vim are you using (`vim --version`):" + + - type: textarea + attributes: + label: "Expected behavior" + - type: textarea + attributes: + label: "Actual behavior" + description: "A description of the behavior you expected. May optionally include logs, images, or videos." diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 928cde894c..0000000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -name: Feature request -about: Request an enhancement for Nvim -title: '' -labels: enhancement - ---- - -<!-- Before reporting: search existing issues and check the FAQ. --> - -- `nvim --version`: -- `vim -u DEFAULTS` (version: ) behaves differently? -- Operating system/version: -- Terminal name/version: -- `$TERM`: - -### Steps to reproduce using `nvim -u NORC` - -``` -nvim -u NORC - -``` - -### Actual behaviour - -### Expected behaviour - diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000000..a9ed2824cb --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,20 @@ +name: Feature request +description: Request an enhancement for Neovim +labels: [enhancement] +body: + + - type: markdown + attributes: + value: | + Before requesting: search [existing issues](https://github.com/neovim/neovim/labels/enhancement) and check the [FAQ](https://github.com/neovim/neovim/wiki/FAQ). + + - type: input + attributes: + label: "Feature already in Vim?" + description: "Does the feature already exist in Vim? If possible, please specify which version of Vim it was introduced in." + + - type: textarea + attributes: + label: "Feature description" + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/lsp_bug_report.md b/.github/ISSUE_TEMPLATE/lsp_bug_report.md deleted file mode 100644 index d2488a14e8..0000000000 --- a/.github/ISSUE_TEMPLATE/lsp_bug_report.md +++ /dev/null @@ -1,58 +0,0 @@ ---- -name: Language server client bug report -about: Report a built-in lsp problem in Nvim -title: '' -labels: bug, lsp - ---- - -<!-- -Before reporting: search existing issues and check the FAQ. Usage questions -such as "How do I...?" or "Why isn't X language server/feature working?" belong -on the [Neovim Discourse](https://neovim.discourse.group/c/7-category/7) and will -be closed. ---> - -- `nvim --version`: -- language server name/version: -- Operating system/version: - -<details> -<summary>nvim -c ":checkhealth nvim lspconfig"</summary> - -<!-- Paste the results from `nvim -c ":checkhealth nvim lspconfig"` here. --> - -</details> - -<details> -<summary>lsp.log</summary> - -<!-- -Please paste the lsp log before and after the problem. - -You can set log level like this. -`:lua vim.lsp.set_log_level("debug")` - -You can find the location of the log with the following command. -`:lua print(vim.lsp.get_log_path())` ---> - -</details> - -### Steps to reproduce using nvim -u minimal_init.lua -<!-- - Note, if the issue is with an autocompletion or other LSP plugin, please - report to the upstream tracker. Download the minmal config with - wget https://raw.githubusercontent.com/neovim/nvim-lspconfig/master/test/minimal_init.lua - and modify it to include any specific commands or servers pertaining to your issues. ---> - - -``` -nvim -u minimal_init.lua -``` - -### Actual behaviour - -### Expected behaviour - diff --git a/.github/ISSUE_TEMPLATE/lsp_bug_report.yml b/.github/ISSUE_TEMPLATE/lsp_bug_report.yml new file mode 100644 index 0000000000..ff25bb0a23 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/lsp_bug_report.yml @@ -0,0 +1,69 @@ +name: Language server client bug report +description: Report a built-in lsp problem in Neovim +labels: [bug, lsp] +body: + + - type: markdown + attributes: + value: | + Before reporting: search [existing issues](https://github.com/neovim/neovim/issues?q=is%3Aissue+is%3Aopen+label%3Abug) and check the [FAQ](https://github.com/neovim/neovim/wiki/FAQ). Usage questions such as "How do I...?" or "Why isn't X language server/feature working?" belong on the [Neovim Discourse](https://neovim.discourse.group/c/7-category/7) and will be closed. + + - type: input + attributes: + label: "Neovim Version" + description: "`nvim --version`:" + validations: + required: true + - type: input + attributes: + label: "Language server name/version:" + validations: + required: true + - type: input + attributes: + label: "Operating system/version:" + validations: + required: true + + - type: textarea + attributes: + label: Checkhealth + description: | + Paste the results from `nvim -c ":checkhealth nvim lspconfig"` here: + render: markdown + + - type: markdown + attributes: + value: | + Note: if the issue is with an autocompletion or other LSP plugin, please report it at that plugin's issue tracker. Download the minimal config with `wget https://raw.githubusercontent.com/neovim/nvim-lspconfig/master/test/minimal_init.lua` and modify it to include any specific commands or servers pertaining to your issues. + - type: textarea + attributes: + label: "Steps to reproduce" + description: | + Steps to reproduce using `nvim -u minimal_init.lua`: + validations: + required: true + + - type: textarea + attributes: + label: "Expected behavior" + - type: textarea + attributes: + label: "Actual behavior" + description: "A description of the behavior you expected. May optionally include logs, images, or videos." + + - type: markdown + attributes: + value: | + Please upload `lsp.log` before and after the problem in a [secret gist](https://gist.github.com/). Paste the url to the gist in the text field below. + + You can set the log level by adding the Lua command + `vim.lsp.set_log_level("debug")` + after setting up LSP in your config. + + You can find the location of the log with the command + `:lua print(vim.lsp.get_log_path())` + + - type: input + attributes: + label: "Link to uploaded log file" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aa16a94802..3b89730434 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,6 +34,7 @@ jobs: runner: ubuntu-20.04 os: linux runs-on: ${{ matrix.runner }} + timeout-minutes: 45 if: github.event.pull_request.draft == false env: CC: ${{ matrix.cc }} diff --git a/.gitignore b/.gitignore index 163140c6e1..e07ce4906e 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ compile_commands.json /tmp/ /.clangd/ /.cache/clangd/ +/.ccls-cache/ .DS_Store *.mo diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index 4dcf5b7bbc..9b8259c2fb 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -2334,8 +2334,9 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {opts}) inserted (true for right, false for left). Defaults to false. • priority: a priority value for the highlight - group. For example treesitter highlighting - uses a value of 100. + group. Default: 4096. For example, treesitter + highlighting uses a default value of 100 (see + |lua-treesitter-highlight-priority|). Return: ~ Id of the created/updated extmark diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 8c360b1778..e32691dfb4 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -6358,8 +6358,7 @@ mode([expr]) Return a string that indicates the current mode. Rv Virtual Replace |gR| Rx Replace mode |i_CTRL-X| completion c Command-line editing - cv Vim Ex mode |gQ| - ce Normal Ex mode |Q| + cv Vim Ex mode |Q| or |gQ| r Hit-enter prompt rm The -- more -- prompt r? |:confirm| query of some sort diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 111c3ee7f7..a15c74d148 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -1199,6 +1199,26 @@ clear({bufnr}, {client_id}, {diagnostic_ns}, {sign_ns}) namespace {sign_ns} number|nil Associated sign namespace +disable({bufnr}, {client_id}) *vim.lsp.diagnostic.disable()* + Disable diagnostics for the given buffer and client + + Parameters: ~ + {bufnr} (optional, number): Buffer handle, defaults + to current + {client_id} (optional, number): Disable diagnostics for + the given client. The default is to disable + diagnostics for all attached clients. + +enable({bufnr}, {client_id}) *vim.lsp.diagnostic.enable()* + Enable diagnostics for the given buffer and client + + Parameters: ~ + {bufnr} (optional, number): Buffer handle, defaults + to current + {client_id} (optional, number): Enable diagnostics for + the given client. The default is to enable + diagnostics for all attached clients. + get({bufnr}, {client_id}) *vim.lsp.diagnostic.get()* Return associated diagnostics for bufnr @@ -1450,12 +1470,36 @@ save({diagnostics}, {bufnr}, {client_id}) *vim.lsp.diagnostic.save()* save_extmarks({bufnr}, {client_id}) TODO: Documentation +set_qflist({opts}) *vim.lsp.diagnostic.set_qflist()* + Sets the quickfix list + + Parameters: ~ + {opts} table|nil Configuration table. Keys: + • {open}: (boolean, default true) + • Open quickfix list after set + + • {client_id}: (number) + • If nil, will consider all clients attached to + buffer. + + • {severity}: (DiagnosticSeverity) + • Exclusive severity to consider. Overrides + {severity_limit} + + • {severity_limit}: (DiagnosticSeverity) + • Limit severity of diagnostics found. E.g. + "Warning" means { "Error", "Warning" } will be + valid. + + • {workspace}: (boolean, default true) + • Set the list with workspace diagnostics + set_loclist({opts}) *vim.lsp.diagnostic.set_loclist()* Sets the location list Parameters: ~ {opts} table|nil Configuration table. Keys: - • {open_loclist}: (boolean, default true) + • {open}: (boolean, default true) • Open loclist after set • {client_id}: (number) @@ -1630,23 +1674,29 @@ save({lenses}, {bufnr}, {client_id}) *vim.lsp.codelens.save()* ============================================================================== Lua module: vim.lsp.handlers *lsp-handlers* - *vim.lsp.handlers.progress_handler()* -progress_handler({_}, {_}, {params}, {client_id}) - See also: ~ - https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_executeCommand + *vim.lsp.handlers.hover()* +hover({_}, {method}, {result}, {_}, {_}, {config}) + |lsp-handler| for the method "textDocument/hover" > + + vim.lsp.handlers["textDocument/hover"] = vim.lsp.with( + vim.lsp.handlers.hover, { + -- Use a sharp border with `FloatBorder` highlights + border = "single" + } + ) +< - *vim.lsp.handlers.signature_help()* -signature_help({_}, {method}, {result}, {client_id}, {bufnr}, {config}) Parameters: ~ {config} table Configuration table. • border: (default=nil) • Add borders to the floating window • See |vim.api.nvim_open_win()| - See also: ~ - https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_declaration@seehttps://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_definition@seehttps://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_typeDefinition@seehttps://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_implementation|lsp-handler| for the method "textDocument/signatureHelp" - The active parameter is highlighted with - |hl-LspSignatureActiveParameter|> + *vim.lsp.handlers.signature_help()* +signature_help({_}, {method}, {result}, {client_id}, {bufnr}, {config}) + |lsp-handler| for the method "textDocument/signatureHelp". The + active parameter is highlighted with + |hl-LspSignatureActiveParameter|. > vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with( vim.lsp.handlers.signature_help, { @@ -1656,6 +1706,12 @@ signature_help({_}, {method}, {result}, {client_id}, {bufnr}, {config}) ) < + Parameters: ~ + {config} table Configuration table. + • border: (default=nil) + • Add borders to the floating window + • See |vim.api.nvim_open_win()| + ============================================================================== Lua module: vim.lsp.util *lsp-util* @@ -1915,14 +1971,14 @@ make_floating_popup_options({width}, {height}, {opts}) *vim.lsp.util.make_formatting_params()* make_formatting_params({options}) - Creates a `FormattingOptions` object for the current buffer - and cursor position. + Creates a `DocumentFormattingParams` object for the current + buffer and cursor position. Parameters: ~ {options} Table with valid `FormattingOptions` entries Return: ~ - `FormattingOptions object + `DocumentFormattingParams` object See also: ~ https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_formatting diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 6aa508956b..ab2230641d 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -4539,11 +4539,6 @@ A jump table for the options with a short description can be found at |Q_op|. List of items that control the format of the output of |:hardcopy|. See |popt-option|. - *'prompt'* *'noprompt'* -'prompt' boolean (default on) - global - When on a ":" prompt is used in Ex mode. - *'pumblend'* *'pb'* 'pumblend' 'pb' number (default 0) global diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt index fb20a583c9..c19b05f6c7 100644 --- a/runtime/doc/quickref.txt +++ b/runtime/doc/quickref.txt @@ -809,7 +809,6 @@ Short explanation of each option: *option-list* 'printmbcharset' 'pmbcs' CJK character set to be used for :hardcopy 'printmbfont' 'pmbfn' font names to be used for CJK output of :hardcopy 'printoptions' 'popt' controls the format of :hardcopy output -'prompt' 'prompt' enable prompt in Ex mode 'pumheight' 'ph' maximum height of the popup menu 'pumwidth' 'pw' minimum width of the popup menu 'pythondll' name of the Python 2 dynamic library diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index ca9e571a98..69aacedaa4 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -226,6 +226,18 @@ Here is a list of built-in predicates : Each predicate has a `not-` prefixed predicate that is just the negation of the predicate. + *vim.treesitter.query.add_predicate()* +vim.treesitter.query.add_predicate({name}, {handler}) + +This adds a predicate with the name {name} to be used in queries. +{handler} should be a function whose signature will be : > + handler(match, pattern, bufnr, predicate) +< + *vim.treesitter.query.list_predicates()* +vim.treesitter.query.list_predicates() + +This lists the currently available predicates to use in queries. + Treesitter Query Directive *lua-treesitter-directives* Treesitter queries can also contain `directives`. Directives store metadata for a node @@ -249,6 +261,21 @@ Here is a list of built-in directives: `({capture_id}, {start_row}, {start_col}, {end_row}, {end_col}, {key?})` The default key is "offset". + *vim.treesitter.query.add_directive()* +vim.treesitter.query.add_directive({name}, {handler}) + +This adds a directive with the name {name} to be used in queries. +{handler} should be a function whose signature will be : > + handler(match, pattern, bufnr, predicate, metadata) +Handlers can set match level data by setting directly on the metadata object `metadata.key = value` +Handlers can set node level data by using the capture id on the metadata table +`metadata[capture_id].key = value` + + *vim.treesitter.query.list_directives()* +vim.treesitter.query.list_directives() + +This lists the currently available directives to use in queries. + Treesitter syntax highlighting (WIP) *lua-treesitter-highlight* NOTE: This is a partially implemented feature, and not usable as a default @@ -294,6 +321,19 @@ identical identifiers, highlighting both as |hl-WarningMsg|: > ((binary_expression left: (identifier) @WarningMsg.left right: (identifier) @WarningMsg.right) (eq? @WarningMsg.left @WarningMsg.right)) < +Treesitter Highlighting Priority *lua-treesitter-highlight-priority* + +Tree-sitter uses |nvim_buf_set_extmark()| to set highlights with a default +priority of 100. This enables plugins to set a highlighting priority lower or +higher than tree-sitter. It is also possible to change the priority of an +individual query pattern manually by setting its `"priority"` metadata attribute: > + + ( + (super_important_node) @ImportantHighlight + ; Give the whole query highlight priority higher than the default (100) + (set! "priority" 105) + ) +< ============================================================================== Lua module: vim.treesitter *lua-treesitter-core* @@ -393,8 +433,13 @@ get_query_files({lang}, {query_name}, {is_included}) {is_included} Internal parameter, most of the time left as `nil` +list_directives() *list_directives()* + Return: ~ + The list of supported directives. + list_predicates() *list_predicates()* - TODO: Documentation + Return: ~ + The list of supported predicates. parse_query({lang}, {query}) *parse_query()* Parse {query} as a string. (If the query is in a file, the @@ -474,11 +519,9 @@ Query:iter_matches({self}, {node}, {source}, {start}, {stop}) for id, node in pairs(match) do local name = query.captures[id] -- `node` was captured by the `name` capture in the match -< -> - local node_data = metadata[id] -- Node level metadata -< -> + + local node_data = metadata[id] -- Node level metadata + ... use the info here ... end end diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index 27c4b82aca..a259afded0 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -473,6 +473,7 @@ Options: 'maxmem' Nvim delegates memory-management to the OS. 'maxmemtot' Nvim delegates memory-management to the OS. 'maxcombine' (6 is always used) + *'prompt'* *'noprompt'* *'restorescreen'* *'rs'* *'norestorescreen'* *'nors'* 'shelltype' *'shortname'* *'sn'* *'noshortname'* *'nosn'* diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index 75faf9bcc7..f5aefc8260 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -590,6 +590,10 @@ end --- as `initializationOptions`. See `initialize` in the LSP spec. --- --@param name (string, default=client-id) Name in log messages. +-- +--@param workspace_folders (table) List of workspace folders passed to the +--- language server. Defaults to root_dir if not set. See `workspaceFolders` in +--- the LSP spec --- --@param get_language_id function(bufnr, filetype) -> language ID as string. --- Defaults to the filetype. @@ -775,6 +779,14 @@ function lsp.start_client(config) off = 'off'; messages = 'messages'; verbose = 'verbose'; } local version = vim.version() + + if not config.workspace_folders then + config.workspace_folders = {{ + uri = vim.uri_from_fname(config.root_dir); + name = string.format("%s", config.root_dir); + }}; + end + local initialize_params = { -- The process Id of the parent process that started the server. Is null if -- the process has not been started by another process. If the parent @@ -815,10 +827,7 @@ function lsp.start_client(config) -- -- workspace folder in the user interface. -- name -- } - workspaceFolders = {{ - uri = vim.uri_from_fname(config.root_dir); - name = string.format("%s", config.root_dir); - }}; + workspaceFolders = config.workspace_folders, } if config.before_init then -- TODO(ashkan) handle errors here. diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua index ced1747ee0..29f8d6c3bc 100644 --- a/runtime/lua/vim/lsp/buf.lua +++ b/runtime/lua/vim/lsp/buf.lua @@ -422,6 +422,21 @@ function M.clear_references() util.buf_clear_references() end +--- Requests code actions from all clients and calls the handler exactly once +--- with all aggregated results +--@private +local function code_action_request(params) + local bufnr = vim.api.nvim_get_current_buf() + local method = 'textDocument/codeAction' + vim.lsp.buf_request_all(bufnr, method, params, function(results) + local actions = {} + for _, r in pairs(results) do + vim.list_extend(actions, r.result or {}) + end + vim.lsp.handlers[method](nil, method, actions, nil, bufnr) + end) +end + --- Selects a code action from the input list that is available at the current --- cursor position. -- @@ -432,7 +447,7 @@ function M.code_action(context) context = context or { diagnostics = vim.lsp.diagnostic.get_line_diagnostics() } local params = util.make_range_params() params.context = context - request('textDocument/codeAction', params) + code_action_request(params) end --- Performs |vim.lsp.buf.code_action()| for a given range. @@ -447,7 +462,7 @@ function M.range_code_action(context, start_pos, end_pos) context = context or { diagnostics = vim.lsp.diagnostic.get_line_diagnostics() } local params = util.make_given_range_params(start_pos, end_pos) params.context = context - request('textDocument/codeAction', params) + code_action_request(params) end --- Executes an LSP server command. diff --git a/runtime/lua/vim/lsp/diagnostic.lua b/runtime/lua/vim/lsp/diagnostic.lua index 1342df529f..246665602d 100644 --- a/runtime/lua/vim/lsp/diagnostic.lua +++ b/runtime/lua/vim/lsp/diagnostic.lua @@ -208,6 +208,9 @@ local diagnostic_cache_lines = setmetatable({}, bufnr_and_client_cacher_mt) local diagnostic_cache_counts = setmetatable({}, bufnr_and_client_cacher_mt) local diagnostic_attached_buffers = {} +-- Disabled buffers and clients +local diagnostic_disabled = setmetatable({}, bufnr_and_client_cacher_mt) + local _bufs_waiting_to_update = setmetatable({}, bufnr_and_client_cacher_mt) --- Store Diagnostic[] by line @@ -816,10 +819,7 @@ end ---@param diagnostic_ns number|nil Associated diagnostic namespace ---@param sign_ns number|nil Associated sign namespace function M.clear(bufnr, client_id, diagnostic_ns, sign_ns) - validate { bufnr = { bufnr, 'n' } } - - bufnr = (bufnr == 0 and api.nvim_get_current_buf()) or bufnr - + bufnr = get_bufnr(bufnr) if client_id == nil then return vim.lsp.for_each_buffer_client(bufnr, function(_, iter_client_id, _) return M.clear(bufnr, iter_client_id) @@ -1092,6 +1092,10 @@ end --@private --- Display diagnostics for the buffer, given a configuration. function M.display(diagnostics, bufnr, client_id, config) + if diagnostic_disabled[bufnr][client_id] then + return + end + config = vim.lsp._with_extend('vim.lsp.diagnostic.on_publish_diagnostics', { signs = true, underline = true, @@ -1245,10 +1249,10 @@ function M.reset(client_id, buffer_client_map) end) end ---- Sets the location list +--- Gets diagnostics, converts them to quickfix/location list items, and applies the item_handler callback to the items. +---@param item_handler function Callback to apply to the diagnostic items +---@param command string|nil Command to execute after applying the item_handler ---@param opts table|nil Configuration table. Keys: ---- - {open_loclist}: (boolean, default true) ---- - Open loclist after set --- - {client_id}: (number) --- - If nil, will consider all clients attached to buffer. --- - {severity}: (DiagnosticSeverity) @@ -1257,9 +1261,8 @@ end --- - Limit severity of diagnostics found. E.g. "Warning" means { "Error", "Warning" } will be valid. --- - {workspace}: (boolean, default false) --- - Set the list with workspace diagnostics -function M.set_loclist(opts) +local function apply_to_diagnostic_items(item_handler, command, opts) opts = opts or {} - local open_loclist = if_nil(opts.open_loclist, true) local current_bufnr = api.nvim_get_current_buf() local diags = opts.workspace and M.get_all(opts.client_id) or { [current_bufnr] = M.get(current_bufnr, opts.client_id) @@ -1276,12 +1279,101 @@ function M.set_loclist(opts) return true end local items = util.diagnostics_to_items(diags, predicate) - local win_id = vim.api.nvim_get_current_win() - util.set_loclist(items, win_id) - if open_loclist then - vim.cmd [[lopen]] + item_handler(items) + if command then + vim.cmd(command) end end + +--- Sets the quickfix list +---@param opts table|nil Configuration table. Keys: +--- - {open}: (boolean, default true) +--- - Open quickfix list after set +--- - {client_id}: (number) +--- - If nil, will consider all clients attached to buffer. +--- - {severity}: (DiagnosticSeverity) +--- - Exclusive severity to consider. Overrides {severity_limit} +--- - {severity_limit}: (DiagnosticSeverity) +--- - Limit severity of diagnostics found. E.g. "Warning" means { "Error", "Warning" } will be valid. +--- - {workspace}: (boolean, default true) +--- - Set the list with workspace diagnostics +function M.set_qflist(opts) + opts = opts or {} + opts.workspace = if_nil(opts.workspace, true) + local open_qflist = if_nil(opts.open, true) + local command = open_qflist and [[copen]] or nil + apply_to_diagnostic_items(util.set_qflist, command, opts) +end + +--- Sets the location list +---@param opts table|nil Configuration table. Keys: +--- - {open}: (boolean, default true) +--- - Open loclist after set +--- - {client_id}: (number) +--- - If nil, will consider all clients attached to buffer. +--- - {severity}: (DiagnosticSeverity) +--- - Exclusive severity to consider. Overrides {severity_limit} +--- - {severity_limit}: (DiagnosticSeverity) +--- - Limit severity of diagnostics found. E.g. "Warning" means { "Error", "Warning" } will be valid. +--- - {workspace}: (boolean, default false) +--- - Set the list with workspace diagnostics +function M.set_loclist(opts) + opts = opts or {} + local open_loclist = if_nil(opts.open, true) + local command = open_loclist and [[lopen]] or nil + apply_to_diagnostic_items(util.set_loclist, command, opts) +end + +--- Disable diagnostics for the given buffer and client +--- @param bufnr (optional, number): Buffer handle, defaults to current +--- @param client_id (optional, number): Disable diagnostics for the given +--- client. The default is to disable diagnostics for all attached +--- clients. +-- Note that when diagnostics are disabled for a buffer, the server will still +-- send diagnostic information and the client will still process it. The +-- diagnostics are simply not displayed to the user. +function M.disable(bufnr, client_id) + if not client_id then + return vim.lsp.for_each_buffer_client(bufnr, function(client) + M.disable(bufnr, client.id) + end) + end + + diagnostic_disabled[bufnr][client_id] = true + M.clear(bufnr, client_id) +end + +--- Enable diagnostics for the given buffer and client +--- @param bufnr (optional, number): Buffer handle, defaults to current +--- @param client_id (optional, number): Enable diagnostics for the given +--- client. The default is to enable diagnostics for all attached +--- clients. +function M.enable(bufnr, client_id) + if not client_id then + return vim.lsp.for_each_buffer_client(bufnr, function(client) + M.enable(bufnr, client.id) + end) + end + + if not diagnostic_disabled[bufnr][client_id] then + return + end + + diagnostic_disabled[bufnr][client_id] = nil + + -- We need to invoke the publishDiagnostics handler directly instead of just + -- calling M.display so that we can preserve any custom configuration options + -- the user may have set with vim.lsp.with. + vim.lsp.handlers["textDocument/publishDiagnostics"]( + nil, + "textDocument/publishDiagnostics", + { + diagnostics = M.get(bufnr, client_id), + uri = vim.uri_from_bufnr(bufnr), + }, + client_id + ) +end -- }}} return M diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua index 797ff762cb..acd20a3e0b 100644 --- a/runtime/lua/vim/lsp/handlers.lua +++ b/runtime/lua/vim/lsp/handlers.lua @@ -17,13 +17,12 @@ local function err_message(...) api.nvim_command("redraw") end ---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_executeCommand +--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_executeCommand M['workspace/executeCommand'] = function() -- Error handling is done implicitly by wrapping all handlers; see end of this file end --- @msg of type ProgressParams --- Basically a token of type number/string +--@private local function progress_handler(_, _, params, client_id) local client = vim.lsp.get_client_by_id(client_id) local client_name = client and client.name or string.format("id=%d", client_id) @@ -59,10 +58,10 @@ local function progress_handler(_, _, params, client_id) vim.api.nvim_command("doautocmd <nomodeline> User LspProgressUpdate") end ---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#progress +--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#progress M['$/progress'] = progress_handler ---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#window_workDoneProgress_create +--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#window_workDoneProgress_create M['window/workDoneProgress/create'] = function(_, _, params, client_id) local client = vim.lsp.get_client_by_id(client_id) local token = params.token -- string or number @@ -74,7 +73,7 @@ M['window/workDoneProgress/create'] = function(_, _, params, client_id) return vim.NIL end ---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#window_showMessageRequest +--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#window_showMessageRequest M['window/showMessageRequest'] = function(_, _, params) local actions = params.actions @@ -95,7 +94,7 @@ M['window/showMessageRequest'] = function(_, _, params) end end ---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#client_registerCapability +--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#client_registerCapability M['client/registerCapability'] = function(_, _, _, client_id) local warning_tpl = "The language server %s triggers a registerCapability ".. "handler despite dynamicRegistration set to false. ".. @@ -107,7 +106,7 @@ M['client/registerCapability'] = function(_, _, _, client_id) return vim.NIL end ---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_codeAction +--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_codeAction M['textDocument/codeAction'] = function(_, _, actions) if actions == nil or vim.tbl_isempty(actions) then print("No code actions available") @@ -141,7 +140,7 @@ M['textDocument/codeAction'] = function(_, _, actions) end end ---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_applyEdit +--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_applyEdit M['workspace/applyEdit'] = function(_, _, workspace_edit) if not workspace_edit then return end -- TODO(ashkan) Do something more with label? @@ -155,7 +154,7 @@ M['workspace/applyEdit'] = function(_, _, workspace_edit) } end ---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_configuration +--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_configuration M['workspace/configuration'] = function(_, _, params, client_id) local client = vim.lsp.get_client_by_id(client_id) if not client then @@ -207,34 +206,34 @@ local function response_to_qflist(map_result, entity) end ---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_references +--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_references M['textDocument/references'] = response_to_qflist(util.locations_to_items, 'references') ---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_documentSymbol +--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_documentSymbol M['textDocument/documentSymbol'] = response_to_qflist(util.symbols_to_items, 'document symbols') ---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_symbol +--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_symbol M['workspace/symbol'] = response_to_qflist(util.symbols_to_items, 'symbols') ---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_rename +--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_rename M['textDocument/rename'] = function(_, _, result) if not result then return end util.apply_workspace_edit(result) end ---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_rangeFormatting +--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_rangeFormatting M['textDocument/rangeFormatting'] = function(_, _, result, _, bufnr) if not result then return end util.apply_text_edits(result, bufnr) end ---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_formatting +--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_formatting M['textDocument/formatting'] = function(_, _, result, _, bufnr) if not result then return end util.apply_text_edits(result, bufnr) end ---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_completion +--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_completion M['textDocument/completion'] = function(_, _, result) if vim.tbl_isempty(result or {}) then return end local row, col = unpack(api.nvim_win_get_cursor(0)) @@ -276,7 +275,7 @@ function M.hover(_, method, result, _, _, config) return util.open_floating_preview(markdown_lines, "markdown", config) end ---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_hover +--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_hover M['textDocument/hover'] = M.hover --@private @@ -306,17 +305,17 @@ local function location_handler(_, method, result) end end ---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_declaration +--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_declaration M['textDocument/declaration'] = location_handler ---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_definition +--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_definition M['textDocument/definition'] = location_handler ---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_typeDefinition +--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_typeDefinition M['textDocument/typeDefinition'] = location_handler ---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_implementation +--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_implementation M['textDocument/implementation'] = location_handler ---- |lsp-handler| for the method "textDocument/signatureHelp" ---- The active parameter is highlighted with |hl-LspSignatureActiveParameter| +--- |lsp-handler| for the method "textDocument/signatureHelp". +--- The active parameter is highlighted with |hl-LspSignatureActiveParameter|. --- <pre> --- vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with( --- vim.lsp.handlers.signature_help, { @@ -358,10 +357,10 @@ function M.signature_help(_, method, result, client_id, bufnr, config) return fbuf, fwin end ---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_signatureHelp +--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_signatureHelp M['textDocument/signatureHelp'] = M.signature_help ---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_documentHighlight +--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_documentHighlight M['textDocument/documentHighlight'] = function(_, _, result, _, bufnr, _) if not result then return end util.buf_highlight_references(bufnr, result) @@ -394,13 +393,13 @@ local make_call_hierarchy_handler = function(direction) end end ---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#callHierarchy/incomingCalls +--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#callHierarchy_incomingCalls M['callHierarchy/incomingCalls'] = make_call_hierarchy_handler('from') ---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#callHierarchy/outgoingCalls +--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#callHierarchy_outgoingCalls M['callHierarchy/outgoingCalls'] = make_call_hierarchy_handler('to') ---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#window/logMessage +--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#window_logMessage M['window/logMessage'] = function(_, _, result, client_id) local message_type = result.type local message = result.message @@ -421,7 +420,7 @@ M['window/logMessage'] = function(_, _, result, client_id) return result end ---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#window/showMessage +--see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#window_showMessage M['window/showMessage'] = function(_, _, result, client_id) local message_type = result.type local message = result.message diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index f047a12dff..dc15d67e1c 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -990,6 +990,7 @@ function M.make_floating_popup_options(width, height, opts) style = 'minimal', width = width, border = opts.border or default_border, + zindex = opts.zindex or 50, } end @@ -1868,10 +1869,10 @@ function M.get_effective_tabstop(bufnr) return (sts > 0 and sts) or (sts < 0 and bo.shiftwidth) or bo.tabstop end ---- Creates a `FormattingOptions` object for the current buffer and cursor position. +--- Creates a `DocumentFormattingParams` object for the current buffer and cursor position. --- --@param options Table with valid `FormattingOptions` entries ---@returns `FormattingOptions object +--@returns `DocumentFormattingParams` object --@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_formatting function M.make_formatting_params(options) validate { options = {options, 't', true} } diff --git a/runtime/lua/vim/shared.lua b/runtime/lua/vim/shared.lua index 0a663628a5..33c2b2c46c 100644 --- a/runtime/lua/vim/shared.lua +++ b/runtime/lua/vim/shared.lua @@ -200,6 +200,12 @@ function vim.tbl_isempty(t) return next(t) == nil end +--- we only merge empty tables or tables that are not a list +--@private +local function can_merge(v) + return type(v) == "table" and (vim.tbl_isempty(v) or not vim.tbl_islist(v)) +end + local function tbl_extend(behavior, deep_extend, ...) if (behavior ~= 'error' and behavior ~= 'keep' and behavior ~= 'force') then error('invalid "behavior": '..tostring(behavior)) @@ -219,8 +225,8 @@ local function tbl_extend(behavior, deep_extend, ...) vim.validate{["after the second argument"] = {tbl,'t'}} if tbl then for k, v in pairs(tbl) do - if type(v) == 'table' and deep_extend and not vim.tbl_islist(v) then - ret[k] = tbl_extend(behavior, true, ret[k] or vim.empty_dict(), v) + if deep_extend and can_merge(v) and can_merge(ret[k]) then + ret[k] = tbl_extend(behavior, true, ret[k], v) elseif behavior ~= 'force' and ret[k] ~= nil then if behavior == 'error' then error('key found in more than one map: '..k) diff --git a/runtime/lua/vim/treesitter/highlighter.lua b/runtime/lua/vim/treesitter/highlighter.lua index 84b6a5f135..cf3cdf4505 100644 --- a/runtime/lua/vim/treesitter/highlighter.lua +++ b/runtime/lua/vim/treesitter/highlighter.lua @@ -248,7 +248,7 @@ local function on_line_impl(self, buf, line) end while line >= state.next_row do - local capture, node = state.iter() + local capture, node, metadata = state.iter() if capture == nil then break end @@ -260,7 +260,7 @@ local function on_line_impl(self, buf, line) { end_line = end_row, end_col = end_col, hl_group = hl, ephemeral = true, - priority = 100 -- Low but leaves room below + priority = tonumber(metadata.priority) or 100 -- Low but leaves room below }) end if start_row > line then diff --git a/runtime/lua/vim/treesitter/query.lua b/runtime/lua/vim/treesitter/query.lua index b81eb18945..4ecd91d295 100644 --- a/runtime/lua/vim/treesitter/query.lua +++ b/runtime/lua/vim/treesitter/query.lua @@ -351,7 +351,12 @@ function M.add_directive(name, handler, force) directive_handlers[name] = handler end ---- Returns the list of currently supported predicates +--- @return The list of supported directives. +function M.list_directives() + return vim.tbl_keys(directive_handlers) +end + +--- @return The list of supported predicates. function M.list_predicates() return vim.tbl_keys(predicate_handlers) end diff --git a/runtime/lua/vim/uri.lua b/runtime/lua/vim/uri.lua index f1a12c72ec..82c9a31464 100644 --- a/runtime/lua/vim/uri.lua +++ b/runtime/lua/vim/uri.lua @@ -52,7 +52,7 @@ end --@private local function is_windows_file_uri(uri) - return uri:match('^file:///[a-zA-Z]:') ~= nil + return uri:match('^file:/+[a-zA-Z]:') ~= nil end --- Get a URI from a file path. @@ -74,7 +74,7 @@ local function uri_from_fname(path) return table.concat(uri_parts) end -local URI_SCHEME_PATTERN = '^([a-zA-Z]+[a-zA-Z0-9+-.]*)://.*' +local URI_SCHEME_PATTERN = '^([a-zA-Z]+[a-zA-Z0-9+-.]*):.*' --- Get a URI from a bufnr --@param bufnr (number): Buffer number @@ -100,10 +100,10 @@ local function uri_to_fname(uri) uri = uri_decode(uri) -- TODO improve this. if is_windows_file_uri(uri) then - uri = uri:gsub('^file:///', '') + uri = uri:gsub('^file:/+', '') uri = uri:gsub('/', '\\') else - uri = uri:gsub('^file://', '') + uri = uri:gsub('^file:/+', '/') end return uri end diff --git a/runtime/syntax/syncolor.vim b/runtime/syntax/syncolor.vim index 5b907a3b83..27cc3360c4 100644 --- a/runtime/syntax/syncolor.vim +++ b/runtime/syntax/syncolor.vim @@ -25,6 +25,8 @@ else endif endif +let did_syncolor = 1 + " Many terminals can only use six different colors (plus black and white). " Therefore the number of colors used is kept low. It doesn't look nice with " too many colors anyway. diff --git a/runtime/syntax/synload.vim b/runtime/syntax/synload.vim index 3863a84c1a..aee9ba8b8e 100644 --- a/runtime/syntax/synload.vim +++ b/runtime/syntax/synload.vim @@ -14,10 +14,8 @@ endif " let others know that syntax has been switched on let syntax_on = 1 -" Set the default highlighting colors. Use a color scheme if specified. -if exists("colors_name") - exe "colors " . colors_name -else +" Set the default highlighting colors +if !exists("colors_name") && !exists("did_syncolor") runtime! syntax/syncolor.vim endif diff --git a/scripts/pvscheck.sh b/scripts/pvscheck.sh index f3371b485e..aa27c94f29 100755 --- a/scripts/pvscheck.sh +++ b/scripts/pvscheck.sh @@ -379,7 +379,7 @@ run_analysis() {( --sourcetree-root . || true rm -rf PVS-studio.{xml,err,tsk,html.d} - local plog_args="PVS-studio.log --srcRoot . --excludedCodes V011" + local plog_args="PVS-studio.log --srcRoot . --excludedCodes V011,V1042" plog-converter $plog_args --renderTypes xml --output PVS-studio.xml plog-converter $plog_args --renderTypes errorfile --output PVS-studio.err plog-converter $plog_args --renderTypes tasklist --output PVS-studio.tsk diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c index b371c08d2a..78e36e5ef0 100644 --- a/src/nvim/api/buffer.c +++ b/src/nvim/api/buffer.c @@ -315,7 +315,7 @@ ArrayOf(String) nvim_buf_get_lines(uint64_t channel_id, } rv.size = (size_t)(end - start); - rv.items = xcalloc(sizeof(Object), rv.size); + rv.items = xcalloc(rv.size, sizeof(Object)); if (!buf_collect_lines(buf, rv.size, start, (channel_id != VIML_INTERNAL_CALL), &rv, err)) { diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index 9b0782f589..bbcfe173c5 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -1696,7 +1696,7 @@ void nvim_put(ArrayOf(String) lines, String type, Boolean after, FUNC_API_SINCE(6) FUNC_API_CHECK_TEXTLOCK { - yankreg_T *reg = xcalloc(sizeof(yankreg_T), 1); + yankreg_T *reg = xcalloc(1, sizeof(yankreg_T)); if (!prepare_yankreg_from_object(reg, type, lines.size)) { api_set_error(err, kErrorTypeValidation, "Invalid type: '%s'", type.data); goto cleanup; diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 3b4fc6c3df..587ef74b35 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -540,12 +540,10 @@ bool close_buffer(win_T *win, buf_T *buf, int action, bool abort_if_last) del_buf = true; } - /* - * Free all things allocated for this buffer. - * Also calls the "BufDelete" autocommands when del_buf is TRUE. - */ - /* Remember if we are closing the current buffer. Restore the number of - * windows, so that autocommands in buf_freeall() don't get confused. */ + // Free all things allocated for this buffer. + // Also calls the "BufDelete" autocommands when del_buf is true. + // Remember if we are closing the current buffer. Restore the number of + // windows, so that autocommands in buf_freeall() don't get confused. bool is_curbuf = (buf == curbuf); // When closing the current buffer stop Visual mode before freeing @@ -5046,8 +5044,8 @@ do_arg_all( xfree(opened); } -// Return TRUE if "buf" is a prompt buffer. -int bt_prompt(buf_T *buf) +/// @return true if "buf" is a prompt buffer. +bool bt_prompt(buf_T *buf) { return buf != NULL && buf->b_p_bt[0] == 'p'; } diff --git a/src/nvim/buffer_updates.c b/src/nvim/buffer_updates.c index f46cac4637..1d131cc4b1 100644 --- a/src/nvim/buffer_updates.c +++ b/src/nvim/buffer_updates.c @@ -50,7 +50,7 @@ bool buf_updates_register(buf_T *buf, uint64_t channel_id, if (send_buffer) { Array args = ARRAY_DICT_INIT; args.size = 6; - args.items = xcalloc(sizeof(Object), args.size); + args.items = xcalloc(args.size, sizeof(Object)); // the first argument is always the buffer handle args.items[0] = BUFFER_OBJ(buf->handle); @@ -68,7 +68,7 @@ bool buf_updates_register(buf_T *buf, uint64_t channel_id, if (line_count >= 1) { linedata.size = line_count; - linedata.items = xcalloc(sizeof(Object), line_count); + linedata.items = xcalloc(line_count, sizeof(Object)); buf_collect_lines(buf, line_count, 1, true, &linedata, NULL); } @@ -93,7 +93,7 @@ void buf_updates_send_end(buf_T *buf, uint64_t channelid) { Array args = ARRAY_DICT_INIT; args.size = 1; - args.items = xcalloc(sizeof(Object), args.size); + args.items = xcalloc(args.size, sizeof(Object)); args.items[0] = BUFFER_OBJ(buf->handle); rpc_send_event(channelid, "nvim_buf_detach_event", args); } @@ -211,7 +211,7 @@ void buf_updates_send_changes(buf_T *buf, // send through the changes now channel contents now Array args = ARRAY_DICT_INIT; args.size = 6; - args.items = xcalloc(sizeof(Object), args.size); + args.items = xcalloc(args.size, sizeof(Object)); // the first argument is always the buffer handle args.items[0] = BUFFER_OBJ(buf->handle); @@ -230,7 +230,7 @@ void buf_updates_send_changes(buf_T *buf, if (num_added > 0) { STATIC_ASSERT(SIZE_MAX >= MAXLNUM, "size_t smaller than MAXLNUM"); linedata.size = (size_t)num_added; - linedata.items = xcalloc(sizeof(Object), (size_t)num_added); + linedata.items = xcalloc((size_t)num_added, sizeof(Object)); buf_collect_lines(buf, (size_t)num_added, firstline, true, &linedata, NULL); } @@ -394,7 +394,7 @@ void buf_updates_changedtick_single(buf_T *buf, uint64_t channel_id) { Array args = ARRAY_DICT_INIT; args.size = 2; - args.items = xcalloc(sizeof(Object), args.size); + args.items = xcalloc(args.size, sizeof(Object)); // the first argument is always the buffer handle args.items[0] = BUFFER_OBJ(buf->handle); diff --git a/src/nvim/change.c b/src/nvim/change.c index ca1ca756bb..b30490deca 100644 --- a/src/nvim/change.c +++ b/src/nvim/change.c @@ -779,7 +779,7 @@ int del_bytes(colnr_T count, bool fixpos_arg, bool use_delcombine) int movelen = oldlen - col - count + 1; // includes trailing NUL if (movelen <= 1) { // If we just took off the last character of a non-blank line, and - // fixpos is TRUE, we don't want to end up positioned at the NUL, + // fixpos is true, we don't want to end up positioned at the NUL, // unless "restart_edit" is set or 'virtualedit' contains "onemore". if (col > 0 && fixpos && restart_edit == 0 && (ve_flags & VE_ONEMORE) == 0 diff --git a/src/nvim/digraph.c b/src/nvim/digraph.c index dd32cef1e3..07e484c178 100644 --- a/src/nvim/digraph.c +++ b/src/nvim/digraph.c @@ -1502,10 +1502,10 @@ char_u *get_digraph_for_char(int val_arg) /// Get a digraph. Used after typing CTRL-K on the command line or in normal /// mode. /// -/// @param cmdline TRUE when called from the cmdline +/// @param cmdline true when called from the cmdline /// /// @returns composed character, or NUL when ESC was used. -int get_digraph(int cmdline) +int get_digraph(bool cmdline) { int cc; no_mapping++; diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 0e7d7c2dc2..dc096bdb93 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -2887,7 +2887,6 @@ void ex_append(exarg_T *eap) } else if (lnum > 0) indent = get_indent_lnum(lnum); } - ex_keep_indent = FALSE; if (eap->getline == NULL) { /* No getline() function, use the lines that follow. This ends * when there is no more. */ @@ -2915,10 +2914,6 @@ void ex_append(exarg_T *eap) if (theline == NULL) break; - /* Using ^ CTRL-D in getexmodeline() makes us repeat the indent. */ - if (ex_keep_indent) - append_indent = indent; - /* Look for the "." after automatic indent. */ vcol = 0; for (p = theline; indent > vcol; ++p) { @@ -3751,6 +3746,7 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, */ while (subflags.do_ask) { if (exmode_active) { + char *prompt; char_u *resp; colnr_T sc, ec; @@ -3767,13 +3763,14 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, sc += numw; ec += numw; } - msg_start(); - for (i = 0; i < (long)sc; ++i) - msg_putchar(' '); - for (; i <= (long)ec; ++i) - msg_putchar('^'); - resp = getexmodeline('?', NULL, 0, true); + prompt = xmallocz(ec + 1); + memset(prompt, ' ', sc); + memset(prompt + sc, '^', ec - sc + 1); + resp = (char_u *)getcmdline_prompt(NUL, prompt, 0, EXPAND_NOTHING, + NULL, CALLBACK_NONE); + msg_putchar('\n'); + xfree(prompt); if (resp != NULL) { typed = *resp; xfree(resp); diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 83472fe146..cf604c2015 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -186,17 +186,14 @@ static void restore_dbg_stuff(struct dbg_stuff *dsp) } /// Repeatedly get commands for Ex mode, until the ":vi" command is given. -void do_exmode(int improved) +void do_exmode(void) { int save_msg_scroll; int prev_msg_row; linenr_T prev_line; int changedtick; - if (improved) - exmode_active = EXMODE_VIM; - else - exmode_active = EXMODE_NORMAL; + exmode_active = true; State = NORMAL; /* When using ":global /pat/ visual" and then "Q" we return to continue @@ -212,7 +209,7 @@ void do_exmode(int improved) while (exmode_active) { /* Check for a ":normal" command and no more characters left. */ if (ex_normal_busy > 0 && typebuf.tb_len == 0) { - exmode_active = 0; + exmode_active = false; break; } msg_scroll = true; @@ -750,8 +747,7 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline, * the :endtry to be missed. */ && (cstack.cs_trylevel == 0 || did_emsg_syntax) && used_getline - && (getline_equal(fgetline, cookie, getexmodeline) - || getline_equal(fgetline, cookie, getexline))) + && getline_equal(fgetline, cookie, getexline)) && (next_cmdline != NULL || cstack.cs_idx >= 0 || (flags & DOCMD_REPEAT))); @@ -2056,8 +2052,7 @@ int parse_command_modifiers(exarg_T *eap, char_u **errormsg, bool skip_only) // in ex mode, an empty line works like :+ if (*eap->cmd == NUL && exmode_active - && (getline_equal(eap->getline, eap->cookie, getexmodeline) - || getline_equal(eap->getline, eap->cookie, getexline)) + && getline_equal(eap->getline, eap->cookie, getexline) && curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count) { eap->cmd = (char_u *)"+"; if (!skip_only) { @@ -7303,7 +7298,7 @@ do_exedit( */ if (exmode_active && (eap->cmdidx == CMD_visual || eap->cmdidx == CMD_view)) { - exmode_active = 0; + exmode_active = false; ex_pressedreturn = false; if (*eap->arg == NUL) { /* Special case: ":global/pat/visual\NLvi-commands" */ diff --git a/src/nvim/ex_docmd.h b/src/nvim/ex_docmd.h index f6bd2adcd5..c8c5a0a3e2 100644 --- a/src/nvim/ex_docmd.h +++ b/src/nvim/ex_docmd.h @@ -16,10 +16,6 @@ #define VALID_PATH 1 #define VALID_HEAD 2 -/* Values for exmode_active (0 is no exmode) */ -#define EXMODE_NORMAL 1 -#define EXMODE_VIM 2 - // Structure used to save the current state. Used when executing Normal mode // commands while in any other mode. typedef struct { diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 4ebd384ae0..855f71ca28 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -2510,266 +2510,6 @@ getexline( return getcmdline(c, 1L, indent, do_concat); } -/* - * Get an Ex command line for Ex mode. - * In Ex mode we only use the OS supplied line editing features and no - * mappings or abbreviations. - * Returns a string in allocated memory or NULL. - */ -char_u * -getexmodeline( - int promptc, // normally ':', NUL for ":append" and '?' - // for :s prompt - void *cookie, - int indent, // indent for inside conditionals - bool do_concat -) -{ - garray_T line_ga; - char_u *pend; - int startcol = 0; - int c1 = 0; - int escaped = FALSE; /* CTRL-V typed */ - int vcol = 0; - char_u *p; - int prev_char; - int len; - - /* always start in column 0; write a newline if necessary */ - compute_cmdrow(); - if ((msg_col || msg_didout) && promptc != '?') - msg_putchar('\n'); - if (promptc == ':') { - /* indent that is only displayed, not in the line itself */ - if (p_prompt) - msg_putchar(':'); - while (indent-- > 0) - msg_putchar(' '); - startcol = msg_col; - } - - ga_init(&line_ga, 1, 30); - - /* autoindent for :insert and :append is in the line itself */ - if (promptc <= 0) { - vcol = indent; - while (indent >= 8) { - ga_append(&line_ga, TAB); - msg_puts(" "); - indent -= 8; - } - while (indent-- > 0) { - ga_append(&line_ga, ' '); - msg_putchar(' '); - } - } - no_mapping++; - - /* - * Get the line, one character at a time. - */ - got_int = FALSE; - while (!got_int) { - ga_grow(&line_ga, 40); - - /* Get one character at a time. Don't use inchar(), it can't handle - * special characters. */ - prev_char = c1; - - // Check for a ":normal" command and no more characters left. - if (ex_normal_busy > 0 && typebuf.tb_len == 0) { - c1 = '\n'; - } else { - c1 = vgetc(); - } - - /* - * Handle line editing. - * Previously this was left to the system, putting the terminal in - * cooked mode, but then CTRL-D and CTRL-T can't be used properly. - */ - if (got_int) { - msg_putchar('\n'); - break; - } - - if (!escaped) { - /* CR typed means "enter", which is NL */ - if (c1 == '\r') - c1 = '\n'; - - if (c1 == BS || c1 == K_BS || c1 == DEL || c1 == K_DEL || c1 == K_KDEL) { - if (!GA_EMPTY(&line_ga)) { - p = (char_u *)line_ga.ga_data; - p[line_ga.ga_len] = NUL; - len = utf_head_off(p, p + line_ga.ga_len - 1) + 1; - line_ga.ga_len -= len; - goto redraw; - } - continue; - } - - if (c1 == Ctrl_U) { - msg_col = startcol; - msg_clr_eos(); - line_ga.ga_len = 0; - goto redraw; - } - - int num_spaces; - if (c1 == Ctrl_T) { - int sw = get_sw_value(curbuf); - - p = (char_u *)line_ga.ga_data; - p[line_ga.ga_len] = NUL; - indent = get_indent_str(p, 8, FALSE); - num_spaces = sw - indent % sw; -add_indent: - if (num_spaces > 0) { - ga_grow(&line_ga, num_spaces + 1); - p = (char_u *)line_ga.ga_data; - char_u *s = skipwhite(p); - - // Insert spaces after leading whitespaces. - long move_len = line_ga.ga_len - (s - p) + 1; - assert(move_len >= 0); - memmove(s + num_spaces, s, (size_t)move_len); - memset(s, ' ', (size_t)num_spaces); - - line_ga.ga_len += num_spaces; - } -redraw: - /* redraw the line */ - msg_col = startcol; - vcol = 0; - p = (char_u *)line_ga.ga_data; - p[line_ga.ga_len] = NUL; - while (p < (char_u *)line_ga.ga_data + line_ga.ga_len) { - if (*p == TAB) { - do { - msg_putchar(' '); - } while (++vcol % 8); - p++; - } else { - len = utfc_ptr2len(p); - msg_outtrans_len(p, len); - vcol += ptr2cells(p); - p += len; - } - } - msg_clr_eos(); - cmd_cursor_goto(msg_row, msg_col); - continue; - } - - if (c1 == Ctrl_D) { - /* Delete one shiftwidth. */ - p = (char_u *)line_ga.ga_data; - if (prev_char == '0' || prev_char == '^') { - if (prev_char == '^') - ex_keep_indent = TRUE; - indent = 0; - p[--line_ga.ga_len] = NUL; - } else { - p[line_ga.ga_len] = NUL; - indent = get_indent_str(p, 8, FALSE); - if (indent == 0) { - continue; - } - --indent; - indent -= indent % get_sw_value(curbuf); - } - - // reduce the line's indentation - char_u *from = skipwhite(p); - char_u *to = from; - int old_indent; - while ((old_indent = get_indent_str(p, 8, FALSE)) > indent) { - *--to = NUL; - } - long move_len = line_ga.ga_len - (from - p) + 1; - assert(move_len > 0); - memmove(to, from, (size_t)move_len); - line_ga.ga_len -= (int)(from - to); - - // Removed to much indentation, fix it before redrawing. - num_spaces = indent - old_indent; - goto add_indent; - } - - if (c1 == Ctrl_V || c1 == Ctrl_Q) { - escaped = TRUE; - continue; - } - - if (IS_SPECIAL(c1)) { - // Ignore other special key codes - continue; - } - } - - if (IS_SPECIAL(c1)) { - c1 = '?'; - } - len = utf_char2bytes(c1, (char_u *)line_ga.ga_data + line_ga.ga_len); - if (c1 == '\n') { - msg_putchar('\n'); - } else if (c1 == TAB) { - // Don't use chartabsize(), 'ts' can be different. - do { - msg_putchar(' '); - } while (++vcol % 8); - } else { - msg_outtrans_len(((char_u *)line_ga.ga_data) + line_ga.ga_len, len); - vcol += char2cells(c1); - } - line_ga.ga_len += len; - escaped = FALSE; - - cmd_cursor_goto(msg_row, msg_col); - pend = (char_u *)(line_ga.ga_data) + line_ga.ga_len; - - /* We are done when a NL is entered, but not when it comes after an - * odd number of backslashes, that results in a NUL. */ - if (!GA_EMPTY(&line_ga) && pend[-1] == '\n') { - int bcount = 0; - - while (line_ga.ga_len - 2 >= bcount && pend[-2 - bcount] == '\\') - ++bcount; - - if (bcount > 0) { - /* Halve the number of backslashes: "\NL" -> "NUL", "\\NL" -> - * "\NL", etc. */ - line_ga.ga_len -= (bcount + 1) / 2; - pend -= (bcount + 1) / 2; - pend[-1] = '\n'; - } - - if ((bcount & 1) == 0) { - --line_ga.ga_len; - --pend; - *pend = NUL; - break; - } - } - } - - no_mapping--; - - /* make following messages go to the next line */ - msg_didout = FALSE; - msg_col = 0; - if (msg_row < Rows - 1) { - msg_row++; - } - emsg_on_display = false; // don't want os_delay() - - if (got_int) - ga_clear(&line_ga); - - return (char_u *)line_ga.ga_data; -} - bool cmdline_overstrike(void) { return ccline.overstrike; @@ -6469,7 +6209,7 @@ static int open_cmdwin(void) char_u typestr[2]; int save_restart_edit = restart_edit; int save_State = State; - int save_exmode = exmode_active; + bool save_exmode = exmode_active; int save_cmdmsg_rl = cmdmsg_rl; /* Can't do this recursively. Can't do it when typing a password. */ @@ -6563,7 +6303,7 @@ static int open_cmdwin(void) save_cmdline(&save_ccline); // No Ex mode here! - exmode_active = 0; + exmode_active = false; State = NORMAL; setmouse(); diff --git a/src/nvim/generators/gen_options.lua b/src/nvim/generators/gen_options.lua index d80a6219eb..9f91160034 100644 --- a/src/nvim/generators/gen_options.lua +++ b/src/nvim/generators/gen_options.lua @@ -69,8 +69,6 @@ local get_flags = function(o) {'alloced'}, {'nodefault'}, {'no_mkrc'}, - {'vi_def'}, - {'vim'}, {'secure'}, {'gettext'}, {'noglob'}, @@ -120,8 +118,11 @@ local get_value = function(v) return '(char_u *) ' .. value_dumpers[type(v)](v) end -local get_defaults = function(d) - return ('{' .. get_value(d.vi) .. ', ' .. get_value(d.vim) .. '}') +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") + end + return get_value(d.vim or d.vi) end local defines = {} @@ -170,11 +171,11 @@ local dump_option = function(i, o) if o.defaults.condition then w(get_cond(o.defaults.condition)) end - w(' .def_val=' .. get_defaults(o.defaults.if_true)) + w(' .def_val=' .. get_defaults(o.defaults.if_true, o.full_name)) if o.defaults.condition then if o.defaults.if_false then w('#else') - w(' .def_val=' .. get_defaults(o.defaults.if_false)) + w(' .def_val=' .. get_defaults(o.defaults.if_false, o.full_name)) end w('#endif') end diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index 538ebf7978..b0d06b7a30 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -2230,20 +2230,22 @@ static int vgetorpeek(bool advance) timedout = true; continue; } - /* When 'insertmode' is set, ESC just beeps in Insert - * mode. Use CTRL-L to make edit() return. - * For the command line only CTRL-C always breaks it. - * For the cmdline window: Alternate between ESC and - * CTRL-C: ESC for most situations and CTRL-C to close the - * cmdline window. */ - if (p_im && (State & INSERT)) + // When 'insertmode' is set, ESC just beeps in Insert + // mode. Use CTRL-L to make edit() return. + // In Ex-mode \n is compatible with original Vim behaviour. + // For the command line only CTRL-C always breaks it. + // For the cmdline window: Alternate between ESC and + // CTRL-C: ESC for most situations and CTRL-C to close the + // cmdline window. + if (p_im && (State & INSERT)) { c = Ctrl_L; - else if ((State & CMDLINE) - || (cmdwin_type > 0 && tc == ESC) - ) + } else if (exmode_active) { + c = '\n'; + } else if ((State & CMDLINE) || (cmdwin_type > 0 && tc == ESC)) { c = Ctrl_C; - else + } else { c = ESC; + } tc = c; break; } diff --git a/src/nvim/globals.h b/src/nvim/globals.h index 9fd5ccf324..bbc936cf16 100644 --- a/src/nvim/globals.h +++ b/src/nvim/globals.h @@ -239,7 +239,6 @@ EXTERN int did_wait_return INIT(= false); // wait_return() was used and EXTERN int need_maketitle INIT(= true); // call maketitle() soon EXTERN int quit_more INIT(= false); // 'q' hit at "--more--" msg -EXTERN int ex_keep_indent INIT(= false); // getexmodeline(): keep indent EXTERN int vgetc_busy INIT(= 0); // when inside vgetc() then > 0 EXTERN int didset_vim INIT(= false); // did set $VIM ourselves @@ -621,7 +620,7 @@ EXTERN long opcount INIT(= 0); // count for pending operator EXTERN int motion_force INIT(=0); // motion force for pending operator // Ex Mode (Q) state -EXTERN int exmode_active INIT(= 0); // Zero, EXMODE_NORMAL or EXMODE_VIM. +EXTERN bool exmode_active INIT(= false); // true if Ex mode is active EXTERN int ex_no_reprint INIT(=false); // No need to print after z or p. EXTERN int reg_recording INIT(= 0); // register for recording or zero diff --git a/src/nvim/highlight.c b/src/nvim/highlight.c index 79e474fa2e..29ee7aae56 100644 --- a/src/nvim/highlight.c +++ b/src/nvim/highlight.c @@ -46,7 +46,7 @@ void highlight_init(void) .id1 = 0, .id2 = 0 })); } -/// @return TRUE if hl table was reset +/// @return true if hl table was reset bool highlight_use_hlstate(void) { if (hlstate_active) { diff --git a/src/nvim/indent.c b/src/nvim/indent.c index 8fa61515ef..c1f9c1e172 100644 --- a/src/nvim/indent.c +++ b/src/nvim/indent.c @@ -62,10 +62,10 @@ int get_indent_buf(buf_T *buf, linenr_T lnum) } -// Count the size (in window cells) of the indent in line "ptr", with -// 'tabstop' at "ts". -// If @param list is TRUE, count only screen size for tabs. -int get_indent_str(const char_u *ptr, int ts, int list) +/// Count the size (in window cells) of the indent in line "ptr", with +/// 'tabstop' at "ts". +/// If @param list is true, count only screen size for tabs. +int get_indent_str(const char_u *ptr, int ts, bool list) FUNC_ATTR_NONNULL_ALL { int count = 0; @@ -91,9 +91,9 @@ int get_indent_str(const char_u *ptr, int ts, int list) return count; } -// Count the size (in window cells) of the indent in line "ptr", using -// variable tabstops. -// if "list" is true, count only screen size for tabs. +/// Count the size (in window cells) of the indent in line "ptr", using +/// variable tabstops. +/// if "list" is true, count only screen size for tabs. int get_indent_str_vtab(const char_u *ptr, long ts, long *vts, bool list) { int count = 0; diff --git a/src/nvim/keymap.c b/src/nvim/keymap.c index 6dacace0a4..277b9ade89 100644 --- a/src/nvim/keymap.c +++ b/src/nvim/keymap.c @@ -543,7 +543,7 @@ unsigned int trans_special(const char_u **srcp, const size_t src_len, /// Put the character sequence for "key" with "modifiers" into "dst" and return /// the resulting length. -/// When "keycode" is TRUE prefer key code, e.g. K_DEL instead of DEL. +/// When "keycode" is true prefer key code, e.g. K_DEL instead of DEL. /// The sequence is not NUL terminated. /// This is how characters in a string are encoded. unsigned int special_to_buf(int key, int modifiers, bool keycode, char_u *dst) diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c index b6d1b5fda4..5799c3ee98 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -45,6 +45,9 @@ static int in_fast_callback = 0; +// Initialized in nlua_init(). +static lua_State *global_lstate = NULL; + typedef struct { Error err; String lua_err_str; @@ -250,7 +253,7 @@ static int nlua_luv_cfpcall(lua_State *lstate, int nargs, int nresult, static void nlua_schedule_event(void **argv) { LuaRef cb = (LuaRef)(ptrdiff_t)argv[0]; - lua_State *const lstate = nlua_enter(); + lua_State *const lstate = global_lstate; nlua_pushref(lstate, cb); nlua_unref(lstate, cb); if (lua_pcall(lstate, 0, 0, 0)) { @@ -553,14 +556,10 @@ static int nlua_state_init(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL return 0; } -/// Initialize lua interpreter +/// Initialize global lua interpreter /// -/// Crashes Nvim if initialization fails. Should be called once per lua -/// interpreter instance. -/// -/// @return New lua interpreter instance. -static lua_State *nlua_init(void) - FUNC_ATTR_NONNULL_RET FUNC_ATTR_WARN_UNUSED_RESULT +/// Crashes Nvim if initialization fails. +void nlua_init(void) { #ifdef NLUA_TRACK_REFS const char *env = os_getenv("NVIM_LUA_NOTRACK"); @@ -577,28 +576,9 @@ static lua_State *nlua_init(void) luaL_openlibs(lstate); nlua_state_init(lstate); - return lstate; + global_lstate = lstate; } -// only to be used by nlua_enter and nlua_free_all_mem! -static lua_State *global_lstate = NULL; - -/// Enter lua interpreter -/// -/// Calls nlua_init() if needed. Is responsible for pre-lua call initialization -/// like updating `package.[c]path` with directories derived from &runtimepath. -/// -/// @return Interpreter instance to use. Will either be initialized now or -/// taken from previous initialization. -static lua_State *nlua_enter(void) - FUNC_ATTR_NONNULL_RET FUNC_ATTR_WARN_UNUSED_RESULT -{ - if (global_lstate == NULL) { - global_lstate = nlua_init(); - } - lua_State *const lstate = global_lstate; - return lstate; -} void nlua_free_all_mem(void) { @@ -1043,8 +1023,7 @@ void nlua_unref(lua_State *lstate, LuaRef ref) void api_free_luaref(LuaRef ref) { - lua_State *const lstate = nlua_enter(); - nlua_unref(lstate, ref); + nlua_unref(global_lstate, ref); } /// push a value referenced in the registry @@ -1064,7 +1043,7 @@ LuaRef api_new_luaref(LuaRef original_ref) return LUA_NOREF; } - lua_State *const lstate = nlua_enter(); + lua_State *const lstate = global_lstate; nlua_pushref(lstate, original_ref); LuaRef new_ref = nlua_ref(lstate, -1); lua_pop(lstate, 1); @@ -1143,7 +1122,7 @@ static void nlua_typval_exec(const char *lcmd, size_t lcmd_len, return; } - lua_State *const lstate = nlua_enter(); + lua_State *const lstate = global_lstate; if (luaL_loadbuffer(lstate, lcmd, lcmd_len, name)) { nlua_error(lstate, _("E5107: Error loading lua %.*s")); return; @@ -1233,7 +1212,7 @@ int typval_exec_lua_callable( /// @return Return value of the execution. Object nlua_exec(const String str, const Array args, Error *err) { - lua_State *const lstate = nlua_enter(); + lua_State *const lstate = global_lstate; if (luaL_loadbuffer(lstate, str.data, str.size, "<nvim>")) { size_t len; @@ -1270,7 +1249,7 @@ Object nlua_exec(const String str, const Array args, Error *err) Object nlua_call_ref(LuaRef ref, const char *name, Array args, bool retval, Error *err) { - lua_State *const lstate = nlua_enter(); + lua_State *const lstate = global_lstate; nlua_pushref(lstate, ref); int nargs = (int)args.size; if (name != NULL) { @@ -1346,7 +1325,7 @@ void ex_luado(exarg_T *const eap) const char *const cmd = (const char *)eap->arg; const size_t cmd_len = strlen(cmd); - lua_State *const lstate = nlua_enter(); + lua_State *const lstate = global_lstate; #define DOSTART "return function(line, linenr) " #define DOEND " end" @@ -1431,7 +1410,7 @@ void ex_luafile(exarg_T *const eap) bool nlua_exec_file(const char *path) FUNC_ATTR_NONNULL_ALL { - lua_State *const lstate = nlua_enter(); + lua_State *const lstate = global_lstate; if (luaL_loadfile(lstate, path)) { nlua_error(lstate, _("E5112: Error while creating lua chunk: %.*s")); @@ -1480,7 +1459,7 @@ int nlua_expand_pat(expand_T *xp, int *num_results, char_u ***results) { - lua_State *const lstate = nlua_enter(); + lua_State *const lstate = global_lstate; int ret = OK; // [ vim ] @@ -1690,7 +1669,7 @@ int nlua_CFunction_func_call( typval_T *rettv, void *state) { - lua_State *const lstate = nlua_enter(); + lua_State *const lstate = global_lstate; LuaCFunctionState *funcstate = (LuaCFunctionState *)state; return typval_exec_lua_callable(lstate, funcstate->lua_callable, @@ -1699,7 +1678,7 @@ int nlua_CFunction_func_call( void nlua_CFunction_func_free(void *state) { - lua_State *const lstate = nlua_enter(); + lua_State *const lstate = global_lstate; LuaCFunctionState *funcstate = (LuaCFunctionState *)state; nlua_unref(lstate, funcstate->lua_callable.func_ref); @@ -1730,7 +1709,7 @@ char_u *nlua_register_table_as_callable(typval_T *const arg) return NULL; } - lua_State *const lstate = nlua_enter(); + lua_State *const lstate = global_lstate; #ifndef NDEBUG int top = lua_gettop(lstate); @@ -1769,7 +1748,7 @@ void nlua_execute_log_keystroke(int c) char_u buf[NUMBUFLEN]; size_t buf_len = special_to_buf(c, mod_mask, false, buf); - lua_State *const lstate = nlua_enter(); + lua_State *const lstate = global_lstate; #ifndef NDEBUG int top = lua_gettop(lstate); diff --git a/src/nvim/main.c b/src/nvim/main.c index 16700d20ab..ed40da5866 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -7,8 +7,6 @@ #include <string.h> #include <stdbool.h> -#include <lua.h> -#include <lauxlib.h> #include <msgpack.h> #include "nvim/ascii.h" @@ -258,6 +256,8 @@ int main(int argc, char **argv) // Check if we have an interactive window. check_and_set_isatty(¶ms); + nlua_init(); + // Process the command line arguments. File names are put in the global // argument list "global_alist". command_line_scan(¶ms); @@ -318,7 +318,8 @@ int main(int argc, char **argv) debug_break_level = params.use_debug_break_level; // Read ex-commands if invoked with "-es". - if (!params.input_isatty && silent_mode && exmode_active == EXMODE_NORMAL) { + if (!params.input_isatty && !params.input_neverscript + && silent_mode && exmode_active) { input_start(STDIN_FILENO); } @@ -341,7 +342,6 @@ int main(int argc, char **argv) TIME_MSG("initialized screen early for UI"); } - // open terminals when opening files that start with term:// #define PROTO "term://" do_cmdline_cmd("augroup nvim_terminal"); @@ -372,6 +372,11 @@ int main(int argc, char **argv) // If using the runtime (-u is not NONE), enable syntax & filetype plugins. if (params.use_vimrc == NULL || !strequal(params.use_vimrc, "NONE")) { + // Source syncolor.vim to set up default UI highlights if the user didn't + // already enable a colorscheme + if (!get_var_value("g:colors_name")) { + source_runtime((char_u *)"syntax/syncolor.vim", DIP_ALL); + } // Does ":filetype plugin indent on". filetype_maybe_enable(); // Sources syntax/syntax.vim, which calls `:filetype on`. @@ -765,7 +770,7 @@ static bool edit_stdin(bool explicit, mparm_T *parmp) { bool implicit = !headless_mode && !embedded_mode - && exmode_active != EXMODE_NORMAL // -E/-Es but not -e/-es. + && (!exmode_active || parmp->input_neverscript) && !parmp->input_isatty && scriptin[0] == NULL; // `-s -` was not given. return explicit || implicit; @@ -908,11 +913,12 @@ static void command_line_scan(mparm_T *parmp) break; } case 'e': { // "-e" Ex mode - exmode_active = EXMODE_NORMAL; + exmode_active = true; break; } case 'E': { // "-E" Ex mode - exmode_active = EXMODE_VIM; + exmode_active = true; + parmp->input_neverscript = true; break; } case 'f': { // "-f" GUI: run in foreground. diff --git a/src/nvim/main.h b/src/nvim/main.h index 61252f2bce..d387e6d668 100644 --- a/src/nvim/main.h +++ b/src/nvim/main.h @@ -30,6 +30,7 @@ typedef struct { bool input_isatty; // stdin is a terminal bool output_isatty; // stdout is a terminal bool err_isatty; // stderr is a terminal + bool input_neverscript; // never treat stdin as script (-E/-Es) int no_swap_file; // "-n" argument used int use_debug_break_level; int window_count; // number of windows to use diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c index 73e3ba53a5..9cd57affb9 100644 --- a/src/nvim/mbyte.c +++ b/src/nvim/mbyte.c @@ -2354,10 +2354,8 @@ int convert_setup(vimconv_T *vcp, char_u *from, char_u *to) return convert_setup_ext(vcp, from, true, to, true); } -/* - * As convert_setup(), but only when from_unicode_is_utf8 is TRUE will all - * "from" unicode charsets be considered utf-8. Same for "to". - */ +/// As convert_setup(), but only when from_unicode_is_utf8 is true will all +/// "from" unicode charsets be considered utf-8. Same for "to". int convert_setup_ext(vimconv_T *vcp, char_u *from, bool from_unicode_is_utf8, char_u *to, bool to_unicode_is_utf8) { diff --git a/src/nvim/memfile_defs.h b/src/nvim/memfile_defs.h index 2402d2147d..3eaa7d83e0 100644 --- a/src/nvim/memfile_defs.h +++ b/src/nvim/memfile_defs.h @@ -101,7 +101,7 @@ typedef struct memfile { blocknr_T mf_neg_count; /// number of negative blocks numbers blocknr_T mf_infile_count; /// number of pages in the file unsigned mf_page_size; /// number of bytes in a page - bool mf_dirty; /// TRUE if there are dirty blocks + bool mf_dirty; /// true if there are dirty blocks } memfile_T; #endif // NVIM_MEMFILE_DEFS_H diff --git a/src/nvim/message.c b/src/nvim/message.c index ec5dabbbc0..3ab4ad5287 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -1324,9 +1324,8 @@ void msg_start(void) 0; } else if (msg_didout) { // start message on next line msg_putchar('\n'); - did_return = TRUE; - if (exmode_active != EXMODE_NORMAL) - cmdline_row = msg_row; + did_return = true; + cmdline_row = msg_row; } if (!msg_didany || lines_left < 0) msg_starthere(); diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c index 38d0a7dadf..19239036fd 100644 --- a/src/nvim/misc1.c +++ b/src/nvim/misc1.c @@ -750,8 +750,8 @@ get_number ( stuffcharReadbuff(':'); if (!exmode_active) cmdline_row = msg_row; - skip_redraw = TRUE; /* skip redraw once */ - do_redraw = FALSE; + skip_redraw = true; // skip redraw once + do_redraw = false; break; } else if (c == Ctrl_C || c == ESC || c == 'q') { n = 0; diff --git a/src/nvim/mouse.c b/src/nvim/mouse.c index 4c0339e5f4..f1ad0ed105 100644 --- a/src/nvim/mouse.c +++ b/src/nvim/mouse.c @@ -570,9 +570,8 @@ static linenr_T find_longest_lnum(void) return ret; } -/// -/// Do a horizontal scroll. Return TRUE if the cursor moved, FALSE otherwise. -/// +/// Do a horizontal scroll. +/// @return true if the cursor moved, false otherwise. bool mouse_scroll_horiz(int dir) { if (curwin->w_p_wrap) { diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 74a3d74860..4213e6f946 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -1188,7 +1188,7 @@ static void normal_check_interrupt(NormalState *s) && s->previous_got_int) { // Typed two CTRL-C in a row: go back to ex mode as if "Q" was // used and keep "got_int" set, so that it aborts ":g". - exmode_active = EXMODE_NORMAL; + exmode_active = true; State = NORMAL; } else if (!global_busy || !exmode_active) { if (!quit_more) { @@ -1340,7 +1340,7 @@ static int normal_check(VimState *state) quit_more = false; // If skip redraw is set (for ":" in wait_return()), don't redraw now. - // If there is nothing in the stuff_buffer or do_redraw is TRUE, + // If there is nothing in the stuff_buffer or do_redraw is true, // update cursor and redraw. if (skip_redraw || exmode_active) { skip_redraw = false; @@ -1398,7 +1398,7 @@ static int normal_check(VimState *state) if (s->noexmode) { return 0; } - do_exmode(exmode_active == EXMODE_VIM); + do_exmode(); return -1; } @@ -4652,7 +4652,7 @@ static void nv_exmode(cmdarg_T *cap) if (VIsual_active) { vim_beep(BO_EX); } else if (!checkclearop(cap->oap)) { - do_exmode(false); + do_exmode(); } } @@ -7101,8 +7101,9 @@ static void nv_g_cmd(cmdarg_T *cap) break; } - if (!checkclearopq(oap)) - do_exmode(true); + if (!checkclearopq(oap)) { + do_exmode(); + } break; case ',': @@ -8146,10 +8147,8 @@ static void nv_event(cmdarg_T *cap) } } -/* - * Return TRUE when 'mousemodel' is set to "popup" or "popup_setpos". - */ -static int mouse_model_popup(void) +/// @return true when 'mousemodel' is set to "popup" or "popup_setpos". +static bool mouse_model_popup(void) { return p_mousem[0] == 'p'; } diff --git a/src/nvim/option.c b/src/nvim/option.c index 0a8a60701a..f67cfd109b 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -16,8 +16,6 @@ // - If it's a numeric option, add any necessary bounds checks to // set_num_option(). // - If it's a list of flags, add some code in do_set(), search for WW_ALL. -// - When adding an option with expansion (P_EXPAND), but with a different -// default for Vi and Vim (no P_VI_DEF), add some code at VIMEXP. // - Add documentation! doc/options.txt, and any other related places. // - Add an entry in runtime/optwin.vim. @@ -208,12 +206,10 @@ typedef struct vimoption { // buffer-local option: global value idopt_T indir; // global option: PV_NONE; // local option: indirect option index - char_u *def_val[2]; // default values for variable (vi and vim) + char_u *def_val; // default values for variable (neovim!!) LastSet last_set; // script in which the option was last set } vimoption_T; -#define VI_DEFAULT 0 // def_val[VI_DEFAULT] is Vi default value -#define VIM_DEFAULT 1 // def_val[VIM_DEFAULT] is Vim default value /* * Flags @@ -232,8 +228,6 @@ typedef struct vimoption { // use free() when assigning new value #define P_WAS_SET 0x100U // option has been set/reset #define P_NO_MKRC 0x200U // don't include in :mkvimrc output -#define P_VI_DEF 0x400U // Use Vi default for Vim -#define P_VIM 0x800U // Vim option // when option changed, what to display: #define P_RSTAT 0x1000U ///< redraw status lines @@ -459,7 +453,7 @@ void set_init_1(bool clean_arg) buf[j] = NUL; opt_idx = findoption("cdpath"); if (opt_idx >= 0) { - options[opt_idx].def_val[VI_DEFAULT] = buf; + options[opt_idx].def_val = buf; options[opt_idx].flags |= P_DEF_ALLOCED; } else { xfree(buf); // cannot happen @@ -527,7 +521,7 @@ void set_init_1(bool clean_arg) check_win_options(curwin); check_options(); - // Set all options to their Vim default + // Set all options to their default value set_options_default(OPT_FREE); // set 'laststatus' @@ -563,15 +557,10 @@ void set_init_1(bool clean_arg) if (p != NULL) { p = xstrdup(p); *(char **)options[opt_idx].var = p; - /* VIMEXP - * Defaults for all expanded options are currently the same for Vi - * and Vim. When this changes, add some code here! Also need to - * split P_DEF_ALLOCED in two. - */ if (options[opt_idx].flags & P_DEF_ALLOCED) { - xfree(options[opt_idx].def_val[VI_DEFAULT]); + xfree(options[opt_idx].def_val); } - options[opt_idx].def_val[VI_DEFAULT] = (char_u *)p; + options[opt_idx].def_val = (char_u *)p; options[opt_idx].flags |= P_DEF_ALLOCED; } } @@ -614,39 +603,34 @@ void set_init_1(bool clean_arg) /// Set an option to its default value. /// This does not take care of side effects! -static void -set_option_default( - int opt_idx, - int opt_flags, // OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL - int compatible // use Vi default value -) +/// +/// @param opt_flags OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL +static void set_option_default(int opt_idx, int opt_flags) { char_u *varp; // pointer to variable for current option - int dvi; // index in def_val[] int both = (opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0; varp = get_varp_scope(&(options[opt_idx]), both ? OPT_LOCAL : opt_flags); uint32_t flags = options[opt_idx].flags; if (varp != NULL) { // skip hidden option, nothing to do for it - dvi = ((flags & P_VI_DEF) || compatible) ? VI_DEFAULT : VIM_DEFAULT; if (flags & P_STRING) { /* Use set_string_option_direct() for local options to handle * freeing and allocating the value. */ if (options[opt_idx].indir != PV_NONE) { set_string_option_direct(NULL, opt_idx, - options[opt_idx].def_val[dvi], opt_flags, 0); + options[opt_idx].def_val, opt_flags, 0); } else { if ((opt_flags & OPT_FREE) && (flags & P_ALLOCED)) { free_string_option(*(char_u **)(varp)); } - *(char_u **)varp = options[opt_idx].def_val[dvi]; + *(char_u **)varp = options[opt_idx].def_val; options[opt_idx].flags &= ~P_ALLOCED; } } else if (flags & P_NUM) { if (options[opt_idx].indir == PV_SCROLL) { win_comp_scroll(curwin); } else { - long def_val = (long)options[opt_idx].def_val[dvi]; + long def_val = (long)options[opt_idx].def_val; if ((long *)varp == &curwin->w_p_so || (long *)varp == &curwin->w_p_siso) { // 'scrolloff' and 'sidescrolloff' local values have a @@ -662,7 +646,7 @@ set_option_default( } } } else { // P_BOOL - *(int *)varp = (int)(intptr_t)options[opt_idx].def_val[dvi]; + *(int *)varp = (int)(intptr_t)options[opt_idx].def_val; #ifdef UNIX // 'modeline' defaults to off for root if (options[opt_idx].indir == PV_ML && getuid() == ROOT_UID) { @@ -692,7 +676,7 @@ set_options_default( { for (int i = 0; options[i].fullname; i++) { if (!(options[i].flags & P_NODEFAULT)) { - set_option_default(i, opt_flags, false); + set_option_default(i, opt_flags); } } @@ -716,10 +700,10 @@ static void set_string_default(const char *name, char *val, bool allocated) int opt_idx = findoption(name); if (opt_idx >= 0) { if (options[opt_idx].flags & P_DEF_ALLOCED) { - xfree(options[opt_idx].def_val[VI_DEFAULT]); + xfree(options[opt_idx].def_val); } - options[opt_idx].def_val[VI_DEFAULT] = allocated + options[opt_idx].def_val = allocated ? (char_u *)val : (char_u *)xstrdup(val); options[opt_idx].flags |= P_DEF_ALLOCED; @@ -766,7 +750,7 @@ void set_number_default(char *name, long val) opt_idx = findoption(name); if (opt_idx >= 0) { - options[opt_idx].def_val[VI_DEFAULT] = (char_u *)(intptr_t)val; + options[opt_idx].def_val = (char_u *)(intptr_t)val; } } @@ -781,7 +765,7 @@ void free_all_options(void) free_string_option(*(char_u **)options[i].var); } if (options[i].flags & P_DEF_ALLOCED) { - free_string_option(options[i].def_val[VI_DEFAULT]); + free_string_option(options[i].def_val); } } else if (options[i].var != VAR_WIN && (options[i].flags & P_STRING)) { // buffer-local option: free global value @@ -804,7 +788,7 @@ void set_init_2(bool headless) // which results in the actual value computed from the window height. idx = findoption("scroll"); if (idx >= 0 && !(options[idx].flags & P_WAS_SET)) { - set_option_default(idx, OPT_LOCAL, false); + set_option_default(idx, OPT_LOCAL); } comp_col(); @@ -850,11 +834,11 @@ void set_init_3(void) ) { if (do_sp) { p_sp = (char_u *)"|& tee"; - options[idx_sp].def_val[VI_DEFAULT] = p_sp; + options[idx_sp].def_val = p_sp; } if (do_srr) { p_srr = (char_u *)">&"; - options[idx_srr].def_val[VI_DEFAULT] = p_srr; + options[idx_srr].def_val = p_srr; } } else if (fnamecmp(p, "sh") == 0 || fnamecmp(p, "ksh") == 0 @@ -870,11 +854,11 @@ void set_init_3(void) // Always use POSIX shell style redirection if we reach this if (do_sp) { p_sp = (char_u *)"2>&1| tee"; - options[idx_sp].def_val[VI_DEFAULT] = p_sp; + options[idx_sp].def_val = p_sp; } if (do_srr) { p_srr = (char_u *)">%s 2>&1"; - options[idx_srr].def_val[VI_DEFAULT] = p_srr; + options[idx_srr].def_val = p_srr; } } xfree(p); @@ -941,12 +925,12 @@ void set_title_defaults(void) */ idx1 = findoption("title"); if (idx1 >= 0 && !(options[idx1].flags & P_WAS_SET)) { - options[idx1].def_val[VI_DEFAULT] = (char_u *)(intptr_t)0; + options[idx1].def_val = (char_u *)(intptr_t)0; p_title = 0; } idx1 = findoption("icon"); if (idx1 >= 0 && !(options[idx1].flags & P_WAS_SET)) { - options[idx1].def_val[VI_DEFAULT] = (char_u *)(intptr_t)0; + options[idx1].def_val = (char_u *)(intptr_t)0; p_icon = 0; } } @@ -986,7 +970,6 @@ int do_set( int adding; // "opt+=arg" int prepending; // "opt^=arg" int removing; // "opt-=arg" - int cp_val = 0; if (*arg == NUL) { showoptions(0, opt_flags); @@ -1157,13 +1140,10 @@ int do_set( if (vim_strchr((char_u *)"?=:!&<", nextchar) != NULL) { arg += len; - cp_val = false; if (nextchar == '&' && arg[1] == 'v' && arg[2] == 'i') { - if (arg[3] == 'm') { // "opt&vim": set to Vim default - cp_val = false; + if (arg[3] == 'm') { // "opt&vim": set to Vim default arg += 3; - } else { // "opt&vi": set to Vi default - cp_val = true; + } else { // "opt&vi": set to Vi default arg += 2; } } @@ -1230,9 +1210,7 @@ int do_set( if (nextchar == '!') { value = *(int *)(varp) ^ 1; } else if (nextchar == '&') { - value = (int)(intptr_t)options[opt_idx].def_val[ - ((flags & P_VI_DEF) || cp_val) - ? VI_DEFAULT : VIM_DEFAULT]; + value = (int)(intptr_t)options[opt_idx].def_val; } else if (nextchar == '<') { // For 'autoread' -1 means to use global value. if ((int *)varp == &curbuf->b_p_ar @@ -1277,8 +1255,7 @@ int do_set( // other error arg++; if (nextchar == '&') { - value = (long)(intptr_t)options[opt_idx].def_val[ - ((flags & P_VI_DEF) || cp_val) ? VI_DEFAULT : VIM_DEFAULT]; + value = (long)(intptr_t)options[opt_idx].def_val; } else if (nextchar == '<') { // For 'undolevels' NO_LOCAL_UNDOLEVEL means to // use the global value. @@ -1355,14 +1332,12 @@ int do_set( origval = oldval; } - if (nextchar == '&') { // set to default val - newval = options[opt_idx].def_val[ - ((flags & P_VI_DEF) || cp_val) - ? VI_DEFAULT : VIM_DEFAULT]; - /* expand environment variables and ~ (since the - * default value was already expanded, only - * required when an environment variable was set - * later */ + if (nextchar == '&') { // set to default val + newval = options[opt_idx].def_val; + // expand environment variables and ~ (since the + // default value was already expanded, only + // required when an environment variable was set + // later new_value_alloced = true; if (newval == NULL) { newval = empty_option; @@ -5091,20 +5066,17 @@ showoptions( /// Return true if option "p" has its default value. static int optval_default(vimoption_T *p, char_u *varp) { - int dvi; - if (varp == NULL) { return true; // hidden option is always at default } - dvi = (p->flags & P_VI_DEF) ? VI_DEFAULT : VIM_DEFAULT; if (p->flags & P_NUM) { - return *(long *)varp == (long)(intptr_t)p->def_val[dvi]; + return *(long *)varp == (long)(intptr_t)p->def_val; } if (p->flags & P_BOOL) { - return *(int *)varp == (int)(intptr_t)p->def_val[dvi]; + return *(int *)varp == (int)(intptr_t)p->def_val; } // P_STRING - return STRCMP(*(char_u **)varp, p->def_val[dvi]) == 0; + return STRCMP(*(char_u **)varp, p->def_val) == 0; } /// Send update to UIs with values of UI relevant options @@ -6153,7 +6125,7 @@ void reset_modifiable(void) p_ma = false; opt_idx = findoption("ma"); if (opt_idx >= 0) { - options[opt_idx].def_val[VI_DEFAULT] = false; + options[opt_idx].def_val = false; } } @@ -6852,7 +6824,7 @@ static void paste_option_changed(void) /// vimrc_found() - Called when a vimrc or "VIMINIT" has been found. /// -/// Set the values for options that didn't get set yet to the Vim defaults. +/// Set the values for options that didn't get set yet to the defaults. /// When "fname" is not NULL, use it to set $"envname" when it wasn't set yet. void vimrc_found(char_u *fname, char_u *envname) { @@ -7746,8 +7718,7 @@ static Dictionary vimoption2dict(vimoption_T *opt) const char *type; Object def; // TODO(bfredl): do you even nocp? - char_u *def_val = opt->def_val[(opt->flags & P_VI_DEF) - ? VI_DEFAULT : VIM_DEFAULT]; + char_u *def_val = opt->def_val; if (opt->flags & P_STRING) { type = "string"; def = CSTR_TO_OBJ(def_val ? (char *)def_val : ""); diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index 0a556390e7..5e40bdd6ef 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -459,7 +459,6 @@ EXTERN char_u *p_pmcs; // 'printmbcharset' EXTERN char_u *p_pfn; // 'printfont' EXTERN char_u *p_popt; // 'printoptions' EXTERN char_u *p_header; // 'printheader' -EXTERN int p_prompt; // 'prompt' EXTERN char_u *p_guicursor; // 'guicursor' EXTERN char_u *p_guifont; // 'guifont' EXTERN char_u *p_guifontwide; // 'guifontwide' diff --git a/src/nvim/options.lua b/src/nvim/options.lua index 0b09686675..0830fb4638 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -10,7 +10,7 @@ -- secure=nil, gettext=nil, noglob=nil, normal_fname_chars=nil, -- pri_mkrc=nil, deny_in_modelines=nil, normal_dname_chars=nil, -- modelineexpr=nil, --- expand=nil, nodefault=nil, no_mkrc=nil, vi_def=true, vim=true, +-- expand=nil, nodefault=nil, no_mkrc=nil, -- alloced=nil, -- save_pv_indir=nil, -- redraw={'curswant'}, @@ -55,7 +55,6 @@ return { full_name='aleph', abbreviation='al', short_desc=N_("ASCII code of the letter Aleph (Hebrew)"), type='number', scope={'global'}, - vi_def=true, redraw={'curswant'}, varname='p_aleph', defaults={if_true={vi=224}} @@ -64,8 +63,6 @@ return { full_name='arabic', abbreviation='arab', short_desc=N_("Arabic as a default second language"), type='bool', scope={'window'}, - vi_def=true, - vim=true, redraw={'curswant'}, defaults={if_true={vi=false}} }, @@ -73,8 +70,6 @@ return { full_name='arabicshape', abbreviation='arshape', short_desc=N_("do shaping for Arabic characters"), type='bool', scope={'global'}, - vi_def=true, - vim=true, redraw={'all_windows', 'ui_option'}, varname='p_arshape', @@ -84,8 +79,6 @@ return { full_name='allowrevins', abbreviation='ari', short_desc=N_("allow CTRL-_ in Insert and Command-line mode"), type='bool', scope={'global'}, - vi_def=true, - vim=true, varname='p_ari', defaults={if_true={vi=false}} }, @@ -93,7 +86,6 @@ return { full_name='ambiwidth', abbreviation='ambw', short_desc=N_("what to do with Unicode chars of ambiguous width"), type='string', scope={'global'}, - vi_def=true, redraw={'all_windows', 'ui_option'}, varname='p_ambw', defaults={if_true={vi="single"}} @@ -102,7 +94,6 @@ return { full_name='autochdir', abbreviation='acd', short_desc=N_("change directory to the file in the current window"), type='bool', scope={'global'}, - vi_def=true, varname='p_acd', defaults={if_true={vi=false}} }, @@ -111,20 +102,19 @@ return { short_desc=N_("take indent for new line from previous line"), type='bool', scope={'buffer'}, varname='p_ai', - defaults={if_true={vi=false, vim=true}} + defaults={if_true={vim=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={vi=false, vim=true}} + defaults={if_true={vim=true}} }, { full_name='autowrite', abbreviation='aw', short_desc=N_("automatically write file if changed"), type='bool', scope={'global'}, - vi_def=true, varname='p_aw', defaults={if_true={vi=false}} }, @@ -132,7 +122,6 @@ return { full_name='autowriteall', abbreviation='awa', short_desc=N_("as 'autowrite', but works with more commands"), type='bool', scope={'global'}, - vi_def=true, varname='p_awa', defaults={if_true={vi=false}} }, @@ -140,26 +129,22 @@ return { full_name='background', abbreviation='bg', short_desc=N_("\"dark\" or \"light\", used for highlight colors"), type='string', scope={'global'}, - vim=true, redraw={'all_windows'}, varname='p_bg', - defaults={if_true={vi="light",vim="dark"}} + defaults={if_true={vim="dark"}} }, { full_name='backspace', abbreviation='bs', short_desc=N_("how backspace works at start of line"), type='string', list='onecomma', scope={'global'}, deny_duplicates=true, - vim=true, varname='p_bs', - defaults={if_true={vi="", vim="indent,eol,start"}} + defaults={if_true={vim="indent,eol,start"}} }, { full_name='backup', abbreviation='bk', short_desc=N_("keep backup file after overwriting a file"), type='bool', scope={'global'}, - vi_def=true, - vim=true, varname='p_bk', defaults={if_true={vi=false}} }, @@ -168,12 +153,11 @@ return { short_desc=N_("make backup as a copy, don't rename the file"), type='string', list='onecomma', scope={'global', 'buffer'}, deny_duplicates=true, - vim=true, varname='p_bkc', defaults={ condition='UNIX', - if_true={vi="yes", vim="auto"}, - if_false={vi="auto", vim="auto"} + if_true={vim="auto"}, + if_false={vim="auto"} }, }, { @@ -182,7 +166,6 @@ return { type='string', list='onecomma', scope={'global'}, deny_duplicates=true, secure=true, - vi_def=true, expand='nodefault', varname='p_bdir', defaults={if_true={vi=''}} @@ -192,7 +175,6 @@ return { short_desc=N_("extension used for the backup file"), type='string', scope={'global'}, normal_fname_chars=true, - vi_def=true, varname='p_bex', defaults={if_true={vi="~"}} }, @@ -201,7 +183,6 @@ return { short_desc=N_("no backup for files that match these patterns"), type='string', list='onecomma', scope={'global'}, deny_duplicates=true, - vi_def=true, varname='p_bsk', defaults={if_true={vi=""}} }, @@ -210,7 +191,6 @@ return { short_desc=N_("do not ring the bell for these reasons"), type='string', list='comma', scope={'global'}, deny_duplicates=true, - vi_def=true, varname='p_bo', defaults={if_true={vi="all"}} }, @@ -218,7 +198,6 @@ return { full_name='binary', abbreviation='bin', short_desc=N_("read/write/edit file in binary mode"), type='bool', scope={'buffer'}, - vi_def=true, redraw={'statuslines'}, varname='p_bin', defaults={if_true={vi=false}} @@ -228,7 +207,6 @@ return { short_desc=N_("a Byte Order Mark to the file"), type='bool', scope={'buffer'}, no_mkrc=true, - vi_def=true, redraw={'statuslines'}, varname='p_bomb', defaults={if_true={vi=false}} @@ -237,7 +215,6 @@ return { full_name='breakat', abbreviation='brk', short_desc=N_("characters that may cause a line break"), type='string', list='flags', scope={'global'}, - vi_def=true, redraw={'all_windows'}, varname='p_breakat', defaults={if_true={vi=" \t!@*-+;:,./?"}} @@ -246,8 +223,6 @@ return { full_name='breakindent', abbreviation='bri', short_desc=N_("wrapped line repeats indent"), type='bool', scope={'window'}, - vi_def=true, - vim=true, redraw={'current_window'}, defaults={if_true={vi=false}} }, @@ -256,7 +231,6 @@ return { short_desc=N_("settings for 'breakindent'"), type='string', list='onecomma', scope={'window'}, deny_duplicates=true, - vi_def=true, alloced=true, redraw={'current_buffer'}, defaults={if_true={vi=""}}, @@ -265,7 +239,6 @@ return { full_name='browsedir', abbreviation='bsdir', short_desc=N_("which directory to start browsing in"), type='string', scope={'global'}, - vi_def=true, enable_if=false, }, { @@ -273,7 +246,6 @@ return { short_desc=N_("what to do when buffer is no longer in window"), type='string', scope={'buffer'}, noglob=true, - vi_def=true, alloced=true, varname='p_bh', defaults={if_true={vi=""}} @@ -283,7 +255,6 @@ return { short_desc=N_("whether the buffer shows up in the buffer list"), type='bool', scope={'buffer'}, noglob=true, - vi_def=true, varname='p_bl', defaults={if_true={vi=1}} }, @@ -292,7 +263,6 @@ return { short_desc=N_("special type of buffer"), type='string', scope={'buffer'}, noglob=true, - vi_def=true, alloced=true, varname='p_bt', defaults={if_true={vi=""}} @@ -302,7 +272,6 @@ return { short_desc=N_("specifies how case of letters is changed"), type='string', list='onecomma', scope={'global'}, deny_duplicates=true, - vi_def=true, varname='p_cmp', defaults={if_true={vi="internal,keepascii"}} }, @@ -311,7 +280,6 @@ return { short_desc=N_("list of directories searched with \":cd\""), type='string', list='comma', scope={'global'}, deny_duplicates=true, - vi_def=true, expand=true, secure=true, varname='p_cdpath', @@ -322,7 +290,7 @@ return { short_desc=N_("used to open the command-line window"), type='string', scope={'global'}, varname='p_cedit', - defaults={if_true={vi="", vim=macros('CTRL_F_STR')}} + defaults={if_true={vim=macros('CTRL_F_STR')}} }, { full_name='channel', @@ -338,7 +306,6 @@ return { short_desc=N_("expression for character encoding conversion"), type='string', scope={'global'}, secure=true, - vi_def=true, varname='p_ccv', defaults={if_true={vi=""}} }, @@ -346,8 +313,6 @@ return { full_name='cindent', abbreviation='cin', short_desc=N_("do C program indenting"), type='bool', scope={'buffer'}, - vi_def=true, - vim=true, varname='p_cin', defaults={if_true={vi=false}} }, @@ -356,7 +321,6 @@ return { short_desc=N_("keys that trigger indent when 'cindent' is set"), type='string', list='onecomma', scope={'buffer'}, deny_duplicates=true, - vi_def=true, alloced=true, varname='p_cink', defaults={if_true={vi=indentkeys_default}} @@ -366,7 +330,6 @@ return { short_desc=N_("how to do indenting when 'cindent' is set"), type='string', list='onecomma', scope={'buffer'}, deny_duplicates=true, - vi_def=true, alloced=true, varname='p_cino', defaults={if_true={vi=""}} @@ -376,7 +339,6 @@ return { short_desc=N_("words where 'si' and 'cin' add an indent"), type='string', list='onecomma', scope={'buffer'}, deny_duplicates=true, - vi_def=true, alloced=true, varname='p_cinw', defaults={if_true={vi="if,else,while,do,for,switch"}} @@ -386,7 +348,6 @@ return { short_desc=N_("use the clipboard as the unnamed register"), type='string', list='onecomma', scope={'global'}, deny_duplicates=true, - vi_def=true, varname='p_cb', defaults={if_true={vi=""}} }, @@ -394,7 +355,6 @@ return { full_name='cmdheight', abbreviation='ch', short_desc=N_("number of lines to use for the command-line"), type='number', scope={'global'}, - vi_def=true, redraw={'all_windows'}, varname='p_ch', defaults={if_true={vi=1}} @@ -403,7 +363,6 @@ return { full_name='cmdwinheight', abbreviation='cwh', short_desc=N_("height of the command-line window"), type='number', scope={'global'}, - vi_def=true, varname='p_cwh', defaults={if_true={vi=7}} }, @@ -412,7 +371,6 @@ return { short_desc=N_("columns to highlight"), type='string', list='onecomma', scope={'window'}, deny_duplicates=true, - vi_def=true, redraw={'current_window'}, defaults={if_true={vi=""}} }, @@ -421,7 +379,6 @@ return { short_desc=N_("number of columns in the display"), type='number', scope={'global'}, no_mkrc=true, - vi_def=true, redraw={'everything'}, varname='p_columns', defaults={if_true={vi=macros('DFLT_COLS')}} @@ -431,7 +388,6 @@ return { short_desc=N_("patterns that can start a comment line"), type='string', list='onecomma', scope={'buffer'}, deny_duplicates=true, - vi_def=true, alloced=true, redraw={'curswant'}, varname='p_com', @@ -441,7 +397,6 @@ return { full_name='commentstring', abbreviation='cms', short_desc=N_("template for comments; used for fold marker"), type='string', scope={'buffer'}, - vi_def=true, alloced=true, redraw={'curswant'}, varname='p_cms', @@ -455,7 +410,7 @@ return { varname='p_force_off', -- pri_mkrc isn't needed here, optval_default() -- always returns TRUE for 'compatible' - defaults={if_true={vi=true, vim=false}} + defaults={if_true={vim=false}} }, { full_name='complete', abbreviation='cpt', @@ -464,13 +419,12 @@ return { deny_duplicates=true, alloced=true, varname='p_cpt', - defaults={if_true={vi=".,w,b,u,t,i", vim=".,w,b,u,t"}} + defaults={if_true={vim=".,w,b,u,t"}} }, { full_name='concealcursor', abbreviation='cocu', short_desc=N_("whether concealable text is hidden in cursor line"), type='string', scope={'window'}, - vi_def=true, alloced=true, redraw={'current_window'}, defaults={if_true={vi=""}} @@ -479,7 +433,6 @@ return { full_name='conceallevel', abbreviation='cole', short_desc=N_("whether concealable text is shown or hidden"), type='number', scope={'window'}, - vi_def=true, redraw={'current_window'}, defaults={if_true={vi=0}} }, @@ -488,7 +441,6 @@ return { short_desc=N_("function to be used for Insert mode completion"), type='string', scope={'buffer'}, secure=true, - vi_def=true, alloced=true, varname='p_cfu', defaults={if_true={vi=""}} @@ -498,15 +450,12 @@ return { short_desc=N_("options for Insert mode completion"), type='string', list='onecomma', scope={'global'}, deny_duplicates=true, - vi_def=true, varname='p_cot', defaults={if_true={vi="menu,preview"}} }, { full_name='completeslash', abbreviation='csl', type='string', scope={'buffer'}, - vi_def=true, - vim=true, varname='p_csl', enable_if='BACKSLASH_IN_FILENAME', defaults={if_true={vi=""}} @@ -515,7 +464,6 @@ return { full_name='confirm', abbreviation='cf', short_desc=N_("ask what to do about unsaved/read-only files"), type='bool', scope={'global'}, - vi_def=true, varname='p_confirm', defaults={if_true={vi=false}} }, @@ -523,8 +471,6 @@ return { full_name='copyindent', abbreviation='ci', short_desc=N_("make 'autoindent' use existing indent structure"), type='bool', scope={'buffer'}, - vi_def=true, - vim=true, varname='p_ci', defaults={if_true={vi=false}} }, @@ -532,17 +478,14 @@ return { full_name='cpoptions', abbreviation='cpo', short_desc=N_("flags for Vi-compatible behavior"), type='string', list='flags', scope={'global'}, - vim=true, redraw={'all_windows'}, varname='p_cpo', - defaults={if_true={vi=macros('CPO_VI'), vim=macros('CPO_VIM')}} + defaults={if_true={vim=macros('CPO_VIM')}} }, { full_name='cscopepathcomp', abbreviation='cspc', short_desc=N_("how many components of the path to show"), type='number', scope={'global'}, - vi_def=true, - vim=true, varname='p_cspc', defaults={if_true={vi=0}} }, @@ -551,7 +494,6 @@ return { short_desc=N_("command to execute cscope"), type='string', scope={'global'}, secure=true, - vi_def=true, expand=true, varname='p_csprg', defaults={if_true={vi="cscope"}} @@ -561,7 +503,6 @@ return { short_desc=N_("use quickfix window for cscope results"), type='string', list='onecomma', scope={'global'}, deny_duplicates=true, - vi_def=true, varname='p_csqf', defaults={if_true={vi=""}} }, @@ -569,8 +510,6 @@ return { full_name='cscoperelative', abbreviation='csre', short_desc=N_("Use cscope.out path basename as prefix"), type='bool', scope={'global'}, - vi_def=true, - vim=true, varname='p_csre', defaults={if_true={vi=0}} }, @@ -578,8 +517,6 @@ return { full_name='cscopetag', abbreviation='cst', short_desc=N_("use cscope for tag commands"), type='bool', scope={'global'}, - vi_def=true, - vim=true, varname='p_cst', defaults={if_true={vi=0}} }, @@ -587,8 +524,6 @@ return { full_name='cscopetagorder', abbreviation='csto', short_desc=N_("determines \":cstag\" search order"), type='number', scope={'global'}, - vi_def=true, - vim=true, varname='p_csto', defaults={if_true={vi=0}} }, @@ -596,8 +531,6 @@ return { full_name='cscopeverbose', abbreviation='csverb', short_desc=N_("give messages when adding a cscope database"), type='bool', scope={'global'}, - vi_def=true, - vim=true, varname='p_csverbose', defaults={if_true={vi=1}} }, @@ -605,7 +538,6 @@ return { full_name='cursorbind', abbreviation='crb', short_desc=N_("move cursor in window as it moves in other windows"), type='bool', scope={'window'}, - vi_def=true, pv_name='p_crbind', defaults={if_true={vi=false}} }, @@ -613,7 +545,6 @@ return { full_name='cursorcolumn', abbreviation='cuc', short_desc=N_("highlight the screen column of the cursor"), type='bool', scope={'window'}, - vi_def=true, redraw={'current_window_only'}, defaults={if_true={vi=false}} }, @@ -621,7 +552,6 @@ return { full_name='cursorline', abbreviation='cul', short_desc=N_("highlight the screen line of the cursor"), type='bool', scope={'window'}, - vi_def=true, redraw={'current_window_only'}, defaults={if_true={vi=false}} }, @@ -629,7 +559,6 @@ return { full_name='debug', short_desc=N_("to \"msg\" to see all error messages"), type='string', scope={'global'}, - vi_def=true, varname='p_debug', defaults={if_true={vi=""}} }, @@ -637,7 +566,6 @@ return { full_name='define', abbreviation='def', short_desc=N_("pattern to be used to find a macro definition"), type='string', scope={'global', 'buffer'}, - vi_def=true, alloced=true, redraw={'curswant'}, varname='p_def', @@ -647,8 +575,6 @@ return { full_name='delcombine', abbreviation='deco', short_desc=N_("delete combining characters on their own"), type='bool', scope={'global'}, - vi_def=true, - vim=true, varname='p_deco', defaults={if_true={vi=false}} }, @@ -658,7 +584,6 @@ return { type='string', list='onecomma', scope={'global', 'buffer'}, deny_duplicates=true, normal_dname_chars=true, - vi_def=true, expand=true, varname='p_dict', defaults={if_true={vi=""}} @@ -668,7 +593,6 @@ return { short_desc=N_("diff mode for the current window"), type='bool', scope={'window'}, noglob=true, - vi_def=true, redraw={'current_window'}, defaults={if_true={vi=false}} }, @@ -677,7 +601,6 @@ return { short_desc=N_("expression used to obtain a diff file"), type='string', scope={'global'}, secure=true, - vi_def=true, redraw={'curswant'}, varname='p_dex', defaults={if_true={vi=""}} @@ -687,7 +610,6 @@ return { short_desc=N_("options for using diff mode"), type='string', list='onecomma', scope={'global'}, deny_duplicates=true, - vi_def=true, alloced=true, redraw={'current_window'}, varname='p_dip', @@ -697,8 +619,6 @@ return { full_name='digraph', abbreviation='dg', short_desc=N_("enable the entering of digraphs in Insert mode"), type='bool', scope={'global'}, - vi_def=true, - vim=true, varname='p_dg', defaults={if_true={vi=false}} }, @@ -708,7 +628,6 @@ return { type='string', list='onecomma', scope={'global'}, deny_duplicates=true, secure=true, - vi_def=true, expand='nodefault', varname='p_dir', defaults={if_true={vi=''}} @@ -718,16 +637,14 @@ return { short_desc=N_("list of flags for how to display text"), type='string', list='onecomma', scope={'global'}, deny_duplicates=true, - vim=true, redraw={'all_windows'}, varname='p_dy', - defaults={if_true={vi="", vim="lastline,msgsep"}} + defaults={if_true={vim="lastline,msgsep"}} }, { full_name='eadirection', abbreviation='ead', short_desc=N_("in which direction 'equalalways' works"), type='string', scope={'global'}, - vi_def=true, varname='p_ead', defaults={if_true={vi="both"}} }, @@ -735,7 +652,6 @@ return { full_name='edcompatible', abbreviation='ed', short_desc=N_("No description"), type='bool', scope={'global'}, - vi_def=true, varname='p_force_off', defaults={if_true={vi=false}} }, @@ -743,7 +659,6 @@ return { full_name='emoji', abbreviation='emo', short_desc=N_("No description"), type='bool', scope={'global'}, - vi_def=true, redraw={'all_windows', 'ui_option'}, varname='p_emoji', defaults={if_true={vi=true}} @@ -753,7 +668,6 @@ return { short_desc=N_("encoding used internally"), type='string', scope={'global'}, deny_in_modelines=true, - vi_def=true, varname='p_enc', defaults={if_true={vi=macros('ENC_DFLT')}} }, @@ -762,7 +676,6 @@ return { short_desc=N_("write <EOL> for last line in file"), type='bool', scope={'buffer'}, no_mkrc=true, - vi_def=true, redraw={'statuslines'}, varname='p_eol', defaults={if_true={vi=true}} @@ -771,7 +684,6 @@ return { full_name='equalalways', abbreviation='ea', short_desc=N_("windows are automatically made the same size"), type='bool', scope={'global'}, - vi_def=true, redraw={'all_windows'}, varname='p_ea', defaults={if_true={vi=true}} @@ -781,7 +693,6 @@ return { short_desc=N_("external program to use for \"=\" command"), type='string', scope={'global', 'buffer'}, secure=true, - vi_def=true, expand=true, varname='p_ep', defaults={if_true={vi=""}} @@ -790,7 +701,6 @@ return { full_name='errorbells', abbreviation='eb', short_desc=N_("ring the bell for error messages"), type='bool', scope={'global'}, - vi_def=true, varname='p_eb', defaults={if_true={vi=false}} }, @@ -799,7 +709,6 @@ return { short_desc=N_("name of the errorfile for the QuickFix mode"), type='string', scope={'global'}, secure=true, - vi_def=true, expand=true, varname='p_ef', defaults={if_true={vi=macros('DFLT_ERRORFILE')}} @@ -809,7 +718,6 @@ return { short_desc=N_("description of the lines in the error file"), type='string', list='onecomma', scope={'global', 'buffer'}, deny_duplicates=true, - vi_def=true, varname='p_efm', defaults={if_true={vi=macros('DFLT_EFM')}} }, @@ -818,7 +726,6 @@ return { short_desc=N_("autocommand events that are ignored"), type='string', list='onecomma', scope={'global'}, deny_duplicates=true, - vi_def=true, varname='p_ei', defaults={if_true={vi=""}} }, @@ -826,8 +733,6 @@ return { full_name='expandtab', abbreviation='et', short_desc=N_("use spaces when <Tab> is inserted"), type='bool', scope={'buffer'}, - vi_def=true, - vim=true, varname='p_et', defaults={if_true={vi=false}} }, @@ -836,7 +741,6 @@ return { short_desc=N_("read .nvimrc and .exrc in the current directory"), type='bool', scope={'global'}, secure=true, - vi_def=true, varname='p_exrc', defaults={if_true={vi=false}} }, @@ -845,7 +749,6 @@ return { short_desc=N_("file encoding for multi-byte text"), type='string', scope={'buffer'}, no_mkrc=true, - vi_def=true, alloced=true, redraw={'statuslines', 'current_buffer'}, varname='p_fenc', @@ -856,7 +759,6 @@ return { short_desc=N_("automatically detected character encodings"), type='string', list='onecomma', scope={'global'}, deny_duplicates=true, - vi_def=true, varname='p_fencs', defaults={if_true={vi="ucs-bom,utf-8,default,latin1"}} }, @@ -865,7 +767,6 @@ return { short_desc=N_("file format used for file I/O"), type='string', scope={'buffer'}, no_mkrc=true, - vi_def=true, alloced=true, redraw={'curswant', 'statuslines'}, varname='p_ff', @@ -876,15 +777,13 @@ return { short_desc=N_("automatically detected values for 'fileformat'"), type='string', list='onecomma', scope={'global'}, deny_duplicates=true, - vim=true, varname='p_ffs', - defaults={if_true={vi=macros('DFLT_FFS_VI'), vim=macros('DFLT_FFS_VIM')}} + defaults={if_true={vim=macros('DFLT_FFS_VIM')}} }, { full_name='fileignorecase', abbreviation='fic', short_desc=N_("ignore case when using file names"), type='bool', scope={'global'}, - vi_def=true, varname='p_fic', defaults={ condition='CASE_INSENSITIVE_FILENAME', @@ -898,7 +797,6 @@ return { type='string', scope={'buffer'}, noglob=true, normal_fname_chars=true, - vi_def=true, alloced=true, expand=true, varname='p_ft', @@ -909,7 +807,6 @@ return { short_desc=N_("characters to use for displaying special items"), type='string', list='onecomma', scope={'global', 'window'}, deny_duplicates=true, - vi_def=true, alloced=true, redraw={'current_window'}, varname='p_fcs', @@ -919,7 +816,6 @@ return { full_name='fixendofline', abbreviation='fixeol', short_desc=N_("make sure last line in file has <EOL>"), type='bool', scope={'buffer'}, - vi_def=true, redraw={'statuslines'}, varname='p_fixeol', defaults={if_true={vi=true}} @@ -929,7 +825,6 @@ return { short_desc=N_("close a fold when the cursor leaves it"), type='string', list='onecomma', scope={'global'}, deny_duplicates=true, - vi_def=true, redraw={'current_window'}, varname='p_fcl', defaults={if_true={vi=""}} @@ -938,7 +833,6 @@ return { full_name='foldcolumn', abbreviation='fdc', short_desc=N_("width of the column used to indicate folds"), type='string', scope={'window'}, - vi_def=true, alloced=true, redraw={'current_window'}, defaults={if_true={vi="0"}} @@ -947,7 +841,6 @@ return { full_name='foldenable', abbreviation='fen', short_desc=N_("set to display all folds open"), type='bool', scope={'window'}, - vi_def=true, redraw={'current_window'}, defaults={if_true={vi=true}} }, @@ -955,8 +848,6 @@ return { full_name='foldexpr', abbreviation='fde', short_desc=N_("expression used when 'foldmethod' is \"expr\""), type='string', scope={'window'}, - vi_def=true, - vim=true, modelineexpr=true, alloced=true, redraw={'current_window'}, @@ -966,8 +857,6 @@ return { full_name='foldignore', abbreviation='fdi', short_desc=N_("ignore lines when 'foldmethod' is \"indent\""), type='string', scope={'window'}, - vi_def=true, - vim=true, alloced=true, redraw={'current_window'}, defaults={if_true={vi="#"}} @@ -976,7 +865,6 @@ return { full_name='foldlevel', abbreviation='fdl', short_desc=N_("close folds with a level higher than this"), type='number', scope={'window'}, - vi_def=true, redraw={'current_window'}, defaults={if_true={vi=0}} }, @@ -984,7 +872,6 @@ return { full_name='foldlevelstart', abbreviation='fdls', short_desc=N_("'foldlevel' when starting to edit a file"), type='number', scope={'global'}, - vi_def=true, redraw={'curswant'}, varname='p_fdls', defaults={if_true={vi=-1}} @@ -994,8 +881,6 @@ return { short_desc=N_("markers used when 'foldmethod' is \"marker\""), type='string', list='onecomma', scope={'window'}, deny_duplicates=true, - vi_def=true, - vim=true, alloced=true, redraw={'current_window'}, defaults={if_true={vi="{{{,}}}"}} @@ -1004,8 +889,6 @@ return { full_name='foldmethod', abbreviation='fdm', short_desc=N_("folding type"), type='string', scope={'window'}, - vi_def=true, - vim=true, alloced=true, redraw={'current_window'}, defaults={if_true={vi="manual"}} @@ -1014,7 +897,6 @@ return { full_name='foldminlines', abbreviation='fml', short_desc=N_("minimum number of lines for a fold to be closed"), type='number', scope={'window'}, - vi_def=true, redraw={'current_window'}, defaults={if_true={vi=1}} }, @@ -1022,7 +904,6 @@ return { full_name='foldnestmax', abbreviation='fdn', short_desc=N_("maximum fold depth"), type='number', scope={'window'}, - vi_def=true, redraw={'current_window'}, defaults={if_true={vi=20}} }, @@ -1031,7 +912,6 @@ return { short_desc=N_("for which commands a fold will be opened"), type='string', list='onecomma', scope={'global'}, deny_duplicates=true, - vi_def=true, redraw={'curswant'}, varname='p_fdo', defaults={if_true={vi="block,hor,mark,percent,quickfix,search,tag,undo"}} @@ -1040,8 +920,6 @@ return { full_name='foldtext', abbreviation='fdt', short_desc=N_("expression used to display for a closed fold"), type='string', scope={'window'}, - vi_def=true, - vim=true, modelineexpr=true, alloced=true, redraw={'current_window'}, @@ -1051,8 +929,6 @@ return { full_name='formatexpr', abbreviation='fex', short_desc=N_("expression used with \"gq\" command"), type='string', scope={'buffer'}, - vi_def=true, - vim=true, modelineexpr=true, alloced=true, varname='p_fex', @@ -1062,16 +938,14 @@ return { full_name='formatoptions', abbreviation='fo', short_desc=N_("how automatic formatting is to be done"), type='string', list='flags', scope={'buffer'}, - vim=true, alloced=true, varname='p_fo', - defaults={if_true={vi=macros('DFLT_FO_VI'), vim=macros('DFLT_FO_VIM')}} + defaults={if_true={vim=macros('DFLT_FO_VIM')}} }, { full_name='formatlistpat', abbreviation='flp', short_desc=N_("pattern used to recognize a list header"), type='string', scope={'buffer'}, - vi_def=true, alloced=true, varname='p_flp', defaults={if_true={vi="^\\s*\\d\\+[\\]:.)}\\t ]\\s*"}} @@ -1081,7 +955,6 @@ return { short_desc=N_("name of external program used with \"gq\" command"), type='string', scope={'global', 'buffer'}, secure=true, - vi_def=true, expand=true, varname='p_fp', defaults={if_true={vi=""}} @@ -1091,7 +964,6 @@ return { short_desc=N_("whether to invoke fsync() after file write"), type='bool', scope={'global'}, secure=true, - vi_def=true, varname='p_fs', defaults={if_true={vi=false}} }, @@ -1099,8 +971,6 @@ return { full_name='gdefault', abbreviation='gd', short_desc=N_("the \":substitute\" flag 'g' is default on"), type='bool', scope={'global'}, - vi_def=true, - vim=true, varname='p_gd', defaults={if_true={vi=false}} }, @@ -1109,7 +979,6 @@ return { short_desc=N_("format of 'grepprg' output"), type='string', list='onecomma', scope={'global'}, deny_duplicates=true, - vi_def=true, varname='p_gefm', defaults={if_true={vi=macros('DFLT_GREPFORMAT')}} }, @@ -1118,7 +987,6 @@ return { short_desc=N_("program to use for \":grep\""), type='string', scope={'global', 'buffer'}, secure=true, - vi_def=true, expand=true, varname='p_gp', defaults={ @@ -1134,7 +1002,6 @@ return { short_desc=N_("GUI: settings for cursor shape and blinking"), type='string', list='onecomma', scope={'global'}, deny_duplicates=true, - vi_def=true, varname='p_guicursor', defaults={if_true={vi="n-v-c-sm:block,i-ci-ve:ver25,r-cr-o:hor20"}} }, @@ -1143,7 +1010,6 @@ return { short_desc=N_("GUI: Name(s) of font(s) to be used"), type='string', list='onecomma', scope={'global'}, deny_duplicates=true, - vi_def=true, varname='p_guifont', redraw={'ui_option'}, defaults={if_true={vi=""}} @@ -1153,7 +1019,6 @@ return { short_desc=N_("list of font names for double-wide characters"), type='string', list='onecomma', scope={'global'}, deny_duplicates=true, - vi_def=true, redraw={'ui_option'}, varname='p_guifontwide', defaults={if_true={vi=""}} @@ -1162,7 +1027,6 @@ return { full_name='guioptions', abbreviation='go', short_desc=N_("GUI: Which components and options are used"), type='string', list='flags', scope={'global'}, - vi_def=true, redraw={'all_windows'}, enable_if=false, }, @@ -1170,7 +1034,6 @@ return { full_name='guitablabel', abbreviation='gtl', short_desc=N_("GUI: custom label for a tab page"), type='string', scope={'global'}, - vi_def=true, modelineexpr=true, redraw={'current_window'}, enable_if=false, @@ -1179,7 +1042,6 @@ return { full_name='guitabtooltip', abbreviation='gtt', short_desc=N_("GUI: custom tooltip for a tab page"), type='string', scope={'global'}, - vi_def=true, redraw={'current_window'}, enable_if=false, }, @@ -1188,7 +1050,6 @@ return { short_desc=N_("full path name of the main help file"), type='string', scope={'global'}, secure=true, - vi_def=true, expand=true, varname='p_hf', defaults={if_true={vi=macros('DFLT_HELPFILE')}} @@ -1197,7 +1058,6 @@ return { full_name='helpheight', abbreviation='hh', short_desc=N_("minimum height of a new help window"), type='number', scope={'global'}, - vi_def=true, varname='p_hh', defaults={if_true={vi=20}} }, @@ -1206,7 +1066,6 @@ return { short_desc=N_("preferred help languages"), type='string', list='onecomma', scope={'global'}, deny_duplicates=true, - vi_def=true, varname='p_hlg', defaults={if_true={vi=""}} }, @@ -1214,7 +1073,6 @@ return { full_name='hidden', abbreviation='hid', short_desc=N_("don't unload buffer when it is |abandon|ed"), type='bool', scope={'global'}, - vi_def=true, varname='p_hid', defaults={if_true={vi=false}} }, @@ -1223,7 +1081,6 @@ return { short_desc=N_("sets highlighting mode for various occasions"), type='string', list='onecomma', scope={'global'}, deny_duplicates=true, - vi_def=true, varname='p_hl', defaults={if_true={vi=macros('HIGHLIGHT_INIT')}} }, @@ -1231,16 +1088,13 @@ return { full_name='history', abbreviation='hi', short_desc=N_("number of command-lines that are remembered"), type='number', scope={'global'}, - vim=true, varname='p_hi', - defaults={if_true={vi=0, vim=10000}} + defaults={if_true={vim=10000}} }, { full_name='hkmap', abbreviation='hk', short_desc=N_("Hebrew keyboard mapping"), type='bool', scope={'global'}, - vi_def=true, - vim=true, varname='p_hkmap', defaults={if_true={vi=false}} }, @@ -1248,8 +1102,6 @@ return { full_name='hkmapp', abbreviation='hkp', short_desc=N_("phonetic Hebrew keyboard mapping"), type='bool', scope={'global'}, - vi_def=true, - vim=true, varname='p_hkmapp', defaults={if_true={vi=false}} }, @@ -1257,16 +1109,14 @@ return { full_name='hlsearch', abbreviation='hls', short_desc=N_("highlight matches with last search pattern"), type='bool', scope={'global'}, - vim=true, redraw={'all_windows'}, varname='p_hls', - defaults={if_true={vi=false, vim=true}} + defaults={if_true={vim=true}} }, { full_name='icon', short_desc=N_("Vim set the text of the window icon"), type='bool', scope={'global'}, - vi_def=true, varname='p_icon', defaults={if_true={vi=false}} }, @@ -1274,7 +1124,6 @@ return { full_name='iconstring', short_desc=N_("to use for the Vim icon text"), type='string', scope={'global'}, - vi_def=true, modelineexpr=true, varname='p_iconstring', defaults={if_true={vi=""}} @@ -1283,7 +1132,6 @@ return { full_name='ignorecase', abbreviation='ic', short_desc=N_("ignore case in search patterns"), type='bool', scope={'global'}, - vi_def=true, varname='p_ic', defaults={if_true={vi=false}} }, @@ -1291,7 +1139,6 @@ return { full_name='imcmdline', abbreviation='imc', short_desc=N_("use IM when starting to edit a command line"), type='bool', scope={'global'}, - vi_def=true, enable_if=false, defaults={if_true={vi=false}} }, @@ -1299,7 +1146,6 @@ return { full_name='imdisable', abbreviation='imd', short_desc=N_("do not use the IM in any mode"), type='bool', scope={'global'}, - vi_def=true, enable_if=false, defaults={if_true={vi=false}} }, @@ -1307,7 +1153,6 @@ return { full_name='iminsert', abbreviation='imi', short_desc=N_("use :lmap or IM in Insert mode"), type='number', scope={'buffer'}, - vi_def=true, varname='p_iminsert', pv_name='p_imi', defaults={ if_true={vi=macros('B_IMODE_NONE')}, @@ -1317,7 +1162,6 @@ return { full_name='imsearch', abbreviation='ims', short_desc=N_("use :lmap or IM when typing a search pattern"), type='number', scope={'buffer'}, - vi_def=true, varname='p_imsearch', pv_name='p_ims', defaults={ if_true={vi=macros('B_IMODE_USE_INSERT')}, @@ -1327,7 +1171,6 @@ return { full_name='inccommand', abbreviation='icm', short_desc=N_("Live preview of substitution"), type='string', scope={'global'}, - vi_def=true, redraw={'all_windows'}, varname='p_icm', defaults={if_true={vi=""}} @@ -1336,7 +1179,6 @@ return { full_name='include', abbreviation='inc', short_desc=N_("pattern to be used to find an include file"), type='string', scope={'global', 'buffer'}, - vi_def=true, alloced=true, varname='p_inc', defaults={if_true={vi="^\\s*#\\s*include"}} @@ -1345,7 +1187,6 @@ return { full_name='includeexpr', abbreviation='inex', short_desc=N_("expression used to process an include line"), type='string', scope={'buffer'}, - vi_def=true, modelineexpr=true, alloced=true, varname='p_inex', @@ -1355,16 +1196,13 @@ return { full_name='incsearch', abbreviation='is', short_desc=N_("highlight match while typing search pattern"), type='bool', scope={'global'}, - vim=true, varname='p_is', - defaults={if_true={vi=false, vim=true}} + defaults={if_true={vim=true}} }, { full_name='indentexpr', abbreviation='inde', short_desc=N_("expression used to obtain the indent of a line"), type='string', scope={'buffer'}, - vi_def=true, - vim=true, modelineexpr=true, alloced=true, varname='p_inde', @@ -1375,7 +1213,6 @@ return { short_desc=N_("keys that trigger indenting with 'indentexpr'"), type='string', list='onecomma', scope={'buffer'}, deny_duplicates=true, - vi_def=true, alloced=true, varname='p_indk', defaults={if_true={vi=indentkeys_default}} @@ -1384,7 +1221,6 @@ return { full_name='infercase', abbreviation='inf', short_desc=N_("adjust case of match for keyword completion"), type='bool', scope={'buffer'}, - vi_def=true, varname='p_inf', defaults={if_true={vi=false}} }, @@ -1392,8 +1228,6 @@ return { full_name='insertmode', abbreviation='im', short_desc=N_("start the edit of a file in Insert mode"), type='bool', scope={'global'}, - vi_def=true, - vim=true, varname='p_im', defaults={if_true={vi=false}} }, @@ -1402,7 +1236,6 @@ return { short_desc=N_("characters included in file names and pathnames"), type='string', list='comma', scope={'global'}, deny_duplicates=true, - vi_def=true, varname='p_isf', defaults={ condition='BACKSLASH_IN_FILENAME', @@ -1417,7 +1250,6 @@ return { short_desc=N_("characters included in identifiers"), type='string', list='comma', scope={'global'}, deny_duplicates=true, - vi_def=true, varname='p_isi', defaults={ condition='WIN32', @@ -1430,17 +1262,15 @@ return { short_desc=N_("characters included in keywords"), type='string', list='comma', scope={'buffer'}, deny_duplicates=true, - vim=true, alloced=true, varname='p_isk', - defaults={if_true={vi="@,48-57,_", vim="@,48-57,_,192-255"}} + defaults={if_true={vim="@,48-57,_,192-255"}} }, { full_name='isprint', abbreviation='isp', short_desc=N_("printable characters"), type='string', list='comma', scope={'global'}, deny_duplicates=true, - vi_def=true, redraw={'all_windows'}, varname='p_isp', defaults={if_true={vi="@,161-255"} @@ -1450,8 +1280,6 @@ return { full_name='joinspaces', abbreviation='js', short_desc=N_("two spaces after a period with a join command"), type='bool', scope={'global'}, - vi_def=true, - vim=true, varname='p_js', defaults={if_true={vi=true}} }, @@ -1461,7 +1289,6 @@ return { type='string', list='onecomma', scope={'global'}, deny_duplicates=true, varname='p_jop', - vim=true, defaults={if_true={vim=''}} }, { @@ -1470,7 +1297,6 @@ return { type='string', scope={'buffer'}, normal_fname_chars=true, pri_mkrc=true, - vi_def=true, alloced=true, redraw={'statuslines', 'current_buffer'}, varname='p_keymap', pv_name='p_kmap', @@ -1481,7 +1307,6 @@ return { short_desc=N_("enable starting/stopping selection with keys"), type='string', list='onecomma', scope={'global'}, deny_duplicates=true, - vi_def=true, varname='p_km', defaults={if_true={vi=""}} }, @@ -1490,7 +1315,6 @@ return { short_desc=N_("program to use for the \"K\" command"), type='string', scope={'global', 'buffer'}, secure=true, - vi_def=true, expand=true, varname='p_kp', defaults={ @@ -1503,7 +1327,6 @@ return { type='string', list='onecomma', scope={'global'}, deny_duplicates=true, secure=true, - vi_def=true, varname='p_langmap', defaults={if_true={vi=""}} }, @@ -1512,7 +1335,6 @@ return { short_desc=N_("language to be used for the menus"), type='string', scope={'global'}, normal_fname_chars=true, - vi_def=true, varname='p_lm', defaults={if_true={vi=""}} }, @@ -1521,29 +1343,27 @@ return { short_desc=N_("do not apply 'langmap' to mapped characters"), type='bool', scope={'global'}, varname='p_lnr', - defaults={if_true={vi=false, vim=true}} + defaults={if_true={vim=true}} }, { full_name='langremap', abbreviation='lrm', short_desc=N_('No description'), type='bool', scope={'global'}, varname='p_lrm', - defaults={if_true={vi=true, vim=false}} + defaults={if_true={vim=false}} }, { full_name='laststatus', abbreviation='ls', short_desc=N_("tells when last window has status lines"), type='number', scope={'global'}, - vim=true, redraw={'all_windows'}, varname='p_ls', - defaults={if_true={vi=1,vim=2}} + defaults={if_true={vim=2}} }, { full_name='lazyredraw', abbreviation='lz', short_desc=N_("don't redraw while executing macros"), type='bool', scope={'global'}, - vi_def=true, varname='p_lz', defaults={if_true={vi=false}} }, @@ -1551,7 +1371,6 @@ return { full_name='linebreak', abbreviation='lbr', short_desc=N_("wrap long lines at a blank"), type='bool', scope={'window'}, - vi_def=true, redraw={'current_window'}, defaults={if_true={vi=false}} }, @@ -1560,7 +1379,6 @@ return { short_desc=N_("of lines in the display"), type='number', scope={'global'}, no_mkrc=true, - vi_def=true, redraw={'everything'}, varname='p_lines', defaults={if_true={vi=macros('DFLT_ROWS')}} @@ -1569,7 +1387,6 @@ return { full_name='linespace', abbreviation='lsp', short_desc=N_("number of pixel lines to use between characters"), type='number', scope={'global'}, - vi_def=true, redraw={'ui_option'}, varname='p_linespace', defaults={if_true={vi=0}} @@ -1578,7 +1395,6 @@ return { full_name='lisp', short_desc=N_("indenting for Lisp"), type='bool', scope={'buffer'}, - vi_def=true, varname='p_lisp', defaults={if_true={vi=false}} }, @@ -1587,7 +1403,6 @@ return { short_desc=N_("words that change how lisp indenting works"), type='string', list='onecomma', scope={'global', 'buffer'}, deny_duplicates=true, - vi_def=true, varname='p_lispwords', pv_name='p_lw', defaults={if_true={vi=macros('LISPWORD_VALUE')}} }, @@ -1595,7 +1410,6 @@ return { full_name='list', short_desc=N_("<Tab> and <EOL>"), type='bool', scope={'window'}, - vi_def=true, redraw={'current_window'}, defaults={if_true={vi=false}} }, @@ -1604,17 +1418,15 @@ return { short_desc=N_("characters for displaying in list mode"), type='string', list='onecomma', scope={'global', 'window'}, deny_duplicates=true, - vim=true, alloced=true, redraw={'current_window'}, varname='p_lcs', - defaults={if_true={vi="eol:$", vim="tab:> ,trail:-,nbsp:+"}} + defaults={if_true={vim="tab:> ,trail:-,nbsp:+"}} }, { full_name='loadplugins', abbreviation='lpl', short_desc=N_("load plugin scripts when starting up"), type='bool', scope={'global'}, - vi_def=true, varname='p_lpl', defaults={if_true={vi=true}} }, @@ -1622,7 +1434,6 @@ return { full_name='magic', short_desc=N_("special characters in search patterns"), type='bool', scope={'global'}, - vi_def=true, varname='p_magic', defaults={if_true={vi=true}} }, @@ -1631,7 +1442,6 @@ return { short_desc=N_("name of the errorfile for \":make\""), type='string', scope={'global'}, secure=true, - vi_def=true, expand=true, varname='p_mef', defaults={if_true={vi=""}} @@ -1640,7 +1450,6 @@ return { full_name='makeencoding', abbreviation='menc', short_desc=N_("Converts the output of external commands"), type='string', scope={'global', 'buffer'}, - vi_def=true, varname='p_menc', defaults={if_true={vi=""}} }, @@ -1649,7 +1458,6 @@ return { short_desc=N_("program to use for the \":make\" command"), type='string', scope={'global', 'buffer'}, secure=true, - vi_def=true, expand=true, varname='p_mp', defaults={if_true={vi="make"}} @@ -1659,7 +1467,6 @@ return { short_desc=N_("pairs of characters that \"%\" can match"), type='string', list='onecomma', scope={'buffer'}, deny_duplicates=true, - vi_def=true, alloced=true, varname='p_mps', defaults={if_true={vi="(:),{:},[:]"}} @@ -1668,7 +1475,6 @@ return { full_name='matchtime', abbreviation='mat', short_desc=N_("tenths of a second to show matching paren"), type='number', scope={'global'}, - vi_def=true, varname='p_mat', defaults={if_true={vi=5}} }, @@ -1676,7 +1482,6 @@ return { full_name='maxcombine', abbreviation='mco', short_desc=N_("maximum nr of combining characters displayed"), type='number', scope={'global'}, - vi_def=true, varname='p_mco', defaults={if_true={vi=6}} }, @@ -1684,7 +1489,6 @@ return { full_name='maxfuncdepth', abbreviation='mfd', short_desc=N_("maximum recursive depth for user functions"), type='number', scope={'global'}, - vi_def=true, varname='p_mfd', defaults={if_true={vi=100}} }, @@ -1692,7 +1496,6 @@ return { full_name='maxmapdepth', abbreviation='mmd', short_desc=N_("maximum recursive depth for mapping"), type='number', scope={'global'}, - vi_def=true, varname='p_mmd', defaults={if_true={vi=1000}} }, @@ -1700,7 +1503,6 @@ return { full_name='maxmempattern', abbreviation='mmp', short_desc=N_("maximum memory (in Kbyte) used for pattern search"), type='number', scope={'global'}, - vi_def=true, varname='p_mmp', defaults={if_true={vi=1000}} }, @@ -1708,7 +1510,6 @@ return { full_name='menuitems', abbreviation='mis', short_desc=N_("maximum number of items in a menu"), type='number', scope={'global'}, - vi_def=true, varname='p_mis', defaults={if_true={vi=25}} }, @@ -1717,7 +1518,6 @@ return { short_desc=N_("memory used before |:mkspell| compresses the tree"), type='string', scope={'global'}, secure=true, - vi_def=true, expand=true, varname='p_msm', defaults={if_true={vi="460000,2000,500"}} @@ -1726,15 +1526,13 @@ return { full_name='modeline', abbreviation='ml', short_desc=N_("recognize modelines at start or end of file"), type='bool', scope={'buffer'}, - vim=true, varname='p_ml', - defaults={if_true={vi=false, vim=true}} + defaults={if_true={vim=true}} }, { full_name='modelineexpr', abbreviation='mle', short_desc=N_("allow some options to be set in modeline"), type='bool', scope={'global'}, - vi_def=true, secure=true, varname='p_mle', defaults={if_true={vi=false}} @@ -1743,7 +1541,6 @@ return { full_name='modelines', abbreviation='mls', short_desc=N_("number of lines checked for modelines"), type='number', scope={'global'}, - vi_def=true, varname='p_mls', defaults={if_true={vi=5}} }, @@ -1752,7 +1549,6 @@ return { short_desc=N_("changes to the text are not possible"), type='bool', scope={'buffer'}, noglob=true, - vi_def=true, varname='p_ma', defaults={if_true={vi=true}} }, @@ -1761,7 +1557,6 @@ return { short_desc=N_("buffer has been modified"), type='bool', scope={'buffer'}, no_mkrc=true, - vi_def=true, redraw={'statuslines'}, varname='p_mod', defaults={if_true={vi=false}} @@ -1770,22 +1565,20 @@ return { full_name='more', short_desc=N_("listings when the whole screen is filled"), type='bool', scope={'global'}, - vim=true, varname='p_more', - defaults={if_true={vi=false, vim=true}} + defaults={if_true={vim=true}} }, { full_name='mouse', short_desc=N_("the use of mouse clicks"), type='string', list='flags', scope={'global'}, varname='p_mouse', - defaults={if_true={vi="", vim=""}} + defaults={if_true={vim=""}} }, { full_name='mousefocus', abbreviation='mousef', short_desc=N_("keyboard focus follows the mouse"), type='bool', scope={'global'}, - vi_def=true, redraw={'ui_option'}, varname='p_mousef', defaults={if_true={vi=false}} @@ -1794,7 +1587,6 @@ return { full_name='mousehide', abbreviation='mh', short_desc=N_("hide mouse pointer while typing"), type='bool', scope={'global'}, - vi_def=true, enable_if=false, defaults={if_true={vi=true}} }, @@ -1802,7 +1594,6 @@ return { full_name='mousemodel', abbreviation='mousem', short_desc=N_("changes meaning of mouse buttons"), type='string', scope={'global'}, - vi_def=true, varname='p_mousem', defaults={if_true={vi="extend"}} }, @@ -1811,14 +1602,12 @@ return { short_desc=N_("shape of the mouse pointer in different modes"), type='string', list='onecomma', scope={'global'}, deny_duplicates=true, - vi_def=true, enable_if=false, }, { full_name='mousetime', abbreviation='mouset', short_desc=N_("max time between mouse double-click"), type='number', scope={'global'}, - vi_def=true, varname='p_mouset', defaults={if_true={vi=500}} }, @@ -1829,13 +1618,12 @@ return { deny_duplicates=true, alloced=true, varname='p_nf', - defaults={if_true={vi="bin,octal,hex", vim="bin,hex"}} + defaults={if_true={vim="bin,hex"}} }, { full_name='number', abbreviation='nu', short_desc=N_("print the line number in front of each line"), type='bool', scope={'window'}, - vi_def=true, redraw={'current_window'}, defaults={if_true={vi=false}} }, @@ -1843,16 +1631,14 @@ return { full_name='numberwidth', abbreviation='nuw', short_desc=N_("number of columns used for the line number"), type='number', scope={'window'}, - vim=true, redraw={'current_window'}, - defaults={if_true={vi=8, vim=4}} + defaults={if_true={vim=4}} }, { full_name='omnifunc', abbreviation='ofu', short_desc=N_("function for filetype-specific completion"), type='string', scope={'buffer'}, secure=true, - vi_def=true, alloced=true, varname='p_ofu', defaults={if_true={vi=""}} @@ -1861,16 +1647,14 @@ return { full_name='opendevice', abbreviation='odev', short_desc=N_("allow reading/writing devices on MS-Windows"), type='bool', scope={'global'}, - vi_def=true, enable_if=false, - defaults={if_true={vi=false, vim=false}} + defaults={if_true={vim=false}} }, { full_name='operatorfunc', abbreviation='opfunc', short_desc=N_("function to be called for |g@| operator"), type='string', scope={'global'}, secure=true, - vi_def=true, varname='p_opfunc', defaults={if_true={vi=""}} }, @@ -1880,7 +1664,6 @@ return { type='string', list='onecomma', scope={'global'}, deny_duplicates=true, secure=true, - vi_def=true, expand=true, varname='p_pp', defaults={if_true={vi=''}} @@ -1889,7 +1672,6 @@ return { full_name='paragraphs', abbreviation='para', short_desc=N_("nroff macros that separate paragraphs"), type='string', scope={'global'}, - vi_def=true, varname='p_para', defaults={if_true={vi="IPLPPPQPP TPHPLIPpLpItpplpipbp"}} }, @@ -1898,7 +1680,6 @@ return { short_desc=N_("pasting text"), type='bool', scope={'global'}, pri_mkrc=true, - vi_def=true, varname='p_paste', defaults={if_true={vi=false}} }, @@ -1906,7 +1687,6 @@ return { full_name='pastetoggle', abbreviation='pt', short_desc=N_("key code that causes 'paste' to toggle"), type='string', scope={'global'}, - vi_def=true, varname='p_pt', defaults={if_true={vi=""}} }, @@ -1915,7 +1695,6 @@ return { short_desc=N_("expression used to patch a file"), type='string', scope={'global'}, secure=true, - vi_def=true, varname='p_pex', defaults={if_true={vi=""}} }, @@ -1924,7 +1703,6 @@ return { short_desc=N_("keep the oldest version of a file"), type='string', scope={'global'}, normal_fname_chars=true, - vi_def=true, varname='p_pm', defaults={if_true={vi=""}} }, @@ -1933,7 +1711,6 @@ return { short_desc=N_("list of directories searched with \"gf\" et.al."), type='string', list='comma', scope={'global', 'buffer'}, deny_duplicates=true, - vi_def=true, expand=true, varname='p_path', defaults={if_true={vi=".,/usr/include,,"}} @@ -1942,8 +1719,6 @@ return { full_name='preserveindent', abbreviation='pi', short_desc=N_("preserve the indent structure when reindenting"), type='bool', scope={'buffer'}, - vi_def=true, - vim=true, varname='p_pi', defaults={if_true={vi=false}} }, @@ -1951,7 +1726,6 @@ return { full_name='previewheight', abbreviation='pvh', short_desc=N_("height of the preview window"), type='number', scope={'global'}, - vi_def=true, varname='p_pvh', defaults={if_true={vi=12}} }, @@ -1960,7 +1734,6 @@ return { short_desc=N_("identifies the preview window"), type='bool', scope={'window'}, noglob=true, - vi_def=true, redraw={'statuslines'}, defaults={if_true={vi=false}} }, @@ -1969,7 +1742,6 @@ return { short_desc=N_("name of the printer to be used for :hardcopy"), type='string', scope={'global'}, secure=true, - vi_def=true, varname='p_pdev', defaults={if_true={vi=""}} }, @@ -1977,7 +1749,6 @@ return { full_name='printencoding', abbreviation='penc', short_desc=N_("encoding to be used for printing"), type='string', scope={'global'}, - vi_def=true, varname='p_penc', defaults={if_true={vi=""}} }, @@ -1986,7 +1757,6 @@ return { short_desc=N_("expression used to print PostScript for :hardcopy"), type='string', scope={'global'}, secure=true, - vi_def=true, varname='p_pexpr', defaults={if_true={vi=""}} }, @@ -1994,7 +1764,6 @@ return { full_name='printfont', abbreviation='pfn', short_desc=N_("name of the font to be used for :hardcopy"), type='string', scope={'global'}, - vi_def=true, varname='p_pfn', defaults={if_true={vi="courier"}} }, @@ -2002,7 +1771,6 @@ return { full_name='printheader', abbreviation='pheader', short_desc=N_("format of the header used for :hardcopy"), type='string', scope={'global'}, - vi_def=true, varname='p_header', defaults={if_true={vi="%<%f%h%m%=Page %N"}} }, @@ -2010,7 +1778,6 @@ return { full_name='printmbcharset', abbreviation='pmbcs', short_desc=N_("CJK character set to be used for :hardcopy"), type='string', scope={'global'}, - vi_def=true, varname='p_pmcs', defaults={if_true={vi=""}} }, @@ -2018,7 +1785,6 @@ return { full_name='printmbfont', abbreviation='pmbfn', short_desc=N_("font names to be used for CJK output of :hardcopy"), type='string', scope={'global'}, - vi_def=true, varname='p_pmfn', defaults={if_true={vi=""}} }, @@ -2027,7 +1793,6 @@ return { short_desc=N_("controls the format of :hardcopy output"), type='string', list='onecomma', scope={'global'}, deny_duplicates=true, - vi_def=true, varname='p_popt', defaults={if_true={vi=""}} }, @@ -2035,15 +1800,13 @@ return { full_name='prompt', short_desc=N_("enable prompt in Ex mode"), type='bool', scope={'global'}, - vi_def=true, - varname='p_prompt', + varname='p_force_on', defaults={if_true={vi=true}} }, { full_name='pumblend', abbreviation='pb', short_desc=N_("Controls transparency level of popup menu"), type='number', scope={'global'}, - vi_def=true, redraw={'ui_option'}, varname='p_pb', defaults={if_true={vi=0}} @@ -2052,7 +1815,6 @@ return { full_name='pumheight', abbreviation='ph', short_desc=N_("maximum height of the popup menu"), type='number', scope={'global'}, - vi_def=true, varname='p_ph', defaults={if_true={vi=0}} }, @@ -2060,7 +1822,6 @@ return { full_name='pumwidth', abbreviation='pw', short_desc=N_("minimum width of the popup menu"), type='number', scope={'global'}, - vi_def=true, varname='p_pw', defaults={if_true={vi=15}} }, @@ -2069,7 +1830,6 @@ return { short_desc=N_("selects default python version to use"), type='number', scope={'global'}, secure=true, - vi_def=true, varname='p_pyx', defaults={if_true={vi=0}} }, @@ -2077,7 +1837,6 @@ return { full_name='quickfixtextfunc', abbreviation='qftf', short_desc=N_("customize the quickfix window"), type='string', scope={'global'}, - vi_def=true, varname='p_qftf', defaults={if_true={vi=""}} }, @@ -2085,7 +1844,6 @@ return { full_name='quoteescape', abbreviation='qe', short_desc=N_("escape characters used in a string"), type='string', scope={'buffer'}, - vi_def=true, alloced=true, varname='p_qe', defaults={if_true={vi="\\"}} @@ -2095,7 +1853,6 @@ return { short_desc=N_("disallow writing the buffer"), type='bool', scope={'buffer'}, noglob=true, - vi_def=true, redraw={'statuslines'}, varname='p_ro', defaults={if_true={vi=false}} @@ -2104,7 +1861,6 @@ return { full_name='redrawdebug', abbreviation='rdb', short_desc=N_("Changes the way redrawing works (debug)"), type='string', list='onecomma', scope={'global'}, - vi_def=true, varname='p_rdb', defaults={if_true={vi=''}} }, @@ -2112,7 +1868,6 @@ return { full_name='redrawtime', abbreviation='rdt', short_desc=N_("timeout for 'hlsearch' and |:match| highlighting"), type='number', scope={'global'}, - vi_def=true, varname='p_rdt', defaults={if_true={vi=2000}} }, @@ -2120,7 +1875,6 @@ return { full_name='regexpengine', abbreviation='re', short_desc=N_("default regexp engine to use"), type='number', scope={'global'}, - vi_def=true, varname='p_re', defaults={if_true={vi=0}} }, @@ -2128,7 +1882,6 @@ return { full_name='relativenumber', abbreviation='rnu', short_desc=N_("show relative line number in front of each line"), type='bool', scope={'window'}, - vi_def=true, redraw={'current_window'}, defaults={if_true={vi=false}} }, @@ -2136,7 +1889,6 @@ return { full_name='remap', short_desc=N_("mappings to work recursively"), type='bool', scope={'global'}, - vi_def=true, varname='p_remap', defaults={if_true={vi=true}} }, @@ -2144,7 +1896,6 @@ return { full_name='report', short_desc=N_("for reporting nr. of lines changed"), type='number', scope={'global'}, - vi_def=true, varname='p_report', defaults={if_true={vi=2}} }, @@ -2152,8 +1903,6 @@ return { full_name='revins', abbreviation='ri', short_desc=N_("inserting characters will work backwards"), type='bool', scope={'global'}, - vi_def=true, - vim=true, varname='p_ri', defaults={if_true={vi=false}} }, @@ -2161,7 +1910,6 @@ return { full_name='rightleft', abbreviation='rl', short_desc=N_("window is right-to-left oriented"), type='bool', scope={'window'}, - vi_def=true, redraw={'current_window'}, defaults={if_true={vi=false}} }, @@ -2169,7 +1917,6 @@ return { full_name='rightleftcmd', abbreviation='rlc', short_desc=N_("commands for which editing works right-to-left"), type='string', scope={'window'}, - vi_def=true, alloced=true, redraw={'current_window'}, defaults={if_true={vi="search"}} @@ -2178,8 +1925,6 @@ return { full_name='ruler', abbreviation='ru', short_desc=N_("show cursor line and column in the status line"), type='bool', scope={'global'}, - vi_def=true, - vim=true, redraw={'statuslines'}, varname='p_ru', defaults={if_true={vi=true}} @@ -2188,7 +1933,6 @@ return { full_name='rulerformat', abbreviation='ruf', short_desc=N_("custom format for the ruler"), type='string', scope={'global'}, - vi_def=true, alloced=true, modelineexpr=true, redraw={'statuslines'}, @@ -2201,7 +1945,6 @@ return { type='string', list='onecomma', scope={'global'}, deny_duplicates=true, secure=true, - vi_def=true, expand='nodefault', varname='p_rtp', defaults={if_true={vi=''}} @@ -2211,7 +1954,6 @@ return { short_desc=N_("lines to scroll with CTRL-U and CTRL-D"), type='number', scope={'window'}, no_mkrc=true, - vi_def=true, pv_name='p_scroll', defaults={if_true={vi=0}} }, @@ -2219,7 +1961,6 @@ return { full_name='scrollback', abbreviation='scbk', short_desc=N_("lines to scroll with CTRL-U and CTRL-D"), type='number', scope={'buffer'}, - vi_def=true, varname='p_scbk', redraw={'current_buffer'}, defaults={if_true={vi=-1}} @@ -2228,7 +1969,6 @@ return { full_name='scrollbind', abbreviation='scb', short_desc=N_("scroll in window as other windows scroll"), type='bool', scope={'window'}, - vi_def=true, pv_name='p_scbind', defaults={if_true={vi=false}} }, @@ -2236,8 +1976,6 @@ return { full_name='scrolljump', abbreviation='sj', short_desc=N_("minimum number of lines to scroll"), type='number', scope={'global'}, - vi_def=true, - vim=true, varname='p_sj', defaults={if_true={vi=1}} }, @@ -2245,8 +1983,6 @@ return { full_name='scrolloff', abbreviation='so', short_desc=N_("minimum nr. of lines above and below cursor"), type='number', scope={'global', 'window'}, - vi_def=true, - vim=true, redraw={'all_windows'}, varname='p_so', defaults={if_true={vi=0}} @@ -2256,7 +1992,6 @@ return { short_desc=N_("how 'scrollbind' should behave"), type='string', list='onecomma', scope={'global'}, deny_duplicates=true, - vi_def=true, varname='p_sbo', defaults={if_true={vi="ver,jump"}} }, @@ -2264,7 +1999,6 @@ return { full_name='sections', abbreviation='sect', short_desc=N_("nroff macros that separate sections"), type='string', scope={'global'}, - vi_def=true, varname='p_sections', defaults={if_true={vi="SHNHH HUnhsh"}} }, @@ -2273,7 +2007,6 @@ return { short_desc=N_("mode for reading .vimrc in current dir"), type='bool', scope={'global'}, secure=true, - vi_def=true, varname='p_secure', defaults={if_true={vi=false}} }, @@ -2281,7 +2014,6 @@ return { full_name='selection', abbreviation='sel', short_desc=N_("what type of selection to use"), type='string', scope={'global'}, - vi_def=true, varname='p_sel', defaults={if_true={vi="inclusive"}} }, @@ -2290,7 +2022,6 @@ return { short_desc=N_("when to use Select mode instead of Visual mode"), type='string', list='onecomma', scope={'global'}, deny_duplicates=true, - vi_def=true, varname='p_slm', defaults={if_true={vi=""}} }, @@ -2299,10 +2030,8 @@ return { short_desc=N_("options for |:mksession|"), type='string', list='onecomma', scope={'global'}, deny_duplicates=true, - vim=true, varname='p_ssop', defaults={if_true={ - vi="blank,buffers,curdir,folds,help,options,tabpages,winsize", vim="blank,buffers,curdir,folds,help,tabpages,winsize" }} }, @@ -2313,14 +2042,13 @@ return { deny_duplicates=true, secure=true, varname='p_shada', - defaults={if_true={vi="", vim="!,'100,<50,s10,h"}} + defaults={if_true={vim="!,'100,<50,s10,h"}} }, { full_name='shadafile', abbreviation='sdf', short_desc=N_("overrides the filename used for shada"), type='string', list='onecomma', scope={'global'}, deny_duplicates=true, - vi_def=true, secure=true, expand=true, varname='p_shadafile', @@ -2331,7 +2059,6 @@ return { short_desc=N_("name of shell to use for external commands"), type='string', scope={'global'}, secure=true, - vi_def=true, expand=true, varname='p_sh', defaults={ @@ -2345,7 +2072,6 @@ return { short_desc=N_("flag to shell to execute one command"), type='string', scope={'global'}, secure=true, - vi_def=true, varname='p_shcf', defaults={ condition='WIN32', @@ -2358,7 +2084,6 @@ return { short_desc=N_("string to put output of \":make\" in error file"), type='string', scope={'global'}, secure=true, - vi_def=true, varname='p_sp', defaults={ condition='WIN32', @@ -2371,7 +2096,6 @@ return { short_desc=N_("quote character(s) for around shell command"), type='string', scope={'global'}, secure=true, - vi_def=true, varname='p_shq', defaults={if_true={vi=""}} }, @@ -2380,7 +2104,6 @@ return { short_desc=N_("string to put output of filter in a temp file"), type='string', scope={'global'}, secure=true, - vi_def=true, varname='p_srr', defaults={ condition='WIN32', @@ -2392,7 +2115,6 @@ return { full_name='shellslash', abbreviation='ssl', short_desc=N_("use forward slash for shell file names"), type='bool', scope={'global'}, - vi_def=true, varname='p_ssl', enable_if='BACKSLASH_IN_FILENAME', defaults={if_true={vi=false}} @@ -2402,14 +2124,13 @@ return { short_desc=N_("whether to use a temp file for shell commands"), type='bool', scope={'global'}, varname='p_stmp', - defaults={if_true={vi=false, vim=true}} + defaults={if_true={vim=true}} }, { full_name='shellxquote', abbreviation='sxq', short_desc=N_("like 'shellquote', but include redirection"), type='string', scope={'global'}, secure=true, - vi_def=true, varname='p_sxq', defaults={ condition='WIN32', @@ -2422,7 +2143,6 @@ return { short_desc=N_("characters to escape when 'shellxquote' is ("), type='string', scope={'global'}, secure=true, - vi_def=true, varname='p_sxe', defaults={if_true={vi=""}} }, @@ -2430,8 +2150,6 @@ return { full_name='shiftround', abbreviation='sr', short_desc=N_("round indent to multiple of shiftwidth"), type='bool', scope={'global'}, - vi_def=true, - vim=true, varname='p_sr', defaults={if_true={vi=false}} }, @@ -2439,7 +2157,6 @@ return { full_name='shiftwidth', abbreviation='sw', short_desc=N_("number of spaces to use for (auto)indent step"), type='number', scope={'buffer'}, - vi_def=true, varname='p_sw', defaults={if_true={vi=8}} }, @@ -2447,15 +2164,13 @@ return { full_name='shortmess', abbreviation='shm', short_desc=N_("list of flags, reduce length of messages"), type='string', list='flags', scope={'global'}, - vim=true, varname='p_shm', - defaults={if_true={vi="S", vim="filnxtToOF"}} + defaults={if_true={vim="filnxtToOF"}} }, { full_name='showbreak', abbreviation='sbr', short_desc=N_("string to use at the start of wrapped lines"), type='string', scope={'global'}, - vi_def=true, redraw={'all_windows'}, varname='p_sbr', defaults={if_true={vi=""}} @@ -2464,15 +2179,13 @@ return { full_name='showcmd', abbreviation='sc', short_desc=N_("show (partial) command in status line"), type='bool', scope={'global'}, - vim=true, varname='p_sc', - defaults={if_true={vi=false, vim=true}} + defaults={if_true={vim=true}} }, { full_name='showfulltag', abbreviation='sft', short_desc=N_("show full tag pattern when completing tag"), type='bool', scope={'global'}, - vi_def=true, varname='p_sft', defaults={if_true={vi=false}} }, @@ -2480,7 +2193,6 @@ return { full_name='showmatch', abbreviation='sm', short_desc=N_("briefly jump to matching bracket if insert one"), type='bool', scope={'global'}, - vi_def=true, varname='p_sm', defaults={if_true={vi=false}} }, @@ -2488,15 +2200,13 @@ return { full_name='showmode', abbreviation='smd', short_desc=N_("message on status line to show current mode"), type='bool', scope={'global'}, - vim=true, varname='p_smd', - defaults={if_true={vi=false, vim=true}} + defaults={if_true={vim=true}} }, { full_name='showtabline', abbreviation='stal', short_desc=N_("tells when the tab pages line is displayed"), type='number', scope={'global'}, - vi_def=true, redraw={'all_windows', 'ui_option'}, varname='p_stal', defaults={if_true={vi=1}} @@ -2505,7 +2215,6 @@ return { full_name='sidescroll', abbreviation='ss', short_desc=N_("minimum number of columns to scroll horizontal"), type='number', scope={'global'}, - vi_def=true, varname='p_ss', defaults={if_true={vi=1}} }, @@ -2513,8 +2222,6 @@ return { full_name='sidescrolloff', abbreviation='siso', short_desc=N_("min. nr. of columns to left and right of cursor"), type='number', scope={'global', 'window'}, - vi_def=true, - vim=true, redraw={'all_windows'}, varname='p_siso', defaults={if_true={vi=0}} @@ -2523,7 +2230,6 @@ return { full_name='signcolumn', abbreviation='scl', short_desc=N_("when to display the sign column"), type='string', scope={'window'}, - vi_def=true, alloced=true, redraw={'current_window'}, defaults={if_true={vi="auto"}} @@ -2532,8 +2238,6 @@ return { full_name='smartcase', abbreviation='scs', short_desc=N_("no ignore case when pattern has uppercase"), type='bool', scope={'global'}, - vi_def=true, - vim=true, varname='p_scs', defaults={if_true={vi=false}} }, @@ -2541,8 +2245,6 @@ return { full_name='smartindent', abbreviation='si', short_desc=N_("smart autoindenting for C programs"), type='bool', scope={'buffer'}, - vi_def=true, - vim=true, varname='p_si', defaults={if_true={vi=false}} }, @@ -2550,16 +2252,13 @@ return { full_name='smarttab', abbreviation='sta', short_desc=N_("use 'shiftwidth' when inserting <Tab>"), type='bool', scope={'global'}, - vim=true, varname='p_sta', - defaults={if_true={vi=false, vim=true}} + defaults={if_true={vim=true}} }, { full_name='softtabstop', abbreviation='sts', short_desc=N_("number of spaces that <Tab> uses while editing"), type='number', scope={'buffer'}, - vi_def=true, - vim=true, varname='p_sts', defaults={if_true={vi=0}} }, @@ -2567,7 +2266,6 @@ return { full_name='spell', short_desc=N_("spell checking"), type='bool', scope={'window'}, - vi_def=true, redraw={'current_window'}, defaults={if_true={vi=false}} }, @@ -2575,7 +2273,6 @@ return { full_name='spellcapcheck', abbreviation='spc', short_desc=N_("pattern to locate end of a sentence"), type='string', scope={'buffer'}, - vi_def=true, alloced=true, redraw={'current_buffer'}, varname='p_spc', @@ -2587,7 +2284,6 @@ return { type='string', list='onecomma', scope={'buffer'}, deny_duplicates=true, secure=true, - vi_def=true, alloced=true, expand=true, varname='p_spf', @@ -2598,7 +2294,6 @@ return { short_desc=N_("language(s) to do spell checking for"), type='string', list='onecomma', scope={'buffer'}, deny_duplicates=true, - vi_def=true, alloced=true, expand=true, redraw={'current_buffer'}, @@ -2611,7 +2306,6 @@ return { type='string', list='onecomma', scope={'global'}, deny_duplicates=true, secure=true, - vi_def=true, expand=true, varname='p_sps', defaults={if_true={vi="best"}} @@ -2621,16 +2315,14 @@ return { type='string', list='onecomma', scope={'buffer'}, deny_duplicates=true, secure=true, - vi_def=true, expand=true, varname='p_spo', - defaults={if_true={vi="", vim=""}} + defaults={if_true={vim=""}} }, { full_name='splitbelow', abbreviation='sb', short_desc=N_("new window from split is below the current one"), type='bool', scope={'global'}, - vi_def=true, varname='p_sb', defaults={if_true={vi=false}} }, @@ -2638,7 +2330,6 @@ return { full_name='splitright', abbreviation='spr', short_desc=N_("new window is put right of the current one"), type='bool', scope={'global'}, - vi_def=true, varname='p_spr', defaults={if_true={vi=false}} }, @@ -2646,7 +2337,6 @@ return { full_name='startofline', abbreviation='sol', short_desc=N_("commands move cursor to first non-blank in line"), type='bool', scope={'global'}, - vi_def=true, vim=false, varname='p_sol', defaults={if_true={vi=false}} @@ -2655,7 +2345,6 @@ return { full_name='statusline', abbreviation='stl', short_desc=N_("custom format for the status line"), type='string', scope={'global', 'window'}, - vi_def=true, alloced=true, modelineexpr=true, redraw={'statuslines'}, @@ -2667,7 +2356,6 @@ return { short_desc=N_("suffixes that are ignored with multiple match"), type='string', list='onecomma', scope={'global'}, deny_duplicates=true, - vi_def=true, varname='p_su', defaults={if_true={vi=".bak,~,.o,.h,.info,.swp,.obj"}} }, @@ -2676,7 +2364,6 @@ return { short_desc=N_("suffixes added when searching for a file"), type='string', list='onecomma', scope={'buffer'}, deny_duplicates=true, - vi_def=true, alloced=true, varname='p_sua', defaults={if_true={vi=""}} @@ -2685,7 +2372,6 @@ return { full_name='swapfile', abbreviation='swf', short_desc=N_("whether to use a swapfile for a buffer"), type='bool', scope={'buffer'}, - vi_def=true, redraw={'statuslines'}, varname='p_swf', defaults={if_true={vi=true}} @@ -2695,7 +2381,6 @@ return { short_desc=N_("sets behavior when switching to another buffer"), type='string', list='onecomma', scope={'global'}, deny_duplicates=true, - vi_def=true, varname='p_swb', defaults={if_true={vi=""}} }, @@ -2703,7 +2388,6 @@ return { full_name='synmaxcol', abbreviation='smc', short_desc=N_("maximum column to find syntax items"), type='number', scope={'buffer'}, - vi_def=true, redraw={'current_buffer'}, varname='p_smc', defaults={if_true={vi=3000}} @@ -2714,7 +2398,6 @@ return { type='string', scope={'buffer'}, noglob=true, normal_fname_chars=true, - vi_def=true, alloced=true, varname='p_syn', defaults={if_true={vi=""}} @@ -2723,8 +2406,6 @@ return { full_name='tagfunc', abbreviation='tfu', short_desc=N_("function used to perform tag searches"), type='string', scope={'buffer'}, - vim=true, - vi_def=true, varname='p_tfu', defaults={if_true={vi=""}} }, @@ -2732,7 +2413,6 @@ return { full_name='tabline', abbreviation='tal', short_desc=N_("custom format for the console tab pages line"), type='string', scope={'global'}, - vi_def=true, modelineexpr=true, redraw={'all_windows'}, varname='p_tal', @@ -2742,15 +2422,13 @@ return { full_name='tabpagemax', abbreviation='tpm', short_desc=N_("maximum number of tab pages for |-p| and \"tab all\""), type='number', scope={'global'}, - vim=true, varname='p_tpm', - defaults={if_true={vi=10, vim=50}} + defaults={if_true={vim=50}} }, { full_name='tabstop', abbreviation='ts', short_desc=N_("number of spaces that <Tab> in file uses"), type='number', scope={'buffer'}, - vi_def=true, redraw={'current_buffer'}, varname='p_ts', defaults={if_true={vi=8}} @@ -2759,7 +2437,6 @@ return { full_name='tagbsearch', abbreviation='tbs', short_desc=N_("use binary searching in tags files"), type='bool', scope={'global'}, - vi_def=true, varname='p_tbs', defaults={if_true={vi=true}} }, @@ -2767,15 +2444,13 @@ return { full_name='tagcase', abbreviation='tc', short_desc=N_("how to handle case when searching in tags files"), type='string', scope={'global', 'buffer'}, - vim=true, varname='p_tc', - defaults={if_true={vi="followic", vim="followic"}} + defaults={if_true={vim="followic"}} }, { full_name='taglength', abbreviation='tl', short_desc=N_("number of significant characters for a tag"), type='number', scope={'global'}, - vi_def=true, varname='p_tl', defaults={if_true={vi=0}} }, @@ -2783,16 +2458,14 @@ return { full_name='tagrelative', abbreviation='tr', short_desc=N_("file names in tag file are relative"), type='bool', scope={'global'}, - vim=true, varname='p_tr', - defaults={if_true={vi=false, vim=true}} + defaults={if_true={vim=true}} }, { full_name='tags', abbreviation='tag', short_desc=N_("list of file names used by the tag command"), type='string', list='onecomma', scope={'global', 'buffer'}, deny_duplicates=true, - vi_def=true, expand=true, varname='p_tags', defaults={if_true={vi="./tags;,tags"}} @@ -2801,7 +2474,6 @@ return { full_name='tagstack', abbreviation='tgst', short_desc=N_("push tags onto the tag stack"), type='bool', scope={'global'}, - vi_def=true, varname='p_tgst', defaults={if_true={vi=true}} }, @@ -2809,7 +2481,6 @@ return { full_name='termbidi', abbreviation='tbidi', short_desc=N_("terminal takes care of bi-directionality"), type='bool', scope={'global'}, - vi_def=true, varname='p_tbidi', defaults={if_true={vi=false}} }, @@ -2817,14 +2488,12 @@ return { full_name='termencoding', abbreviation='tenc', short_desc=N_("Terminal encodig"), type='string', scope={'global'}, - vi_def=true, defaults={if_true={vi=""}} }, { full_name='termguicolors', abbreviation='tgc', short_desc=N_("Terminal true color support"), type='bool', scope={'global'}, - vi_def=false, redraw={'ui_option'}, varname='p_tgc', defaults={if_true={vi=false}} @@ -2833,15 +2502,13 @@ return { full_name='termpastefilter', abbreviation='tpf', type='string', list='onecomma', scope={'global'}, deny_duplicates=true, - vim=true, varname='p_tpf', - defaults={if_true={vi="", vim="BS,HT,ESC,DEL"}} + defaults={if_true={vim="BS,HT,ESC,DEL"}} }, { full_name='terse', short_desc=N_("hides notification of search wrap"), type='bool', scope={'global'}, - vi_def=true, varname='p_terse', defaults={if_true={vi=false}} }, @@ -2849,8 +2516,6 @@ return { full_name='textwidth', abbreviation='tw', short_desc=N_("maximum width of text that is being inserted"), type='number', scope={'buffer'}, - vi_def=true, - vim=true, redraw={'current_buffer'}, varname='p_tw', defaults={if_true={vi=0}} @@ -2861,7 +2526,6 @@ return { type='string', list='onecomma', scope={'global', 'buffer'}, deny_duplicates=true, normal_dname_chars=true, - vi_def=true, expand=true, varname='p_tsr', defaults={if_true={vi=""}} @@ -2870,8 +2534,6 @@ return { full_name='tildeop', abbreviation='top', short_desc=N_("tilde command \"~\" behaves like an operator"), type='bool', scope={'global'}, - vi_def=true, - vim=true, varname='p_to', defaults={if_true={vi=false}} }, @@ -2879,7 +2541,6 @@ return { full_name='timeout', abbreviation='to', short_desc=N_("time out on mappings and key codes"), type='bool', scope={'global'}, - vi_def=true, varname='p_timeout', defaults={if_true={vi=true}} }, @@ -2887,7 +2548,6 @@ return { full_name='timeoutlen', abbreviation='tm', short_desc=N_("time out time in milliseconds"), type='number', scope={'global'}, - vi_def=true, varname='p_tm', defaults={if_true={vi=1000}} }, @@ -2895,7 +2555,6 @@ return { full_name='title', short_desc=N_("Vim set the title of the window"), type='bool', scope={'global'}, - vi_def=true, varname='p_title', defaults={if_true={vi=false}} }, @@ -2903,7 +2562,6 @@ return { full_name='titlelen', short_desc=N_("of 'columns' used for window title"), type='number', scope={'global'}, - vi_def=true, varname='p_titlelen', defaults={if_true={vi=85}} }, @@ -2913,7 +2571,6 @@ return { type='string', scope={'global'}, secure=true, no_mkrc=true, - vi_def=true, varname='p_titleold', defaults={if_true={vi=""}} }, @@ -2921,7 +2578,6 @@ return { full_name='titlestring', short_desc=N_("to use for the Vim window title"), type='string', scope={'global'}, - vi_def=true, modelineexpr=true, varname='p_titlestring', defaults={if_true={vi=""}} @@ -2930,8 +2586,6 @@ return { full_name='ttimeout', short_desc=N_("out on mappings"), type='bool', scope={'global'}, - vi_def=true, - vim=true, redraw={'ui_option'}, varname='p_ttimeout', defaults={if_true={vi=true}} @@ -2940,7 +2594,6 @@ return { full_name='ttimeoutlen', abbreviation='ttm', short_desc=N_("time out time for key codes in milliseconds"), type='number', scope={'global'}, - vi_def=true, redraw={'ui_option'}, varname='p_ttm', defaults={if_true={vi=50}} @@ -2950,7 +2603,6 @@ return { short_desc=N_("No description"), type='bool', scope={'global'}, no_mkrc=true, - vi_def=true, varname='p_force_on', defaults={if_true={vi=true}} }, @@ -2960,7 +2612,6 @@ return { type='string', list='onecomma', scope={'global'}, deny_duplicates=true, secure=true, - vi_def=true, expand='nodefault', varname='p_udir', defaults={if_true={vi=''}} @@ -2969,8 +2620,6 @@ return { full_name='undofile', abbreviation='udf', short_desc=N_("save undo information in a file"), type='bool', scope={'buffer'}, - vi_def=true, - vim=true, varname='p_udf', defaults={if_true={vi=false}} }, @@ -2978,7 +2627,6 @@ return { full_name='undolevels', abbreviation='ul', short_desc=N_("maximum number of changes that can be undone"), type='number', scope={'global', 'buffer'}, - vi_def=true, varname='p_ul', defaults={if_true={vi=1000}} }, @@ -2986,7 +2634,6 @@ return { full_name='undoreload', abbreviation='ur', short_desc=N_("max nr of lines to save for undo on a buffer reload"), type='number', scope={'global'}, - vi_def=true, varname='p_ur', defaults={if_true={vi=10000}} }, @@ -2994,7 +2641,6 @@ return { full_name='updatecount', abbreviation='uc', short_desc=N_("after this many characters flush swap file"), type='number', scope={'global'}, - vi_def=true, varname='p_uc', defaults={if_true={vi=200}} }, @@ -3002,7 +2648,6 @@ return { full_name='updatetime', abbreviation='ut', short_desc=N_("after this many milliseconds flush swap file"), type='number', scope={'global'}, - vi_def=true, varname='p_ut', defaults={if_true={vi=4000}} }, @@ -3010,7 +2655,6 @@ return { full_name='varsofttabstop', abbreviation='vsts', short_desc=N_("list of numbers of spaces that <Tab> uses while editing"), type='string', list='comma', scope={'buffer'}, - vi_def=true, varname='p_vsts', defaults={if_true={vi=""}} }, @@ -3018,7 +2662,6 @@ return { full_name='vartabstop', abbreviation='vts', short_desc=N_("list of numbers of spaces that <Tab> in file uses"), type='string', list='comma', scope={'buffer'}, - vi_def=true, varname='p_vts', redraw={'current_buffer'}, defaults={if_true={vi=""}} @@ -3027,7 +2670,6 @@ return { full_name='verbose', abbreviation='vbs', short_desc=N_("give informative messages"), type='number', scope={'global'}, - vi_def=true, varname='p_verbose', defaults={if_true={vi=0}} }, @@ -3036,7 +2678,6 @@ return { short_desc=N_("file to write messages in"), type='string', scope={'global'}, secure=true, - vi_def=true, expand=true, varname='p_vfile', defaults={if_true={vi=""}} @@ -3046,7 +2687,6 @@ return { short_desc=N_("directory where to store files with :mkview"), type='string', scope={'global'}, secure=true, - vi_def=true, expand='nodefault', varname='p_vdir', defaults={if_true={vi=''}} @@ -3056,7 +2696,6 @@ return { short_desc=N_("specifies what to save for :mkview"), type='string', list='onecomma', scope={'global'}, deny_duplicates=true, - vi_def=true, varname='p_vop', defaults={if_true={vi="folds,options,cursor,curdir"}} }, @@ -3077,17 +2716,14 @@ return { short_desc=N_("when to use virtual editing"), type='string', list='onecomma', scope={'global'}, deny_duplicates=true, - vi_def=true, - vim=true, redraw={'curswant'}, varname='p_ve', - defaults={if_true={vi="", vim=""}} + defaults={if_true={vim=""}} }, { full_name='visualbell', abbreviation='vb', short_desc=N_("use visual bell instead of beeping"), type='bool', scope={'global'}, - vi_def=true, varname='p_vb', defaults={if_true={vi=false}} }, @@ -3095,7 +2731,6 @@ return { full_name='warn', short_desc=N_("for shell command when buffer was changed"), type='bool', scope={'global'}, - vi_def=true, varname='p_warn', defaults={if_true={vi=true}} }, @@ -3103,23 +2738,20 @@ return { full_name='whichwrap', abbreviation='ww', short_desc=N_("allow specified keys to cross line boundaries"), type='string', list='flagscomma', scope={'global'}, - vim=true, varname='p_ww', - defaults={if_true={vi="", vim="b,s"}} + defaults={if_true={vim="b,s"}} }, { full_name='wildchar', abbreviation='wc', short_desc=N_("command-line character for wildcard expansion"), type='number', scope={'global'}, - vim=true, varname='p_wc', - defaults={if_true={vi=imacros('Ctrl_E'), vim=imacros('TAB')}} + defaults={if_true={vim=imacros('TAB')}} }, { full_name='wildcharm', abbreviation='wcm', short_desc=N_("like 'wildchar' but also works when mapped"), type='number', scope={'global'}, - vi_def=true, varname='p_wcm', defaults={if_true={vi=0}} }, @@ -3128,7 +2760,6 @@ return { short_desc=N_("files matching these patterns are not completed"), type='string', list='onecomma', scope={'global'}, deny_duplicates=true, - vi_def=true, varname='p_wig', defaults={if_true={vi=""}} }, @@ -3136,7 +2767,6 @@ return { full_name='wildignorecase', abbreviation='wic', short_desc=N_("ignore case when completing file names"), type='bool', scope={'global'}, - vi_def=true, varname='p_wic', defaults={if_true={vi=false}} }, @@ -3144,33 +2774,29 @@ return { full_name='wildmenu', abbreviation='wmnu', short_desc=N_("use menu for command line completion"), type='bool', scope={'global'}, - vim=true, varname='p_wmnu', - defaults={if_true={vi=false, vim=true}} + defaults={if_true={vim=true}} }, { full_name='wildmode', abbreviation='wim', short_desc=N_("mode for 'wildchar' command-line expansion"), type='string', list='onecomma', scope={'global'}, deny_duplicates=false, - vim=true, varname='p_wim', - defaults={if_true={vi="", vim="full"}} + defaults={if_true={vim="full"}} }, { full_name='wildoptions', abbreviation='wop', short_desc=N_("specifies how command line completion is done"), type='string', list='onecomma', scope={'global'}, deny_duplicates=true, - vim=true, varname='p_wop', - defaults={if_true={vi='', vim='pum,tagfile'}} + defaults={if_true={vim='pum,tagfile'}} }, { full_name='winaltkeys', abbreviation='wak', short_desc=N_("when the windows system handles ALT keys"), type='string', scope={'global'}, - vi_def=true, varname='p_wak', defaults={if_true={vi="menu"}} }, @@ -3178,7 +2804,6 @@ return { full_name='winblend', abbreviation='winbl', short_desc=N_("Controls transparency level for floating windows"), type='number', scope={'window'}, - vi_def=true, redraw={'current_window'}, defaults={if_true={vi=0}} }, @@ -3186,7 +2811,6 @@ return { full_name='winhighlight', abbreviation='winhl', short_desc=N_("Setup window-local highlights"); type='string', scope={'window'}, - vi_def=true, alloced=true, redraw={'current_window'}, defaults={if_true={vi=""}} @@ -3195,7 +2819,6 @@ return { full_name='window', abbreviation='wi', short_desc=N_("nr of lines to scroll for CTRL-F and CTRL-B"), type='number', scope={'global'}, - vi_def=true, varname='p_window', defaults={if_true={vi=0}} }, @@ -3203,7 +2826,6 @@ return { full_name='winheight', abbreviation='wh', short_desc=N_("minimum number of lines for the current window"), type='number', scope={'global'}, - vi_def=true, varname='p_wh', defaults={if_true={vi=1}} }, @@ -3211,7 +2833,6 @@ return { full_name='winfixheight', abbreviation='wfh', short_desc=N_("keep window height when opening/closing windows"), type='bool', scope={'window'}, - vi_def=true, redraw={'statuslines'}, defaults={if_true={vi=false}} }, @@ -3219,7 +2840,6 @@ return { full_name='winfixwidth', abbreviation='wfw', short_desc=N_("keep window width when opening/closing windows"), type='bool', scope={'window'}, - vi_def=true, redraw={'statuslines'}, defaults={if_true={vi=false}} }, @@ -3227,7 +2847,6 @@ return { full_name='winminheight', abbreviation='wmh', short_desc=N_("minimum number of lines for any window"), type='number', scope={'global'}, - vi_def=true, varname='p_wmh', defaults={if_true={vi=1}} }, @@ -3235,7 +2854,6 @@ return { full_name='winminwidth', abbreviation='wmw', short_desc=N_("minimal number of columns for any window"), type='number', scope={'global'}, - vi_def=true, varname='p_wmw', defaults={if_true={vi=1}} }, @@ -3243,7 +2861,6 @@ return { full_name='winwidth', abbreviation='wiw', short_desc=N_("minimal number of columns for current window"), type='number', scope={'global'}, - vi_def=true, varname='p_wiw', defaults={if_true={vi=20}} }, @@ -3251,7 +2868,6 @@ return { full_name='wrap', short_desc=N_("lines wrap and continue on the next line"), type='bool', scope={'window'}, - vi_def=true, redraw={'current_window'}, defaults={if_true={vi=true}} }, @@ -3259,7 +2875,6 @@ return { full_name='wrapmargin', abbreviation='wm', short_desc=N_("chars from the right where wrapping starts"), type='number', scope={'buffer'}, - vi_def=true, varname='p_wm', defaults={if_true={vi=0}} }, @@ -3267,7 +2882,6 @@ return { full_name='wrapscan', abbreviation='ws', short_desc=N_("searches wrap around the end of the file"), type='bool', scope={'global'}, - vi_def=true, varname='p_ws', defaults={if_true={vi=true}} }, @@ -3275,7 +2889,6 @@ return { full_name='write', short_desc=N_("to a file is allowed"), type='bool', scope={'global'}, - vi_def=true, varname='p_write', defaults={if_true={vi=true}} }, @@ -3283,7 +2896,6 @@ return { full_name='writeany', abbreviation='wa', short_desc=N_("write to file with no need for \"!\" override"), type='bool', scope={'global'}, - vi_def=true, varname='p_wa', defaults={if_true={vi=false}} }, @@ -3291,8 +2903,6 @@ return { full_name='writebackup', abbreviation='wb', short_desc=N_("make a backup before overwriting a file"), type='bool', scope={'global'}, - vi_def=true, - vim=true, varname='p_wb', defaults={if_true={vi=true}} }, @@ -3300,7 +2910,6 @@ return { full_name='writedelay', abbreviation='wd', short_desc=N_("delay this many msec for each char (for debug)"), type='number', scope={'global'}, - vi_def=true, varname='p_wd', defaults={if_true={vi=0}} }, diff --git a/src/nvim/search.c b/src/nvim/search.c index a946a5e24b..809eec7ffc 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -1501,7 +1501,7 @@ int searchc(cmdarg_T *cap, int t_cmd) FUNC_ATTR_NONNULL_ALL { int c = cap->nchar; // char to search for - Direction dir = cap->arg; // TRUE for searching forward + int dir = cap->arg; // true for searching forward long count = cap->count1; // repeat count int col; char_u *p; diff --git a/src/nvim/search.h b/src/nvim/search.h index 98ddaa5eeb..0dbaf79c37 100644 --- a/src/nvim/search.h +++ b/src/nvim/search.h @@ -88,7 +88,7 @@ typedef struct searchstat { int cur; // current position of found words int cnt; // total count of found words - int exact_match; // TRUE if matched exactly on specified position + bool exact_match; // true if matched exactly on specified position int incomplete; // 0: search was fully completed // 1: recomputing was timed out // 2: max count exceeded diff --git a/src/nvim/sign.c b/src/nvim/sign.c index d884ae62f4..c6f59b42b8 100644 --- a/src/nvim/sign.c +++ b/src/nvim/sign.c @@ -115,10 +115,10 @@ static void sign_group_unref(char_u *groupname) } } -/// Returns TRUE if 'sign' is in 'group'. +/// @return true if 'sign' is in 'group'. /// A sign can either be in the global group (sign->group == NULL) /// or in a named group. If 'group' is '*', then the sign is part of the group. -int sign_in_group(sign_entry_T *sign, const char_u *group) +bool sign_in_group(sign_entry_T *sign, const char_u *group) { return ((group != NULL && STRCMP(group, "*") == 0) || (group == NULL && sign->se_group == NULL) diff --git a/src/nvim/state.c b/src/nvim/state.c index a3c74789d1..437cb0db47 100644 --- a/src/nvim/state.c +++ b/src/nvim/state.c @@ -171,12 +171,10 @@ char *get_mode(void) buf[1] = 'x'; } } - } else if ((State & CMDLINE) || exmode_active) { + } else if (State & CMDLINE) { buf[0] = 'c'; - if (exmode_active == EXMODE_VIM) { + if (exmode_active) { buf[1] = 'v'; - } else if (exmode_active == EXMODE_NORMAL) { - buf[1] = 'e'; } } else if (State & TERM_FOCUS) { buf[0] = 't'; diff --git a/src/nvim/testdir/setup.vim b/src/nvim/testdir/setup.vim index fd9cfb54be..fcbc28fdc0 100644 --- a/src/nvim/testdir/setup.vim +++ b/src/nvim/testdir/setup.vim @@ -20,7 +20,7 @@ set tags=./tags,tags set undodir^=. set wildoptions= set startofline -set sessionoptions&vi +set sessionoptions+=options " 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/test_mksession.vim b/src/nvim/testdir/test_mksession.vim index 4e46dbac16..4026f2bf98 100644 --- a/src/nvim/testdir/test_mksession.vim +++ b/src/nvim/testdir/test_mksession.vim @@ -170,7 +170,7 @@ func Test_mksession_rtp() return endif new - set sessionoptions&vi + set sessionoptions+=options let _rtp=&rtp " Make a real long (invalid) runtimepath value, " that should exceed PATH_MAX (hopefully) @@ -290,7 +290,7 @@ endfunc if has('extra_search') func Test_mksession_hlsearch() - set sessionoptions&vi + set sessionoptions+=options set hlsearch mksession! Xtest_mks.out nohlsearch @@ -630,7 +630,7 @@ endfunc " Test for mksession with a named scratch buffer func Test_mksession_scratch() - set sessionoptions&vi + set sessionoptions+=options enew | only file Xscratch set buftype=nofile diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c index 431237bac5..dcc086a0cf 100644 --- a/src/nvim/tui/tui.c +++ b/src/nvim/tui/tui.c @@ -1123,8 +1123,8 @@ static void tui_mode_change(UI *ui, String mode, Integer mode_idx) data->showing_mode = (ModeShape)mode_idx; } -static void tui_grid_scroll(UI *ui, Integer g, Integer startrow, Integer endrow, - Integer startcol, Integer endcol, +static void tui_grid_scroll(UI *ui, Integer g, Integer startrow, // -V751 + Integer endrow, Integer startcol, Integer endcol, Integer rows, Integer cols FUNC_ATTR_UNUSED) { TUIData *data = ui->data; diff --git a/src/nvim/undo.c b/src/nvim/undo.c index 7afabc7913..3096fe84c0 100644 --- a/src/nvim/undo.c +++ b/src/nvim/undo.c @@ -1018,14 +1018,14 @@ static ExtmarkUndoObject *unserialize_extmark(bufinfo_T *bi, bool *error, extup->type = type; if (type == kExtmarkSplice) { n_elems = (size_t)sizeof(ExtmarkSplice) / sizeof(uint8_t); - buf = xcalloc(sizeof(uint8_t), n_elems); + buf = xcalloc(n_elems, sizeof(uint8_t)); if (!undo_read(bi, buf, n_elems)) { goto error; } extup->data.splice = *(ExtmarkSplice *)buf; } else if (type == kExtmarkMove) { n_elems = (size_t)sizeof(ExtmarkMove) / sizeof(uint8_t); - buf = xcalloc(sizeof(uint8_t), n_elems); + buf = xcalloc(n_elems, sizeof(uint8_t)); if (!undo_read(bi, buf, n_elems)) { goto error; } diff --git a/test/functional/legacy/listchars_spec.lua b/test/functional/legacy/listchars_spec.lua index cffb9fd376..dc6ccd3628 100644 --- a/test/functional/legacy/listchars_spec.lua +++ b/test/functional/legacy/listchars_spec.lua @@ -8,7 +8,7 @@ local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers describe("'listchars'", function() before_each(function() clear() - feed_command('set listchars&vi') + feed_command('set listchars=eol:$') end) -- luacheck: ignore 613 (Trailing whitespace in a string) diff --git a/test/functional/legacy/mksession_spec.lua b/test/functional/legacy/mksession_spec.lua index a2af891107..bca9cd833c 100644 --- a/test/functional/legacy/mksession_spec.lua +++ b/test/functional/legacy/mksession_spec.lua @@ -12,7 +12,7 @@ describe('mksession', function() end) it('supports "skiprtp" value', function() - command('set sessionoptions&vi') + command('set sessionoptions+=options') command('set rtp+=$HOME') command('set pp+=$HOME') command('mksession! Xtest_mks.out') diff --git a/test/functional/lua/uri_spec.lua b/test/functional/lua/uri_spec.lua index f782769935..052a8a1ecd 100644 --- a/test/functional/lua/uri_spec.lua +++ b/test/functional/lua/uri_spec.lua @@ -53,12 +53,18 @@ describe('URI methods', function() describe('uri to filepath', function() describe('decode Unix file path', function() - it('file path includes only ascii charactors', function() + it('file path includes only ascii characters', function() exec_lua("uri = 'file:///Foo/Bar/Baz.txt'") eq('/Foo/Bar/Baz.txt', exec_lua("return vim.uri_to_fname(uri)")) end) + it('local file path without hostname', function() + exec_lua("uri = 'file:/Foo/Bar/Baz.txt'") + + eq('/Foo/Bar/Baz.txt', exec_lua("return vim.uri_to_fname(uri)")) + end) + it('file path including white space', function() exec_lua("uri = 'file:///Foo%20/Bar/Baz.txt'") @@ -85,6 +91,15 @@ describe('URI methods', function() eq('C:\\Foo\\Bar\\Baz.txt', exec_lua(test_case)) end) + it('local file path without hostname', function() + local test_case = [[ + local uri = 'file:/C:/Foo/Bar/Baz.txt' + return vim.uri_to_fname(uri) + ]] + + eq('C:\\Foo\\Bar\\Baz.txt', exec_lua(test_case)) + end) + it('file path includes only ascii charactors with encoded colon character', function() local test_case = [[ local uri = 'file:///C%3A/Foo/Bar/Baz.txt' @@ -125,6 +140,12 @@ describe('URI methods', function() return vim.uri_to_fname('JDT://content/%5C/') ]]) end) + + it('uri_to_fname returns non-file scheme URI without authority unchanged', function() + eq('zipfile:/path/to/archive.zip%3A%3Afilename.txt', exec_lua [[ + return vim.uri_to_fname('zipfile:/path/to/archive.zip%3A%3Afilename.txt') + ]]) + end) end) describe('decode URI without scheme', function() @@ -146,5 +167,14 @@ describe('URI methods', function() ]], uri) eq(uri, exec_lua(test_case)) end) + + it('uri_to_bufnr & uri_from_bufnr returns original uri for non-file uris without authority', function() + local uri = 'zipfile:/path/to/archive.zip%3A%3Afilename.txt' + local test_case = string.format([[ + local uri = '%s' + return vim.uri_from_bufnr(vim.uri_to_bufnr(uri)) + ]], uri) + eq(uri, exec_lua(test_case)) + end) end) end) diff --git a/test/functional/lua/vim_spec.lua b/test/functional/lua/vim_spec.lua index 976e63b44d..4e2bed4deb 100644 --- a/test/functional/lua/vim_spec.lua +++ b/test/functional/lua/vim_spec.lua @@ -603,6 +603,31 @@ describe('lua stdlib', function() return vim.tbl_islist(c) and count == 0 ]])) + eq(exec_lua([[ + local a = { a = { b = 1 } } + local b = { a = {} } + return vim.tbl_deep_extend("force", a, b) + ]]), {a = {b = 1}}) + + eq(exec_lua([[ + local a = { a = 123 } + local b = { a = { b = 1} } + return vim.tbl_deep_extend("force", a, b) + ]]), {a = {b = 1}}) + + ok(exec_lua([[ + local a = { a = {[2] = 3} } + local b = { a = {[3] = 3} } + local c = vim.tbl_deep_extend("force", a, b) + return vim.deep_equal(c, {a = {[3] = 3}}) + ]])) + + eq(exec_lua([[ + local a = { a = { b = 1} } + local b = { a = 123 } + return vim.tbl_deep_extend("force", a, b) + ]]), {a = 123 }) + eq('Error executing lua: vim/shared.lua:0: invalid "behavior": nil', pcall_err(exec_lua, [[ return vim.tbl_deep_extend() diff --git a/test/functional/plugin/lsp/codelens_spec.lua b/test/functional/plugin/lsp/codelens_spec.lua index e09d93f7cc..2dc9b8f960 100644 --- a/test/functional/plugin/lsp/codelens_spec.lua +++ b/test/functional/plugin/lsp/codelens_spec.lua @@ -11,7 +11,7 @@ describe('vim.lsp.codelens', function() after_each(helpers.clear) it('on_codelens_stores_and_displays_lenses', function() - local fake_uri = "file://fake/uri" + local fake_uri = "file:///fake/uri" local bufnr = exec_lua([[ fake_uri = ... local bufnr = vim.uri_to_bufnr(fake_uri) diff --git a/test/functional/plugin/lsp/diagnostic_spec.lua b/test/functional/plugin/lsp/diagnostic_spec.lua index 962028e7e1..7359ee4bce 100644 --- a/test/functional/plugin/lsp/diagnostic_spec.lua +++ b/test/functional/plugin/lsp/diagnostic_spec.lua @@ -49,7 +49,7 @@ describe('vim.lsp.diagnostic', function() end ]] - fake_uri = "file://fake/uri" + fake_uri = "file:///fake/uri" exec_lua([[ fake_uri = ... @@ -241,6 +241,38 @@ describe('vim.lsp.diagnostic', function() ]])) end) + it('should not display diagnostics when disabled', function() + eq({0, 2}, exec_lua [[ + local server_1_diags = { + make_error("Error 1", 1, 1, 1, 5), + make_warning("Warning on Server 1", 2, 1, 2, 5), + } + local server_2_diags = { + make_warning("Warning 1", 2, 1, 2, 5), + } + + vim.lsp.diagnostic.on_publish_diagnostics(nil, nil, { uri = fake_uri, diagnostics = server_1_diags }, 1) + vim.lsp.diagnostic.on_publish_diagnostics(nil, nil, { uri = fake_uri, diagnostics = server_2_diags }, 2) + + vim.lsp.diagnostic.disable(diagnostic_bufnr, 1) + + return { + count_of_extmarks_for_client(diagnostic_bufnr, 1), + count_of_extmarks_for_client(diagnostic_bufnr, 2), + } + ]]) + + eq({4, 0}, exec_lua [[ + vim.lsp.diagnostic.enable(diagnostic_bufnr, 1) + vim.lsp.diagnostic.disable(diagnostic_bufnr, 2) + + return { + count_of_extmarks_for_client(diagnostic_bufnr, 1), + count_of_extmarks_for_client(diagnostic_bufnr, 2), + } + ]]) + end) + describe('reset', function() it('diagnostic count is 0 and displayed diagnostics are 0 after call', function() -- 1 Error (1) diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua index 35cc2d3075..e5533af73b 100644 --- a/test/functional/plugin/lsp_spec.lua +++ b/test/functional/plugin/lsp_spec.lua @@ -14,6 +14,7 @@ local retry = helpers.retry local NIL = helpers.NIL local read_file = require('test.helpers').read_file local write_file = require('test.helpers').write_file +local isCI = helpers.isCI -- Use these to get access to a coroutine so that I can run async tests and use -- yield. @@ -262,8 +263,8 @@ describe('LSP', function() end) it('should succeed with manual shutdown', function() - if 'openbsd' == helpers.uname() then - pending('hangs the build on openbsd #14028, re-enable with freeze timeout #14204') + if isCI() then + pending('hangs the build on CI #14028, re-enable with freeze timeout #14204') return end local expected_handlers = { @@ -1147,14 +1148,14 @@ describe('LSP', function() make_edit(0, 0, 0, 3, "First ↥ 🤦 🦄") }, textDocument = { - uri = "file://fake/uri"; + uri = "file:///fake/uri"; version = editVersion } } end before_each(function() target_bufnr = exec_lua [[ - local bufnr = vim.uri_to_bufnr("file://fake/uri") + local bufnr = vim.uri_to_bufnr("file:///fake/uri") local lines = {"1st line of text", "2nd line of 语text"} vim.api.nvim_buf_set_lines(bufnr, 0, 1, false, lines) return bufnr @@ -1234,7 +1235,7 @@ describe('LSP', function() make_edit(row, 0, row, 1000, new_line) }, textDocument = { - uri = "file://fake/uri"; + uri = "file:///fake/uri"; version = editVersion } } @@ -1252,7 +1253,7 @@ describe('LSP', function() before_each(function() local ret = exec_lua [[ - local bufnr = vim.uri_to_bufnr("file://fake/uri") + local bufnr = vim.uri_to_bufnr("file:///fake/uri") local lines = { "Original Line #1", "Original Line #2" @@ -1532,19 +1533,19 @@ describe('LSP', function() it('Convert Location[] to items', function() local expected = { { - filename = 'fake/uri', + filename = '/fake/uri', lnum = 1, col = 3, text = 'testing' }, } local actual = exec_lua [[ - local bufnr = vim.uri_to_bufnr("file://fake/uri") + local bufnr = vim.uri_to_bufnr("file:///fake/uri") local lines = {"testing", "123"} vim.api.nvim_buf_set_lines(bufnr, 0, 1, false, lines) local locations = { { - uri = 'file://fake/uri', + uri = 'file:///fake/uri', range = { start = { line = 0, character = 2 }, ['end'] = { line = 0, character = 3 }, @@ -1558,14 +1559,14 @@ describe('LSP', function() it('Convert LocationLink[] to items', function() local expected = { { - filename = 'fake/uri', + filename = '/fake/uri', lnum = 1, col = 3, text = 'testing' }, } local actual = exec_lua [[ - local bufnr = vim.uri_to_bufnr("file://fake/uri") + local bufnr = vim.uri_to_bufnr("file:///fake/uri") local lines = {"testing", "123"} vim.api.nvim_buf_set_lines(bufnr, 0, 1, false, lines) local locations = { @@ -1779,14 +1780,14 @@ describe('LSP', function() local expected = { { col = 1, - filename = 'test_a', + filename = '/test_a', kind = 'File', lnum = 2, text = '[File] TestA' }, { col = 1, - filename = 'test_b', + filename = '/test_b', kind = 'Module', lnum = 4, text = '[Module] TestB' @@ -1809,7 +1810,7 @@ describe('LSP', function() line = 2 } }, - uri = "file://test_a" + uri = "file:///test_a" }, contanerName = "TestAContainer" }, @@ -1828,7 +1829,7 @@ describe('LSP', function() line = 4 } }, - uri = "file://test_b" + uri = "file:///test_b" }, contanerName = "TestBContainer" } @@ -1867,7 +1868,7 @@ describe('LSP', function() before_each(function() target_bufnr = exec_lua [[ - local bufnr = vim.uri_to_bufnr("file://fake/uri") + local bufnr = vim.uri_to_bufnr("file:///fake/uri") local lines = {"1st line of text", "å å ɧ 汉语 ↥ 🤦 🦄"} vim.api.nvim_buf_set_lines(bufnr, 0, 1, false, lines) return bufnr @@ -1876,7 +1877,7 @@ describe('LSP', function() local location = function(start_line, start_char, end_line, end_char) return { - uri = "file://fake/uri", + uri = "file:///fake/uri", range = { start = { line = start_line, character = start_char }, ["end"] = { line = end_line, character = end_char }, @@ -1901,7 +1902,7 @@ describe('LSP', function() it('jumps to a LocationLink', function() local pos = jump({ - targetUri = "file://fake/uri", + targetUri = "file:///fake/uri", targetSelectionRange = { start = { line = 0, character = 4 }, ["end"] = { line = 0, character = 4 }, diff --git a/test/functional/treesitter/highlight_spec.lua b/test/functional/treesitter/highlight_spec.lua index 05e0c5fe2c..175525b3f2 100644 --- a/test/functional/treesitter/highlight_spec.lua +++ b/test/functional/treesitter/highlight_spec.lua @@ -570,4 +570,47 @@ describe('treesitter highlighting', function() ]]} screen:expect{ unchanged=true } end) + + it("supports highlighting with priority", function() + if pending_c_parser(pending) then return end + + insert([[ + int x = INT_MAX; + #define READ_STRING(x, y) (char_u *)read_string((x), (size_t)(y)) + #define foo void main() { \ + return 42; \ + } + ]]) + + exec_lua [[ + local parser = vim.treesitter.get_parser(0, "c") + test_hl = vim.treesitter.highlighter.new(parser, {queries = {c = hl_query..'\n((translation_unit) @Error (set! "priority" 101))\n'}}) + ]] + -- expect everything to have Error highlight + screen:expect{grid=[[ + {12:int}{8: x = INT_MAX;} | + {8:#define READ_STRING(x, y) (char_u *)read_string((x), (size_t)(y))}| + {8:#define foo void main() { \} | + {8: return 42; \} | + {8: }} | + ^ | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + | + ]], attr_ids={ + [1] = {bold = true, foreground = Screen.colors.Blue1}; + [8] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red}; + -- bold will not be overwritten at the moment + [12] = {background = Screen.colors.Red, bold = true, foreground = Screen.colors.Grey100}; + }} + end) end) diff --git a/test/functional/treesitter/parser_spec.lua b/test/functional/treesitter/parser_spec.lua index d2f9148e8f..d9df5fbc0d 100644 --- a/test/functional/treesitter/parser_spec.lua +++ b/test/functional/treesitter/parser_spec.lua @@ -646,6 +646,19 @@ int x = INT_MAX; {2, 29, 2, 68} -- READ_STRING_OK(x, y) (char_u *)read_string((x), (size_t)(y)) }, get_ranges()) end) + it("should list all directives", function() + local res_list = exec_lua[[ + local query = require'vim.treesitter.query' + + local list = query.list_directives() + + table.sort(list) + + return list + ]] + + eq({ 'offset!', 'set!' }, res_list) + end) end) end) |