diff options
Diffstat (limited to 'runtime')
| -rw-r--r-- | runtime/doc/change.txt | 3 | ||||
| -rw-r--r-- | runtime/doc/vim_diff.txt | 4 | ||||
| -rw-r--r-- | runtime/lua/vim/lsp.lua | 13 | ||||
| -rw-r--r-- | runtime/lua/vim/treesitter/query.lua | 15 | ||||
| -rw-r--r-- | runtime/syntax/lsp_markdown.vim | 27 |
5 files changed, 49 insertions, 13 deletions
diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt index 571fbaec95..b905f53db7 100644 --- a/runtime/doc/change.txt +++ b/runtime/doc/change.txt @@ -633,6 +633,9 @@ Directory for temporary files is created in the first possible directory of: actually work differently. You can use `:&&` to keep the flags. + *&-default* + Mapped to ":&&<CR>" by default. |default-mappings| + *g&* g& Synonym for `:%s//~/&` (repeat last substitute with last search pattern on all lines with the same flags). diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index 8e853aaf9e..bacf160206 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -89,6 +89,7 @@ of these in your config by simply removing the mapping, e.g. ":unmap Y". inoremap <C-W> <C-G>u<C-W> xnoremap * y/\V<C-R>"<CR> xnoremap # y?\V<C-R>"<CR> + nnoremap & :&&<CR> < Default Autocommands ~ *default-autocmds* @@ -350,7 +351,8 @@ Commands: Functions: |input()| and |inputdialog()| support for each other’s features (return on cancel and completion respectively) via dictionary argument (replaces all - other arguments if used). + other arguments if used), and "cancelreturn" can have any type if passed in + a dictionary. |input()| and |inputdialog()| support user-defined cmdline highlighting. Highlight groups: diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index 554b5f0bfa..0e72aae188 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -739,13 +739,18 @@ function lsp.start(config, opts) end config.name = config.name or (config.cmd[1] and vim.fs.basename(config.cmd[1])) or nil local bufnr = api.nvim_get_current_buf() - for _, client in pairs(lsp.get_active_clients()) do - if reuse_client(client, config) then - lsp.buf_attach_client(bufnr, client.id) - return client.id + for _, clients in ipairs({ uninitialized_clients, lsp.get_active_clients() }) do + for _, client in pairs(clients) do + if reuse_client(client, config) then + lsp.buf_attach_client(bufnr, client.id) + return client.id + end end end local client_id = lsp.start_client(config) + if client_id == nil then + return nil -- lsp.start_client will have printed an error + end lsp.buf_attach_client(bufnr, client_id) return client_id end diff --git a/runtime/lua/vim/treesitter/query.lua b/runtime/lua/vim/treesitter/query.lua index 0cc2b6d2a4..103e85abfd 100644 --- a/runtime/lua/vim/treesitter/query.lua +++ b/runtime/lua/vim/treesitter/query.lua @@ -221,6 +221,9 @@ end local predicate_handlers = { ['eq?'] = function(match, _, source, predicate) local node = match[predicate[2]] + if not node then + return true + end local node_text = M.get_node_text(node, source) local str @@ -241,6 +244,9 @@ local predicate_handlers = { ['lua-match?'] = function(match, _, source, predicate) local node = match[predicate[2]] + if not node then + return true + end local regex = predicate[3] return string.find(M.get_node_text(node, source), regex) end, @@ -265,6 +271,9 @@ local predicate_handlers = { return function(match, _, source, pred) local node = match[pred[2]] + if not node then + return true + end local regex = compiled_vim_regexes[pred[3]] return regex:match_str(M.get_node_text(node, source)) end @@ -272,6 +281,9 @@ local predicate_handlers = { ['contains?'] = function(match, _, source, predicate) local node = match[predicate[2]] + if not node then + return true + end local node_text = M.get_node_text(node, source) for i = 3, #predicate do @@ -285,6 +297,9 @@ local predicate_handlers = { ['any-of?'] = function(match, _, source, predicate) local node = match[predicate[2]] + if not node then + return true + end local node_text = M.get_node_text(node, source) -- Since 'predicate' will not be used by callers of this function, use it diff --git a/runtime/syntax/lsp_markdown.vim b/runtime/syntax/lsp_markdown.vim index 90d3185673..4be7595807 100644 --- a/runtime/syntax/lsp_markdown.vim +++ b/runtime/syntax/lsp_markdown.vim @@ -1,23 +1,34 @@ " Vim syntax file -" Language: lsp_markdown -" Maintainer: Michael Lingelbach <m.j.lbach@gmail.com -" URL: http://neovim.io -" Remark: Uses markdown syntax file +" Language: Markdown-like LSP docstrings +" Maintainer: https://github.com/neovim/neovim +" URL: http://neovim.io +" Remark: Uses markdown syntax file -" always source the system included markdown instead of any other installed -" markdown.vim syntax files +" Source the default Nvim markdown syntax, not other random ones. execute 'source' expand('<sfile>:p:h') .. '/markdown.vim' syn cluster mkdNonListItem add=mkdEscape,mkdNbsp +" Don't highlight invalid markdown syntax in LSP docstrings. +syn clear markdownError + syn clear markdownEscape syntax region markdownEscape matchgroup=markdownEscape start=/\\\ze[\\\x60*{}\[\]()#+\-,.!_>~|"$%&'\/:;<=?@^ ]/ end=/./ containedin=ALL keepend oneline concealends -" conceal html entities +" Conceal backticks (which delimit code fragments). +" We ignore g:markdown_syntax_conceal here. +syn region markdownCode matchgroup=markdownCodeDelimiter start="`" end="`" keepend contains=markdownLineStart concealends +syn region markdownCode matchgroup=markdownCodeDelimiter start="`` \=" end=" \=``" keepend contains=markdownLineStart concealends +syn region markdownCode matchgroup=markdownCodeDelimiter start="^\s*````*.*$" end="^\s*````*\ze\s*$" keepend concealends + +" Highlight code fragments. +hi def link markdownCode Special + +" Conceal HTML entities. syntax match mkdNbsp / / conceal cchar= syntax match mkdLt /</ conceal cchar=< syntax match mkdGt />/ conceal cchar=> syntax match mkdAmp /&/ conceal cchar=& syntax match mkdQuot /"/ conceal cchar=" -hi def link mkdEscape special +hi def link mkdEscape Special |