History of SelectedVimTips
Version 19 | Current version | |
---|---|---|
useful .(g)vimrc mappingsThe attachment id given is not valid. here you can get a copy of my .vimrc file. click on it to view it and to download it right click the file and choose: save as...vim to the rescue!what do you do when you have a php function in front of you and you don't know what it does or you can't remember in what order the parameters are passed in?i'm not sure what you do, but i move my cursor onto that function and hit <ctrl-shift-p>. that's it! just recently i stumbled accross this useful vim tip: it allows you to position your cursor on any php function and using your mapping it will open the appropriate page on www.php.net i use this in my .vimrc
obviously you can replace opera with your favourite browser and replace the mapping with your preferred mapping. unfortunately lynx doesn't work in gvim and thus you need to open the page in an external browser. Note: don't forget to use <ctrl-v><ctrl-r> and <ctrl-v><ctrl-w> to get ^R and ^W some useful .vimrc settingshide bufferswhen you add the following to you .vimrc file:
buffers will be hidden instead of closed when you edit a new file in the same window. this means that the undo history of the file is still in tact and when you call the file again using minibufexporer or :<buffer number="">b , you can hit u to undo previous additions. when you do this though, you can have unsaved buffers in the background... auto source .vimrc on save
setting up vim for bitweaver
php specific stuffIf you like SQL syntax highlighting inside Strings:let php_sql_query = 1 Enable HTML syntax highlighting inside strings: let php_htmlInStrings = 1 For highlighting parent error ] or ): let php_parent_error_close = 1 For skipping a php end tag, if there exists an open ( or [ without a closing one: let php_parent_error_open = 1 Enable folding for classes and functions: let php_folding = 1 using Ctrl-A and Ctrl-Xyou can increase number using <ctrl-a> and decrease them using <ctrl-x>. if you do this with padding zeros, it might cause problems as 0777 is an octal value and increasing this will give you some strange results. to avoid this, add the following to your .vimrc:
generic vim tips and tricks:regregisters are an awesome feature of vim. they are places where you can yank text and call it later on. the text you store in the registers is persistent and will remain in there until you remove it or you replace it with different content. i have entire templates stored in the registers which allows me to quickly create new templates with all indenting, free of typos...to store some text in a register execute the following from within normal mode:
explanation:
call that same text stored in the g register:
explanation:
to append all text from the cursor to the next > character to the contents of "g register, execute the following command:
explanation:
to view the contents of all your registers, type
background reading:he reg:he y :grepgrep can be used from within vim. it's basically as if you're using it in a console, but it has some great bonuses when using it from within vim.say you are in the root directory of /bitweaver/, try tiping the following:
this will generate some lines of where grep finds the occurances of 'html_checkboxes'. once done, hit enter and it will open a page with the first occurance. once you are done editing this code, you can type:
this will open a new window in the bottom right corner with all the results grep found earlier. all you do now is move the cursor onto the file of interest and hit <enter> or double click on the file of interest (if you have mouse support enabled). if you should do a new search on top of the initial search, you can follow the same procedure and return back to the 'html_checkboxes' results by typing:
returning back to the more recent results, you just need to type:
background reading
tagsthis allows you to navigate bitweaver like a speeding bullet.you will need to install ctags if you haven't got it installed yet. in your bitweaver root directory type: ctags -R this will create a file called tags which will contain a reference of every function in bitweaver. in your .vimrc file you need to set the path to this file, that vim always knows where to look for the functions:
now start up vim and move your cursor on top of any function and hit CTRL+] to return back to where you were, just hit CTRL+T </enter></shift-v></s-v></ctrl-x></ctrl-a></buffer></ctrl-w></ctrl-v></ctrl-r></ctrl-v></ctrl-shift-p> | useful .(g)vimrc mappingshere you can get a copy of my ~/.vimrc, ~/.gvimrc and ~/.vim dir.vim to the rescue!what do you do when you have a php function in front of you and you don't know what it does or you can't remember in what order the parameters are passed in?i'm not sure what you do, but i move my cursor onto that function and hit <ctrl-shift-p>. that's it! just recently i stumbled accross this useful vim tip: it allows you to position your cursor on any php function and using your mapping it will open the appropriate page on www.php.net i use this in my .vimrc
obviously you can replace opera with your favourite browser and replace the mapping with your preferred mapping. unfortunately lynx doesn't work in gvim and thus you need to open the page in an external browser. Note: don't forget to use <ctrl-v><ctrl-r> and <ctrl-v><ctrl-w> to get ^R and ^W some useful .vimrc settingshide bufferswhen you add the following to you .vimrc file:
buffers will be hidden instead of closed when you edit a new file in the same window. this means that the undo history of the file is still in tact and when you call the file again using minibufexporer or :<buffer number="">b , you can hit u to undo previous additions. when you do this though, you can have unsaved buffers in the background... auto source .vimrc on save
setting up vim for bitweaver
php specific stuffIf you like SQL syntax highlighting inside Strings:let php_sql_query = 1 Enable HTML syntax highlighting inside strings: let php_htmlInStrings = 1 For highlighting parent error ] or ): let php_parent_error_close = 1 For skipping a php end tag, if there exists an open ( or [ without a closing one: let php_parent_error_open = 1 Enable folding for classes and functions: let php_folding = 1 using Ctrl-A and Ctrl-Xyou can increase number using <ctrl-a> and decrease them using <ctrl-x>. if you do this with padding zeros, it might cause problems as 0777 is an octal value and increasing this will give you some strange results. to avoid this, add the following to your .vimrc:
generic vim tips and tricks:regregisters are an awesome feature of vim. they are places where you can yank text and call it later on. the text you store in the registers is persistent and will remain in there until you remove it or you replace it with different content. i have entire templates stored in the registers which allows me to quickly create new templates with all indenting, free of typos...to store some text in a register execute the following from within normal mode:
explanation:
call that same text stored in the g register:
explanation:
to append all text from the cursor to the next > character to the contents of "g register, execute the following command:
explanation:
to view the contents of all your registers, type
background reading:he reg:he y :grepgrep can be used from within vim. it's basically as if you're using it in a console, but it has some great bonuses when using it from within vim.say you are in the root directory of /bitweaver/, try tiping the following:
this will generate some lines of where grep finds the occurances of 'html_checkboxes'. once done, hit enter and it will open a page with the first occurance. once you are done editing this code, you can type:
this will open a new window in the bottom right corner with all the results grep found earlier. all you do now is move the cursor onto the file of interest and hit <enter> or double click on the file of interest (if you have mouse support enabled). if you should do a new search on top of the initial search, you can follow the same procedure and return back to the 'html_checkboxes' results by typing:
returning back to the more recent results, you just need to type:
background reading
tagsthis allows you to navigate bitweaver like a speeding bullet.you will need to install ctags if you haven't got it installed yet. in your bitweaver root directory type: ctags -R this will create a file called tags which will contain a reference of every function in bitweaver. in your .vimrc file you need to set the path to this file, that vim always knows where to look for the functions:
now start up vim and move your cursor on top of any function and hit CTRL+] to return back to where you were, just hit CTRL+T gfto get gf (goto file) working with bitweaver insert the fllowing in your .vimrc file
now, all you need to do is hover over a file name with your cursor and hit gf. that will automatically take you to the flle and you can start editing it. </enter></shift-v></s-v></ctrl-x></ctrl-a></buffer></ctrl-w></ctrl-v></ctrl-r></ctrl-v></ctrl-shift-p> |