diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/api.txt | 2 | ||||
-rw-r--r-- | runtime/doc/eval.txt | 16 | ||||
-rw-r--r-- | runtime/doc/lua.txt | 21 | ||||
-rw-r--r-- | runtime/doc/starting.txt | 3 | ||||
-rw-r--r-- | runtime/filetype.vim | 3 | ||||
-rw-r--r-- | runtime/lua/vim/shared.lua | 46 | ||||
-rw-r--r-- | runtime/plugin/diagnostic.vim | 26 |
7 files changed, 70 insertions, 47 deletions
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index df345e4981..a8b4bc7dd2 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -1251,7 +1251,7 @@ nvim_open_term({buffer}, {opts}) *nvim_open_term()* For instance, for a floating display, first create an empty buffer using |nvim_create_buf()|, then display it using |nvim_open_win()|, and then call this function. Then - |nvim_chan_send()| cal be called immediately to process + |nvim_chan_send()| can be called immediately to process sequences in a virtual terminal having the intended size. Parameters: ~ diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index d6f72b68f7..d9ecdb40de 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -3419,6 +3419,8 @@ complete_info([{what}]) *complete_info()* "" Not in completion mode "keyword" Keyword completion |i_CTRL-X_CTRL-N| "ctrl_x" Just pressed CTRL-X |i_CTRL-X| + "scroll" Scrolling with |i_CTRL-X_CTRL-E| or + |i_CTRL-X_CTRL-Y| "whole_line" Whole lines |i_CTRL-X_CTRL-L| "files" File names |i_CTRL-X_CTRL-F| "tags" Tags |i_CTRL-X_CTRL-]| @@ -6863,29 +6865,31 @@ mode([expr]) Return a string that indicates the current mode. niR Normal using |i_CTRL-O| in |Replace-mode| niV Normal using |i_CTRL-O| in |Virtual-Replace-mode| v Visual by character + vs Visual by character using |v_CTRL-O| in Select mode V Visual by line + Vs Visual by line using |v_CTRL-O| in Select mode CTRL-V Visual blockwise + CTRL-Vs Visual blockwise using |v_CTRL-O| in Select mode s Select by character S Select by line CTRL-S Select blockwise - vs Visual by character using |v_CTRL-O| from - Select mode - Vs Visual by line using |v_CTRL-O| from Select mode - CTRL-Vs Visual blockwise using |v_CTRL-O| from Select mode i Insert ic Insert mode completion |compl-generic| ix Insert mode |i_CTRL-X| completion R Replace |R| Rc Replace mode completion |compl-generic| - Rv Virtual Replace |gR| Rx Replace mode |i_CTRL-X| completion + Rv Virtual Replace |gR| + Rvc Virtual Replace mode completion |compl-generic| + Rvx Virtual Replace mode |i_CTRL-X| completion c Command-line editing cv Vim Ex mode |Q| or |gQ| r Hit-enter prompt rm The -- more -- prompt - r? |:confirm| query of some sort + r? A |:confirm| query of some sort ! Shell or external command is executing t Terminal mode: keys go to the job + This is useful in the 'statusline' option or when used with |remote_expr()| In most other places it always returns "c" or "n". diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 22e323baa7..f6daa70b4c 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -1373,20 +1373,25 @@ pesc({s}) *vim.pesc()* See also: ~ https://github.com/rxi/lume -split({s}, {sep}, {plain}) *vim.split()* +split({s}, {sep}, {kwargs}) *vim.split()* Splits a string at each instance of a separator. Examples: > - split(":aa::b:", ":") --> {'','aa','','b',''} - split("axaby", "ab?") --> {'','x','y'} - split(x*yz*o, "*", true) --> {'x','yz','o'} + + split(":aa::b:", ":") --> {'','aa','','b',''} + split("axaby", "ab?") --> {'','x','y'} + split("x*yz*o", "*", {plain=true}) --> {'x','yz','o'} + split("|x|y|z|", "|", {trimempty=true}) --> {'x', 'y', 'z'} < Parameters: ~ - {s} String to split - {sep} Separator string or pattern - {plain} If `true` use `sep` literally (passed to - String.find) + {s} String to split + {sep} Separator string or pattern + {kwargs} Keyword arguments: + • plain: (boolean) If `true` use `sep` literally + (passed to string.find) + • trimempty: (boolean) If `true` remove empty + items from the front and back of the list Return: ~ List-like table of the split components. diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt index 87a48e6d2a..bb775ec884 100644 --- a/runtime/doc/starting.txt +++ b/runtime/doc/starting.txt @@ -90,10 +90,11 @@ argument. See |info-message| about capturing the text. *--clean* ---clean Equivalent to "-u NONE -i NONE": +--clean Mimics a fresh install of Nvim: - Skips initializations from files and environment variables. - No 'shada' file is read or written. - Excludes user directories from 'runtimepath' + - Loads builtin plugins, unlike "-u NONE -i NONE". *--noplugin* --noplugin Skip loading plugins. Resets the 'loadplugins' option. diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 5e0c6fb32e..322215e1de 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -872,6 +872,9 @@ au BufNewFile,BufRead *.json-patch setf json " Jupyter Notebook is also json au BufNewFile,BufRead *.ipynb setf json +" Other files that look like json +au BufNewFile,BufRead .babelrc,.eslintrc,.prettierrc,.firebaserc setf json + " JSONC au BufNewFile,BufRead *.jsonc setf jsonc diff --git a/runtime/lua/vim/shared.lua b/runtime/lua/vim/shared.lua index 18c1e21049..b57b7ad4ad 100644 --- a/runtime/lua/vim/shared.lua +++ b/runtime/lua/vim/shared.lua @@ -98,17 +98,53 @@ end --- <pre> --- split(":aa::b:", ":") --> {'','aa','','b',''} --- split("axaby", "ab?") --> {'','x','y'} ---- split(x*yz*o, "*", true) --> {'x','yz','o'} +--- split("x*yz*o", "*", {plain=true}) --> {'x','yz','o'} +--- split("|x|y|z|", "|", {trimempty=true}) --> {'x', 'y', 'z'} --- </pre> --- +--- ---@see |vim.gsplit()| --- ---@param s String to split ---@param sep Separator string or pattern ----@param plain If `true` use `sep` literally (passed to String.find) +---@param kwargs Keyword arguments: +--- - plain: (boolean) If `true` use `sep` literally (passed to string.find) +--- - trimempty: (boolean) If `true` remove empty items from the front +--- and back of the list ---@returns List-like table of the split components. -function vim.split(s,sep,plain) - local t={} for c in vim.gsplit(s, sep, plain) do table.insert(t,c) end +function vim.split(s, sep, kwargs) + local plain + local trimempty = false + if type(kwargs) == 'boolean' then + -- Support old signature for backward compatibility + plain = kwargs + else + vim.validate { kwargs = {kwargs, 't', true} } + kwargs = kwargs or {} + plain = kwargs.plain + trimempty = kwargs.trimempty + end + + local t = {} + local skip = trimempty + for c in vim.gsplit(s, sep, plain) do + if c ~= "" then + skip = false + end + + if not skip then + table.insert(t, c) + end + end + + if trimempty then + for i = #t, 1, -1 do + if t[i] ~= "" then + break + end + table.remove(t, i) + end + end + return t end diff --git a/runtime/plugin/diagnostic.vim b/runtime/plugin/diagnostic.vim deleted file mode 100644 index 2183623ac8..0000000000 --- a/runtime/plugin/diagnostic.vim +++ /dev/null @@ -1,26 +0,0 @@ -" :help vim.diagnostic - -hi default DiagnosticError ctermfg=1 guifg=Red -hi default DiagnosticWarn ctermfg=3 guifg=Orange -hi default DiagnosticInfo ctermfg=4 guifg=LightBlue -hi default DiagnosticHint ctermfg=7 guifg=LightGrey - -hi default DiagnosticUnderlineError cterm=underline gui=underline guisp=Red -hi default DiagnosticUnderlineWarn cterm=underline gui=underline guisp=Orange -hi default DiagnosticUnderlineInfo cterm=underline gui=underline guisp=LightBlue -hi default DiagnosticUnderlineHint cterm=underline gui=underline guisp=LightGrey - -hi default link DiagnosticVirtualTextError DiagnosticError -hi default link DiagnosticVirtualTextWarn DiagnosticWarn -hi default link DiagnosticVirtualTextInfo DiagnosticInfo -hi default link DiagnosticVirtualTextHint DiagnosticHint - -hi default link DiagnosticFloatingError DiagnosticError -hi default link DiagnosticFloatingWarn DiagnosticWarn -hi default link DiagnosticFloatingInfo DiagnosticInfo -hi default link DiagnosticFloatingHint DiagnosticHint - -hi default link DiagnosticSignError DiagnosticError -hi default link DiagnosticSignWarn DiagnosticWarn -hi default link DiagnosticSignInfo DiagnosticInfo -hi default link DiagnosticSignHint DiagnosticHint |