aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/autoload/health/provider.vim2
-rw-r--r--runtime/doc/eval.txt38
-rw-r--r--runtime/doc/nvim_terminal_emulator.txt7
-rw-r--r--runtime/lua/vim/lsp/util.lua8
-rw-r--r--runtime/lua/vim/uri.lua15
5 files changed, 52 insertions, 18 deletions
diff --git a/runtime/autoload/health/provider.vim b/runtime/autoload/health/provider.vim
index 86f9f060ff..6d481e9f49 100644
--- a/runtime/autoload/health/provider.vim
+++ b/runtime/autoload/health/provider.vim
@@ -589,7 +589,7 @@ function! s:check_ruby() abort
\ 'Are you behind a firewall or proxy?'])
return
endif
- let latest_gem = get(split(latest_gem, 'neovim (\|, \|)$' ), 1, 'not found')
+ let latest_gem = get(split(latest_gem, 'neovim (\|, \|)$' ), 0, 'not found')
let current_gem_cmd = host .' --version'
let current_gem = s:system(current_gem_cmd)
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 4ff6269004..6f13b34876 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -6689,6 +6689,33 @@ range({expr} [, {max} [, {stride}]]) *range()*
range(0) " []
range(2, 0) " error!
<
+ *readdir()*
+readdir({directory} [, {expr}])
+ Return a list with file and directory names in {directory}.
+
+ When {expr} is omitted all entries are included.
+ When {expr} is given, it is evaluated to check what to do:
+ If {expr} results in -1 then no further entries will
+ be handled.
+ If {expr} results in 0 then this entry will not be
+ added to the list.
+ If {expr} results in 1 then this entry will be added
+ to the list.
+ Each time {expr} is evaluated |v:val| is set to the entry name.
+ When {expr} is a function the name is passed as the argument.
+ For example, to get a list of files ending in ".txt": >
+ readdir(dirname, {n -> n =~ '.txt$'})
+< To skip hidden and backup files: >
+ readdir(dirname, {n -> n !~ '^\.\|\~$'})
+
+< If you want to get a directory tree: >
+ function! s:tree(dir)
+ return {a:dir : map(readdir(a:dir),
+ \ {_, x -> isdirectory(x) ?
+ \ {x : s:tree(a:dir . '/' . x)} : x})}
+ endfunction
+ echo s:tree(".")
+<
*readfile()*
readfile({fname} [, {binary} [, {max}]])
Read file {fname} and return a |List|, each line of the file
@@ -6720,17 +6747,6 @@ readfile({fname} [, {binary} [, {max}]])
the result is an empty list.
Also see |writefile()|.
- *readdir()*
-readdir({directory} [, {expr}])
- Return a list with file and directory names in {directory}.
- You can also use |glob()| if you don't need to do complicated
- things, such as limiting the number of matches.
-
- When {expr} is omitted all entries are included.
- When {expr} is given, it is evaluated to check what to do:
- If {expr} results in -1 then no further entries will
- be handled.
-
reg_executing() *reg_executing()*
Returns the single letter name of the register being executed.
Returns an empty string when no register is being executed.
diff --git a/runtime/doc/nvim_terminal_emulator.txt b/runtime/doc/nvim_terminal_emulator.txt
index 55c5335a60..a96d118667 100644
--- a/runtime/doc/nvim_terminal_emulator.txt
+++ b/runtime/doc/nvim_terminal_emulator.txt
@@ -50,6 +50,13 @@ mode" in a normal buffer, such as |i| or |:startinsert|. In this mode all keys
except <C-\><C-N> are sent to the underlying program. Use <C-\><C-N> to return
to normal-mode. |CTRL-\_CTRL-N|
+Terminal-mode forces these local options:
+
+ 'nocursorline'
+ 'nocursorcolumn'
+ 'scrolloff' = 0
+ 'sidescrolloff' = 0
+
Terminal-mode has its own |:tnoremap| namespace for mappings, this can be used
to automate any terminal interaction.
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua
index e77b9f199c..494eebf9ea 100644
--- a/runtime/lua/vim/lsp/util.lua
+++ b/runtime/lua/vim/lsp/util.lua
@@ -160,7 +160,7 @@ function M.apply_text_document_edit(text_document_edit)
local text_document = text_document_edit.textDocument
local bufnr = vim.uri_to_bufnr(text_document.uri)
-- `VersionedTextDocumentIdentifier`s version may be nil https://microsoft.github.io/language-server-protocol/specification#versionedTextDocumentIdentifier
- if text_document.version ~= nil and M.buf_versions[bufnr] > text_document.version then
+ if text_document.version ~= vim.NIL and M.buf_versions[bufnr] > text_document.version then
print("Buffer ", text_document.uri, " newer than edits.")
return
end
@@ -432,9 +432,9 @@ function M.jump_to_location(location)
vim.cmd "normal! m'"
-- Push a new item into tagstack
- local items = {}
- table.insert(items, {tagname=vim.fn.expand("<cword>"), from=vim.fn.getpos('.')})
- vim.fn.settagstack(vim.fn.bufnr('%'), {items=items}, 't')
+ local from = {vim.fn.bufnr('%'), vim.fn.line('.'), vim.fn.col('.'), 0}
+ local items = {{tagname=vim.fn.expand('<cword>'), from=from}}
+ vim.fn.settagstack(vim.fn.win_getid(), {items=items}, 't')
--- Jump to new location
api.nvim_set_current_buf(bufnr)
diff --git a/runtime/lua/vim/uri.lua b/runtime/lua/vim/uri.lua
index d91fb7ffd3..e28cc9e20f 100644
--- a/runtime/lua/vim/uri.lua
+++ b/runtime/lua/vim/uri.lua
@@ -66,7 +66,13 @@ local function uri_from_fname(path)
end
local function uri_from_bufnr(bufnr)
- return uri_from_fname(vim.api.nvim_buf_get_name(bufnr))
+ local fname = vim.api.nvim_buf_get_name(bufnr)
+ local scheme = fname:match("^([a-z]+)://.*")
+ if scheme then
+ return fname
+ else
+ return uri_from_fname(fname)
+ end
end
local function uri_to_fname(uri)
@@ -83,7 +89,12 @@ end
-- Return or create a buffer for a uri.
local function uri_to_bufnr(uri)
- return vim.fn.bufadd((uri_to_fname(uri)))
+ local scheme = assert(uri:match("^([a-z]+)://.*"), 'Uri must contain a scheme: ' .. uri)
+ if scheme == 'file' then
+ return vim.fn.bufadd(uri_to_fname(uri))
+ else
+ return vim.fn.bufadd(uri)
+ end
end
return {