Escape <Bar> when setting indentkeys (#474)
In `keymap.autoindent`, `!^F` is added to `indentkeys`, then `<C-f>` is fed. In the end `indentkeys` is reset to its original value. We need to escape any `|` in `indentkeys` when setting the option because otherwise they are seen as the command separator.
This commit is contained in:
committed by
GitHub
parent
01fcf869bb
commit
bf31b71f03
@@ -79,7 +79,7 @@ keymap.autoindent = function()
|
|||||||
local keys = {}
|
local keys = {}
|
||||||
table.insert(keys, keymap.t('<Cmd>setlocal indentkeys+=!^F<CR>'))
|
table.insert(keys, keymap.t('<Cmd>setlocal indentkeys+=!^F<CR>'))
|
||||||
table.insert(keys, keymap.t('<C-f>'))
|
table.insert(keys, keymap.t('<C-f>'))
|
||||||
table.insert(keys, keymap.t('<Cmd>setlocal indentkeys=%s<CR>'):format(vim.bo.indentkeys))
|
table.insert(keys, keymap.t('<Cmd>setlocal indentkeys=%s<CR>'):format(vim.bo.indentkeys:gsub( '|', '\\|')))
|
||||||
return table.concat(keys, '')
|
return table.concat(keys, '')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user