tag:blogger.com,1999:blog-6637736252081011583.post733177658403550764..comments2023-10-23T11:13:47.199-07:00Comments on Daily Vim: Text Editor Tips, Tricks, Tutorials, and HOWTOs: Out of the box AutocompletionTravis Whittonhttp://www.blogger.com/profile/14592647486468034166noreply@blogger.comBlogger16125tag:blogger.com,1999:blog-6637736252081011583.post-2753214055225849012009-04-26T13:43:00.000-07:002009-04-26T13:43:00.000-07:00To switch buffers with Ctrl-Tab you can do the fol...To switch buffers with Ctrl-Tab you can do the following:<br /><br />:map <C-Tab> :bnext<CR><br /><br />This will "round" the opened buffers in the current window. <br /><br />Me myself have this set of mappings:<br /><br />map <C-Tab> <C-W><C-W><br />map <S-Right> :bnext<CR><br />map <S-Left> :bprevious<CR><br /><br />with these mappings, if you use :split or :vsplit to span more than one "window" you can rotate focus between them using Ctrl-Tab. To switch the buffer on the current selected window then I use Shift-Left and Shift-right.<br /><br />Hope this helps.sachttps://www.blogger.com/profile/05795926691847000915noreply@blogger.comtag:blogger.com,1999:blog-6637736252081011583.post-68054070970719805332009-03-23T13:29:00.000-07:002009-03-23T13:29:00.000-07:00Try this command to change the auto completion to ...Try this command to change the auto completion to the simpler syntax highlighting hints as the auto completer.<BR/><BR/>:setlocal omnifunc=syntaxcomplete#Complete<BR/><BR/>If that is what you always want for Perl add this to your .vimrc after all your other auto commands.<BR/><BR/>autocmd Filetype perl setlocal omnifunc=syntaxcomplete#Complete<BR/><BR/>If you want syntax completion for all file types use * for the file type. If you want to fail over to syntax complettion for file types that don't have omni completion put this in your .vimrc after your other auto commands.<BR/><BR/>if has("autocmd") && exists("+omnifunc")<BR/> autocmd Filetype *<BR/> \ if &omnifunc == "" |<BR/> \ setlocal omnifunc=syntaxcomplete#Complete |<BR/> \ endif<BR/>endif<BR/><BR/>You can also do something a little more complex which just disable the perlPOD part of the perl filetype omni complete.<BR/><BR/>Try this command:<BR/><BR/>let g:omni_syntax_group_exclude_perl = 'perlPOD'<BR/><BR/>generically it's:<BR/><BR/>let g:omni_syntax_group_exclude_{filetype} = 'comma,separated,list'<BR/><BR/>And you can get the complete list of syntax groups while in a file with the filetype in question with this command:<BR/><BR/>:syntax list<BR/><BR/>Then just add that command to your .vimrc to make it permanent.<BR/><BR/>Check out this help topic for more info:<BR/><BR/>:h ft-syntax-omnifreegnuhttps://www.blogger.com/profile/13789503355246876159noreply@blogger.comtag:blogger.com,1999:blog-6637736252081011583.post-4659573415438392942009-03-23T08:08:00.000-07:002009-03-23T08:08:00.000-07:00It works with .pl files too. I'd like to know how ...It works with .pl files too. I'd like to know how to turn it off for Perl though. Takes way too much time to scan the perl modules for the auto-complete possibilities.<BR/><BR/>CaseyAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-6637736252081011583.post-22715723550249918992009-03-22T12:47:00.000-07:002009-03-22T12:47:00.000-07:00A couple of things.The up and down arrows work lik...A couple of things.<BR/><BR/>The up and down arrows work like ctrl-n and ctrl-p on Mac OS X with the console vim when a omnicomplete list is on screen.<BR/><BR/>That weather script is a Bash function definition and changing "zip" to $1 passes in the first argument to weather on the command line. Like so: weather 10001freegnuhttps://www.blogger.com/profile/13789503355246876159noreply@blogger.comtag:blogger.com,1999:blog-6637736252081011583.post-6176681872483730762009-03-21T20:15:00.000-07:002009-03-21T20:15:00.000-07:00@Bryce: Ctrl+]. You may need to set up your tags f...@Bryce: Ctrl+]. You may need to set up your tags file. :help Ctrl-]grey wolfhttps://www.blogger.com/profile/13208311996127730049noreply@blogger.comtag:blogger.com,1999:blog-6637736252081011583.post-48599851348271139842009-03-21T08:08:00.000-07:002009-03-21T08:08:00.000-07:00Cream (and Easy Mode) give a non-modal interface (...Cream (and Easy Mode) give a non-modal interface (like most editors), not a quasimodal one. Unless there's something new in Cream in the last few days...wtanksleyhttps://www.blogger.com/profile/03283393679440645366noreply@blogger.comtag:blogger.com,1999:blog-6637736252081011583.post-47400738278374653072009-03-21T07:50:00.000-07:002009-03-21T07:50:00.000-07:00For Mac users, put this in ~/.vimrc, this enables ...For Mac users, put this in ~/.vimrc, this enables omnicomplete.<BR/><BR/>filetype plugin on<BR/><BR/>Also on Ubuntu, you can install vim-python to enable autocompletion for Python.the DtTvBhttps://www.blogger.com/profile/03740150770601085764noreply@blogger.comtag:blogger.com,1999:blog-6637736252081011583.post-35178312192119327692009-03-21T02:05:00.000-07:002009-03-21T02:05:00.000-07:00wtanksley, take a look at Cream for vim. Great pos...wtanksley, take a look at Cream for vim. Great post anyway :)Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6637736252081011583.post-11121092599965752822009-03-20T15:25:00.000-07:002009-03-20T15:25:00.000-07:00Challenge taken.Can vim be configured to operate u...Challenge taken.<BR/><BR/>Can vim be configured to operate using a quasimode rather than as fully modal? For example, it'd be in insert mode normally, then switch to command mode so long as I'm holding down capslock (or some other key), and as soon as I release, it's back in insert mode.wtanksleyhttps://www.blogger.com/profile/03283393679440645366noreply@blogger.comtag:blogger.com,1999:blog-6637736252081011583.post-14771587641861806882009-03-20T13:37:00.000-07:002009-03-20T13:37:00.000-07:00@brycethornton:Take a look at :help tags. It works...@brycethornton:<BR/><BR/>Take a look at :help tags. It works with all languages that exuberant-ctags supports which does include PHP. The only down side is that it isn't as smart as the omni complete code so if there are multiple tags with the same name (think toSting in JAVA) it won't use context to pick the right one. If this becomes an issue, I suggest mapping ^] to g^] so that it will present a list when there is more than one match.Mathias Stearnhttps://www.blogger.com/profile/17055783979411175605noreply@blogger.comtag:blogger.com,1999:blog-6637736252081011583.post-10852888618375948912009-03-20T10:29:00.000-07:002009-03-20T10:29:00.000-07:00Is it possible to jump to the function definition ...Is it possible to jump to the function definition from a piece of code that uses the function? This is for PHP specifically, but for any language would be great?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6637736252081011583.post-66185472602079647152009-03-20T08:57:00.000-07:002009-03-20T08:57:00.000-07:00If you add these lines to your vimrc, SuperTab wil...If you add these lines to your vimrc, SuperTab will do smarter completion. If you have a '/' it will do filename completion, otherwise it does ^X^O (omni-completion).<BR/><BR/>let g:SuperTabDefaultCompletionType = "context"<BR/>let g:SuperTabContextDefaultCompletionType = "<c-x><c-o>"<BR/><BR/>take a look at the Global Variables section of the supertab script for more config optionsMathias Stearnhttps://www.blogger.com/profile/17055783979411175605noreply@blogger.comtag:blogger.com,1999:blog-6637736252081011583.post-23349035365847217312009-03-20T06:48:00.000-07:002009-03-20T06:48:00.000-07:00This is an awesome tip. Thanks!This is an awesome tip. Thanks!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6637736252081011583.post-40526486783582939492009-03-20T06:12:00.000-07:002009-03-20T06:12:00.000-07:00Can vim do mru buffer switching on ctrl-tab ? I lo...Can vim do mru buffer switching on ctrl-tab ? I look for this for a long time.Emmanuelhttps://www.blogger.com/profile/00384354579659866859noreply@blogger.comtag:blogger.com,1999:blog-6637736252081011583.post-82803851549681906772009-03-20T06:11:00.000-07:002009-03-20T06:11:00.000-07:00weather{ declare -a WEATHERARRAY zip...weather<BR/>{<BR/> declare -a WEATHERARRAY<BR/> zip="zip"<BR/> WEATHERARRAY=( `lynx -dump "http://www.google.com/search?hl=en&lr=&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&q=weather+${zip}&btnG=Search" | grep -A 5 -m 1 "Weather for" | sed "s/ - \[.*iGoogle/ - /"`)<BR/> echo ${WEATHERARRAY[@]}<BR/>}Chrishttps://www.blogger.com/profile/08053614400760550597noreply@blogger.comtag:blogger.com,1999:blog-6637736252081011583.post-64000864670613851162009-03-20T04:57:00.000-07:002009-03-20T04:57:00.000-07:00Oh yeah? Does it tell you the weather like Eclipse...Oh yeah? Does it <A HREF="http://www.lockergnome.com/insideweatherbug/2008/07/07/weatherbug-eclipse-plug-in-weatherbug-api-entry/" REL="nofollow">tell you the weather</A> like Eclipse does? :-)Anonymousnoreply@blogger.com