Provides Zsh-style pathname completion in the Vim command line.
Specifically, it will complete each component of pathname independently up to the first ambiguous match.
Here's an example:
Will expand to:
So long as there are no ambiguous matches along the way. You can provide as much of each component as you want. This also works:
If there are any ambiguous matches, it will complete as much as it can.
You can freely intermingle
<C-s> completion until you get
the path you want.
<C-s> doesn't invoke any completion menus; it just
completes what it can.
cd ~/.vim/bundle git clone git://github.com/fweep/vim-zsh-path-completion.git
To suppress the key mapping:
let g:zsh_path_completion_suppress_mappings = 1
To provide your own mapping, bind to
<Plug>ZshPathComplete. The default
cmap <C-s> <Plug>ZshPathComplete
It doesn't understand context. Whereas Vim builtins like
that they need a filename argument, and only do
<Tab> completion when
appropriate, this will try to expand whatever token is there when you
It doesn't handle quotes/spaces/special characters. That should be fixable.
If a component in the middle of the path is ambiguous, it will discard everything after the unambiguous prefix (zsh will expand the common portion and position the cursor at the first differing character, leaving the rest of the path string intact).
<C-s> only works on the end of the command line; if you move the
cursor to the middle and invoke it, you won't get good results.
I hope to address some of these issues. Soliciting feedback for now.
Please file a GitHub issue if you find bugs.
A note on clutter
I'm not happy about all the Ruby stuff in the top-level directory. It's
there because Bundler will not allow you to
monitor paths above its root, so I can't use a relative path to
watch() for changes in the
plugin directory. Bundler also won't
follow symlinks. If you install the plugin with
pathogen (or another Vim package
handler), it doesn't really matter that the directory is cluttered up.
If you don't use pathogen, well...you should. I'll move everything to a
test directory once I figure out how to make Bundler happy.
This was motivation by a question on Stack Overflow by Mykle Hansen. Thanks for the idea, Mykle!
Copyright (C) 2013 Jim Stewart
MIT License. See LICENSE file.