History of SelectedVimTips

Differences from version 12 to 22



@@ -1,5 +1,7 @@

 {maketoc}
 ! useful .(g)vimrc mappings
+{attachment id=160 float=left} here 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?
 

@@ -9,14 +11,14 @@

 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
-{code()}
+{code source=bash}
 " open window in browser with php function under cursor
 if has("gui_running")
  nmap <c-s-p> :!opera -newpage http://us2.php.net/^R^W\#function.^R^W<CR>
 elseif
  nmap <c-s-p> :!lynx -accept_all_cookies http://us2.php.net/^R^W\#function.^R^W<CR>
 endif
-{code}
+{/code}
 
 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.
 

@@ -25,42 +27,58 @@

 ! some useful .vimrc settings
 !! hide buffers
 when you add the following to you .vimrc file:
-{code()}
+{code source=bash}
 set hid
-{code}
+{/code}
 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
-{code()}
+{code source=bash}
 if has("autocmd")
  " source the .vimrc file on save to apply all changes immediately
  autocmd! bufwritepost .vimrc source ~/.vimrc
 endif
-{code}
+{/code}
 
 !! setting up vim for bitweaver
-{code()}
+{code source=bash}
 if has("autocmd")
  autocmd bufnewfile,bufenter * set noet ts=4 sw=4
 endif
-{code}
+{/code}
+
+!! php specific stuff
+If 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-X
 you 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:
-{code()}
+{code source=bash}
 set nrformats-=octal
-{code}
+{/code}
 
 ! generic vim tips and tricks
 !! :reg
 registers 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:
-{code()}
+{code source=bash}
 <s-v>4j"gy
-{code}
+{/code}
 
 explanation:
 ;<s-v>: <Shift-v> -- enter visual mode linewise

@@ -69,18 +87,18 @@

 ;y: yank the contents of the marked text to the accessed register __and__ the normal register, accessible through p
 
 call that same text stored in the g register:
-{code()}
+{code source=bash}
 "gp
-{code}
+{/code}
 
 explanation:
 ;"g: access the g register
 ;p: put
 
 to append all text from the cursor to the next __>__ character to the contents of __"g register__, execute the following command:
-{code()}
+{code source=bash}
 "Gyf>
-{code}
+{/code}
 
 explanation:
 ;"G: append the following stuff to the "g register

@@ -88,9 +106,9 @@

 ;f>: __find__ the next occurance of > in the current line (including the > character). if you want to exclude the character use t>, which will __find to__ the character.
 
 to view the contents of all your registers, type
-{code()}
+{code source=bash}
 :reg
-{code}
+{/code}
 
 !!! background reading
 :he reg

@@ -100,32 +118,54 @@

 grep 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:
-{code()}
+{code source=bash}
 :grep -rni --include="*.tpl" 'html_checkboxes' *
-{code}
+{/code}
 
 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:
-{code()}
+{code source=bash}
 :copen
-{code}
+{/code}
 
 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:
-{code()}
+{code source=bash}
 :colder
-{code}
+{/code}
 
 returning back to the more recent results, you just need to type:
-{code()}
+{code source=bash}
 :cnewer
-{code}
+{/code}
 
 !!! background reading
-{code()}
+{code source=bash}
 :he :grep
 :he :copen
-{code}
+{/code}
+
+!! tags
+this allows you to navigate bitweaver like a speeding bullet.
+
+you will need to install [http://ctags.sf.net/|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:
+{code source=bash}
+set tags=tags,./tags,../tags,../../tags
+{/code}
+now start up vim and move your cursor on top of any function and hit ~np~CTRL+]~/np~
+to return back to where you were, just hit CTRL+T
+
+!! gf
+to get gf (goto file) working with bitweaver insert the fllowing in your .vimrc file
+{code source=bash}
+set path=,,.,./../*
+set includeexpr=substitute(v:fname,'\\([^/]*/\\)','\\1templates/','g')
+{/code}
+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.
+
 
Page History
Date/CommentUserIPVersion
28 Mar 2006 (13:39 UTC)
xing194.152.164.4522
Current • Source
xing194.152.164.4521
View • Compare • Difference • Source
xing194.152.164.4520
View • Compare • Difference • Source
xing194.152.164.4519
View • Compare • Difference • Source
xing194.152.164.4517
View • Compare • Difference • Source
xing194.152.164.4516
View • Compare • Difference • Source
xing194.152.164.4515
View • Compare • Difference • Source
xing194.152.164.4514
View • Compare • Difference • Source
xing194.152.164.4513
View • Compare • Difference • Source
xing194.152.164.4512
View • Compare • Difference • Source
xing194.152.164.4511
View • Compare • Difference • Source
xing194.152.164.4510
View • Compare • Difference • Source
xing194.152.164.459
View • Compare • Difference • Source
xing194.152.164.458
View • Compare • Difference • Source
xing194.152.164.457
View • Compare • Difference • Source
xing194.152.164.456
View • Compare • Difference • Source
xing194.152.164.455
View • Compare • Difference • Source
xing194.152.164.454
View • Compare • Difference • Source
xing194.152.164.453
View • Compare • Difference • Source
xing194.152.164.452
View • Compare • Difference • Source
xing194.152.164.451
View • Compare • Difference • Source