feat: Add escape spamming

This commit is contained in:
TJ DeVries
2020-08-29 23:18:01 -04:00
parent 6a75a0b6d3
commit 7c921b288f

View File

@@ -8,10 +8,10 @@ local mappings = {}
local keymap = {} local keymap = {}
mappings.set_keymap = function(prompt_bufnr, results_bufnr) mappings.set_keymap = function(prompt_bufnr, results_bufnr)
local function default_mapper(map_key, table_key) local function default_mapper(mode, map_key, table_key)
a.nvim_buf_set_keymap( a.nvim_buf_set_keymap(
prompt_bufnr, prompt_bufnr,
'i', mode,
map_key, map_key,
string.format( string.format(
[[<C-O>:lua __TelescopeMapping(%s, %s, '%s')<CR>]], [[<C-O>:lua __TelescopeMapping(%s, %s, '%s')<CR>]],
@@ -25,9 +25,11 @@ mappings.set_keymap = function(prompt_bufnr, results_bufnr)
) )
end end
default_mapper('<c-n>', 'control-n') default_mapper('i', '<c-n>', 'control-n')
default_mapper('<c-p>', 'control-p') default_mapper('i', '<c-p>', 'control-p')
default_mapper('<CR>', 'enter') default_mapper('i', '<CR>', 'enter')
default_mapper('n', '<esc>', 'escape')
end end
@@ -88,4 +90,8 @@ keymap["enter"] = function(prompt_bufnr, results_bufnr)
end end
end end
keymap["escape"] = function(prompt_bufnr)
vim.cmd(string.format([[bwipeout! %s]], prompt_bufnr))
end
return mappings return mappings