-
Notifications
You must be signed in to change notification settings - Fork 0
/
.nvimrc
303 lines (216 loc) · 6.03 KB
/
.nvimrc
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
" Plugins {{{
" Make sure you use single quotes
" Install vim-plug if it does not exist
if empty(glob('~/.nvim/autoload/plug.vim'))
silent !curl -fLo ~/.nvim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall
endif
call plug#begin('~/.nvim/plugged')
Plug 'benekastah/neomake'
Plug 'vim-scripts/wombat256.vim'
Plug 'bling/vim-airline'
" On-demand loading
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'ervandew/supertab'
Plug 'Shougo/neocomplcache'
Plug 'Shougo/unite.vim'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-endwise'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-unimpaired'
Plug 'tpope/vim-commentary'
" Fuzzy finder
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': 'yes \| ./install' }
Plug 'moll/vim-bbye'
Plug 'rking/ag.vim'
" dash api
Plug 'rizzatti/dash.vim'
" Essence syntax
Plug '~/.vim/bundle/essence'
" Indent guides
Plug 'Yggdroot/indentLine'
" json
Plug 'elzr/vim-json'
call plug#end()
" }}}
" With a map leader it's possible to do extra key combinations
let mapleader = ","
let g:mapleader = ","
" Leader key timeout
set tm=2000
" Allow mouse use"
set mouse=a
" Don't show mode changes
set noshowmode
" Syntax checking
autocmd! BufWritePost * Neomake
" Color scheme
silent! colorscheme wombat256mod
" Allow the normal use of "," by pressing it twice
noremap ,, ,
" Kill the damned Ex mode.
nnoremap Q <nop>
" highlight the current line
set cursorline
" Line numbers
set number
" Configure backspace so it acts as it should act
set backspace=eol,start,indent
set whichwrap+=<,>,h,l
" Always show the status line
set laststatus=2
" Use Cedilla ¸ as the trailing whitespace char
set listchars=tab:‣\ ,trail:¸
set list
" Line wraping
set showbreak=↪
let g:indentLine_enabled =0
" Pressing ,ss will toggle and untoggle spell checking
map <leader>ss :setlocal spell!<cr>
" Treat long lines as break lines (useful when moving around in them)
nnoremap j gj
nnoremap k gk
" Remember info about open buffers on close
set viminfo^=%
" jump to tag in new tab
noremap ,ct <C-w><C-]><C-w>T
"sane sys paste
set pastetoggle=<F2>
" Auto readload on external changes
set autoread
" Searching {{{
" Ignore case when searching
set ignorecase
" When searching try to be smart about cases
set smartcase
" Highlight search results
set hlsearch
" Makes search act like search in modern browsers
set incsearch
" make p in Visual mode replace the selected text with the yank register
vnoremap p <Esc>:let current_reg = @"<CR>gvdi<C-R>=current_reg<CR><Esc>"
" yank to sys board
vmap ,p "*y<CR>
" Disable highlight when <leader><cr> is pressed
" but preserve cursor coloring
nmap <silent> <leader><cr> :noh\|hi Cursor guibg=red<cr>
" }}}
" File Search {{{
" dash search
nmap <silent> <leader>d <Plug>DashSearch
" Fuzzy find files
" nnoremap <silent> <Leader><space> :Unite file_rec/neovim<CR>
nnoremap <silent> <Leader><space> :FZF<CR>
nnoremap <Leader>w :IndentLinesToggle<CR>
"}}}
" Spacing {{{
" Use spaces instead of tabs
"set expandtab
" Be smart when using tabs ;)
set smarttab
" 1 tab == 4 spaces
set shiftwidth=4
set tabstop=4
set softtabstop=4
autocmd BufRead,BufNewFile *.py set tabstop=4 shiftwidth=4 softtabstop=4
autocmd BufRead,BufNewFile *.rb set noexpandtab tabstop=2 shiftwidth=2
" }}}
" Auto completion {{{
" Turn on the WiLd menu
set wildmenu
" Tab-complete files up to longest unambiguous prefix
set wildmode=list:longest,full
let g:neocomplcache_enable_at_startup=1
let g:neocomplcache_enable_smart_case=1
" }}}
" Jump to splits {{{
noremap <c-h> <c-w>h
noremap <c-k> <c-w>k
noremap <c-j> <c-w>j
noremap <c-l> <c-w>l
" }}}
" Buffers {{{
" allow unsaved
set hidden
" delete buffer
nnoremap <Leader>q :Bdelete<CR>
nnoremap <Leader>Q :bufdo :Bdelete<CR>
" CMD-' CMD-\
noremap °;133 :bprev<cr>
noremap °;134 :bnext<cr>
imap °;133 <esc>:bprev<cr>
imap °;134 <esc>:bnext<cr>
tnoremap °;133 <C-\><C-n> :bprev<cr>
tnoremap °;134 <C-\><C-n> :bnext<cr>
" buffers list
let g:airline#extensions#tabline#enabled=1
let g:airline#extensions#tabline#buffer_idx_mode = 1
let g:airline#extensions#tabline#show_close_button = 1
let g:airline#extensions#tabline#close_symbol = 'X'
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
" }}}
" Folding {{{
set foldmethod=marker
set foldnestmax=10
set nofoldenable
set foldlevel=2
" }}}
" Vim jump to the last position when reopening a file {{{
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal! g'\"" | endif
endif
" }}}
" Whitespace {{{
" Delete trailing white space on save
func! DeleteTrailingWS()
exe "normal mz"
%s/\s\+$//ge
exe "normal `z"
endfunc
augroup whitespace
autocmd!
autocmd BufWrite * :call DeleteTrailingWS()
augroup END
" }}}
" Undo {{{
set undofile " Save undo's after file closes
set undodir=$HOME/.nvim/undo " where to save undo histories
set undolevels=1000 " How many undos
set undoreload=10000 " number of lines to save for undo
" }}}
" Airline {{{
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 = 'Ξ'
" powerline 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 = ''
" }}}