aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2020-12-01 00:15:12 +0100
committerBjörn Linse <bjorn.linse@gmail.com>2020-12-01 00:57:52 +0100
commitbed9839f46047abd81f7c9b56936ba177829221c (patch)
tree132ae30cb74c001a13962c3a07e11ebe12408535 /test
parentaec61074a97bac3290f1afef309429b35a71d1a2 (diff)
downloadrneovim-bed9839f46047abd81f7c9b56936ba177829221c.tar.gz
rneovim-bed9839f46047abd81f7c9b56936ba177829221c.tar.bz2
rneovim-bed9839f46047abd81f7c9b56936ba177829221c.zip
ex_getln: add secret charm
Opt in to this secret world using set wildchar=0 " already the default, but remove if non-zero existing config: set wildcharm=0 now you can map 'wildmode' just like any mode: cnoremap <tab> <c-z> function! Spacey() return getcmdline()[-1:] == "/" ? "\<bs>" : "" endfunc cnoremap <expr> / wildmenumode() ? Spacey()."/<c-z>" : "/" Possibly asked questions: What about backwards compatibility? ==== Just do nothing and your existing 'wildchar' and 'wildcharm' will keep working. Doesn't `<c-z>` mean suspend? ==== Not in cmdline mode. If it would then the recommended wildcharm would not have been `<c-z>` to start with. My config relies on `:<c-z>` being a synonym to `:<nop>`! ==== just no.
Diffstat (limited to 'test')
-rw-r--r--test/functional/helpers.lua1
-rw-r--r--test/functional/ui/wildmode_spec.lua59
2 files changed, 60 insertions, 0 deletions
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua
index d85a6a3cfe..0829560b9c 100644
--- a/test/functional/helpers.lua
+++ b/test/functional/helpers.lua
@@ -442,6 +442,7 @@ function module.new_argv(...)
'NVIM_LOG_FILE',
'NVIM_RPLUGIN_MANIFEST',
'GCOV_ERROR_FILE',
+ 'XDG_DATA_DIRS',
'TMPDIR',
}) do
if not env_tbl[k] then
diff --git a/test/functional/ui/wildmode_spec.lua b/test/functional/ui/wildmode_spec.lua
index 99ebc4971e..85c3f8c2de 100644
--- a/test/functional/ui/wildmode_spec.lua
+++ b/test/functional/ui/wildmode_spec.lua
@@ -3,6 +3,7 @@ local Screen = require('test.functional.ui.screen')
local clear, feed, command = helpers.clear, helpers.feed, helpers.command
local iswin = helpers.iswin
local funcs = helpers.funcs
+local meths = helpers.meths
local eq = helpers.eq
local eval = helpers.eval
local retry = helpers.retry
@@ -396,6 +397,64 @@ describe("'wildmenu'", function()
|
]])
end)
+
+ it('works with c_CTRL_Z standard mapping', function()
+ screen:set_default_attr_ids {
+ [1] = {bold = true, foreground = Screen.colors.Blue1};
+ [2] = {foreground = Screen.colors.Grey0, background = Screen.colors.Yellow};
+ [3] = {bold = true, reverse = true};
+ }
+
+ -- Wildcharm? where we are going we aint't no need no wildcharm.
+ eq(0, meths.get_option'wildcharm')
+ -- Don't mess the defaults yet (neovim is about backwards compatibility)
+ eq(9, meths.get_option'wildchar')
+ -- Lol what is cnoremap? Some say it can define mappings.
+ command 'set wildchar=0'
+ eq(0, meths.get_option'wildchar')
+
+ command 'cnoremap <f2> <c-z>'
+ feed(':syntax <f2>')
+ screen:expect{grid=[[
+ |
+ {1:~ }|
+ {1:~ }|
+ {2:case}{3: clear cluster > }|
+ :syntax case^ |
+ ]]}
+ feed '<esc>'
+
+ command 'set wildmode=longest:full,full'
+ -- this will get cleaner once we have native lua expr mappings:
+ command [[cnoremap <expr> <tab> luaeval("not rawset(_G, 'coin', not coin).coin") ? "<c-z>" : "c"]]
+
+ feed ':syntax <tab>'
+ screen:expect{grid=[[
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ :syntax c^ |
+ ]]}
+
+ feed '<tab>'
+ screen:expect{grid=[[
+ |
+ {1:~ }|
+ {1:~ }|
+ {3:case clear cluster > }|
+ :syntax c^ |
+ ]]}
+
+ feed '<tab>'
+ screen:expect{grid=[[
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ :syntax cc^ |
+ ]]}
+ end)
end)
describe('command line completion', function()