From bf31b71f03c8275995b74ad66eb1b7d1762de786 Mon Sep 17 00:00:00 2001 From: Martijn Hoogendoorn Date: Fri, 5 Nov 2021 03:47:06 +0100 Subject: [PATCH] Escape when setting indentkeys (#474) In `keymap.autoindent`, `!^F` is added to `indentkeys`, then `` 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. --- lua/cmp/utils/keymap.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/cmp/utils/keymap.lua b/lua/cmp/utils/keymap.lua index abddd9a..32079c9 100644 --- a/lua/cmp/utils/keymap.lua +++ b/lua/cmp/utils/keymap.lua @@ -79,7 +79,7 @@ keymap.autoindent = function() local keys = {} table.insert(keys, keymap.t('setlocal indentkeys+=!^F')) table.insert(keys, keymap.t('')) - table.insert(keys, keymap.t('setlocal indentkeys=%s'):format(vim.bo.indentkeys)) + table.insert(keys, keymap.t('setlocal indentkeys=%s'):format(vim.bo.indentkeys:gsub( '|', '\\|'))) return table.concat(keys, '') end