diff --git a/autoload/fzf/vim.vim b/autoload/fzf/vim.vim index 4c7e322..98e14ac 100755 --- a/autoload/fzf/vim.vim +++ b/autoload/fzf/vim.vim @@ -361,7 +361,7 @@ function! s:build_hint(entries, defaults, ...) let keys = [] let actions = get(g:, 'fzf_action', s:default_action) if a:defaults - if index(taken, 'enter') < 0 && index(taken, 'return') < 0 + if index(taken, 'enter') < 0 call add(entries, ['Enter', 'Open']) endif for [key, name, label] in [['ctrl-x', 'C-X', 'HSplit'], ['ctrl-v', 'C-V', 'VSplit'], ['ctrl-t', 'C-T', 'Tab']] @@ -442,6 +442,9 @@ function! s:show_key() return s:conf('show_key', 'ctrl-o') endfunction +" fzf spells these two events more than one way +let s:key_aliases = {'return': 'enter', 'alt-return': 'alt-enter'} + " A key can be a comma-separated list, which fzf binds to every key in it. " fzf escapes 'alt-,' before splitting on the comma, so do the same. It also " lowercases a key name before matching it, except for 'alt-X' and a bare @@ -452,8 +455,9 @@ function! s:split_keys(keys) let keys = map(split(substitute(a:keys, '\c\(alt-\),', '\1'.sep, 'g'), ','), \ 'substitute(v:val, sep, ",", "g")') " 'alt-X' keeps X as typed but not its prefix, so fold only the prefix there - return map(keys, 'strchars(v:val) == 1 ? v:val + call map(keys, 'strchars(v:val) == 1 ? v:val \ : v:val =~? "^alt-.$" ? "alt-".v:val[4:] : tolower(v:val)') + return map(keys, 'get(s:key_aliases, v:val, v:val)') endfunction " 'ctrl-alt-x' -> 'C-A-X' and 'double-click' -> 'Dbl-Click', to match the