-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
160 lines (127 loc) · 3.74 KB
/
vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
scriptencoding utf-8
set nocompatible
filetype off
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" set the path Vundle installs plugins to and init call
call vundle#rc("~/.vim/bundle/")
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" better file browser
Plugin 'scrooloose/nerdtree'
" class/module browser
Plugin 'majutsushi/tagbar'
" airline, awesome powerline
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
" tmuxline, make tmux statusline looks like airline
Plugin 'edkolev/tmuxline.vim'
" chinese vimcdoc
Plugin 'yianwillis/vimcdoc'
" tomasr/molokai
Plugin 'tomasr/molokai'
" Plugins from vim-scripts repos:
" Search results counter
Plugin 'IndexedSearch'
" Gvim colorscheme
"Plugin 'Wombat'
" Yank history navigation
Plugin 'YankRing.vim'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
" ========================================================
" Vim settings and mappings
" Settings
filetype plugin indent on
" colors and fonts for gvim
if has('gui_running')
"colorscheme wombat
colorscheme molokai
set guioptions-=T
if has('gui_win32')
set guifont=Inconsolata-dz\ for\ Powerline:h12
set guifontwide=YouYuan:h12:cGB2312
else
set guifont=Inconsolata-dz\ for\ Powerline\ Medium\ 12
endif
endif
" mapleader
let mapleader = ","
"syntax highlight on
syntax on
" hidden startup message
set shortmess=atI
" always show status bar
set laststatus=2
" highlight search results
set hlsearch
set ignorecase
nnoremap <silent> <C-l> :<C-u>nohlsearch<CR><C-l>
" auto indent for a new line
set autoindent
" <BS> to delete in insert mode
set backspace=indent,eol,start
" set tab for indent
set expandtab
set shiftwidth=4
set tabstop=4
" set auto read file
set autoread
" better backup, swap and undos storage
set directory=~/.vim/dirs/tmp
set backup
set backupdir=~/.vim/dirs/backups
set undofile
set undodir=~/.vim/dirs/undos
set viminfo+=n~/.vim/dirs/viminfo
let g:yankring_history_dir = '~/.vim/dirs/'
" mapping xx to ESC
inoremap fd <ESC>
inoremap jj <ESC>
inoremap jk <ESC>
" quick edit and source vimrc
nnoremap <leader>ev :vsplit $MYVIMRC<cr>
nnoremap <leader>sv :source $MYVIMRC<cr>
" ========================================================
" Plugin settings and mappings
" vim-airline
" vim-airline-themes
let g:airline_theme ='luna'
" use patched font for powerline symbol
let g:airline_powerline_fonts = 1
" powerline symbols
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
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_symbols.maxlinenr = ''
" Automatically displays all buffers when there's only one tab open.
let g:airline#extensions#tabline#enabled = 1
"let g:airline#extensions#tabline#buffer_nr_show = 1
" Make tmux statusline looks like airline
let g:airline#extensions#tmuxline#enabled = 1
" Display index of the buffer
let g:airline#extensions#tabline#buffer_idx_mode = 1
nmap <leader>1 <Plug>AirlineSelectTab1
nmap <leader>2 <Plug>AirlineSelectTab2
nmap <leader>3 <Plug>AirlineSelectTab3
nmap <leader>4 <Plug>AirlineSelectTab4
nmap <leader>5 <Plug>AirlineSelectTab5
nmap <leader>6 <Plug>AirlineSelectTab6
nmap <leader>7 <Plug>AirlineSelectTab7
nmap <leader>8 <Plug>AirlineSelectTab8
nmap <leader>9 <Plug>AirlineSelectTab9
nmap <leader>- <Plug>AirlineSelectPrevTab
nmap <leader>+ <Plug>AirlineSelectNextTab
" NERDTree config
map <F3> :NERDTreeToggle<CR>