Calling all dojo users of VIM; what are your favorite configuration options?

You are viewing a wiki page. You are welcome to join the group and then edit it. Be bold!
public

Hello all VIM users, I made a .vimrc for you to use with VIM. Of course this one is configured to make drupal developement under vim easier. I'am not a experienced VIM-user, so everyone that has suggestions to more features or anything related to VIM, throw them in here. For you concerned about forking documentation, look at this as docoumentation-dev. And the handbookpages as stable.

To make use of this config, do the following in your command line:

~$ touch .vimrc
~$ vim .vimrc

Now add this configuration to your .vimrc:

NOTE! asterix symbols is filtered out on this wiki. So I have attached the .vimrc file for you to download.
Comments are initiated with " and are placed above the the configuration line to explain what it does.

"syntax on gives us syntax highlighting
syntax on

"set whatever colorschema you want, this time we use oceandeep which you can find at http://www.vim.org
colors oceandeep

"syntax highlighting inside php sql queries
let php_sql_query = 1

"set the spaces instead of regular tab
set expandtab

"sets tab and shiftwidth to 2 spaces according to drupals coding standard
set tabstop=2 shiftwidth=2 softtabstop=2

"give filenames with .inc, .module and .php the php syntax highlighting
autocmd BufRead .inc,.module set ft=php

"use the same indent from current line when starting a new line
set autoindent

"use smart autoindenting. Used when line ends with {
set smartindent

"gives us linenumbering
set number

"sets vim in pastemode and you avoid unwanted sideeffects
set paste

"the incremental search gives us matching words as you type.
set incsearch

"the highlight search will highlight all matchings, and you can browse the document to see all matches
set hlsearch

There is a handbook page on this topic here: http://drupal.org/node/29325

AttachmentSize
vimrc-1-0.txt1005 bytes

great!

greggles's picture
greggles - Wed, 2007-05-16 19:50

Morphir - this is an amazing contribution. Thanks so much for starting it!

--
Knaddisons Denver Life | mmm Free Range Burritos


..

morphir's picture
morphir - Fri, 2007-05-18 15:19

Goody :)


Here's mine

victorkane@drupal.org's picture
victorkane@drup... - Sat, 2007-05-19 17:38

set expandtab
set tabstop=2 shiftwidth=2 softtabstop=2
set autoindent
set nocompatible

syntax on
filetype on
filetype indent on
filetype plugin on

Victor Kane
http://awebfactory.com.ar


Thank you victor!

morphir's picture
morphir - Mon, 2007-05-28 06:32

I took the
set tabstop=2 shiftwidth=2 softtabstop=2 in one line. Much cleaner that way.

set nocompatible is a bit of a mystery too me, this got something to do with vi (the father of vim).. care to explain?

The manual explains that one should be careful with this setting. And that it should, if specified, be in the very beginning of the .vimrc


Yeah, sorry, can't remember

victorkane@drupal.org's picture
victorkane@drup... - Thu, 2007-05-31 00:32

Yeah, sorry, can't remember for the life of me what that is doing there. Might be a holdover from some ruby on rails stuff... I suppose it should be omitted ...

Victor Kane
http://awebfactory.com.ar


update

morphir's picture
morphir - Tue, 2007-05-29 13:04

The
autocmd BufRead .inc,.module set ft=php gives filetypes with the ending .inc .module and .php the php syntax highlighting.
The
colors oceandeep is of course just an example of colorschema, use you whatever schema you prefer.
The
set incsearch gives you incremental word search. Will highlight word as type..
The
set hlsearch will highlight ALL words that match your search. They will stay highlighted as you scroll down.
Eg. :/ifelse will then highlight all ifelse statements.


well this is my .vimrc

Jadelrab's picture
Jadelrab - Mon, 2007-05-28 07:09

morphir, my friend this is a good idea ..

i think sharing my .vimrc will be ok as it explains itself

set dict+=~/.vim/dictionaries/drupal50-functions.dict
colorscheme wombat
syntax on
set number
autocmd InsertLeave * se nocul
autocmd InsertEnter * se cul
autocmd InsertEnter * se cindent
autocmd InsertEnter * se completeopt=longest,menuone
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplMapWindowNavArrows = 1
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplModSelTarget = 1
let g:miniBufExplUseSingleClick = 1
set showcmd
au BufNewFile,BufRead .php,.module,*.install set filetype=php
map CC "+y
map PP "+gP
set autoindent
set gfn=Bitstream\ Vera\ Sans\ Mono\ 10

the first line is drupal functions dictionary from here http://www.vim.org/scripts/script.php?script_id=1675
autcmd series display current line highlighted so that it is gonna be known (in insert mode) and removes it if anyother mode
the let used to organize open buffers with a plugin minbufexplorer
the mapping to easy copy and paste .. i forget to map the cut too :)
and the last line to set the gui font face which is i like most the "bitstream vera sans mono" in size 10

hope to be helpful ..


TagList plugin

victorkane@drupal.org's picture
victorkane@drup... - Mon, 2007-06-04 13:51

While we are on the subject of vim, one of the plugins I use every day with it is the TagList plugin, which uses exuberant tags to provide an overview of the structure of source code files and efficient browsing through source code files.

I have a write-up with instructions on how to install and setup here: http://awebfactory.com.ar/node/153

Victor Kane
http://awebfactory.com.ar