mirror of
https://github.com/neovim/neovim.git
synced 2026-08-29 18:41:48 +00:00
docs: misc #39256
This commit is contained in:
17
.github/workflows/labeler_issue.yml
vendored
17
.github/workflows/labeler_issue.yml
vendored
@@ -17,18 +17,25 @@ jobs:
|
||||
script: |
|
||||
const title = context.payload.issue.title;
|
||||
const titleSplit = title.split(/\b/).map(e => e.toLowerCase());
|
||||
const keywords = ['api', 'treesitter', 'ui', 'ui2', 'lsp'];
|
||||
var match = new Set();
|
||||
const keywords = ['api', 'lsp', 'treesitter', 'ui', 'ui2'];
|
||||
var labels = new Set();
|
||||
|
||||
for (const keyword of keywords) {
|
||||
if (titleSplit.includes(keyword)) {
|
||||
match.add(keyword)
|
||||
labels.add(keyword)
|
||||
}
|
||||
}
|
||||
if (match.size !== 0) {
|
||||
|
||||
// Special cases.
|
||||
if (titleSplit.includes('vim.pack')) {
|
||||
labels.add('packages')
|
||||
}
|
||||
|
||||
if (labels.size !== 0) {
|
||||
github.rest.issues.addLabels({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.issue.number,
|
||||
labels: Array.from(match)
|
||||
labels: Array.from(labels)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -306,8 +306,8 @@ To choose a new "EXX" error code (e.g. |E5555|), just print a message with
|
||||
a new EXX number: >
|
||||
emsg(_("E996: Invalid thing"));
|
||||
<
|
||||
To see existing error codes: >
|
||||
:new | put =filter(getcompletion('h E', 'cmdline'), 'v:val =~# ''E\d\d''')
|
||||
To see existing error codes: >vim
|
||||
:exe 'help' | let g:errtags=sort(map(taglist('E\d\d\d\?\d\?'), 'v:val.name'), 'N') | new | put =g:errtags
|
||||
|
||||
The `linterrcodes` build target checks that all "EXX" codes are unique and
|
||||
have help tags. It runs in CI, but you can also run it locally: >
|
||||
|
||||
@@ -169,6 +169,18 @@ Other references:
|
||||
- https://github.com/neovim/neovim/pull/18375
|
||||
- https://github.com/neovim/neovim/pull/21605
|
||||
|
||||
==============================================================================
|
||||
Filesystem *dev-filesystem*
|
||||
|
||||
https://github.com/neovim/neovim/issues/36112 Path handling, especially
|
||||
separator chars ("/" vs "\"), is designed as follows: "/" separators are used
|
||||
every except at the "edges", i.e. the separator chars are coverted
|
||||
just-in-time, and only when absolutely needed. This is similar to how UTF-8
|
||||
encoding is used internally for all text, but buffers can read/write various
|
||||
encodings.
|
||||
|
||||
P.S. Windows handles "/" separators just fine, except in rare cases. It'll be
|
||||
fine, don't worry. Just use "/", for god's sake!
|
||||
|
||||
==============================================================================
|
||||
API
|
||||
|
||||
@@ -99,6 +99,9 @@ https://github.com/neovim/neovim/commit/00f60c2ce78fc1280e93d5a36bc7b2267d5f4ac6
|
||||
|
||||
TYPES OF "NOT APPLICABLE" VIM PATCHES ~
|
||||
|
||||
- Unwanted features:
|
||||
- "modelinestrict" https://github.com/neovim/neovim/issues/38985
|
||||
- "tabpanel"
|
||||
- Vim9script features, and anything related to `:scriptversion`. (Nvim
|
||||
supports Vimscript version 1 only.) Be aware that patches labelled `Vim9:`
|
||||
may still contain applicable fixes to other parts of the codebase, so these
|
||||
@@ -352,4 +355,4 @@ Pattern matching has several differences:
|
||||
When modifying an existing regular pattern, make sure that it still fits its
|
||||
group.
|
||||
|
||||
vim:tw=78:ts=8:noet:ft=help:norl:
|
||||
vim:tw=78:ts=8:et:ft=help:norl:
|
||||
|
||||
@@ -2508,6 +2508,15 @@ Example: >lua
|
||||
vim.print(vim.fn.readblob('.git/config'))
|
||||
<
|
||||
|
||||
*vim.fs.write()*
|
||||
|
||||
You can use |writefile()| to write a file without explicitly opening/closing
|
||||
it.
|
||||
|
||||
Example: >lua
|
||||
vim.fn.writefile('foo\0bar', 'data.bin', 'b')
|
||||
<
|
||||
|
||||
|
||||
vim.fs.abspath({path}) *vim.fs.abspath()*
|
||||
Converts `path` to an absolute path. Expands tilde (~) at the beginning of
|
||||
|
||||
@@ -157,6 +157,8 @@ LSP
|
||||
LUA
|
||||
|
||||
• |vim.net.request()| can specify custom headers by passing `opts.headers`.
|
||||
• |writefile()| treats Lua strings as "blob", so it can be used to write
|
||||
binary data.
|
||||
• |vim.filetype.inspect()| returns a copy of the internal tables used for
|
||||
filetype detection.
|
||||
• Added `__eq` metamethod to |vim.VersionRange|. 2 distinct but representing
|
||||
|
||||
@@ -5298,6 +5298,10 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
For a window-local value, -1 means to use the global value.
|
||||
Values below -1 are invalid.
|
||||
|
||||
Example: >vim
|
||||
:set scrolloff=99 scrolloffpad=1
|
||||
<
|
||||
|
||||
After using the local value, go back the global value with one of
|
||||
these two: >vim
|
||||
setlocal scrolloffpad<
|
||||
@@ -7010,15 +7014,22 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
used for CTRL-\ CTRL-N and CTRL-\ CTRL-G when part of a command has
|
||||
been typed.
|
||||
|
||||
*'ttyfast'* *'tf'* *'nottyfast'* *'notf'*
|
||||
*'ttyfast'* *'tf'* *'nottyfast'* *'notf'* *E1568* *$NVIM_NOTTYFAST*
|
||||
'ttyfast' 'tf' boolean (default on)
|
||||
global
|
||||
Assume that the underlying terminal can respond quickly to queries
|
||||
required by features such as 'background' detection.
|
||||
Enables Nvim |TUI| features which assume a fast (usually local) host
|
||||
terminal. During startup, Nvim queries the terminal (for 'background'
|
||||
detection, etc.) and must wait for a response (or timeout).
|
||||
|
||||
Nvim issues terminal queries before reading the user's |config| file,
|
||||
so disabling this option there will not work. Set $NVIM_NOTTYFAST
|
||||
before starting Nvim to disable terminal queries.
|
||||
If your terminal environment is slow (e.g. remote SSH), or broken
|
||||
(doesn't respond to queries), Nvim startup may be slower. Therefore
|
||||
you can disable this option by setting the `$NVIM_NOTTYFAST`
|
||||
environment variable before starting Nvim: >
|
||||
NVIM_NOTTYFAST=1 nvim
|
||||
<
|
||||
|
||||
The queries are performed early, before |--cmd| and user |config|, so
|
||||
`:set nottyfast` in your config happens too late.
|
||||
|
||||
*'undodir'* *'udir'* *E5003*
|
||||
'undodir' 'udir' string (default "$XDG_STATE_HOME/nvim/undo//")
|
||||
|
||||
@@ -90,7 +90,7 @@ Defaults *defaults* *nvim-defaults*
|
||||
- 'ttimeoutlen' defaults to 50
|
||||
- 'ttyfast' is set by default, but it can be unset during startup by setting
|
||||
the environment variable `NVIM_NOTTYFAST` to adjust the startup sequence for
|
||||
slow environments.
|
||||
slow environments (such as ssh).
|
||||
- 'undodir' defaults to ~/.local/state/nvim/undo// (|xdg|), auto-created
|
||||
- 'viewoptions' includes "unix,slash", excludes "options"
|
||||
- 'viminfo' includes "!"
|
||||
|
||||
@@ -12398,16 +12398,19 @@ wordcount() *wordcount()*
|
||||
Return: ~
|
||||
(`any`)
|
||||
|
||||
writefile({object}, {fname} [, {flags}]) *writefile()*
|
||||
When {object} is a |List| write it to file {fname}. Each list
|
||||
item is separated with a NL. Each list item must be a String
|
||||
or Number.
|
||||
All NL characters are replaced with a NUL character.
|
||||
Inserting CR characters needs to be done before passing {list}
|
||||
to writefile().
|
||||
writefile({data}, {fname} [, {flags}]) *writefile()*
|
||||
Writes {data} to file {fname}.
|
||||
|
||||
When {object} is a |Blob| write the bytes to file {fname}
|
||||
unmodified, also when binary mode is not specified.
|
||||
- When {data} is a |Blob| its bytes are written unmodified
|
||||
(even if binary mode "b" is not specified).
|
||||
- When {data} is a Lua string, it is treated as a blob.
|
||||
- When {data} is a |List|, each list item is treated as a text
|
||||
line (terminated with a newline). Each list item must be
|
||||
a String or Number.
|
||||
- Any NL (newline) chars in the line are treated as a NUL
|
||||
character. (This is a workaround to allow Vimscript to
|
||||
write binary data, and is irrelevant for Lua, which should
|
||||
just pass a string instead.)
|
||||
|
||||
{flags} must be a String. These characters are recognized:
|
||||
|
||||
@@ -12446,7 +12449,7 @@ writefile({object}, {fname} [, {flags}]) *writefile()*
|
||||
<
|
||||
|
||||
Parameters: ~
|
||||
• {object} (`any`)
|
||||
• {data} (`any`)
|
||||
• {fname} (`string`)
|
||||
• {flags} (`string?`)
|
||||
|
||||
|
||||
@@ -468,11 +468,11 @@ do
|
||||
|
||||
vim.keymap.set({ 'x' }, '[N', function()
|
||||
require 'vim.treesitter._select'.select_grow_prev(vim.v.count1)
|
||||
end, { desc = 'Select expand previous node' })
|
||||
end, { desc = 'Select previous sibling node' })
|
||||
|
||||
vim.keymap.set({ 'x' }, ']N', function()
|
||||
require 'vim.treesitter._select'.select_grow_next(vim.v.count1)
|
||||
end, { desc = 'Select expand next node' })
|
||||
end, { desc = 'Select next sibling node' })
|
||||
|
||||
vim.keymap.set({ 'x', 'o' }, 'an', function()
|
||||
if vim.treesitter.get_parser(nil, nil, { error = false }) then
|
||||
@@ -1002,7 +1002,7 @@ do
|
||||
and os.getenv('NVIM_TEST') == nil
|
||||
then
|
||||
vim.notify(
|
||||
"defaults.lua: Did not detect DSR response from terminal for 'background' detection. This results in a slower startup time. To disable this and other 'ttyfast' features during startup, set the environment variable NVIM_NOTTYFAST",
|
||||
"E1568: Terminal did not respond to DSR request for 'background' color. Startup may be slower. :help 'ttyfast'",
|
||||
vim.log.levels.WARN,
|
||||
{ _truncate = true }
|
||||
)
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
--- @meta
|
||||
-- This file is NOT generated, edit it directly.
|
||||
error('Cannot require a meta file')
|
||||
|
||||
--- @alias elem_or_list<T> T|T[]
|
||||
|
||||
|
||||
24
runtime/lua/vim/_meta/options.gen.lua
generated
24
runtime/lua/vim/_meta/options.gen.lua
generated
@@ -5516,6 +5516,12 @@ vim.go.so = vim.go.scrolloff
|
||||
--- For a window-local value, -1 means to use the global value.
|
||||
--- Values below -1 are invalid.
|
||||
---
|
||||
--- Example:
|
||||
---
|
||||
--- ```vim
|
||||
--- :set scrolloff=99 scrolloffpad=1
|
||||
--- ```
|
||||
---
|
||||
--- After using the local value, go back the global value with one of
|
||||
--- these two:
|
||||
---
|
||||
@@ -7555,12 +7561,20 @@ vim.o.ttm = vim.o.ttimeoutlen
|
||||
vim.go.ttimeoutlen = vim.o.ttimeoutlen
|
||||
vim.go.ttm = vim.go.ttimeoutlen
|
||||
|
||||
--- Assume that the underlying terminal can respond quickly to queries
|
||||
--- required by features such as 'background' detection.
|
||||
--- Enables Nvim `TUI` features which assume a fast (usually local) host
|
||||
--- terminal. During startup, Nvim queries the terminal (for 'background'
|
||||
--- detection, etc.) and must wait for a response (or timeout).
|
||||
---
|
||||
--- Nvim issues terminal queries before reading the user's `config` file,
|
||||
--- so disabling this option there will not work. Set $NVIM_NOTTYFAST
|
||||
--- before starting Nvim to disable terminal queries.
|
||||
--- If your terminal environment is slow (e.g. remote SSH), or broken
|
||||
--- (doesn't respond to queries), Nvim startup may be slower. Therefore
|
||||
--- you can disable this option by setting the `$NVIM_NOTTYFAST`
|
||||
--- environment variable before starting Nvim:
|
||||
--- ```
|
||||
--- NVIM_NOTTYFAST=1 nvim
|
||||
--- ```
|
||||
---
|
||||
--- The queries are performed early, before `--cmd` and user `config`, so
|
||||
--- `:set nottyfast` in your config happens too late.
|
||||
---
|
||||
--- @type boolean
|
||||
vim.o.ttyfast = true
|
||||
|
||||
23
runtime/lua/vim/_meta/vimfn.gen.lua
generated
23
runtime/lua/vim/_meta/vimfn.gen.lua
generated
@@ -11273,15 +11273,18 @@ function vim.fn.winwidth(nr) end
|
||||
--- @return any
|
||||
function vim.fn.wordcount() end
|
||||
|
||||
--- When {object} is a |List| write it to file {fname}. Each list
|
||||
--- item is separated with a NL. Each list item must be a String
|
||||
--- or Number.
|
||||
--- All NL characters are replaced with a NUL character.
|
||||
--- Inserting CR characters needs to be done before passing {list}
|
||||
--- to writefile().
|
||||
--- Writes {data} to file {fname}.
|
||||
---
|
||||
--- When {object} is a |Blob| write the bytes to file {fname}
|
||||
--- unmodified, also when binary mode is not specified.
|
||||
--- - When {data} is a |Blob| its bytes are written unmodified
|
||||
--- (even if binary mode "b" is not specified).
|
||||
--- - When {data} is a Lua string, it is treated as a blob.
|
||||
--- - When {data} is a |List|, each list item is treated as a text
|
||||
--- line (terminated with a newline). Each list item must be
|
||||
--- a String or Number.
|
||||
--- - Any NL (newline) chars in the line are treated as a NUL
|
||||
--- character. (This is a workaround to allow Vimscript to
|
||||
--- write binary data, and is irrelevant for Lua, which should
|
||||
--- just pass a string instead.)
|
||||
---
|
||||
--- {flags} must be a String. These characters are recognized:
|
||||
---
|
||||
@@ -11319,11 +11322,11 @@ function vim.fn.wordcount() end
|
||||
--- call writefile(fl, "foocopy", "b")
|
||||
--- <
|
||||
---
|
||||
--- @param object any
|
||||
--- @param data any
|
||||
--- @param fname string
|
||||
--- @param flags? string
|
||||
--- @return any
|
||||
function vim.fn.writefile(object, fname, flags) end
|
||||
function vim.fn.writefile(data, fname, flags) end
|
||||
|
||||
--- Bitwise XOR on the two arguments. The arguments are converted
|
||||
--- to a number. A List, Dict or Float argument causes an error.
|
||||
|
||||
@@ -30,6 +30,15 @@
|
||||
--- ```lua
|
||||
--- vim.print(vim.fn.readblob('.git/config'))
|
||||
--- ```
|
||||
---
|
||||
--- [vim.fs.write()]()
|
||||
---
|
||||
--- You can use |writefile()| to write a file without explicitly opening/closing it.
|
||||
---
|
||||
--- Example:
|
||||
--- ```lua
|
||||
--- vim.fn.writefile('foo\0bar', 'data.bin', 'b')
|
||||
--- ```
|
||||
|
||||
local uv = vim.uv
|
||||
|
||||
|
||||
@@ -22,8 +22,10 @@ local banned_verbs = {
|
||||
delete = 'del',
|
||||
disable = 'enable',
|
||||
exit = 'cancel', -- or "stop"
|
||||
-- format = 'fmt',
|
||||
list = 'get',
|
||||
notify = 'print', -- or "echo"
|
||||
pretty = 'fmt',
|
||||
remove = 'del',
|
||||
toggle = 'enable',
|
||||
}
|
||||
|
||||
@@ -692,9 +692,7 @@ void nvim_exec_autocmds(Object event, Dict(exec_autocmds) *opts, Arena *arena, E
|
||||
{
|
||||
int au_group = AUGROUP_ALL;
|
||||
bool modeline = true;
|
||||
|
||||
buf_T *b = curbuf;
|
||||
|
||||
Object *data = NULL;
|
||||
|
||||
Array event_array = unpack_string_or_array(event, "event", true, arena, err);
|
||||
|
||||
@@ -13659,15 +13659,18 @@ M.funcs = {
|
||||
args = { 2, 3 },
|
||||
base = 1,
|
||||
desc = [=[
|
||||
When {object} is a |List| write it to file {fname}. Each list
|
||||
item is separated with a NL. Each list item must be a String
|
||||
or Number.
|
||||
All NL characters are replaced with a NUL character.
|
||||
Inserting CR characters needs to be done before passing {list}
|
||||
to writefile().
|
||||
Writes {data} to file {fname}.
|
||||
|
||||
When {object} is a |Blob| write the bytes to file {fname}
|
||||
unmodified, also when binary mode is not specified.
|
||||
- When {data} is a |Blob| its bytes are written unmodified
|
||||
(even if binary mode "b" is not specified).
|
||||
- When {data} is a Lua string, it is treated as a blob.
|
||||
- When {data} is a |List|, each list item is treated as a text
|
||||
line (terminated with a newline). Each list item must be
|
||||
a String or Number.
|
||||
- Any NL (newline) chars in the line are treated as a NUL
|
||||
character. (This is a workaround to allow Vimscript to
|
||||
write binary data, and is irrelevant for Lua, which should
|
||||
just pass a string instead.)
|
||||
|
||||
{flags} must be a String. These characters are recognized:
|
||||
|
||||
@@ -13707,8 +13710,8 @@ M.funcs = {
|
||||
|
||||
]=],
|
||||
name = 'writefile',
|
||||
params = { { 'object', 'any' }, { 'fname', 'string' }, { 'flags', 'string' } },
|
||||
signature = 'writefile({object}, {fname} [, {flags}])',
|
||||
params = { { 'data', 'any' }, { 'fname', 'string' }, { 'flags', 'string' } },
|
||||
signature = 'writefile({data}, {fname} [, {flags}])',
|
||||
},
|
||||
xor = {
|
||||
args = 2,
|
||||
|
||||
@@ -1753,6 +1753,10 @@ void f_writefile(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
||||
return;
|
||||
}
|
||||
|
||||
// XXX: this logic is bit weird because of how `decode_string` works: #39328
|
||||
// - if decode_string finds NUL in the Lua string, it assigns VAR_BLOB
|
||||
// - else it assigns VAR_STRING
|
||||
|
||||
if (argvars[0].v_type == VAR_LIST) {
|
||||
TV_LIST_ITER_CONST(argvars[0].vval.v_list, li, {
|
||||
if (!tv_check_str_or_nr(TV_LIST_ITEM_TV(li))) {
|
||||
@@ -1760,9 +1764,9 @@ void f_writefile(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
||||
}
|
||||
});
|
||||
} else if (argvars[0].v_type != VAR_BLOB
|
||||
// Always treat Lua strings as "blob" data.
|
||||
&& !(argvars[0].v_type == VAR_STRING && script_is_lua(current_sctx.sc_sid))) {
|
||||
semsg(_(e_invarg2),
|
||||
_("writefile() first argument must be a List or a Blob"));
|
||||
semsg(_(e_invarg2), _("writefile() first argument must be a List or a Blob"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -7264,6 +7264,10 @@ local options = {
|
||||
For a window-local value, -1 means to use the global value.
|
||||
Values below -1 are invalid.
|
||||
|
||||
Example: >vim
|
||||
:set scrolloff=99 scrolloffpad=1
|
||||
<
|
||||
|
||||
After using the local value, go back the global value with one of
|
||||
these two: >vim
|
||||
setlocal scrolloffpad<
|
||||
@@ -9778,17 +9782,26 @@ local options = {
|
||||
abbreviation = 'tf',
|
||||
defaults = true,
|
||||
desc = [=[
|
||||
Assume that the underlying terminal can respond quickly to queries
|
||||
required by features such as 'background' detection.
|
||||
|
||||
Nvim issues terminal queries before reading the user's |config| file,
|
||||
so disabling this option there will not work. Set $NVIM_NOTTYFAST
|
||||
before starting Nvim to disable terminal queries.
|
||||
Enables Nvim |TUI| features which assume a fast (usually local) host
|
||||
terminal. During startup, Nvim queries the terminal (for 'background'
|
||||
detection, etc.) and must wait for a response (or timeout).
|
||||
|
||||
If your terminal environment is slow (e.g. remote SSH), or broken
|
||||
(doesn't respond to queries), Nvim startup may be slower. Therefore
|
||||
you can disable this option by setting the `$NVIM_NOTTYFAST`
|
||||
environment variable before starting Nvim: >
|
||||
NVIM_NOTTYFAST=1 nvim
|
||||
<
|
||||
|
||||
The queries are performed early, before |--cmd| and user |config|, so
|
||||
`:set nottyfast` in your config happens too late.
|
||||
]=],
|
||||
full_name = 'ttyfast',
|
||||
no_mkrc = true,
|
||||
scope = { 'global' },
|
||||
short_desc = N_('assume terminal responds quickly, enabling more features'),
|
||||
-- Vim E1568: https://github.com/vim/vim/blob/0f9218851dc91a855c3d186ccd05f550907cf37e/src/errors.h#L3791
|
||||
tags = { 'E1568', '$NVIM_NOTTYFAST' },
|
||||
type = 'boolean',
|
||||
varname = 'p_tf',
|
||||
},
|
||||
|
||||
@@ -194,7 +194,7 @@ int os_setenv(const char *name, const char *value, int overwrite)
|
||||
#endif
|
||||
int r;
|
||||
#ifdef MSWIN
|
||||
// libintl uses getenv() for LC_ALL/LANG/etc., so we must use _putenv_s().
|
||||
// Call _putenv_s() so libintl can see LC_ALL/LANG/etc. libuv only calls SetEnvironmentVariableW.
|
||||
if (striequal(name, "LC_ALL") || striequal(name, "LANGUAGE")
|
||||
|| striequal(name, "LANG") || striequal(name, "LC_MESSAGES")) {
|
||||
r = _putenv_s(name, value); // NOLINT
|
||||
|
||||
@@ -30,6 +30,11 @@ local is_os = t.is_os
|
||||
local testlog = 'Xtest-defaults-log'
|
||||
|
||||
describe('startup defaults', function()
|
||||
it("NVIM_NOTTYFAST=1 unsets 'ttyfast'", function()
|
||||
clear { env = { NVIM_NOTTYFAST = '1' } }
|
||||
eq(0, n.eval('&ttyfast'))
|
||||
end)
|
||||
|
||||
describe(':filetype', function()
|
||||
local function expect_filetype(expected)
|
||||
local screen = Screen.new(50, 4)
|
||||
|
||||
@@ -3326,7 +3326,7 @@ describe('TUI', function()
|
||||
end)
|
||||
local child_session = n.connect(child_server)
|
||||
local expected_msg =
|
||||
"defaults.lua: Did not detect DSR response from terminal for 'background' detection. This results in a slower startup time. To disable this and other 'ttyfast' features during startup, set the environment variable NVIM_NOTTYFAST"
|
||||
"E1568: Terminal did not respond to DSR request for 'background' color. Startup may be slower. :help 'ttyfast'"
|
||||
retry(nil, 4000, function()
|
||||
eq({ true, { mode = 'n', blocking = false } }, { child_session:request('nvim_get_mode') })
|
||||
if not is_os('win') then -- ConPTY provides DSR response on Windows?
|
||||
|
||||
@@ -20,7 +20,7 @@ describe('title', function()
|
||||
screen = Screen.new()
|
||||
end)
|
||||
|
||||
it('defaults to "No Name" and the PWD in the title if the buffer is unnamed', function()
|
||||
it('shows "No Name", CWD if the buffer is unnamed', function()
|
||||
local expected = (is_os('win') and '[No Name] (C:/) - Nvim' or '[No Name] (/) - Nvim')
|
||||
command(is_os('win') and 'cd C:\\' or 'cd /')
|
||||
command('set title')
|
||||
@@ -29,30 +29,24 @@ describe('title', function()
|
||||
end)
|
||||
end)
|
||||
|
||||
it(
|
||||
'defaults to the filename and its directory in the title if the buffer is named as a path outside the PWD',
|
||||
function()
|
||||
local expected = (is_os('win') and 'myfile (C:/mydir) - Nvim' or 'myfile (/mydir) - Nvim')
|
||||
command('set title')
|
||||
command(is_os('win') and 'file C:\\mydir\\myfile' or 'file /mydir/myfile')
|
||||
screen:expect(function()
|
||||
eq(expected, screen.title)
|
||||
end)
|
||||
end
|
||||
)
|
||||
it('shows filename + directory if the buffer name is outside CWD', function()
|
||||
local expected = (is_os('win') and 'myfile (C:/mydir) - Nvim' or 'myfile (/mydir) - Nvim')
|
||||
command('set title')
|
||||
command(is_os('win') and 'file C:\\mydir\\myfile' or 'file /mydir/myfile')
|
||||
screen:expect(function()
|
||||
eq(expected, screen.title)
|
||||
end)
|
||||
end)
|
||||
|
||||
it(
|
||||
'defaults to the filename and the PWD in the title if the buffer is a file in the PWD',
|
||||
function()
|
||||
local expected = (is_os('win') and 'myfile (C:/) - Nvim' or 'myfile (/) - Nvim')
|
||||
command('set title')
|
||||
command(is_os('win') and 'cd C:\\' or 'cd /')
|
||||
command('file myfile')
|
||||
screen:expect(function()
|
||||
eq(expected, screen.title)
|
||||
end)
|
||||
end
|
||||
)
|
||||
it('shows filename + CWD if the buffer is in CWD', function()
|
||||
local expected = (is_os('win') and 'myfile (C:/) - Nvim' or 'myfile (/) - Nvim')
|
||||
command('set title')
|
||||
command(is_os('win') and 'cd C:\\' or 'cd /')
|
||||
command('file myfile')
|
||||
screen:expect(function()
|
||||
eq(expected, screen.title)
|
||||
end)
|
||||
end)
|
||||
|
||||
it('is updated in Insert mode', function()
|
||||
command(is_os('win') and 'cd C:\\' or 'cd /')
|
||||
|
||||
Reference in New Issue
Block a user