-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnvim.vim
298 lines (217 loc) · 7.71 KB
/
nvim.vim
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
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'morhetz/gruvbox'
Plugin 'vim-airline/vim-airline'
Plugin 'ryanoasis/vim-devicons'
Plugin 'tpope/vim-fugitive'
Plugin 'airblade/vim-gitgutter'
Plugin 'ludovicchabant/vim-gutentags'
Plugin 'scrooloose/syntastic'
Plugin 'scrooloose/nerdcommenter'
Plugin 'scrooloose/nerdtree'
Plugin 'Shougo/deoplete.nvim'
Plugin 'Shougo/deoplete-zsh'
Plugin 'zchee/deoplete-go', {'for': 'go'}
Plugin 'python-mode/python-mode', {'for': ['python', 'py']}
Plugin 'integralist/vim-mypy', {'for': ['python', 'py']}
Plugin 'zchee/deoplete-jedi', {'for': ['python', 'py']}
Plugin 'iamcco/markdown-preview.nvim', { 'do': 'cd app & yarn install', 'for': ['md', 'markdown'] }
Plugin 'dhruvasagar/vim-table-mode', {'for': ['markdown', 'md']}
Plugin 'Quramy/tsuquyomi', {'for': ['typescript', 'ts']} " might require vimproc
Plugin 'leafgarland/typescript-vim', {'for': ['typescript', 'ts']}
Plugin 'Quramy/vim-js-pretty-template', {'for': ['js', 'javascript', 'typescript', 'ts']}
Plugin 'janko-m/vim-test'
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
" VIM behaviour ========================================================== {{{
" Tell VIM to remember certain things when we exit
" '10 : marks will be remembered for up to 10 previously edited files
" "100 : will save up to 100 lines for each register
" :20 : up to 20 lines of command-line history will be remembered
" % : saves and restores the buffer list
" n... : where to save the viminfo files
set viminfo='10,\"100,:20,%,n~/.vim/backup/.viminfo
" Show (partial) command in the last line of the screen.
set showcmd
" GUI settings
set title
" Don't update the display while executing macros
set lazyredraw
" Always display a status line at the bottom of the window
set laststatus=2
" Keep 3 lines visible down from the cursor while scrolling
set scrolloff=3
" Enable ctags support
set tags=./tags;/
" If file is not modified in VIM but changed outside, reload it
set autoread
" Keep commands history longer (by default keeps only 20 commands)
set history=1000
" Shows information on VIM bottom
set ruler
" Show line numbers in editor
set number
" Ignore case in search and replace
set ignorecase
" Found text will be highlighted and search will be repeated over file
set incsearch
" Smart search: if lowercase ignore case of matches, if not case-sensitive
set smartcase
" Keep VIM history even file is closed
set viminfo='20,<50,s10,h
" Remove trailing spaces after save
au BufWritePre * silent g/\s\+$/s///
" Set fold level to open all methods arround
set foldlevel=100
" enable per-project settings files
set exrc
" }}}
" Edit behaviour ========================================================= {{{
" Encoding
set termencoding=utf-8
set encoding=utf-8
" Set tab to 4 spaces
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
" Enable wrap mode to see long code lines
set wrap
set textwidth=0
" Enable mouse features
set mouse=a
" For new lines automatically indent by current line indent
set autoindent
set copyindent
" Show matching for symbols like () and etc.
set showmatch
" Allow backspace on everything in insert mode
set backspace=indent,eol,start
" Word wrap not in the middle of the word
set formatoptions=l
set lbr
" }}}
" Edit behaviour based on fyle type ====================================== {{{
autocmd Filetype html setlocal ts=2 sts=2 sw=2
autocmd Filetype yaml setlocal ts=2 sts=2 sw=2
autocmd Filetype js setlocal ts=2 sts=2 sw=2
" }}}
" Backups and swap ======================================================= {{{
set backup
set backupdir=~/.vim/backup
set noswapfile
" }}}
" Mappings =============================================================== {{{
" Mapleader from \ to ,
let mapleader=","
" <SHIFT + t> - trim white spaces in lines end
map <s-t> :%s/ \+$//g<CR>
" Toggles non printable character visibility
nmap <silent> <leader>w :set nolist!<CR>
" Allow to overwrite root protected files (in case of missed sudo)
cmap w!! %!sudo tee > /dev/null %
" Toggle NERDtree
map <leader>n :NERDTreeToggle<CR>
" TagBar Toggle
map <leader>m :TagbarToggle<CR>
" Spell Check
map <F5> <Esc>:setlocal spell spelllang=lt<CR>
map <F6> <Esc>:setlocal spell spelllang=en_us<CR>
map <F7> <Esc>:setlocal nospell<CR>
" No autoindent in paste mode
set pastetoggle=<F2>
" Clean search highlight on space
nnoremap <silent> <Space> :nohlsearch<Bar>:echo<CR>
" Insert new line after the cursor
nmap <CR> i<Enter><Esc>l
" Text wrap navigation made easy
map j gj
map k gk
" Reselect visual block after indent/outdent
vnoremap < <gv
vnoremap > >gv
" Resize windows with arrows
nmap <left> :3wincmd <<cr>
nmap <right> :3wincmd ><cr>
nmap <up> :3wincmd +<cr>
nmap <down> :3wincmd -<cr>
" Window close
map <leader>wc :wincmd q<cr>
" Window rotate
map <leader>wr <C-W>r
" Alias to ^w
nmap <C-q> <C-w>
" Terminal escape
tnoremap <C-[> <C-\><C-n>
tnoremap <Esc> <C-\><C-n>
" Terminal init
nmap <leader>t :terminal<cr>
" Tab Complete
inoremap <expr><tab> pumvisible()? "\<c-n>" : "\<tab>"
" Insert new line above cursor
nmap <C-K> O<Esc>j
" Insert new line below cursor
nmap <C-J> o<Esc>k
" Insert space after cursor
nmap <C-L> li <Esc>h
" Insert space before cursor
nmap <C-H> i <Esc>l
" }}}
" File types options ===================================================== {{{
" Ignore these file types on :e
set wildmenu
set wildmode=list:longest
set wildignore=*.swp,*.bak,*.pyc
" fuzzy :find
set path+=**
" }}}
" Omnicomplete =========================================================== {{{
"set completeopt=menuone,longest
" }}}
" Colors ================================================================= {{{
" Enable syntax highlighting
syntax on
let g:gruvbox_italic=1
set termguicolors
" Set Color scheme
colorscheme gruvbox
" Enable CursorLine
set cursorline
"" Paint 80 symbols line
set colorcolumn=80
set background=dark
" }}}
" Plugin Settings ======================================================== {{{
" NERDTree
let NERDTreeMinimalUI=1
let NERDTreeDirArrows=1
let NERDTreeIgnore=['\.pyc$', '\.bak$', '\.swp$', '__pycache__$', '\.egg-info$']
" Airline
let g:airline_powerline_fonts = 1
" Deoplete
let g:deoplete#enable_at_startup = 1
" Fugitive
autocmd User fugitive
\ if fugitive#buffer().type() =~# '^\%(tree\|blob\)$' |
\ nnoremap <buffer> .. :edit %:h<CR> |
\ endif
autocmd BufReadPost fugitive://* set bufhidden=delete
" }}}