2010/8/13 caruso_g <[email protected]>:
> On Aug 12, 12:58 am, Tim Johnson <[email protected]> wrote:
>> I've used vim for years for other programming languages other than
>> PHP. Now I'm starting to learn PHP. I have downloaded the *piv*
>> package.http://www.vim.org/scripts/script.php?script_id=3125
>> I am sure that `piv' is going to be really helpful.
>>
>> I would welcome any other tips, tricks, recipes, and vim scripts,
>> that other may have found useful for PHP programming.

I don't use any special pluggin nowadays, but I have a few personal
mappings and tricks really usefull for me (but maybe not for you).

This is a commented extract of my ~/.vimrc

-8<------------------------------------------
syntax on
              " (obvious)

set foldmethod=marker
              " Lets me to group code by functionality and abstraction
level. (see example below).

set ignorecase


" Indentation: {{{
set tabstop=3
set shiftwidth=3
set autoindent
            " ...borrowed from somewhere and tuned. I'm not
definitively defined on this aspect.

set listchars=tab:\|-
set list
             " Read in this list ;-)
             " You can do ':set nolist' anytime if you need to copy
with mouse from xterm.
" }}}


" F4 -> Bash in file's directory: {{{
noremap <F4> :!cd<space>$(dirname<space>"%");bash<enter>
                " Easy way to examine current file directory.
" }}}

" F6 -> Fold selection: {{{
noremap <F6> di//<space>{{{<enter>//<space>}}}<enter><esc>kPkddpkJ$%kJ$%bzc
                 " Improveable, but I love this:
                 "    * Start coding block or function preferably with
a comment in one row
                 "           ...or inline comment.
                 "    * Then, visually select the block and press F6.
                 "    * Final cursor position is intentional (for
distinct situations too large to explain here).
" }}}

" F12 -> Reformat open parentheses: {{{
noremap <F12> :s/\s*(\s*/ (/g<enter>
                  " Funny little way (maybe bad translation:
http://www.wordreference.com/es/en/translation.asp?spen=manias )
" }}}

" <enter><del> mappings for quoted strings: {{{
map <enter><del> i\n"<enter>. "<esc>
map <enter><del><del> i"<enter>. "<esc>
imap <enter><del> \n"<enter>. "
imap <enter><del><del> "<enter>. "
                   " Useful for multiple row strings (specially SQL
which I want to use in
                   " idented code and log somewhere without identation garbage.
" }}}
-8<------------------------------------------


I also usually use vim 'like a console' to query database data or
structure info or test commands or code blocks simply (temporary)
copying it somewhere, doing some modifications or initializations if
needed, selecting visually and executing :!psql <args> (for Postgres
in my case), :!php (for php), :!bash, etc...




-- 
Joan Miquel Torres__________________________________
Linux Registered User #164872
http://www.mallorcaweb.net/joanmiquel
BULMA: http://bulma.net http://breu.bulma.net/?l2301

-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to