aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/ci.yml2
-rw-r--r--README.md3
-rw-r--r--runtime/doc/index.txt2
-rw-r--r--runtime/doc/lua.txt3
-rw-r--r--runtime/doc/starting.txt9
-rw-r--r--runtime/doc/various.txt4
-rw-r--r--runtime/filetype.vim3
-rw-r--r--runtime/lua/vim/lsp.lua7
-rw-r--r--runtime/lua/vim/lsp/handlers.lua12
-rw-r--r--runtime/nvim.appdata.xml1
-rw-r--r--src/nvim/ex_cmds.c7
-rw-r--r--src/nvim/ex_cmds.lua2
-rw-r--r--src/nvim/ex_getln.c2
-rw-r--r--src/nvim/log.c14
-rw-r--r--src/nvim/lua/executor.c15
-rw-r--r--src/nvim/search.c87
-rw-r--r--src/nvim/testdir/test_autocmd.vim6
-rw-r--r--src/nvim/testdir/test_filetype.vim3
-rw-r--r--src/nvim/testdir/test_options.vim21
-rw-r--r--src/nvim/testdir/test_sleep.vim26
-rw-r--r--test/functional/options/defaults_spec.lua7
21 files changed, 173 insertions, 63 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 34c3b2b4bb..44a911b21b 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -61,7 +61,7 @@ jobs:
brew unlink gcc@8 gcc@9
brew update >/dev/null
brew upgrade
- brew install automake ccache cpanminus ninja
+ brew install automake ccache perl cpanminus ninja
- name: Setup interpreter packages
run: |
diff --git a/README.md b/README.md
index 180fc1df14..f4d92b77a1 100644
--- a/README.md
+++ b/README.md
@@ -46,7 +46,7 @@ Install from package
Pre-built packages for Windows, macOS, and Linux are found on the
[Releases](https://github.com/neovim/neovim/releases/) page.
-[Managed packages] are in Homebrew, [Debian], [Ubuntu], [Fedora], [Arch Linux],
+[Managed packages] are in [Homebrew], [Debian], [Ubuntu], [Fedora], [Arch Linux],
[Gentoo], and more!
Install from source
@@ -137,5 +137,6 @@ Apache 2.0 license, except for contributions copied from Vim (identified by the
[Fedora]: https://apps.fedoraproject.org/packages/neovim
[Arch Linux]: https://www.archlinux.org/packages/?q=neovim
[Gentoo]: https://packages.gentoo.org/packages/app-editors/neovim
+[Homebrew]: https://formulae.brew.sh/formula/neovim
<!-- vim: set tw=80: -->
diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt
index 17de1d8533..172821ac28 100644
--- a/runtime/doc/index.txt
+++ b/runtime/doc/index.txt
@@ -1543,6 +1543,8 @@ tag command action ~
|:sign| :sig[n] manipulate signs
|:silent| :sil[ent] run a command silently
|:sleep| :sl[eep] do nothing for a few seconds
+|:sleep!| :sl[eep]! do nothing for a few seconds, without the
+ cursor visible
|:slast| :sla[st] split window and go to last file in the
argument list
|:smagic| :sm[agic] :substitute with 'magic'
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt
index a03de10a17..92898cfad1 100644
--- a/runtime/doc/lua.txt
+++ b/runtime/doc/lua.txt
@@ -622,6 +622,9 @@ vim.api.{func}({...}) *vim.api*
Example: call the "nvim_get_current_line()" API function: >
print(tostring(vim.api.nvim_get_current_line()))
+vim.version() *vim.version*
+ Returns the version of the current neovim build.
+
vim.in_fast_event() *vim.in_fast_event()*
Returns true if the code is executing as part of a "fast" event
handler, where most of the API is disabled. These are low-level events
diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt
index 48b9aad58b..4a99aa47bf 100644
--- a/runtime/doc/starting.txt
+++ b/runtime/doc/starting.txt
@@ -1316,8 +1316,9 @@ file when reading and include:
==============================================================================
Standard Paths *standard-path*
-Nvim stores configuration and data in standard locations. Plugins are strongly
-encouraged to follow this pattern also. Use |stdpath()| to get the paths.
+Nvim stores configuration, data, and logs in standard locations. Plugins are
+strongly encouraged to follow this pattern also. Use |stdpath()| to get the
+paths.
*base-directories* *xdg*
The "base" (root) directories conform to the XDG Base Directory Specification.
@@ -1342,8 +1343,8 @@ LOG FILE *$NVIM_LOG_FILE*
Besides 'debug' and 'verbose', Nvim keeps a general log file for internal
debugging, plugins and RPC clients. >
:echo $NVIM_LOG_FILE
-Usually the file is ~/.cache/nvim/log unless that path is inaccessible
-or if $NVIM_LOG_FILE was set before |startup|.
+By default, the file is located at stdpath('cache')/log unless that path
+is inaccessible or if $NVIM_LOG_FILE was set before |startup|.
vim:noet:tw=78:ts=8:ft=help:norl:
diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt
index b6885d6e25..5fb7c4ce50 100644
--- a/runtime/doc/various.txt
+++ b/runtime/doc/various.txt
@@ -489,12 +489,12 @@ gO Show a filetype-specific, navigable "outline" of the
Currently works in |help| and |:Man| buffers.
[N]gs *gs* *:sl* *:sleep*
-:[N]sl[eep] [N] [m] Do nothing for [N] seconds, or [N] milliseconds if [m]
+:[N]sl[eep] [N][m] Do nothing for [N] seconds, or [N] milliseconds if [m]
was given. "gs" always uses seconds.
Default is one second. >
:sleep "sleep for one second
:5sleep "sleep for five seconds
- :sleep 100m "sleep for a hundred milliseconds
+ :sleep 100m "sleep for 100 milliseconds
10gs "sleep for ten seconds
< Can be interrupted with CTRL-C.
"gs" stands for "goto sleep".
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index ba81a3348e..9104519451 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -1620,6 +1620,9 @@ au BufNewFile,BufRead *.mib,*.my setf mib
au BufNewFile,BufRead *.hog,snort.conf,vision.conf setf hog
au BufNewFile,BufRead *.rules call dist#ft#FTRules()
+" SPARQL queries
+au BufNewFile,BufRead *.rq,*.sparql setf sparql
+
" Spec (Linux RPM)
au BufNewFile,BufRead *.spec setf spec
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua
index 1a814f5b6c..9e05eeae89 100644
--- a/runtime/lua/vim/lsp.lua
+++ b/runtime/lua/vim/lsp.lua
@@ -582,12 +582,19 @@ function lsp.start_client(config)
local valid_traces = {
off = 'off'; messages = 'messages'; verbose = 'verbose';
}
+ local version = vim.version()
local initialize_params = {
-- The process Id of the parent process that started the server. Is null if
-- the process has not been started by another process. If the parent
-- process is not alive then the server should exit (see exit notification)
-- its process.
processId = uv.getpid();
+ -- Information about the client
+ -- since 3.15.0
+ clientInfo = {
+ name = "Neovim",
+ version = string.format("%s.%s.%s", version.major, version.minor, version.patch)
+ };
-- The rootPath of the workspace. Is null if no folder is open.
--
-- @deprecated in favour of rootUri.
diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua
index 87f35363b1..b4a1eff316 100644
--- a/runtime/lua/vim/lsp/handlers.lua
+++ b/runtime/lua/vim/lsp/handlers.lua
@@ -97,6 +97,18 @@ M['window/showMessageRequest'] = function(_, _, params)
end
end
+--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#client_registerCapability
+M['client/registerCapability'] = function(_, _, _, client_id)
+ local warning_tpl = "The language server %s triggers a registerCapability "..
+ "handler despite dynamicRegistration set to false. "..
+ "Report upstream, this warning is harmless"
+ local client = vim.lsp.get_client_by_id(client_id)
+ local client_name = client and client.name or string.format("id=%d", client_id)
+ local warning = string.format(warning_tpl, client_name)
+ log.warn(warning)
+ return vim.NIL
+end
+
--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_codeAction
M['textDocument/codeAction'] = function(_, _, actions)
if actions == nil or vim.tbl_isempty(actions) then
diff --git a/runtime/nvim.appdata.xml b/runtime/nvim.appdata.xml
index 025de1b5a9..e99c76a930 100644
--- a/runtime/nvim.appdata.xml
+++ b/runtime/nvim.appdata.xml
@@ -26,6 +26,7 @@
</screenshots>
<releases>
+ <release date="2020-08-04" version="0.4.4"/>
<release date="2019-11-06" version="0.4.3"/>
<release date="2019-09-15" version="0.4.2"/>
<release date="2019-09-15" version="0.4.1"/>
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 61e4d634c6..a2487336f1 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -3693,6 +3693,7 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout,
} else {
char_u *orig_line = NULL;
int len_change = 0;
+ const bool save_p_lz = p_lz;
int save_p_fen = curwin->w_p_fen;
curwin->w_p_fen = FALSE;
@@ -3701,6 +3702,9 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout,
int temp = RedrawingDisabled;
RedrawingDisabled = 0;
+ // avoid calling update_screen() in vgetorpeek()
+ p_lz = false;
+
if (new_start != NULL) {
/* There already was a substitution, we would
* like to show this to the user. We cannot
@@ -3754,7 +3758,8 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout,
/* clear the question */
msg_didout = FALSE; /* don't scroll up */
msg_col = 0;
- gotocmdline(TRUE);
+ gotocmdline(true);
+ p_lz = save_p_lz;
// restore the line
if (orig_line != NULL) {
diff --git a/src/nvim/ex_cmds.lua b/src/nvim/ex_cmds.lua
index 069d5d461b..e9046da800 100644
--- a/src/nvim/ex_cmds.lua
+++ b/src/nvim/ex_cmds.lua
@@ -2455,7 +2455,7 @@ module.cmds = {
},
{
command='sleep',
- flags=bit.bor(RANGE, COUNT, EXTRA, TRLBAR, CMDWIN),
+ flags=bit.bor(BANG, RANGE, COUNT, EXTRA, TRLBAR, CMDWIN),
addr_type='ADDR_OTHER',
func='ex_sleep',
},
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 626b840798..2aa66f6a8c 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -3828,7 +3828,7 @@ static void cmd_cursor_goto(int row, int col)
ui_grid_cursor_goto(grid->handle, row, col);
}
-void gotocmdline(int clr)
+void gotocmdline(bool clr)
{
if (ui_has(kUICmdline)) {
return;
diff --git a/src/nvim/log.c b/src/nvim/log.c
index a90c95c034..324382a0f7 100644
--- a/src/nvim/log.c
+++ b/src/nvim/log.c
@@ -69,6 +69,14 @@ static bool log_path_init(void)
|| log_file_path[0] == '\0'
|| os_isdir((char_u *)log_file_path)
|| !log_try_create(log_file_path)) {
+ // Make kXDGCacheHome if it does not exist.
+ char *cachehome = get_xdg_home(kXDGCacheHome);
+ char *failed_dir = NULL;
+ bool log_dir_failure = false;
+ if (!os_isdir((char_u *)cachehome)) {
+ log_dir_failure = (os_mkdir_recurse(cachehome, 0700, &failed_dir) != 0);
+ }
+ XFREE_CLEAR(cachehome);
// Invalid $NVIM_LOG_FILE or failed to expand; fall back to default.
char *defaultpath = stdpaths_user_cache_subpath("log");
size_t len = xstrlcpy(log_file_path, defaultpath, size);
@@ -83,6 +91,11 @@ static bool log_path_init(void)
return false;
}
os_setenv(LOG_FILE_ENV, log_file_path, true);
+ if (log_dir_failure) {
+ WLOG("Failed to create directory %s for writing logs: %s",
+ failed_dir, os_strerror(log_dir_failure));
+ }
+ XFREE_CLEAR(failed_dir);
}
return true;
}
@@ -323,4 +336,3 @@ static bool v_do_log_to_file(FILE *log_file, int log_level,
return true;
}
-
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c
index 344a2387d6..3219c02068 100644
--- a/src/nvim/lua/executor.c
+++ b/src/nvim/lua/executor.c
@@ -5,6 +5,7 @@
#include <lualib.h>
#include <lauxlib.h>
+#include "nvim/version.h"
#include "nvim/misc1.h"
#include "nvim/getchar.h"
#include "nvim/garray.h"
@@ -78,6 +79,17 @@ static void nlua_error(lua_State *const lstate, const char *const msg)
lua_pop(lstate, 1);
}
+/// Return version of current neovim build
+///
+/// @param lstate Lua interpreter state.
+static int nlua_nvim_version(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL
+{
+ Dictionary version = version_dict();
+ nlua_push_Dictionary(lstate, version, true);
+ api_free_dictionary(version);
+ return 1;
+}
+
/// Compare two strings, ignoring case
///
/// Expects two values on the stack: compared strings. Returns one of the
@@ -420,6 +432,9 @@ static int nlua_state_init(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL
// str_byteindex
lua_pushcfunction(lstate, &nlua_str_byteindex);
lua_setfield(lstate, -2, "str_byteindex");
+ // neovim version
+ lua_pushcfunction(lstate, &nlua_nvim_version);
+ lua_setfield(lstate, -2, "version");
// schedule
lua_pushcfunction(lstate, &nlua_schedule);
lua_setfield(lstate, -2, "schedule");
diff --git a/src/nvim/search.c b/src/nvim/search.c
index 787a464070..2802da6f7f 100644
--- a/src/nvim/search.c
+++ b/src/nvim/search.c
@@ -4497,9 +4497,9 @@ find_pattern_in_path(
regmatch_T regmatch;
regmatch_T incl_regmatch;
regmatch_T def_regmatch;
- int matched = FALSE;
- int did_show = FALSE;
- int found = FALSE;
+ bool matched = false;
+ bool did_show = false;
+ bool found = false;
int i;
char_u *already = NULL;
char_u *startp = NULL;
@@ -4611,7 +4611,7 @@ find_pattern_in_path(
}
MSG_PUTS_TITLE(_("in path ---\n"));
}
- did_show = TRUE;
+ did_show = true;
while (depth_displayed < depth && !got_int) {
++depth_displayed;
for (i = 0; i < depth_displayed; i++)
@@ -4761,10 +4761,10 @@ search_line:
matched = !STRNCMP(startp, ptr, len);
if (matched && define_matched && whole
&& vim_iswordc(startp[len]))
- matched = FALSE;
+ matched = false;
} else if (regmatch.regprog != NULL
&& vim_regexec(&regmatch, line, (colnr_T)(p - line))) {
- matched = TRUE;
+ matched = true;
startp = regmatch.startp[0];
// Check if the line is not a comment line (unless we are
// looking for a define). A line starting with "# define"
@@ -4789,15 +4789,16 @@ search_line:
if (matched
&& p[0] == '/'
&& (p[1] == '*' || p[1] == '/')) {
- matched = FALSE;
- /* After "//" all text is comment */
- if (p[1] == '/')
+ matched = false;
+ // After "//" all text is comment
+ if (p[1] == '/') {
break;
- ++p;
+ }
+ p++;
} else if (!matched && p[0] == '*' && p[1] == '/') {
- /* Can find match after "* /". */
- matched = TRUE;
- ++p;
+ // Can find match after "* /".
+ matched = true;
+ p++;
}
}
}
@@ -4811,7 +4812,7 @@ search_line:
if (depth == -1 && lnum == curwin->w_cursor.lnum)
break;
- found = TRUE;
+ found = true;
aux = p = startp;
if (compl_cont_status & CONT_ADDING) {
p += compl_length;
@@ -4879,9 +4880,10 @@ search_line:
break;
}
} else if (action == ACTION_SHOW_ALL) {
- found = TRUE;
- if (!did_show)
- gotocmdline(TRUE); /* cursor at status line */
+ found = true;
+ if (!did_show) {
+ gotocmdline(true); // cursor at status line
+ }
if (curr_fname != prev_fname) {
if (did_show)
msg_putchar('\n'); /* cursor below last one */
@@ -4890,28 +4892,28 @@ search_line:
msg_home_replace_hl(curr_fname);
prev_fname = curr_fname;
}
- did_show = TRUE;
- if (!got_int)
- show_pat_in_path(line, type, TRUE, action,
- (depth == -1) ? NULL : files[depth].fp,
- (depth == -1) ? &lnum : &files[depth].lnum,
- match_count++);
+ did_show = true;
+ if (!got_int) {
+ show_pat_in_path(line, type, true, action,
+ (depth == -1) ? NULL : files[depth].fp,
+ (depth == -1) ? &lnum : &files[depth].lnum,
+ match_count++);
+ }
/* Set matched flag for this file and all the ones that
* include it */
for (i = 0; i <= depth; ++i)
files[i].matched = TRUE;
} else if (--count <= 0) {
- found = TRUE;
+ found = true;
if (depth == -1 && lnum == curwin->w_cursor.lnum
- && l_g_do_tagpreview == 0
- )
+ && l_g_do_tagpreview == 0) {
EMSG(_("E387: Match is on current line"));
- else if (action == ACTION_SHOW) {
+ } else if (action == ACTION_SHOW) {
show_pat_in_path(line, type, did_show, action,
- (depth == -1) ? NULL : files[depth].fp,
- (depth == -1) ? &lnum : &files[depth].lnum, 1L);
- did_show = TRUE;
+ (depth == -1) ? NULL : files[depth].fp,
+ (depth == -1) ? &lnum : &files[depth].lnum, 1L);
+ did_show = true;
} else {
/* ":psearch" uses the preview window */
if (l_g_do_tagpreview != 0) {
@@ -4960,15 +4962,16 @@ search_line:
break;
}
exit_matched:
- matched = FALSE;
- /* look for other matches in the rest of the line if we
- * are not at the end of it already */
+ matched = false;
+ // look for other matches in the rest of the line if we
+ // are not at the end of it already
if (def_regmatch.regprog == NULL
&& action == ACTION_EXPAND
&& !(compl_cont_status & CONT_SOL)
&& *startp != NUL
- && *(p = startp + utfc_ptr2len(startp)) != NUL)
+ && *(p = startp + utfc_ptr2len(startp)) != NUL) {
goto search_line;
+ }
}
line_breakcheck();
if (action == ACTION_EXPAND)
@@ -5046,16 +5049,20 @@ fpip_end:
vim_regfree(def_regmatch.regprog);
}
-static void show_pat_in_path(char_u *line, int type, int did_show, int action, FILE *fp, linenr_T *lnum, long count)
+static void show_pat_in_path(char_u *line, int type, bool did_show, int action,
+ FILE *fp, linenr_T *lnum, long count)
+ FUNC_ATTR_NONNULL_ARG(1, 6)
{
char_u *p;
- if (did_show)
- msg_putchar('\n'); /* cursor below last one */
- else if (!msg_silent)
- gotocmdline(TRUE); /* cursor at status line */
- if (got_int) /* 'q' typed at "--more--" message */
+ if (did_show) {
+ msg_putchar('\n'); // cursor below last one
+ } else if (!msg_silent) {
+ gotocmdline(true); // cursor at status line
+ }
+ if (got_int) { // 'q' typed at "--more--" message
return;
+ }
for (;; ) {
p = line + STRLEN(line) - 1;
if (fp != NULL) {
diff --git a/src/nvim/testdir/test_autocmd.vim b/src/nvim/testdir/test_autocmd.vim
index 641e98ab30..c571e37ac3 100644
--- a/src/nvim/testdir/test_autocmd.vim
+++ b/src/nvim/testdir/test_autocmd.vim
@@ -1110,14 +1110,14 @@ func Test_BufReadCmd()
endfunc
func SetChangeMarks(start, end)
- exe a:start. 'mark ['
- exe a:end. 'mark ]'
+ exe a:start .. 'mark ['
+ exe a:end .. 'mark ]'
endfunc
" Verify the effects of autocmds on '[ and ']
func Test_change_mark_in_autocmds()
edit! Xtest
- call feedkeys("ia\<CR>b\<CR>c\<CR>d\<C-g>u", 'xtn')
+ call feedkeys("ia\<CR>b\<CR>c\<CR>d\<C-g>u\<Esc>", 'xtn')
call SetChangeMarks(2, 3)
write
diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim
index aa36f4e518..180170fe9a 100644
--- a/src/nvim/testdir/test_filetype.vim
+++ b/src/nvim/testdir/test_filetype.vim
@@ -429,6 +429,7 @@ let s:filename_checks = {
\ 'smith': ['file.smt', 'file.smith'],
\ 'sml': ['file.sml'],
\ 'snobol4': ['file.sno', 'file.spt'],
+ \ 'sparql': ['file.rq', 'file.sparql'],
\ 'spec': ['file.spec'],
\ 'spice': ['file.sp', 'file.spice'],
\ 'spup': ['file.speedup', 'file.spdata', 'file.spd'],
@@ -715,7 +716,7 @@ func Test_pp_file()
call assert_equal('pascal', &filetype)
bwipe!
- call delete('Xfile.ts')
+ call delete('Xfile.pp')
filetype off
endfunc
diff --git a/src/nvim/testdir/test_options.vim b/src/nvim/testdir/test_options.vim
index ccc5e6ffc9..84d99ebb74 100644
--- a/src/nvim/testdir/test_options.vim
+++ b/src/nvim/testdir/test_options.vim
@@ -266,8 +266,14 @@ func Test_set_errors()
call assert_fails('set foldmarker=x', 'E536:')
call assert_fails('set commentstring=x', 'E537:')
call assert_fails('set complete=x', 'E539:')
+ call assert_fails('set rulerformat=%-', 'E539:')
+ call assert_fails('set rulerformat=%(', 'E542:')
+ call assert_fails('set rulerformat=%15(%%', 'E542:')
+ call assert_fails('set statusline=%$', 'E539:')
call assert_fails('set statusline=%{', 'E540:')
call assert_fails('set statusline=%(', 'E542:')
+ call assert_fails('set statusline=%)', 'E542:')
+
if has('cursorshape')
" This invalid value for 'guicursor' used to cause Vim to crash.
call assert_fails('set guicursor=i-ci,r-cr:h', 'E545:')
@@ -281,6 +287,21 @@ func Test_set_errors()
call assert_fails('set winminwidth=10 winwidth=9', 'E592:')
call assert_fails("set showbreak=\x01", 'E595:')
call assert_fails('set t_foo=', 'E846:')
+ if has('python') || has('python3')
+ call assert_fails('set pyxversion=6', 'E474:')
+ endif
+ call assert_fails("let &tabstop='ab'", 'E521:')
+ call assert_fails('set sessionoptions=curdir,sesdir', 'E474:')
+ call assert_fails('set foldmarker={{{,', 'E474:')
+ call assert_fails('set sessionoptions=sesdir,curdir', 'E474:')
+ call assert_fails('set listchars=trail:· ambiwidth=double', 'E834:')
+ set listchars&
+ call assert_fails('set fillchars=stl:· ambiwidth=double', 'E835:')
+ set fillchars&
+ call assert_fails('set fileencoding=latin1,utf-8', 'E474:')
+ set nomodifiable
+ call assert_fails('set fileencoding=latin1', 'E21:')
+ set modifiable&
endfunc
" Must be executed before other tests that set 'term'.
diff --git a/src/nvim/testdir/test_sleep.vim b/src/nvim/testdir/test_sleep.vim
new file mode 100644
index 0000000000..f71855fd4b
--- /dev/null
+++ b/src/nvim/testdir/test_sleep.vim
@@ -0,0 +1,26 @@
+" Test for sleep and sleep! commands
+
+func! s:get_time_ms()
+ let timestr = reltimestr(reltime())
+ let dotidx = stridx(timestr, '.')
+ let sec = str2nr(timestr[:dotidx])
+ let msec = str2nr(timestr[dotidx + 1:])
+ return (sec * 1000) + (msec / 1000)
+endfunc
+
+func! s:assert_takes_longer(cmd, time_ms)
+ let start = s:get_time_ms()
+ execute a:cmd
+ let end = s:get_time_ms()
+ call assert_true(end - start >=# a:time_ms)
+endfun
+
+func! Test_sleep_bang()
+ call s:assert_takes_longer('sleep 50m', 50)
+ call s:assert_takes_longer('sleep! 50m', 50)
+ call s:assert_takes_longer('sl 50m', 50)
+ call s:assert_takes_longer('sl! 50m', 50)
+ call s:assert_takes_longer('1sleep', 1000)
+endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab
diff --git a/test/functional/options/defaults_spec.lua b/test/functional/options/defaults_spec.lua
index 12a31b592d..eb5e284385 100644
--- a/test/functional/options/defaults_spec.lua
+++ b/test/functional/options/defaults_spec.lua
@@ -233,13 +233,6 @@ describe('startup defaults', function()
}})
eq(xdgcachedir..'/log', string.gsub(eval('$NVIM_LOG_FILE'), '\\', '/'))
end)
- it('defaults to .nvimlog if stdpath("cache") is invalid', function()
- clear({env={
- XDG_CACHE_HOME='Xtest-missing-xdg-dir',
- NVIM_LOG_FILE='.', -- Any directory is invalid.
- }})
- eq('.nvimlog', eval('$NVIM_LOG_FILE'))
- end)
end)
end)