[Vim] My configure of vim #vim #personer
// vim: syntax=vimscript
set t_Co=256
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'git://git.wincent.com/command-t.git'
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
Plugin 'Valloric/YouCompleteMe'
Plugin 'vim-airline/vim-airline'
Plugin 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plugin 'Yggdroot/indentLine'
Plugin '907th/vim-auto-save'
Plugin 'scrooloose/nerdcommenter'
Plugin 'NLKNguyen/papercolor-theme'
Plugin 'hdima/python-syntax'
Plugin 'ryanoasis/vim-devicons'
Plugin 'simnalamburt/vim-mundo'
call vundle#end()
filetype plugin indent on
""indent show""
let g:indentLine_char = '▏'
""""
:set clipboard=unnamedplus
" theme vim
set background=light
colorscheme PaperColor
set laststatus=2
""basic config""
syntax on
set relativenumber
set incsearch
set ignorecase
set smartcase
set nohlsearch
set noswapfile
set nowrap
set nobackup
set expandtab
set shiftwidth=4
set softtabstop=0
set tabstop=4
set number
set bs=2
""set backspace=indent,eol
""Mapping""
nmap <silent> <C-s> :w<CR>
nnoremap <S-z> :q!<CR>
inoremap <F2> <Esc>:q!<CR>
vnoremap <S-z> <Esc>:q!<CR>
nnoremap <C-z> :q<CR>
inoremap <C-z> <Esc>:q<CR>
vnoremap <C-z> <Esc>:q<CR>
nnoremap <C-w> :w<CR>
inoremap <C-w> <Esc>:w<CR>
vnoremap <C-w> <Esc>:w<CR>
nnoremap <S-w> :x!<CR>
"inoremap <F5> <Esc>:x!<CR>
vnoremap <S-w> <Esc>:x!<CR>
""vnoremap <C-c> "*yy
nmap <silent> <F10> :AutoSaveToggle<CR>
nmap <silent> <F3> :NERDTreeToggle<CR>
noremap <C-d> :sh<cr>
inoremap <C-d> <Esc>:sh<CR>
vnoremap <C-d> <Esc>:sh<CR>
"map undo and redo"
inoremap <C-r> <Esc><C-r>
inoremap <C-u> <Esc>u
nnoremap r <C-r>
set pastetoggle=<F8>
set encoding=utf-8
" nnoremap <C-t> :tabnew<CR>
" inoremap <C-t> :tabnew<CR>
""Not input file will show TreeFolder""
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
""Show git config""
let g:airline#extensions#whitespace#enabled = 0
let g:airline#extensions#branch#enabled= 1
let g:airline_powerline_fonts = 1
""let g:airline_detect_whitespace=0
""let b:airline_whitespace_disabled = 1
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
" unicode symbols
" let g:airline_left_sep = '»'
" let g:airline_left_sep = '▶'
" let g:airline_right_sep = '«'
" let g:airline_right_sep = '◀'
" let g:airline_symbols.linenr = '␊'
" let g:airline_symbols.linenr = ''
let g:airline_symbols.linenr = '¶'
let g:airline_symbols.branch = '⎇'
let g:airline_symbols.paste = 'ρ'
" let g:airline_symbols.paste = 'Þ'
" let g:airline_symbols.paste = '∥'
" let g:airline_symbols.whitespace = 'Ξ'
let g:airline_skip_empty_sections = 1
" airline symbols
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = ''
" let g:airline_symbols.linenr = ''
" let g:airline_left_sep = '⮀'
" let g:airline_left_alt_sep = '⮁'
" let g:airline_right_sep = '⮂'
" let g:airline_right_alt_sep = '⮃'
" let loaded_nerd_tree=1
" NERDTress File highlighting
function! NERDTreeHighlightFile(extension, fg, bg, guifg, guibg)
exec 'autocmd filetype nerdtree highlight ' . a:extension .' ctermbg='. a:bg .' ctermfg='. a:fg .' guibg='. a:guibg .' guifg='. a:guifg
exec 'autocmd filetype nerdtree syn match ' . a:extension .' #^\s\+.*'. a:extension .'$#'
endfunction
call NERDTreeHighlightFile('jade', 'green', 'none', 'green', '#151515')
call NERDTreeHighlightFile('ini', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('md', 'blue', 'none', '#3366FF', '#151515')
call NERDTreeHighlightFile('yml', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('config', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('conf', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('json', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('html', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('styl', 'cyan', 'none', 'cyan', '#151515')
call NERDTreeHighlightFile('css', 'cyan', 'none', 'cyan', '#151515')
call NERDTreeHighlightFile('coffee', 'Red', 'none', 'red', '#151515')
call NERDTreeHighlightFile('js', 'Red', 'none', '#ffa500', '#151515')
call NERDTreeHighlightFile('php', 'Magenta', 'none', '#ff00ff', '#151515')
call NERDTreeHighlightFile('py', 'red', 'none', 'red', '#151515')
" nmap <Leader>bb :call shekcon#SetBackground()<CR>
let NERDTreeMouseMode=2
augroup MouseInNERDTreeOnly
autocmd!
autocmd BufEnter NERD_tree_* set mouse=a
autocmd BufLeave NERD_tree_* set mouse=a
augroup END
set mouse=a
let NERDTreeAutoDeleteBuffer = 1
""inoremap <A-r> <Esc>:so<Space>~/.vimrc<CR>
""nnoremap <A-r> :so<Space>~/.vimrc<CR>
" auto fair"
inoremap ( ()<Left>
inoremap " ""<Left>
inoremap { {}<Left>
inoremap [ []<Left>
inoremap , ,<Space>
" show icon dev for nerdtree"
""let g:webdevicons_enable = 1
""let g:webdevicons_enable_nerdtree = 1
let g:webdevicons_enable_airline_tabline = 1
let g:WebDevIconsUnicodeDecorateFolderNodes = 1
let g:WebDevIconsUnicodeDecorateFolderNodeDefaultSymbol = ''
""Mapping copy cut paste""
"copy"
vmap <C-c> "+y
nmap <C-c> "+Y
imap <C-c> <Esc>"+Y i
"cut"
vmap <C-x> "+y gvd
nmap <C-x> "+Y dd
imap <C-x> <Esc><Esc><Esc> "+Y dd i
"paste"
nmap <C-v> "+P
imap <C-v> <Esc><Esc><Esc> "+P
vmap <C-v> <Esc><Esc><Esc> "+P
"ctrl-a"
imap <C-a> <Esc>ggVG
vmap <C-a> ggVG
nmap <C-a> ggVG
"backspace"
vmap <Space> x
" autosave file"
let g:auto_save = 1 " enable AutoSave on Vim startup
let g:auto_save_events = ["InsertLeave", "TextChanged"]
set updatetime=800
let g:auto_save_silent = 1 " do not display the auto-save notification
"history undotree files"
set undodir=~/.vim/undodir
set undolevels=5000
set undofile
nnoremap <F5> :MundoToggle<CR>
""let g:mundo_width = 45
""let g:mundo_preview_height = 40
let g:mundo_right = 1
"solution for quickly quit insert mode"
set timeoutlen=1000 ttimeoutlen=0
"comment config "
" Add spaces after comment delimiters by default
let g:NERDSpaceDelims = 1
" Use compact syntax for prettified multi-line comments
let g:NERDCompactSexyComs = 1
" Align line-wise comment delimiters flush left instead of following code indentation
let g:NERDDefaultAlign = 'left'
" Set a language to use its alternate delimiters by default
let g:NERDAltDelims_java = 1
" Add your own custom formats or override the defaults
let g:NERDCustomDelimiters = { 'c': { 'left': '/**','right': '*/' } }
" Allow commenting and inverting empty lines (useful when commenting a region)
let g:NERDCommentEmptyLines = 1
" Enable trimming of trailing whitespace when uncommenting
let g:NERDTrimTrailingWhitespace = 1
" Enable NERDCommenterToggle to check all selected lines is commented or not
let g:NERDToggleCheckAllLines = 1
"define my vim config"
" source ~/.vim/autoload/shekcon.vim
" function! SetBackGround()
" if exists('theme') && theme == 'light'
" echo('theme')
" set background=dark
" else
" set background=light
" endif
" endfunction
nmap <F9> :set<Space>background=dark<CR>
" inoremap <Silent> <Leader>bb <Esc>:set background=dark<CR>
nmap <F10> :set<Space>background=light<CR>
" inoremap <Silent> <Leader>ll <Esc>:set background=light<CR>
" call SetBackGround()