dotfiles
dotfiles copied to clipboard
CtrlP Commands
Fuzzy selecting of commands. Optionally take a prefix, e.g. call CtrlpCommands('VTR')
Initial WIP implementation:
function! ExtractedCommandName(command_definition)
let shell_split = "echo " . shellescape(a:command_definition) . " | sed -E 's/.{4}//' | cut -d ' ' -f 1"
return substitute(system(shell_split), "\n", "", "")
endfunction
" function! Mapped(fn, l)
" let new_list = deepcopy(a:l)
" call map(new_list, string(a:fn) . '(v:val)')
" return new_list
" endfunction
function! s:GetCommandList()
redir @a
silent! command
redir end
let definitions = split(getreg("a"), "\n")
let substitute_command = string(function('ExtractedCommandName')) . '(v:val)'
let commands = map(definitions[1:10], substitute_command)
echo commands
endfunction
command! Commands call <sid>GetCommandList()
Whoa.
Well, I mean, it doesn't "work" yet, so that's a pretty big caveat. But it'll get there.
:Commands
from fzf.vim does exactly this, right?
No way that I can see to provide a filter on startup, but otherwise Commands is the functionality I'm describing.