You are on page 1of 5

" ase Vim settings, rather then Vi settings (much better!).

" This must be first, because it changes other options as a side effect. set nocompatible "The modelines bit prevents some security exploits having to do with modelines i n files. I never use modelines so I don t miss any functionality here. set modelines=0 " allow backspacing over everything in insert mode set backspace=indent,eol,start if has("vms") set nobackup else set backup endif set ruler set showcmd set incsearch " do not keep a backup file, use versions instead " keep a backup file " show the cursor position all the time " display incomplete commands " do incremental searching

" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries " let &guioptions = substitute(&guioptions, "t", "", "g") " Don't use Ex mode, use Q for formatting map Q gq " CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo, " so that you can undo CTRL-U after inserting a line break. inoremap <C-U> <C-G>u<C-U> " In many terminal emulators the mouse works just fine, thus enable it. if has('mouse') set mouse=a endif " Switch syntax highlighting on, when the terminal has colors " Also switch on highlighting the last used search pattern. if &t_Co > 2 || has("gui_running") syntax on set hlsearch endif " Only do this part when compiled with support for autocommands. if has("autocmd") " Enable file type detection. " Use the default filetype settings, so that mail gets 'tw' set to 72, " 'cindent' is on in C files, etc. " Also load indent files, to automatically do language-dependent indenting. filetype plugin indent on " Put these in an autocmd group, so that we can delete them easily. augroup vimrcEx au! " For all text files set 'textwidth' to 78 characters. autocmd FileType text setlocal textwidth=78 " " " " When editing a file, always jump to the last known cursor position. Don't do it when the position is invalid or when inside an event handler (happens when dropping a file on gvim). Also don't do it when the mark is in the first line, that is the default

" position when opening a file. autocmd BufReadPost * \ if line("'\"") > 1 && line("'\"") <= line("$") | \ exe "normal! g`\"" | \ endif augroup END else set autoindent endif " has("autocmd") " Convenient command to see the difference between the current buffer and the " file it was loaded from, thus the changes you made. " Only define it when not defined already. if !exists(":DiffOrig") command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis \ | wincmd p | diffthis endif """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => General """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Sets how many lines of history VIM has to remember set history=700 " Enable filetype plugin " Set to auto read when a file is changed from the outside set autoread " With a map leader it's possible to do extra key combinations " like <leader>w saves the current file let mapleader = "," let g:mapleader = "," " Fast saving nmap <leader>w :w!<cr> " Fast editing of the .vimrc map <leader>e :e! ~/.vimrc<cr> map <leader>f <C-]> nmap <leader>r :reg<cr> nmap <leader>c :changes<cr> " "******* COMMAND ********* command CleanHTML :%s#<[^>]\+>##g command ConvertToUnix :1,$s/^M/\r/g """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" set selectmode=mouse set encoding=utf-8 set guifont=Lucida_Console:h8 set guioptions-=T set errorfile=/tmp/bp.errors.log set ic set fileformats=unix,mac,dos set mousef " Tabs set shiftwidth=4 " always set autoindenting on

