-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.vim
executable file
·162 lines (124 loc) · 4 KB
/
init.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
" When started as "evim", evim.vim will already have done these settings.
if v:progname =~? "evim"
finish
endif
set nocompatible
let mapleader = ','
call plug#begin('~/.vim/bundle')
Plug 'junegunn/vim-plug'
Plug 'sheerun/vimrc'
Plug 'sheerun/vim-polyglot'
Plug 'editorconfig/editorconfig-vim'
Plug 'Quramy/vim-js-pretty-template'
Plug 'airblade/vim-gitgutter'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-vinegar'
Plug 'junegunn/gv.vim'
Plug 'altercation/vim-colors-solarized'
Plug 'arcticicestudio/nord-vim'
Plug 'ayu-theme/ayu-vim'
Plug 'sainnhe/gruvbox-material'
Plug 'dracula/vim'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
let g:airline_powerline_fonts = 1
let g:airline_theme = 'base16_gruvbox_dark_hard'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
let g:coc_global_extensions = [
\ 'coc-prettier',
\ 'coc-eslint',
\ 'coc-tsserver',
\ 'coc-stylelintplus'
\ ]
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction
set updatetime=300
set shortmess+=c
inoremap <silent><expr> <TAB>
\ pumvisible() ? coc#_select_confirm() :
\ coc#expandableOrJumpable() ? "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
vmap <leader>ed <Plug>(coc-codeaction-selected)
nmap <leader>ed <Plug>(coc-codeaction)
imap <C-l> <Plug>(coc-snippets-expand)
vmap <C-j> <Plug>(coc-snippets-select)
" GoTo code navigation.
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)
" Use K to show documentation in preview window
nnoremap <silent> K :call <SID>show_documentation()<CR>
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
else
call CocAction('doHover')
endif
endfunction
function! ShowDocIfNoDiagnostic(timer_id)
if (coc#float#has_float() == 0 && CocHasProvider('hover') == 1)
silent call CocActionAsync('doHover')
endif
endfunction
function! s:show_hover_doc()
call timer_start(500, 'ShowDocIfNoDiagnostic')
endfunction
autocmd CursorHoldI * :call <SID>show_hover_doc()
autocmd CursorHold * :call <SID>show_hover_doc()
nmap <leader>do <Plug>(coc-codeaction)
Plug 'honza/vim-snippets'
Plug 'aliou/sql-heredoc.vim'
Plug 'ntpeters/vim-better-whitespace'
Plug 'powerman/vim-plugin-AnsiEsc'
Plug 'preservim/nerdcommenter'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
nnoremap <silent> <leader>f :Rg<CR>
nnoremap <silent> <leader>b :Buffers<CR>
nnoremap <silent> <C-f> :Files<CR>
Plug 'junegunn/goyo.vim'
Plug '[email protected]:github/copilot.vim.git'
let g:copilot_no_tab_map = v:true
inoremap <silent><expr> <S-TAB> copilot#Accept("")
call plug#end()
set re=0
set showcmd
set splitright
set clipboard+=unnamedplus
set expandtab
set tabstop=2
set softtabstop=2
set shiftwidth=2
set textwidth=79
set fo+=t
call jspretmpl#register_tag('pug', 'pug')
autocmd FileType javascript JsPreTmpl
autocmd FileType javascriptreact JsPreTmpl
autocmd FileType typescript JsPreTmpl
" Stop using arrow keys!
noremap <Up> <nop>
noremap <Down> <nop>
noremap <Left> <nop>
noremap <Right> <nop>
set cmdheight=2
" Don't use Ex mode, use Q for formatting
map Q gq
set background=dark
let g:gruvbox_material_background = 'hard'
let g:gruvbox_material_palette = 'original'
colorscheme gruvbox-material
" Set filename as tmux title
autocmd BufReadPost,FileReadPost,BufNewFile,BufEnter * call system("tmux rename-window 'vim " . expand("%:t") . "'")
autocmd VimLeave * call system("tmux setw automatic-rename")
autocmd BufRead,BufNewFile *eslintrc set filetype=json
set backup
set backupdir=~/.vim/backup
highlight Comment cterm=italic gui=italic
command Bacon :r! curl -s "https://baconipsum.com/api/?type=all-meat¶s=3&format=text"
command Lemon :r! ~/bin/lemon-ipsum.js