Commit Graph

133 Commits

Author SHA1 Message Date
zeertzjq
3090648584 test: revert test and doc changes from #6724, add a test for #6716
Multi-char 'pastetoggle' now works without breaking character-find.
2022-04-29 15:51:04 +08:00
zeertzjq
519e4c4472 test: correct order of arguments to eq() and neq() 2022-04-26 11:38:58 +08:00
zeertzjq
94f12e8a59 vim-patch:8.2.4801: fix for cursorbind fix not fully tested
Problem:    Fix for cursorbind fix not fully tested.
Solution:   Add another test case. (Christian Brabandt, closes vim/vim#10240)
3fd7480cd2
2022-04-21 06:10:42 +08:00
zeertzjq
5600766b41 vim-patch:8.2.4795: 'cursorbind' scrolling depends on whether 'cursorline' is set
Problem:    'cursorbind' scrolling depends on whether 'cursorline' is set.
Solution:   Always call validate_cursor(). (Christian Brabandt, closes vim/vim#10230,
            closes vim/vim#10014)
2c645e8b00
2022-04-21 06:10:42 +08:00
zeertzjq
194411d18a test: add a test for #17609 2022-03-07 06:43:03 +08:00
zeertzjq
7528bcec42 fix(options): using :set fillchars should clear local value 2021-11-17 07:11:46 +08:00
zeertzjq
8c24e1462c vim-patch:8.2.2518: 'listchars' should be window-local
Problem:    'listchars' should be window-local.
Solution:   Make 'listchars' global-local. (Yegappan Lakshmanan, Marco Hinz,
            closes vim/vim#5206, closes vim/vim#7850)
eed9d46293

Nvim already has this feature, but it implements :set listchars the same
as :setglobal listchars, which is incorrect. Vim's implementation of
:set listchars is correct: using :set listchars clears local value.
2021-11-17 07:11:40 +08:00
Justin M. Keyes
6751d6254b
refactor(tests): use assert_alive() #15546 2021-09-01 09:42:53 -07:00
Gregory Anders
460019366e feat: defaults: auto-create backup dir
Copy the behavior of 'undodir' and create the last specified directory
in the 'backupdir' option if it doesn't exist.

Use trailing slashes for 'backupdir' as well as 'viewdir' and 'undodir'
by default. Note that 'undodir' always behaves as though it has the
trailing slashes, regardless of whether or not they are present. They
are added to the default option value to minimize surprise.

The '.' value in 'backupdir' is kept because the default behavior for
backups is solely to have a backup if the save of the main file to disk
fails. As soon as that save is completed the backup file is removed, so
generally there is no need to put them in a central location.

Co-authored by: murphy66 <murphy66@gmail.com>
2021-08-27 10:34:44 -06:00
Michael Lingelbach
abbfaf286f
logs: make kXDGCacheHome if it doesn't exist (#13758) 2021-01-16 21:14:59 +01:00
Michael Lingelbach
ea8756f85d
logging: move to XDG_CACHE_HOME (#13739)
while there is some controversy, stdpath('cache') looks like  a better fit for logs than stdpath('data'): you can remove logs without preventing nvim to work which fits the XDG_CACHE_HOME definition of `user specific non-essential data files`.
2021-01-13 23:20:21 +01:00
erw7
aa45579206
win/env: fix stdpath()/XDG_* initialization, parsing #12829
- Windows environment variables are semicolon-separated, but some logic
  was assuming colon (:). This broke initialization and parsing of
  XDG_CONFIG_DIRS, XDG_DATA_DIRS, 'runtimepath', stdpath(), etc.
- test/defaults_spec: enable tests on Windows

ref #12793
2020-09-07 22:40:12 -07:00
Jan Edmund Lazo
3c9ec83395
vim-patch:8.2.0966: 'shortmess' flag "n" not used in two places
Problem:    'shortmess' flag "n" not used in two places.
Solution:   Make use of the "n" flag consistent. (Nick Jensen, closes vim/vim#6245,
            closes vim/vim#6244)
722e505d1a
2020-06-18 18:01:43 -04:00
Will Eccles
87d892afa0
vim-patch:8.1.0864 Make 'scrolloff' and 'sidescrolloff' options window local (#11854)
Problem: cannot have a local value for 'scrolloff' and 'sidescrolloff'

Author: Bram Moolenar

375e339007
2020-03-17 20:05:34 +01:00
Matthieu Coudron
1a2be57da3 foldcolumn: allow auto:X
Similar to signcolumn, allow foldcolumn to adapt itself to the number of
folds.

Regression:
vim supports a maximum fdc of 12, this limits it to 9.
2020-02-29 20:27:22 +01:00
Björn Linse
ef2e6522c5 tests: bail out on libdir just like $VIMRUNTIME, it cannot be calculated 2020-02-07 09:32:25 +01:00
Björn Linse
c5b812c9ea env: try find library dir (like /usr[/local]/lib/nvim) and add it to &rtp 2020-02-07 09:22:55 +01:00
Justin M. Keyes
c34130d13a API: deprecate nvim_command_output 2019-12-02 20:52:06 -08:00
Daniel Hahler
22b52dd462
log_init: call log_path_init (#11501)
This has to be done after `init_homedir` for XDG default and `set_init_1` for
lookup from env, which could be done earlier likely (to help with
https://github.com/neovim/neovim/issues/10937), but this keeps it in
sync with Vim.

Fixes https://github.com/neovim/neovim/issues/11499.
2019-12-02 22:21:15 +01:00
Björn Linse
49a40f425d options: make 'fillchars' and 'listchars' global-local
These options were previously global. A global-local window option
behaves closer to a global option "per default" (i e with :set),
but still supports local behavior via :setl

Also this restores back-compat for nvim_set_option("fcs", ...)
which are currently broken on 0.4.x but worked in earlier versions
2019-11-26 19:14:54 +01:00
Björn Linse
4987311fb5 tests/ui: remove unnecessary screen:detach()
It is perfectly fine and expected to detach from the screen just by
the UI disconnecting from nvim or exiting nvim. Just keep detach() in
screen_basic_spec, to get some coverage of the detach method itself.

This avoids hang on failure in many situations (though one could argue
that detach() should be "fast", or at least "as fast as resize",
which works in press-return already).

Never use detach() just to change the size of the screen, try_resize()
method exists for that specifically.
2019-10-13 22:10:42 +02:00
Daniel Hahler
b2d6a6891e findoption_len: treat viminfo/viminfofile as aliases
Ref: https://github.com/neovim/neovim/pull/10672#issuecomment-524716824
2019-08-26 09:39:00 +02:00
Jan Edmund Lazo
8062e6ff88 vim-patch:8.1.1614: 'numberwidth' can only go up to 10
Problem:    'numberwidth' can only go up to 10.
Solution:   Allow up to 20. (Charlie Stanton, closes vim/vim#4584)
f8a0712655
2019-07-05 21:26:46 -04:00
Justin M. Keyes
9d7aaf7149 lua/shared: move table util funcs to vim.shared
Use `tbl_` prefix for all table-util functions. Specify in the function
docstring if it expects a list-like or map-like table.
2019-05-18 21:07:30 +02:00
Justin M. Keyes
fd04877eb0 test: remove use of require('test.helpers')
The test.functional.helpers and test.unit.helpers modules now include
all of the public functions from test.helpers, so there is no need to
separately require('test.helpers').
2019-05-18 15:48:13 +02:00
Justin M. Keyes
769f44e918 win/defaults: Use "…/nvim-data/site" in 'runtimepath'
On Windows we store non-config data in "$XDG_DATA_HOME/nvim-data". But
the "…/site" items in 'runtimepath' did not correctly point to that
location, they used "…/nvim/site".

Fix the init logic to use  "…/nvim-data/site".

closes #9910
2019-04-28 00:27:07 +02:00
Justin M. Keyes
17291642bd test: clear(): args_rm parameter 2019-04-27 16:19:40 +02:00
Justin M. Keyes
f0a7e3fc9a test: 'shadafile' default
ref 773bdd41ec
2019-04-27 16:19:40 +02:00
Jan Edmund Lazo
5a40abe2d5 vim-patch:8.0.1114: default for 'iminsert' is annoying
Problem:    Default for 'iminsert' is annoying.
Solution:   Make the default always zero. (Yasuhiro Matsumoto, closes vim/vim#2071)
4cf56bbc85
2019-02-03 09:52:13 -05:00
Marco Hinz
88b0899eb4
tests: 'fcs' and 'lcs' are local to the window 2019-01-26 15:10:46 +01:00
Björn Linse
c8810a51a3 tests: improve robustness of immediate successes in screen tests 2018-10-15 20:13:11 +02:00
Justin M. Keyes
22c83a4de9 swapfile: Always show swap dialog (E325)
If swapfile dialog prompts for input, it must be displayed to the user.

fix #8840
fix #9027
2018-09-23 15:58:01 +02:00
Justin M. Keyes
c3d24368a1 shortmess+=F: Hide :bnext, :bprev fileinfo messages 2018-09-23 15:58:01 +02:00
Justin M. Keyes
489d32f2b8
startup: fix ":if 0|syntax on|endif" bug (#8731)
Problem: ":if 0|syntax {on,off}|endif" skips the default of "syntax on"
because the executor was setting the `did_syntax_onoff` flag even though
"syntax {on,off}" is not actually executed.

closes #8728
2018-07-18 14:30:11 +02:00
Justin M. Keyes
b7514493a0
defaults: shortmess+=F (#8619)
Because we default to laststatus=2 (statusline is always visible), the
:edit message is not useful.

ref #6289
2018-06-22 08:18:02 +02:00
Björn Linse
5442f0b622 fillchars: make checks more strict and improve tests 2018-06-14 14:00:09 +02:00
Jack Bracewell
a7bb63c55d Add ‘eob’ option to fillchars
This option allows configuring what character is shown on the empty
lines at the end of a buffer, previously hardcoded to ‘~’
2018-06-13 17:54:16 +02:00
Björn Linse
050f3975f6 options: remove 'maxcombine` option (always use 6) 2018-06-13 10:11:35 +02:00
Justin M. Keyes
26d5a981eb do not pass NULL to os_getenv
closes #8393
2018-05-18 19:04:37 +02:00
Justin M. Keyes
2aa308c685
Merge #5658 'Apply :lmap in macros' 2018-05-17 02:13:31 +02:00
James McCoy
ec459965f5
test/options: Fix stdpath() failures on Windows 2018-04-01 22:40:20 -04:00
Christian Höltje
868b84199e eval: Add stdpath() method (#5297)
Adds the :stdpath method for fetching XDG standard directories.

Fixes #5297
2018-03-29 10:41:04 -04:00
James McCoy
79f9c2d9c6
Merge branch 'master' into yagebu/option-fixes 2018-03-28 21:54:39 -04:00
Matthew Malcomson
cc58ec9a80 Update documentation
Update vim_diff.txt with :lmap differences, update documentation on
'keymap', and add tests.

The tests added are to demonstrate the behaviour specified in the
documentation of :loadkeymap.
2018-03-14 10:39:14 +00:00
Matthew Malcomson
3b304fc04a 'keymap' now uses :lmap instead of :lnoremap
This means that the major way that :lmap mappings are applied works as
one would expect with macros.
This also means that having a translation with 'keymap' does not
preclude using mappings in insert mode with :imap.
2018-03-14 10:39:14 +00:00
Matthew Malcomson
d989051220 Split :lnoremap test into done and pending
There is some behaviour that we keep with the recent changes, and some
behaviour that we change.
Instetad of having one failing test covering  all behaviour, we split
the test into two.
2018-03-14 10:39:14 +00:00
Matthew Malcomson
e01f35c4bb :lnoremap mappings should not be remapped when replaying a recording 2018-03-14 10:39:14 +00:00
Matthew Malcomson
20bfe0f2a3 Account for :lmap in macros
close #5652
Start by adding some tests
2018-03-14 10:39:14 +00:00
Matthieu Coudron
384a39479a 'fillchars': fix defaults logic; handle ambiwidth=double #7986
Update tests.
2018-02-23 00:48:35 +01:00
Justin M. Keyes
4fedad6c5b Merge #7753 'win: enable more functional tests' 2018-01-06 17:52:14 +01:00
Jan Edmund Lazo
7311fb7cad win: enable more functional tests
- plugin/shada_spec.lua: Use \r\n as Windows EOL for tests on
  BufWriteCmd, FileWriteCmd, FileAppendCmd. Alternative is 'set
  fileformat=unix'.
2018-01-06 17:47:00 +01:00
Justin M. Keyes
7c4bb23ff3 defaults: do :filetype stuff unless explicitly "off"
Until now, the default `:filetype ...` setup was skipped if the user
config touched `:filetype` in any way (including implicitly via `:syntax
on`).  No one needs that, and it's very confusing.

Instead, proceed with `:filetype ... on` unless the user explicitly
called `:filetype ... off`.

closes #7765
2018-01-04 10:32:09 +01:00
Justin M. Keyes
a3134bc480 test: tabstop=<big-number> #2838 2017-10-22 14:11:09 +02:00
Jakob Schnitzer
4403864da3 update tests 2017-06-28 20:23:03 +02:00
Jakob Schnitzer
e8829710bc Merge branch 'master' into option-fixes 2017-06-28 16:52:04 +02:00
Justin M. Keyes
d07661b9a3 log: Fall back to CWD-relative .nvimlog
If if the resolved $NVIM_LOG_FILE *and* stdpath("data")/log cannot be
created (e.g. because the XDG data directory does not exist), fall back
to .nvimlog in the current direcrtory.
2017-06-07 00:27:26 +02:00
Justin M. Keyes
bb96b8219d log: set $NVIM_LOG_FILE; fallback to $XDG_DATA_HOME/nvim/log 2017-06-07 00:26:56 +02:00
Matthew Malcomson
033b1cb7d9 'pastetoggle': Revert support for multi-key value (#6724)
Reverts commit 337b6179df

Closes #6716 at the expense of not being able to use a
multi-key 'pastetoggle' manually.

Multi-key 'pastetoggle' can still be used when inserting the entire
option into the typebuffer at once (though the use here is
questionable).

Also remove those tests to do with waiting for the completion of
'pastetoggle' and mention in the documentation that 'pastetoggle'
doesn't wait for timeout.
2017-05-31 13:20:06 +02:00
James McCoy
e20691ccb4
defaults_spec: Test changing :filetype/:syntax in -c, after defaults 2017-04-27 09:20:03 -04:00
Jakob Schnitzer
ff8b2eb435 Merge branch 'master' into option-fixes 2017-04-24 11:35:10 +02:00
ZyX
65fb622000 functests: Replace execute with either command or feed_command
Hope this will make people using feed_command less likely: this hides bugs.
Already found at least two:

1. msgpackparse() will show internal error: hash_add() in case of duplicate
   keys, though it will still work correctly. Currently silenced.
2. ttimeoutlen was spelled incorrectly, resulting in option not being set when
   expected. Test was still functioning somehow though. Currently fixed.
2017-04-09 03:24:08 +03:00
ZyX
9158cc171f functests: Refactor options/pastetoggle
Note: typo, ttimeoutlen not set ever.

Mention @hardenedapple
2017-04-08 23:48:22 +03:00
Matthew Malcomson
337b6179df 'pastetoggle': support value >1 char (#6421)
If we `set pastetoggle=abcde`, and manually type it, then `vgetorpeek()`
sees part of the option before it has all been inserted into the
typebuffer.
To signify this it sets `keylen = KEYLEN_PART_KEY`, but the condition
about whether to return the current key from `vgetorpeek()` only checks
for `keylen = KEYLEN_PART_MAP`.
Add a check for `KEYLEN_PART_KEY` to account for the `'pastetoggle'`
option.
2017-04-01 21:50:29 +02:00
Jakob Schnitzer
4049492b6d also test set_option 2017-04-01 12:26:58 +02:00
Jakob Schnitzer
8a55f9b1c8 update for changes in master; fix 'window'; tests 2017-03-31 18:30:06 +02:00
Jakob Schnitzer
db095f6563 options: more tests; check first set later; stricter validation 2017-03-30 23:04:54 +02:00
Jakob Schnitzer
44f039a1c8 options: fix setglobal for buf-local number options 2017-03-30 23:04:54 +02:00
Jakob Schnitzer
628d0335b8 options: add some tests 2017-03-30 23:04:54 +02:00
Jakob Schnitzer
e47622f26b options: setlocal should only set local value
For 'iminsert' and 'imsearch' the global value was always changed.
2017-03-30 23:04:54 +02:00
Justin M. Keyes
a90beeadbb defaults: 'showcmd', 'belloff', 'ruler'
- Vim "unix default" of 'noshowcmd' is serving few users. And it's
  inconsistent.
- 'ruler' and 'belloff=all' improve the out-of-the-box experience.
- Continue to use 'noshowcmd' and 'noruler' by default in the functional
  tests to keep them fast.

TODO: Add a "disable slow stuff" command or mapping to address the
use-case of a very slow terminal connection.
2017-03-16 18:44:10 +01:00
Justin M. Keyes
224f99b85d win: Append process dir to $PATH
This allows executables to be found by :!, system(), and executable() if
they live next to ("sibling" to) nvim.exe. This is what gvim on Windows
does, and also matches the behavior of Win32 SearchPath().

c4a249a736/src/os_win32.c (L354-L370)
2017-02-04 11:07:49 +01:00
Rui Abreu Ferreira
32156f06f7 XDG: Windows: resolve $LOCALAPPDATA, $TEMP (#5278)
After #4964 environment variables in the XDG "fallback" table are no
longer expanded.

Fallback to correctly expanded $LOCALAPPDATA, $TEMP. If that fails
(unlikely), fallback to hard-coded paths (e.g. ~/AppData/Local).

Closes #5255
2017-01-08 03:18:00 +01:00
Rui Abreu Ferreira
39c628d031 Mark some functional tests as pending in Windows 2016-08-26 08:21:41 +01:00
James McCoy
84bf53b803
Set the default value for 'packpath'
As noted in “:help 'packpath'”, the default value is supposed to be the
same as that for 'runtimepath'.  This was missed in the original port of
the packages functionality from Vim.

Closes #5193
2016-08-08 18:19:26 -04:00
ZyX
9767b9f00f functests: Also make sure that set all& does not expand 2016-07-10 02:04:27 +03:00
ZyX
3878626c05 functests: Add tests for XDG defaults 2016-07-10 02:04:27 +03:00
ZyX
895f712df8 option: Do not expand options, obtained from XDG vars
It is a wrong thing to do, this makes valid variable values be treated 
incorrectly: in

    XDG_DATA_HOME='/home/$foo/.local/share'

`$foo` should be treated literally and not expanded to `foo` environment 
variable value.

Also makes option_expand not try to expand too long strings even if these too 
long strings are default values. Previously it thought that default values 
should always be expanded. Also does not try to expand NULL should it be the 
default value just in case.

Fixes #4961
2016-07-10 02:04:27 +03:00
Justin M. Keyes
173d366a5b test: TUI colors ('t_Co') 2016-07-03 01:29:00 -04:00
Marco Hinz
0d9593ff14 Tests: check 'autochdir' on startup 2016-07-02 01:03:05 +02:00
ZyX
ff470bb853 functests: Check logs in lua code
It is otherwise impossible to determine which test failed sanitizer/valgrind
check. test/functional/helpers.lua module return was changed so that tests which
do not provide after_each function to get new check will automatically fail.
2016-06-10 21:50:49 +03:00
KillTheMule
360d0513d1 Satisfy testlint.
For that, make luatest ignore the preload.lua files.
2016-04-28 19:30:17 +02:00
Justin M. Keyes
523ff9c55c test: defaults_spec.lua 2016-04-15 02:23:27 -04:00
Justin M. Keyes
5a9d3be54c test: minor changes 2016-03-17 00:21:48 -04:00