set tabstop=4 set softtabstop=4 set expandtab set nowrapscan set wrap set ignorecase set smartcase set showtabline=2 set foldmethod=marker set wildmenu set wildmode=longest,full set hidden set confirm map N Nzz map n nzz """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Backups and undo """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Turn backup off, since most stuff is in SVN, git anyway... "Backup and Dir set backupdir=~/.vim/backup set dir=~/.vim/backup set directory=~/.vim/tmp """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" set cul set showmatch set smartindent set smarttab set scrolloff=3 " keep at least 3 lines above/below set complete=.,w,b,u,U,t,i,d set ttyfast set nu set noerrorbells """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " ******* File management ******* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" "autocmd BufEnter * silent! lcd %:p:h noremap <leader>k :BufExplorer<CR> let g:bufExplorerSplitBelow=1 " Split new window below current. noremap <leader>m :NERDTreeClose<CR>:MRU<CR> let MRU_Window_Height = 20 "let MRU_Use_Current_Window = 1 "let MRU_Add_Menu = 0 "noremap ,f :FufFile **/<CR> "let g:fuf_file_exclude = '\v\~$|\.(o|exe|dll|bak|orig|swp)$|(^|[/\\])\.(hg|git| bzr)($|[/\\])|(^|[/\\])\.(cache)($|[/\\])' noremap <leader>n :NERDTreeToggle %:p:h<CR> let NERDTreeQuitOnOpen = 1 let NERDTreaChDirMode=2 "nnoremap <silent> <S-t> :tabnew<CR>:NERDTree<CR> "TagList noremap <leader>l :TlistToggle<CR> let Tlist_Exit_OnlyWindow = 1 let Tlist_GainFocus_On_ToggleOpen = 1 let Tlist_Use_Right_Window = 1 let Tlist_Show_One_File = 1 set tags=~/.vim/tags if version >= 703

nnoremap <leader>u :GundoToggle<CR> "persistent undo set undodir=~/.vim/undodir set undofile set undolevels = 1000 "maximum number of changes that can be undone set undoreload = 10000 "maximum number lines to save for undo on a buffer re load endif " Command-T let g:CommandTMatchWindowReverse = 1 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" "Other inoremap jj <Esc> map <F2> :mksession! ~/vimtoday.ses " ******* Navigation ******** nnoremap <C-H> gT nnoremap <C-L> gt nnoremap <C-K> :bp<CR> nnoremap <C-J> :bn<CR> "au BufRead *.php set ft=php.html "au BufNewFile *.php set ft=php.html au FileType php set omnifunc=phpcomplete#CompletePHP " PHP Generated Code Highlights (HTML & SQL) let php_sql_query=1 let php_htmlInStrings=1 " run file with PHP CLI (CTRL-M) autocmd FileType php noremap <C-M> :w!<CR>:!php %<CR> " PHP parser check (CTRL-L) autocmd FileType php noremap <C-L> w!<CR>:!php -l %<CR> au BufRead,BufNewFile *.html.twig set ft=html.twig syntax=htmltwig "autocmd FileType javascript compiler closure "let g:JSHintHighlightErrorLine = 0 " Automatically open, but do not go to (if there are errors) the quickfix / " location list window, or close it when is has become empty. " Note: Must allow nesting of autocmds to enable any customizations for quickfix " buffers. " Note: Normally, :cwindow jumps to the quickfix window if the command opens it " (but not if it's already open). However, as part of the autocmd, this doesn't " seem to happen. "autocmd QuickFixCmdPost [^l]* nested cwindow "autocmd QuickFixCmdPost l* nested lwindow "******** THEME AND LAYOUT ******** "colorscheme ir_black "colorscheme herald "colorscheme tir_black "let moria_style = 'white' "colo moria "let moria_fontface = 'mixed' hi clear SpellBad hi SpellBad gui=underline,bold cterm=underline,bold guibg=darkgrey ctermbg=darkg rey set laststatus=2 set statusline=%F%m%r%h%w\ (%{&ff})-[%{v:lang}]{%Y} set statusline+=%= "align the rest to right

set statusline+=[%l,%v][%p%%] "Set the guifont :set guifont=Menlo:h12 hi clear StatusLine hi clear StatusLineNC hi StatusLine guifg=darkgreen guibg=black ctermbg=darkgreen ctermfg=black hi StatusLineNC guifg=white guibg=black ctermbg=white ctermfg=black au InsertEnter * set nocursorline au InsertLeave * set cursorline """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Command mode related """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Smart mappings on the command line cno $h e ~/ cno $j e ./ " Bash like keys for the command line cnoremap <C-A> <Home> cnoremap <C-E> <End> cnoremap <C-K> <C-U> cnoremap <C-P> <Up> cnoremap <C-N> <Down> :iabbrev </ </<C-X><C-O> inoremap <C-v> <C-v>:set nopaste nmap <leader>j :!node %<cr> call pathogen#infect() "gdefault applies substitutions globally on lines. For example, instead of ":%s/foo/bar/g you just type :%s/foo/bar/. set gdefault nnoremap <tab> % vnoremap <tab> % " Fold tag nnoremap <leader>ft Vatzf nnoremap <leader>w <C-w>v<C-w>l if &t_Co >= 256 || has("gui_running") colorscheme mustang endif set wildignore+=*.o,*.obj,.git,*cache*

You might also like