2 points · by eof · 15y ago · 8 comments
" Command/TAB Completion
"set wildchar=<number> " Character typed to start wildcard expansion
set wildmenu
set wildmode=longest,list,full " use ksh/tcsh autolist TAB completion
EDIT: removed my stupid condescending remark about knowing how to configure vim. sorry.However, I am not sure
:e **/
does what you are talking about.Tab completion has always worked for me "out of the box" (though without that wildmenu which is cool); but only in one directory at a time.
This allows me to open vim in /home/eof and type
:e **/foo<tab>
and tab between /home/eof/somefolder/deeper/food.gif
and /home/eof/something/very/deep/foolsinlove.mp3
This is really useful, obviously, if you are jumping around a larger project.The cool part about learning to configure vim is by doing so, you are actually learning to both USE and enhance vim. It is definitely worth the effort.
My all time favorite "configuration" of vim is automatically reloading ~/.vimrc on save.
" auto-reload vimrc on save changes
au! BufWritePost .vimrc source %
With the above, you do have to be a bit careful though, since if you define something save/reload, then delete said definition line and save/reload again, it is still defined.For me, and obviously many others, it is important for tab completion to be consistent between my editor and my shell. In my case using ksh for my shell, the above settings make tab completion in vim behave just like it does in my shell.
If ``:e /foo'' is used in a shallow and lightly filled subdirectory, like for some project dir, it's more usable and useful. On the other hand, if you have tons of stuff in your current (home) directory, it takes far too long. If you're not really specific with your search term, you'll get the "E77: Too many file names" error.
Though often wishful thinking, I prefer to remember where the hell I put the damn files. ;)
It's really fine, I don't know how to configure vim. To be fair, there are a lot of options and you can get a long way just figuring out easy ways to do things you do all the time; while never really bothering to study it in depth.
All that being said, I downloaded and ran ksh; and I don't think what you've said is capturing the functionality of
:e **/
It's not usually a matter of 'remembering' where I put my files; it's being in /modules/module_dir/specific_module/module.file and needing to edit /views/view_name/js/some_shit.js,esome_s<tab> is a nice way of jumping to that file
:args *.rb
Sadly, the above is easy to forget if you don't use it a lot but such is life for everything in a powerful text editor.Now here's the fun part. The above will open each of the files in a new buffer. You might want each buffer to be put into it's own tab, so just add the following to your ~/.vimrc to map CTR-ALT-T to create a new tab for each of the existing buffers.
" open each buffer in it's own tab
map <C-M-T> :tab sball<CR>
If the vim default CTRL-t drives you nuts because you use a web browser far too often, you can remap it in vim to create a new tab. I've got mine set as follows so it not only makes CTRL-t create a new tab, but it also puts your focus in the vim command and fills in the ":e " so you can open a new file: " Open New Tab
map <C-T> :tabnew<CR>:e
Yes, this last bit is due to the personal annoyance of hitting CTRL-t and mistakenly expecting a new tab to appear when vim doesn't work that way by default.