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