Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CtrlP Commands #109

Open
christoomey opened this issue Oct 6, 2015 · 4 comments
Open

CtrlP Commands #109

christoomey opened this issue Oct 6, 2015 · 4 comments
Labels

Comments

@christoomey
Copy link
Owner

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()
@christoomey christoomey added the vim label Oct 6, 2015
@gabebw
Copy link

gabebw commented Oct 6, 2015

Whoa.

@christoomey
Copy link
Owner Author

Well, I mean, it doesn't "work" yet, so that's a pretty big caveat. But it'll get there.

@gabebw
Copy link

gabebw commented Sep 18, 2017

:Commands from fzf.vim does exactly this, right?

@christoomey
Copy link
Owner Author

No way that I can see to provide a filter on startup, but otherwise Commands is the functionality I'm describing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants