! 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
|
;4j: mark the next 4 lines
|
;"g: access the g register
|
;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 source=bash} |
+"gp |
+{/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
|