aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/api.txt44
-rw-r--r--runtime/doc/cmdline.txt3
-rw-r--r--runtime/doc/lsp.txt2
-rw-r--r--runtime/doc/starting.txt28
-rw-r--r--runtime/doc/vim_diff.txt3
-rw-r--r--runtime/filetype.vim9
-rw-r--r--runtime/lua/vim/lsp.lua4
-rw-r--r--runtime/lua/vim/lsp/diagnostic.lua11
-rw-r--r--runtime/lua/vim/lsp/util.lua1
-rw-r--r--runtime/syntax/dockerfile.vim33
10 files changed, 103 insertions, 35 deletions
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt
index 58633455c3..755e7becb3 100644
--- a/runtime/doc/api.txt
+++ b/runtime/doc/api.txt
@@ -933,6 +933,39 @@ nvim_get_option({name}) *nvim_get_option()*
Return: ~
Option value (global)
+nvim_get_option_info({name}) *nvim_get_option_info()*
+ Gets the option information for one option
+
+ Resulting dictionary has keys:
+ • name (string): Name of the option
+ • shortname (shortname): Shortened name of the option
+ • type (string): Name of the type of option
+ • default (Any): The default value for the option
+
+ Script-Related Keys:
+ • was_set (bool): Whether the option was set.
+ • last_set_sid (int): Last set script id
+ • last_set_linenr (int): Last set script id, -1 if invalid.
+ • last_set_lchan (int): Last set script id, -1 if invalid.
+
+ Flag-Related Keys:
+ • win (bool): Window-local option
+ • buf (bool): Buffer-local option
+ • global_local (bool): Global or Buffer local option
+ • flaglist (bool): List of single char flags
+
+ Parameters: ~
+ {name} Option name
+
+ Return: ~
+ Option Information
+
+nvim_get_options_info() *nvim_get_options_info()*
+ Gets the option information for all options.
+
+ Return: ~
+ Map<option_name, option_info>
+
nvim_get_proc({pid}) *nvim_get_proc()*
Gets info describing process `pid` .
@@ -950,11 +983,16 @@ nvim_get_runtime_file({name}, {all}) *nvim_get_runtime_file()*
'name' can contain wildcards. For example
nvim_get_runtime_file("colors/*.vim", true) will return all
- color scheme files.
+ color scheme files. Always use forward slashes (/) in the
+ search pattern for subdirectories regardless of platform.
It is not an error to not find any files. An empty array is
returned then.
+ To find a directory, `name` must end with a forward slash,
+ like "rplugin/python/". Without the slash it would instead
+ look for an ordinary file called "rplugin/python".
+
Attributes: ~
{fast}
@@ -1535,7 +1573,9 @@ nvim_set_hl({ns_id}, {name}, {val}) *nvim_set_hl()*
{ns_id} number of namespace for this highlight
{name} highlight group name, like ErrorMsg
{val} highlight definiton map, like
- |nvim_get_hl_by_name|.
+ |nvim_get_hl_by_name|. in addition the following
+ keys are also recognized: `default` : don't
+ override existing definition, like `hi default`
nvim_set_hl_ns({ns_id}) *nvim_set_hl_ns()*
Set active namespace for highlights.
diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt
index 562a1f23ac..098245b5a8 100644
--- a/runtime/doc/cmdline.txt
+++ b/runtime/doc/cmdline.txt
@@ -215,6 +215,9 @@ CTRL-Y When there is a modeless selection, copy the selection into
the clipboard.
If there is no selection CTRL-Y is inserted as a character.
+ *c_CTRL-Z*
+CTRL-Z Trigger 'wildmode'. Same as 'wildcharm', but always available.
+
CTRL-M or CTRL-J *c_CTRL-M* *c_CTRL-J* *c_<NL>* *c_<CR>* *c_CR*
<CR> or <NL> start entered command
diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt
index 78829fbba1..c8a44dfb75 100644
--- a/runtime/doc/lsp.txt
+++ b/runtime/doc/lsp.txt
@@ -1049,7 +1049,7 @@ get_all() *vim.lsp.diagnostic.get_all()*
Get all diagnostics for all clients
Return: ~
- Diagnostic[]
+ {bufnr:Diagnostic[]}
*vim.lsp.diagnostic.get_count()*
get_count({bufnr}, {severity}, {client_id})
diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt
index f58b0d5030..160995b440 100644
--- a/runtime/doc/starting.txt
+++ b/runtime/doc/starting.txt
@@ -104,7 +104,7 @@ argument.
--startuptime {fname} *--startuptime*
During startup write timing messages to the file {fname}.
This can be used to find out where time is spent while loading
- your |init.vim|, plugins and opening the first file.
+ your |config|, plugins and opening the first file.
When {fname} already exists new messages are appended.
(Only available when compiled with the |+startuptime|
feature).
@@ -211,7 +211,7 @@ argument.
When 'verbose' is set messages are printed to stderr. >
echo foo | nvim -V1 -es
-< User |init.vim| is skipped (unless given with |-u|).
+< User |config| is skipped (unless given with |-u|).
Swap file is skipped (like |-n|).
User |shada| is loaded (unless "-i NONE" is given).
@@ -406,12 +406,14 @@ accordingly. Vim proceeds in this order:
proceeding to load user configuration.
4. Load user config (execute Ex commands from files, environment, …).
- $VIMINIT environment variable is read as one Ex command line (separate
- multiple commands with '|' or <NL>).
- *config* *init.vim* *vimrc* *exrc*
- A file containing init commands is generically called a "vimrc" or
- "config". Each line in such a file is executed as an Ex command.
- |vimrc-intro| |base-directories|
+ An environment variable (e.g. $VIMINIT) is read as one Ex command
+ line, where multiple commands must be separated with '|' or <NL>.
+ *config* *init.vim* *init.lua* *vimrc* *exrc*
+ A file that contains initialization commands is generically called
+ a "vimrc" or config file. It can be a Vimscript or Lua file named
+ "init.vim" or "init.lua" respectively. It is an error to use both at
+ the same time. Each line in a "init.vim" is executed as an Ex command
+ line. See also |vimrc-intro| and |base-directories|.
The Nvim config file is "init.vim", located at:
Unix ~/.config/nvim/init.vim
@@ -578,7 +580,7 @@ The extreme flexibility of editors like Vim and Emacs means that any plugin or
setting can affect the entire editor in ways that are not initially obvious.
To find the cause of a problem in your config, you must "bisect" it:
-1. Remove or disable half of your `init.vim`.
+1. Remove or disable half of your |config|.
2. Restart Nvim.
3. If the problem still occurs, goto 1.
4. If the problem is gone, restore half of the removed lines.
@@ -597,7 +599,7 @@ to 'shortmess'.
$VIM and $VIMRUNTIME
*$VIM*
The environment variable "$VIM" is used to locate various user files for Nvim,
-such as the user startup script |init.vim|. This depends on the system, see
+such as the user |config|. This depends on the system, see
|startup|.
Nvim will try to get the value for $VIM in this order:
@@ -709,11 +711,11 @@ can be used with different terminals.
Only global mappings are stored, not mappings local to a buffer.
-A common method is to use a default |init.vim| file, make some modifications
+A common method is to use a default |config| file, make some modifications
with ":map" and ":set" commands and write the modified file. First read the
default vimrc in with a command like ":source ~piet/.vimrc.Cprogs", change
the settings and then save them in the current directory with ":mkvimrc!". If
-you want to make this file your default |init.vim|, move it to
+you want to make this file your default |config|, move it to
$XDG_CONFIG_HOME/nvim. You could also use autocommands |autocommand| and/or
modelines |modeline|.
@@ -1065,7 +1067,7 @@ do this. This can be useful in order to create a second file, say
"~/.my.shada" which could contain certain settings that you always want when
you first start Neovim. For example, you can preload registers with
particular data, or put certain commands in the command line history. A line
-in your |init.vim| file like >
+in your |config| file like >
:rshada! ~/.my.shada
can be used to load this information. You could even have different ShaDa
files for different types of files (e.g., C code) and load them based on the
diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt
index 0f15aefd17..808af5f544 100644
--- a/runtime/doc/vim_diff.txt
+++ b/runtime/doc/vim_diff.txt
@@ -182,8 +182,6 @@ Highlight groups:
|hl-Whitespace| highlights 'listchars' whitespace
Input/Mappings:
- |<Cmd>| pseudokey
-
ALT (|META|) chords always work (even in the |TUI|). Map |<M-| with any key:
<M-1>, <M-BS>, <M-Del>, <M-Ins>, <M-/>, <M-\>, <M-Space>, <M-Enter>, etc.
Case-sensitive: <M-a> and <M-A> are two different keycodes.
@@ -215,7 +213,6 @@ Signs:
Signs are removed if the associated line is deleted.
Variables:
- |v:exiting|
|v:progpath| is always absolute ("full")
|v:windowid| is always available (for use by external UIs)
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index b9d2a43d5d..ed19fa1a43 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -1768,8 +1768,13 @@ au BufNewFile,BufReadPost *.tutor setf tutor
" TWIG files
au BufNewFile,BufReadPost *.twig setf twig
-" Typescript
-au BufNewFile,BufReadPost *.ts setf typescript
+" Typescript or Qt translation file (which is XML)
+au BufNewFile,BufReadPost *.ts
+ \ if getline(1) =~ '<?xml' |
+ \ setf xml |
+ \ else |
+ \ setf typescript |
+ \ endif
" TypeScript with React
au BufNewFile,BufRead *.tsx setf typescriptreact
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua
index 92f56b2ddf..f082fe29f2 100644
--- a/runtime/lua/vim/lsp.lua
+++ b/runtime/lua/vim/lsp.lua
@@ -1032,9 +1032,9 @@ function lsp.buf_request(bufnr, method, params, handler)
end
end)
- -- if no clients support the given method, call the handler with the proper
+ -- if has client but no clients support the given method, call the callback with the proper
-- error message.
- if not method_supported then
+ if not tbl_isempty(all_buffer_active_clients[resolve_bufnr(bufnr)] or {}) and not method_supported then
local unsupported_err = lsp._unsupported_method(method)
handler = handler or lsp.handlers[method]
if handler then
diff --git a/runtime/lua/vim/lsp/diagnostic.lua b/runtime/lua/vim/lsp/diagnostic.lua
index 1570d4a122..27a1f53f89 100644
--- a/runtime/lua/vim/lsp/diagnostic.lua
+++ b/runtime/lua/vim/lsp/diagnostic.lua
@@ -308,15 +308,16 @@ end
--- Get all diagnostics for all clients
---
----@return Diagnostic[]
+---@return {bufnr: Diagnostic[]}
function M.get_all()
- local all_diagnostics = {}
- for _, buf_diagnostics in pairs(diagnostic_cache) do
+ local diagnostics_by_bufnr = {}
+ for bufnr, buf_diagnostics in pairs(diagnostic_cache) do
+ diagnostics_by_bufnr[bufnr] = {}
for _, client_diagnostics in pairs(buf_diagnostics) do
- vim.list_extend(all_diagnostics, client_diagnostics)
+ vim.list_extend(diagnostics_by_bufnr[bufnr], client_diagnostics)
end
end
- return all_diagnostics
+ return diagnostics_by_bufnr
end
--- Return associated diagnostics for bufnr
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua
index f78a36fda2..5804ac6656 100644
--- a/runtime/lua/vim/lsp/util.lua
+++ b/runtime/lua/vim/lsp/util.lua
@@ -957,6 +957,7 @@ function M.open_floating_preview(contents, filetype, opts)
end
api.nvim_buf_set_lines(floating_bufnr, 0, -1, true, contents)
api.nvim_buf_set_option(floating_bufnr, 'modifiable', false)
+ api.nvim_buf_set_option(floating_bufnr, 'bufhidden', 'wipe')
M.close_preview_autocmd({"CursorMoved", "CursorMovedI", "BufHidden", "BufLeave"}, floating_winnr)
return floating_bufnr, floating_winnr
end
diff --git a/runtime/syntax/dockerfile.vim b/runtime/syntax/dockerfile.vim
index 4cf50d999f..ce52e697cd 100644
--- a/runtime/syntax/dockerfile.vim
+++ b/runtime/syntax/dockerfile.vim
@@ -1,26 +1,45 @@
" dockerfile.vim - Syntax highlighting for Dockerfiles
" Maintainer: Honza Pokorny <https://honza.ca>
-" Version: 0.6
-" Last Change: 2019 Aug 16
+" Last Change: 2020 Feb 11
" License: BSD
+" https://docs.docker.com/engine/reference/builder/
if exists("b:current_syntax")
finish
endif
-let b:current_syntax = "dockerfile"
+syntax include @JSON syntax/json.vim
+unlet b:current_syntax
+
+syntax include @Shell syntax/sh.vim
+unlet b:current_syntax
syntax case ignore
+syntax match dockerfileLinePrefix /\v^\s*(ONBUILD\s+)?\ze\S/ contains=dockerfileKeyword nextgroup=dockerfileInstruction skipwhite
+syntax region dockerfileFrom matchgroup=dockerfileKeyword start=/\v^\s*(FROM)\ze(\s|$)/ skip=/\v\\\_./ end=/\v((^|\s)AS(\s|$)|$)/ contains=dockerfileOption
-syntax match dockerfileKeyword /\v^\s*(ONBUILD\s+)?(ADD|ARG|CMD|COPY|ENTRYPOINT|ENV|EXPOSE|FROM|HEALTHCHECK|LABEL|MAINTAINER|RUN|SHELL|STOPSIGNAL|USER|VOLUME|WORKDIR)\s/
+syntax keyword dockerfileKeyword contained ADD ARG CMD COPY ENTRYPOINT ENV EXPOSE HEALTHCHECK LABEL MAINTAINER ONBUILD RUN SHELL STOPSIGNAL USER VOLUME WORKDIR
+syntax match dockerfileOption contained /\v(^|\s)\zs--\S+/
-syntax match dockerfileKeyword /\v(AS)/
+syntax match dockerfileInstruction contained /\v<(\S+)>(\s+--\S+)*/ contains=dockerfileKeyword,dockerfileOption skipwhite nextgroup=dockerfileValue
+syntax match dockerfileInstruction contained /\v<(ADD|COPY)>(\s+--\S+)*/ contains=dockerfileKeyword,dockerfileOption skipwhite nextgroup=dockerfileJSON
+syntax match dockerfileInstruction contained /\v<(HEALTHCHECK)>(\s+--\S+)*/ contains=dockerfileKeyword,dockerfileOption skipwhite nextgroup=dockerfileInstruction
+syntax match dockerfileInstruction contained /\v<(CMD|ENTRYPOINT|RUN)>/ contains=dockerfileKeyword skipwhite nextgroup=dockerfileShell
+syntax match dockerfileInstruction contained /\v<(CMD|ENTRYPOINT|RUN)>\ze\s+\[/ contains=dockerfileKeyword skipwhite nextgroup=dockerfileJSON
+syntax match dockerfileInstruction contained /\v<(SHELL|VOLUME)>/ contains=dockerfileKeyword skipwhite nextgroup=dockerfileJSON
-syntax region dockerfileString start=/\v"/ skip=/\v\\./ end=/\v"/
+syntax region dockerfileString contained start=/\v"/ skip=/\v\\./ end=/\v"/
+syntax region dockerfileJSON contained keepend start=/\v\[/ skip=/\v\\\_./ end=/\v$/ contains=@JSON
+syntax region dockerfileShell contained keepend start=/\v/ skip=/\v\\\_./ end=/\v$/ contains=@Shell
+syntax region dockerfileValue contained keepend start=/\v/ skip=/\v\\\_./ end=/\v$/ contains=dockerfileString
-syntax match dockerfileComment "\v^\s*#.*$"
+syntax region dockerfileComment start=/\v^\s*#/ end=/\v$/
+set commentstring=#\ %s
hi def link dockerfileString String
hi def link dockerfileKeyword Keyword
hi def link dockerfileComment Comment
+hi def link dockerfileOption Special
+
+let b:current_syntax = "dockerfile"