Created
January 20, 2011 19:24
-
-
Save slindberg/788444 to your computer and use it in GitHub Desktop.
Vim config file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set ls=2 " allways show status line | |
set number " show line numbers | |
set ruler " show line current line number/column | |
set showmatch " show matching brackets/braces/parantheses | |
set showcmd " display incomplete commands | |
set ttyfast " smoother changes | |
set tabstop=2 " numbers of spaces of tab character | |
set shiftwidth=2 " numbers of spaces to (auto)indent | |
set autoindent " auto indentation | |
set expandtab " use spaces instead of evil tabs | |
set smartindent " like above but more generic | |
set whichwrap=b,s,h,l,<,>,[,] " move freely between lines using these commands | |
set nowrap " don't wrap lines that are longer than the terminal width | |
set incsearch " search incrementally | |
set hlsearch " highlight search results | |
set ignorecase " when searching, ignore case | |
set smartcase " only ignore case (above) if the search is all lowercase | |
filetype on " filetype detection on | |
filetype plugin on " load plugins | |
syntax on " use syntax highlighting | |
set t_Co=256 " this fixes colors on OS X terminal | |
colorscheme ir_black " choose a colorscheme | |
" get rid of annoying shift key blunders | |
com W w | |
com Wq wq | |
com Q q | |
" use ctrl-[hjkl] to select the active split | |
nmap <silent> <c-k> <c-w>k | |
nmap <silent> <c-j> <c-w>j | |
nmap <silent> <c-h> <c-w>h | |
nmap <silent> <c-l> <c-w>l | |
nmap <silent> <c-c> <c-w>c | |
" center on what we are looking for | |
nnoremap n nzz | |
nnoremap N Nzz | |
nnoremap g# g#zz | |
" remove search highlight with double escape | |
map <silent> <esc><esc> :nohlsearch<CR> | |
" comment/uncomment mappings | |
map ,/ :s/^/\/\//<CR>:nohlsearch<CR> | |
map /, :s/^\(\s*\)\=\/\//\1/<CR>:nohlsearch<CR> | |
map ,# :s/^/#/<CR>:nohlsearch<CR> | |
map #, :s/^\(\s*\)\=#/\1/<CR>:nohlsearch<CR> | |
" wrapping comments | |
map ,* :s/^\(.*\)$/\/\* \1 \*\//<CR>:nohlsearch<CR> | |
map *, :s/^\/\* \(.*\) \*\/$/\1/<CR>:nohlsearch<CR> | |
map ,< :s/^\(.*\)$/<\!-- \1 -->/<CR>:nohlsearch<CR> | |
" file type associations | |
au BufNewFile,BufRead *.less set filetype=less | |
if has("autocmd") | |
" file type associations | |
autocmd BufNewFile,BufRead *.less set filetype=less | |
" tab settings | |
autocmd FileType php setl | |
\ noexpandtab | |
\ tabstop=4 | |
\ shiftwidth=4 | |
" remove all trailing whitespace on save | |
autocmd BufWritePre * :%s/\s\+$//e | |
" plugins are loaded after .vimrc is processed | |
autocmd VimEnter * call Plugins() | |
endif | |
" plugin specific settings | |
function! Plugins() | |
" NERDTree alias | |
if exists(":NERDTree") | |
" ctrl+n toggles NERDTree | |
nmap <silent> <c-n> :NERDTreeToggle<CR> | |
" quit if NERDTree window is the last window open | |
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif | |
endif | |
endfunction | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment