Cleaned and iNdented vimrc

This commit is contained in:
lhark 2015-08-08 22:44:49 +02:00
parent 69af453d11
commit 2c7730b8b9

284
vimrc
View file

@ -36,52 +36,52 @@
set nocompatible set nocompatible
"[Use Plug-ins and Plug-in Manager(Vundle) only on UNIX or MAC OS]" "[Use Plug-ins and Plug-in Manager(Vundle) only on UNIX or MAC OS]"
if has("unix") || has("mac") if has("unix") || has("mac")
filetype off filetype off
"[Download and install Vundle Plug-in Manager]" "[Download and install Vundle Plug-in Manager]"
try try
if !isdirectory(expand("$HOME/.vim/bundle")) if !isdirectory(expand("$HOME/.vim/bundle"))
silent !mkdir -p $HOME/.vim/bundle silent !mkdir -p $HOME/.vim/bundle
silent cd $HOME/.vim/bundle silent cd $HOME/.vim/bundle
silent !git clone https://github.com/gmarik/Vundle.vim.git silent !git clone https://github.com/gmarik/Vundle.vim.git
silent cd $HOME silent cd $HOME
endif endif
"[Run Plug-ins]" "[Run Plug-ins]"
set runtimepath+=$HOME/.vim/bundle/Vundle.vim set runtimepath+=$HOME/.vim/bundle/Vundle.vim
call vundle#begin() call vundle#begin()
Plugin 'gmarik/Vundle.vim' Plugin 'gmarik/Vundle.vim'
map <F2> :VundleInstall<CR> map <F2> :VundleInstall<CR>
map <F3> :VundleUpdate<CR> map <F3> :VundleUpdate<CR>
if has("python") if has("python")
Plugin 'klen/python-mode' Plugin 'klen/python-mode'
endif endif
if has("perl") if has("perl")
Plugin 'vim-perl/vim-perl' Plugin 'vim-perl/vim-perl'
endif endif
if has("ruby") if has("ruby")
Plugin 'terryma/vim-multiple-cursors' Plugin 'terryma/vim-multiple-cursors'
endif endif
Plugin 'majutsushi/tagbar' Plugin 'majutsushi/tagbar'
map <F4> :TagbarToggle<CR> map <F4> :TagbarToggle<CR>
Plugin 'mbbill/undotree' Plugin 'mbbill/undotree'
map <F5> :UndotreeToggle<CR> map <F5> :UndotreeToggle<CR>
Plugin 'scrooloose/nerdtree' Plugin 'scrooloose/nerdtree'
map <F6> :NERDTreeToggle<CR> map <F6> :NERDTreeToggle<CR>
Plugin 'AutoComplPop' Plugin 'AutoComplPop'
Plugin 'kien/ctrlp.vim' Plugin 'kien/ctrlp.vim'
Plugin 'godlygeek/tabular' Plugin 'godlygeek/tabular'
Plugin 'tpope/vim-surround' Plugin 'tpope/vim-surround'
Plugin 'mhinz/vim-startify' Plugin 'mhinz/vim-startify'
Plugin 'Raimondi/delimitMate' Plugin 'Raimondi/delimitMate'
Plugin 'msanders/snipmate.vim' Plugin 'msanders/snipmate.vim'
Plugin 'Lokaltog/vim-easymotion' Plugin 'Lokaltog/vim-easymotion'
"[Vim colorschemes]" "[Vim colorschemes]"
Plugin 'tomasr/molokai' Plugin 'tomasr/molokai'
Plugin 'djjcast/mirodark' Plugin 'djjcast/mirodark'
call vundle#end() call vundle#end()
catch catch
endtry endtry
else else
filetype on filetype on
endif endif
"[Recognize the type/syntax of the file]" "[Recognize the type/syntax of the file]"
filetype plugin on filetype plugin on
@ -93,7 +93,7 @@ runtime macros/matchit.vim
syntax on syntax on
"[Read the changes after the save .vimrc]" "[Read the changes after the save .vimrc]"
if has("autocmd") if has("autocmd")
autocmd! BufWritePost $MYVIMRC source $MYVIMRC autocmd! BufWritePost $MYVIMRC source $MYVIMRC
endif endif
"[Define the leader key]" "[Define the leader key]"
let mapleader="," let mapleader=","
@ -112,6 +112,10 @@ nnoremap <C-j> <C-W>j
nnoremap <C-k> <C-W>k nnoremap <C-k> <C-W>k
nnoremap <C-h> <C-W>h nnoremap <C-h> <C-W>h
nnoremap <C-l> <C-W>l nnoremap <C-l> <C-W>l
nnoremap <C-Up> <C-W>k
nnoremap <C-Down> <C-W>j
nnoremap <C-Left> <C-W>h
nnoremap <C-Right> <C-W>l
"[Locate the desired objects in the center of the screen]" "[Locate the desired objects in the center of the screen]"
nnoremap <silent> n nzz nnoremap <silent> n nzz
nnoremap <silent> N Nzz nnoremap <silent> N Nzz
@ -148,7 +152,7 @@ set showfulltag
"[Don't give the intro message when starting Vim]" "[Don't give the intro message when starting Vim]"
set shortmess="" set shortmess=""
if has("unix") || has("mac") if has("unix") || has("mac")
set shortmess+=I set shortmess+=I
endif endif
"[Always show StatusLine]" "[Always show StatusLine]"
set laststatus=2 set laststatus=2
@ -167,7 +171,7 @@ set splitright
set equalalways set equalalways
"[Lisp coding settings]" "[Lisp coding settings]"
if (&filetype == "lisp") if (&filetype == "lisp")
set lisp set lisp
endif endif
"[Use the mouse in terminal]" "[Use the mouse in terminal]"
set mouse=a set mouse=a
@ -187,43 +191,43 @@ set cmdwinheight=10
set virtualedit=all set virtualedit=all
"[GUI/Color Scheme/Font settings]" "[GUI/Color Scheme/Font settings]"
if has("gui_running") if has("gui_running")
winsize 90 50 winsize 90 50
silent cd $HOME silent cd $HOME
set linespace=0 set linespace=0
set guioptions="" set guioptions=""
set guitablabel="" set guitablabel=""
if has("autocmd") if has("autocmd")
autocmd InsertEnter * set cursorline autocmd InsertEnter * set cursorline
autocmd InsertLeave * set nocursorline autocmd InsertLeave * set nocursorline
endif endif
if has("win32") || has("win64") if has("win32") || has("win64")
try try
colorscheme desert colorscheme desert
set guifont=PT_Mono:h11 set guifont=PT_Mono:h11
catch catch
endtry endtry
elseif has("unix") elseif has("unix")
try try
colorscheme mirodark colorscheme mirodark
set guifont=PT\ Mono\ 11 set guifont=PT\ Mono\ 11
catch catch
endtry endtry
elseif has("mac") elseif has("mac")
try try
set antialias set antialias
colorscheme molokai colorscheme molokai
set guifont=Monaco:h11 set guifont=Monaco:h11
catch catch
endtry endtry
endif endif
else else
if has("unix") || has("mac") if has("unix") || has("mac")
try try
set t_Co=256 set t_Co=256
colorscheme desert colorscheme desert
catch catch
endtry endtry
endif endif
endif endif
"[Backspace functions]" "[Backspace functions]"
set backspace=indent,eol,start set backspace=indent,eol,start
@ -231,7 +235,7 @@ set backspace=indent,eol,start
set scrolloff=10 set scrolloff=10
set scrolljump=10 set scrolljump=10
set showmatch set showmatch
set matchpairs="" set matchpairs=":"
set matchpairs+=(:) set matchpairs+=(:)
set matchpairs+={:} set matchpairs+={:}
set matchpairs+=[:] set matchpairs+=[:]
@ -263,7 +267,7 @@ set textwidth=80
set number set number
set numberwidth=2 set numberwidth=2
"[Don't show current position]" "[Don't show current position]"
set noruler set ruler
"[For regular expressions turn magic on]" "[For regular expressions turn magic on]"
set magic set magic
"[Search settings]" "[Search settings]"
@ -331,19 +335,19 @@ set sessionoptions+=unix,slash,blank,buffers,curdir
set sessionoptions+=folds,help,options,tabpages,winsize set sessionoptions+=folds,help,options,tabpages,winsize
"[Completion settings]" "[Completion settings]"
if has("autocmd") if has("autocmd")
autocmd FileType c set omnifunc=ccomplete#Complete autocmd FileType c set omnifunc=ccomplete#Complete
autocmd FileType css set omnifunc=csscomplete#CompleteCSS autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
if has("ruby") if has("ruby")
autocmd FileType ruby set omnifunc=rubycomplete#Complete autocmd FileType ruby set omnifunc=rubycomplete#Complete
endif endif
if has("perl") if has("perl")
autocmd FileType perl set omnifunc=perlcomplete#CompletePERL autocmd FileType perl set omnifunc=perlcomplete#CompletePERL
endif endif
if has("python") if has("python")
autocmd FileType python set omnifunc=pythoncomplete#Complete autocmd FileType python set omnifunc=pythoncomplete#Complete
endif endif
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
endif endif
"[Completion search settings]" "[Completion search settings]"
set complete=.,b,d,i,k,s,t,u,U,w set complete=.,b,d,i,k,s,t,u,U,w
@ -369,63 +373,63 @@ set wildignore=*.o,*.obj,*.pyc,*.pyo,*.swp,*.bak,*.exe,*.class
set confirm set confirm
"[Method used for encryption when the buffer is written to a file]" "[Method used for encryption when the buffer is written to a file]"
if (version <= 702) if (version <= 702)
set cryptmethod=zip set cryptmethod=zip
else else
set cryptmethod=blowfish set cryptmethod=blowfish
endif endif
"[Make the scripts executable]" "[Make the scripts executable]"
function! ChangeScriptMode() function! ChangeScriptMode()
if getline(1) =~ "#!" if getline(1) =~ "#!"
if getline(1) =~ "bin/" if getline(1) =~ "bin/"
silent !chmod +x <afile> silent !chmod +x <afile>
endif endif
endif endif
endfunction endfunction
if has("unix") || has("mac") if has("unix") || has("mac")
if has("autocmd") if has("autocmd")
autocmd BufWritePost * call ChangeScriptMode() autocmd BufWritePost * call ChangeScriptMode()
endif endif
endif endif
"[Python/Perl scripts templates]" "[Python/Perl scripts templates]"
function! InitScriptFile(type) function! InitScriptFile(type)
if (a:type == "python") if (a:type == "python")
execute setline(1, "#!/usr/bin/env python") execute setline(1, "#!/usr/bin/env python")
execute setline(2, "# -*- coding: utf-8 -*-") execute setline(2, "# -*- coding: utf-8 -*-")
elseif (a:type == "perl") elseif (a:type == "perl")
execute setline(1, "#!/usr/bin/env perl") execute setline(1, "#!/usr/bin/env perl")
execute setline(2, "") execute setline(2, "")
execute setline(3, "use warnings;") execute setline(3, "use warnings;")
execute setline(4, "use strict;") execute setline(4, "use strict;")
endif endif
normal Go normal Go
endfunction endfunction
if has("autocmd") if has("autocmd")
autocmd BufNewFile *.pl,*.pm call InitScriptFile("perl") autocmd BufNewFile *.pl,*.pm call InitScriptFile("perl")
autocmd BufNewFile *.py,*.pyw call InitScriptFile("python") autocmd BufNewFile *.py,*.pyw call InitScriptFile("python")
endif endif
"[Remove tabs and spaces at the end of lines]" "[Remove tabs and spaces at the end of lines]"
function! DeleteTrailingTWS() function! DeleteTrailingTWS()
normal mb normal mb
silent %s/[ \t]*$//g silent %s/[ \t]*$//g
silent %s/\s\+$//ge silent %s/\s\+$//ge
normal 'b normal 'b
endfunction endfunction
if has("autocmd") if has("autocmd")
autocmd BufWritePre *.py,*.pyw retab autocmd BufWritePre *.py,*.pyw retab
autocmd BufWritePre * call DeleteTrailingTWS() autocmd BufWritePre * call DeleteTrailingTWS()
endif endif
"[Show current mode in StatusLine]" "[Show current mode in StatusLine]"
function! ShowModeInStatusLine() function! ShowModeInStatusLine()
let g:currentMode = mode() let g:currentMode = mode()
let g:showMode = "" let g:showMode = ""
if (g:currentMode ==# "i") if (g:currentMode ==# "i")
let g:showMode = "Insert" let g:showMode = "Insert"
elseif (g:currentMode ==# "R") elseif (g:currentMode ==# "R")
let g:showMode = "Replace" let g:showMode = "Replace"
elseif (g:currentMode ==# "n") elseif (g:currentMode ==# "n")
let g:showMode = "Normal" let g:showMode = "Normal"
else else
let g:showMode = "Visual" let g:showMode = "Visual"
endif endif
return g:showMode return g:showMode
endfunction""""""""""""""""""" endfunction"""""""""""""""""""