-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.init.vim
More file actions
408 lines (334 loc) · 9.7 KB
/
.init.vim
File metadata and controls
408 lines (334 loc) · 9.7 KB
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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
call plug#begin('~/.config/nvim/plugged')
Plug 'tpope/vim-sensible'
Plug 'tpope/vim-rails'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-sleuth'
Plug 'junegunn/vim-easy-align'
Plug 'gregsexton/MatchTag'
Plug 'vim-ruby/vim-ruby'
Plug 'Yggdroot/indentLine'
Plug 'kchmck/vim-coffee-script'
Plug 'mattn/emmet-vim'
Plug 'tpope/vim-repeat'
Plug 'kana/vim-textobj-user'
Plug 'nelstrom/vim-textobj-rubyblock'
Plug 'scrooloose/nerdtree'
Plug 'ruanyl/vim-gh-line'
Plug 'tpope/vim-unimpaired'
Plug 'ck3g/vim-change-hash-syntax'
Plug 'FooSoft/vim-argwrap'
Plug 'tpope/vim-endwise'
Plug 'tpope/vim-haml'
Plug 'dense-analysis/ale'
Plug 'wakatime/vim-wakatime'
Plug 'rhysd/clever-f.vim'
Plug 'tpope/vim-rhubarb'
Plug 'rakr/vim-one'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'fvictorio/vim-extract-variable'
Plug 'hashivim/vim-terraform'
Plug 'ekalinin/Dockerfile.vim'
Plug 'f-person/git-blame.nvim'
Plug 'kdheepak/lazygit.nvim'
Plug 'sindrets/diffview.nvim'
Plug 'hoob3rt/lualine.nvim'
Plug 'elixir-editors/vim-elixir'
Plug 'slim-template/vim-slim'
Plug 'mhinz/vim-signify'
Plug 'mhinz/vim-mix-format'
Plug 'digitaltoad/vim-pug'
Plug 'olimorris/onedarkpro.nvim'
" autocomplete
Plug 'neovim/nvim-lspconfig'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-cmdline'
Plug 'hrsh7th/nvim-cmp'
Plug 'tzachar/cmp-tabnine', { 'do': './install.sh' }
" For vsnip users.
Plug 'hrsh7th/cmp-vsnip'
Plug 'hrsh7th/vim-vsnip'
" Elixir
Plug 'mhinz/vim-mix-format'
" typing
Plug 'alvan/vim-closetag'
Plug 'tpope/vim-surround'
Plug 'jiangmiao/auto-pairs'
" syntax
Plug 'sheerun/vim-polyglot'
Plug 'pangloss/vim-javascript'
Plug 'styled-components/vim-styled-components', { 'branch': 'main' }
Plug 'norcalli/nvim-colorizer.lua'
" Themes
Plug 'morhetz/gruvbox'
Plug 'dracula/vim'
Plug 'lifepillar/vim-solarized8'
Plug 'projekt0n/github-nvim-theme'
Plug 'tanvirtin/monokai.nvim'
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
" Tmux
Plug 'christoomey/vim-tmux-navigator'
" Buffers
Plug 'matbme/JABS.nvim'
call plug#end()
syntax enable
set background=dark
" autocmd vimenter * ++nested colorscheme solarized8
colorscheme dracula
" colorscheme github_dimmed
" colorscheme monokai_pro
" colorscheme gruvbox
let g:gruvbox_contrast_dark = "hard"
highlight Normal ctermbg=NONE
" Basic setiings
highlight Comment gui=italic
highlight Comment cterm=italic
highlight htmlArg gui=italic
highlight htmlArg cterm=italic
highlight htmlArg cterm=italic
set autoread
set termguicolors
set clipboard=unnamed " copy to system clipboard
set completeopt=menu,menuone,noselect
" set ruler
set nowrap " don't wrap lines
set tabstop=2 " a tab is two spaces
set shiftwidth=2 " an autoindent (with <<) is two spaces
set softtabstop=2 " if we have smart tabs, treat like hard tabs
set expandtab " Use spaces instead of tags
set list " Show invisible characters
set lazyredraw
set ttyfast
set synmaxcol=512
syntax sync minlines=256
" Change buffer whitout saving
set hidden
" default updatetime 4000ms is not good for async update
" vim-signify
set updatetime=300
" Some servers have issues with backup files, see #649.
set nobackup
set nowritebackup
" Give more space for displaying messages.
set cmdheight=2
" always show signcolumns
set signcolumn=yes
set number
set noswapfile
set splitright
set splitbelow
set smartcase
set ignorecase
set incsearch
set hlsearch
" error bells
set noerrorbells
set visualbell
set t_vb=
set tm=500
set showcmd " show incomplete commands
set so=7 " set 7 lines to the cursors - when moving vertical
set scrolloff=3 " lines of text around cursor
set title " set terminal title
let mapleader = ' '
let maplocalleader = ' '
map <silent><Leader>o :only<CR>
autocmd FileType scss setl iskeyword+=@-@
let g:UltiSnipsSnippetDirectories=[$HOME.'/.config/nvim/UltiSnips']
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsListSnippets="<C-_>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<S-tab>"
map <C-P> :FZF<CR>
map <Leader>b :JABSOpen <CR>
map <Leader>t :BTags <CR>
map <Leader>h :History <CR>
imap <C-f> <plug>(fzf-complete-line)
" HTML, JSX
let g:closetag_filenames = '*.html,*.js,*.jsx,*.ts,*.tsx'
"Easy align config
vmap <Enter> <Plug>(EasyAlign)
" NERDtree
map <silent><leader>n :NERDTreeToggle<CR>
map <silent><leader>- :NERDTreeFind<cr>
let g:nerdtree_tabs_focus_on_files = 1
let g:NERDTreeWinSize=35
let NERDTreeMinimalUI = 1
let g:NERDTreeWinSize = 30
let g:NERDTreeQuitOnOpen=0
let NERDTreeShowHidden=1
let NERDTreeIgnore=['\.git$']
let $FZF_DEFAULT_OPTS='--layout=reverse'
" setup mapping to call :LazyGit
nnoremap <silent> <leader>gg :LazyGit<CR>
" ctags
nnoremap <leader>s :tag <C-R><C-W><CR><Left>
" hit ,f to find the definition of the current class
" this uses ctags. the standard way to get this is Ctrl-]
nnoremap <silent><leader>f <C-]>
" use ,F to jump to tag in a vertical split
nnoremap <silent><leader>F :let word=expand("<cword>")<CR>:vsp<CR>:wincmd w<cr>:exec("tag ". word)<cr>
"spelling
autocmd BufRead,BufNewFile *.markdown setlocal spell
autocmd BufRead,BufNewFile *.gitcommit setlocal spell
" Make it obvious where 100 characters is
set textwidth=100
set colorcolumn=+1
" Numbers
set number
set numberwidth=5
set sidescroll=1
let Grep_Skip_Dirs = '.git log tmp'
" Vim. Live it. (http://www.tylercipriani.com/vim.html)
inoremap <up> <nop>
vnoremap <up> <nop>
nnoremap <up> <nop>
inoremap <down> <nop>
vnoremap <down> <nop>
nnoremap <down> <nop>
inoremap <left> <nop>
vnoremap <left> <nop>
nnoremap <left> <nop>
inoremap <right> <nop>
vnoremap <right> <nop>
nnoremap <right> <nop>
" save a file
nnoremap <silent><Leader>w :w<CR>
" switch between current and last buffer
nmap <leader><tab> <c-^>
" scroll the viewport faster
nnoremap <C-e> 3<C-e>
nnoremap <C-y> 3<C-y>
let g:user_emmet_leader_key='<C-Z>'
" Always show statusline
set laststatus=2
" Better navigation in long lines
nnoremap j gj
nnoremap k gk
nmap <leader>cf <Plug>CtrlSFPrompt
nmap <silent> <BS> :nohlsearch<CR>
" vim-ruby
let ruby_operators = 1
let ruby_space_errors = 1
let ruby_no_expensive = 1
" Strip trailing whitespace
function! <SID>StripTrailingWhitespaces()
" Preparation: save last search, and cursor position.
let _s=@/
let l = line(".")
let c = col(".")
" Do the business:
%s/\s\+$//e
" Clean up: restore previous search history, and cursor position
let @/=_s
call cursor(l, c)
endfunction
autocmd BufWritePre * :call <SID>StripTrailingWhitespaces()
let g:indent_guides_auto_colors = 1
let g:indent_guides_start_level = 2
let g:indent_guides_guide_size = 1
noremap K :Rg! <C-r>=expand('<cword>')<CR><CR>
nnoremap \ :Rg<SPACE>
" Exclude Javascript files in :Rtags via rails.vim due to warnings when parsing
let g:Tlist_Ctags_Cmd="ctags --exclude='*.js'"
let g:surround_113 = "#{\r}" " v
let g:surround_35 = "#{\r}" " #
let g:surround_45 = "<% \r %>" " -
let g:surround_61 = "<%= \r %>" " =
nnoremap <silent> <leader>a :ArgWrap<CR>
nnoremap <leader>B :<c-u>exe "colors" (g:colors_name =~# "dark"
\ ? substitute(g:colors_name, 'dark', 'light', '')
\ : substitute(g:colors_name, 'light', 'dark', '')
\ )<cr>
" Quickly select the text that was just pasted. This allows you to, e.g.,
" indent it after pasting.
noremap gV `[v`]
" Stay in visual mode when indenting. You will never have to run gv after
" performing an indentation.
vnoremap < <gv
vnoremap > >gv
autocmd BufRead,BufNewFile *.axlsx set filetype=ruby
au BufNewFile,BufRead *.arb set ft=ruby
noremap ; :
let &t_ZH="\e[3m"
let &t_ZR="\e[23m"
function! RubocopAutocorrect()
execute "!rubocop -a " . bufname("%")
endfunction
map <silent> <Leader>cop :call RubocopAutocorrect()<cr>
" ale
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 1
let g:ale_fixers = { 'elixir': ['mix_format'] }
" Move between linting errors
nnoremap ]r :ALENextWrap<CR>
nnoremap [r :ALEPreviousWrap<CR>
lua <<EOF
require('lualine').setup({
options = { theme = 'onedarkpro' }
})
require("jabs").setup {
position = "center",
width = 50,
height = 10,
border = "rounded",
preview_position = "top",
preview = {
width = 70,
height = 20,
border = "rounded",
},
}
-- Tabnine setup
local tabnine = require('cmp_tabnine.config')
tabnine:setup({
max_lines = 1000;
max_num_results = 20;
sort = true;
run_on_every_keystroke = true;
snippet_placeholder = '..';
ignored_file_types = {
lua = true
};
show_prediction_strength = false;
})
-- Setup nvim-cmp.
local cmp = require'cmp'
cmp.setup({
sources = {
{ name = 'cmp_tabnine' },
{name = 'path'},
{name = 'nvim_lsp', keyword_length = 3},
{name = 'buffer', keyword_length = 3},
{name = 'luasnip', keyword_length = 2},
},
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
}),
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
})
})
})
EOF