Extend fzf#vim#maps() to allow listing only the buffer-local mappings
- Dominant language
- Vim Script
- Stars
- 10.3k
- Forks
- 608
- Avg merge
- 5d 8h
- Merged PRs (30d)
- 2
Description
Listing only the buffer-local mappings may be helpful if an ftplugin introduces some additional (and not so frequently used) mappings, which may be lost in a whole list of all mappings :)
Seems like an easy patch:
--- plugin/fzf.vim
+++ plugin/fzf.vim
@@ -59,7 +59,8 @@
\'command! -bar -bang Windows call fzf#vim#windows(0)',
\'command! -bar -bang Commits call fzf#vim#commits(0)',
\'command! -bar -bang BCommits call fzf#vim#buffer_commits(0)',
-\'command! -bar -bang Maps call fzf#vim#maps("n", 0)',
+\'command! -bar -bang Maps call fzf#vim#maps("n", "all", 0)',
+\'command! -bar -bang BMaps call fzf#vim#maps("n", "buf", 0)',
\'command! -bar -bang Filetypes call fzf#vim#filetypes(0)',
\'command! -bang -nargs=* History call s:history(, 0)'])
--- autoload/fzf/vim.vm
+++ autoload/fzf/vim.vm
@@ -1179,14 +1179,15 @@
\ substitute(key, '<[^ >]\+>', '\=eval("\"\\".submatch(0)."\"")', 'g'))
endfunction
-function! fzf#vim#maps(mode, ...)
+function! fzf#vim#maps(mode, loc, ...)
+ let s:loc = (a:loc == "buf") ? " " : ""
let s:map_gv = a:mode == 'x' ? 'gv' : ''
let s:map_cnt = v:count == 0 ? '' : v:count
let s:map_reg = empty(v:register) ? '' : ('"'.v:register)
let s:map_op = a:mode == 'o' ? v:operator : ''
redir => cout
- silent execute 'verbose' a:mode.'map'
+ silent execute 'verbose' a:mode.'map'.s:loc
redir END
let list = []
let curr = ''
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.