set nocompatible " VIM extensions, not very VI compatible; " this setting must be set because when vim " finds a .vimrc on startup, it will set " itself as "compatible" with vi if has("syntax") syntax on endif if has('cmdline_info') set ruler " show the ruler " a ruler on steroids set rulerformat=%30(%=\:b%n%y%m%r%w\ %l,%c%V\ %P%) set showcmd " show partial commands in status line and " selected characters/lines in visual mode endif if has('statusline') set laststatus=1 " show statusline only if there are > 1 windows " a statusline, also on steroids set statusline=%<%f\ %=\:\b%n%y%m%r%w\ %l,%c%V\ %P endif " Ctrl+Backspace erases one word at a time (normal, command-line, insert mode) nnoremap db cnoremap inoremap db if has('gui_running') set guioptions-=T " No toolbar, thank you. else map map! set mouse=a set ttymouse=xterm endif nnoremap :TlistToggle if version >= 700 set spell spelllang=en_gb endif filetype plugin indent on " enable filetype detection, and plugins, and auto-indent. set lz " do not redraw while running macros (much faster) (LazyRedraw) set hid " you can change buffer without saving set wrap " wrap long lines set backspace=2 " make backspace work normally set autoindent " indent at the same level of the previous line "set smartindent " Do smart indenting... set shiftwidth=4 " use indents of 4 spaces set shiftround " Keep indentation at multiples of shiftwidth set tabstop=4 set sts=4 set expandtab set history=500 " Store 500 lines of command history. set smarttab " Smart tabbing, makes backspace be nice. set comments=sO:*-,mO:*,exO:*/,s1:/*,mb:*,ex:*/,f://,b:#,:%,:XCOMM,n:>,fb:- set formatoptions+=tcq " basic formatting of text and comments "set matchpairs+=<:> " match, to be used with % set grepprg=ack-grep\ -a if has("autocmd") " Skip these if vim wasn't compiled with autocmd support augroup vimrcAu " All following autocmds are in this group " clear any already in this group (in case we're sourced twice) auto! auto BufNewFile,BufRead *.[CcHh] set cindent fo=croq "auto BufNewFile,BufRead *.java,*.jsp set comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,f://,b:#,:%,:XCOMM,n:>,fb:- fo=croq auto FileType php,javascript,java,python set comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,f://,b:#,:%,:XCOMM,n:>,fb:- fo=croq "auto BufNewFile,BufRead *.pl,*.py set comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,f://,b:#,:%,:XCOMM,n:>,fb:- fo=croq auto BufNewFile,BufRead *.pyt set filetype=xml fo=croq autocmd! BufNewFile,BufRead *.pde setlocal cindent smartindent ft=arduino fo=croq auto FileType mail set tw=74 nosmartindent auto FileType ruby,eruby set tabstop=2 shiftwidth=2 sts=2 | iab ?> %> auto FileType coffee,markdown set tabstop=2 shiftwidth=2 sts=2 auto FileType python,django,htmldjango iab ?> %} autocmd FileType json set equalprg=json_reformat auto FileType none set nosmartindent auto BufWinEnter * if &ft !~ '\(txt\|text\|mail\)\?' | setlocal nospell | endif autocmd FileType php,javascript,python,ruby,css,javascript,less,html,djangohtml autocmd BufWritePre :keepjumps %s/\s\+$//e "autocmd BufReadPost * :DetectIndent " Settings for SMR project autocmd BufNewFile,BufRead /home/alex/Code/Work/Siliconmilkroundabout/smr/* set tabstop=2 shiftwidth=2 sts=2 augroup END endif set showmatch set autowrite " Go back to previous line if we have one. autocmd BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal g`\"" | endif " Save and restore folds etc. automatically. au BufWinLeave ?* silent mkview au BufWinEnter ?* silent loadview " Refresh syntax highlighting. noremap :syntax sync fromstart inoremap :syntax sync fromstarta " Settings for Project. nmap :NERDTreeToggle " Settings for snippetsEmu. let g:snip_start_tag = '<{' let g:snip_end_tag = '}>' let g:snip_set_textmate_cp = '1' " Tab to expand snippets, not automatically. " Settings for Taglist. let Tlist_Use_Right_Window = 1 " Position on the right. let Tlist_WinWidth = 30 " 20 characters wide. nnoremap :TlistToggle " Make things prettier. set t_Co=16 set background=light " Additions from http://items.sjbach.com/319/configuring-vim-right set hidden nnoremap ' ` nnoremap ` ' set history=1000 set wildmenu set wildmode=list:longest set ignorecase set smartcase set title let &titleold=getcwd() set scrolloff=3 set listchars=tab:>-,trail:ยท,eol:$ nmap s :set nolist! " Some suggestions from http://statico.github.com/vim.html nmap l :setlocal number! nmap p :set paste! nmap h :set hlsearch! nmap n :set spell! nmap j gj nmap k gk " Pathogen plugin handling. call pathogen#infect() " Select the last thing pasted. nnoremap gV `[v`] " No entering visual mode from mouse dragging/clicing. noremap noremap! " Disable PHPCodeSniffer, because it is picky as all hell. let g:syntastic_php_checkers=['php', 'phpmd'] " Settings for DetectIndent. let g:detectindent_preferred_indent = 4