Using vim's command-t within rails projects
I'm a big fan of tpope's rails.vim but 开发者_运维问答I find the default search mechanism's autocomplete to be a pain in the ass.
At the same time I've found command-t's fuzzy search to be awesome and faster than going :RTcontroller a<TAB><TAB><TAB>
.
However, it defaults to searching within the same directory of my currently open file which is less than useful.
Is there a good way to get command-t to begin searching at the root of my rails project whenever I open a file within it? Going :cd ../../ before opening up command-t almost seems to make its use moot.
Thanks!
I don't use Command-T, but I'd assume it has no project-awareness. However, rails.vim does, and you can probably use the buffer-local rails_root variable to focus search:
:exe "CommandT" b:rails_root
I have exactly the same need; it seems that Command-T cannot find files in parent or sibling directories.
Luckily I found ctrlp at https://github.com/kien/ctrlp.vim, which works as desired and runs very smoothly. Besides, installation is a snap if you happen to use Vundle and ctrlp works out of the box. It doesn't depend on Ruby as Command-T does.
精彩评论