-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
122 lines (91 loc) · 2.65 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
set nocompatible
syntax on
filetype plugin on
filetype plugin indent on
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
set ttyfast
set number
set wildmenu
set expandtab
set tabstop=2
set shiftwidth=2
set showcmd
set laststatus=2
set ruler
set incsearch
set hlsearch
set ignorecase
set smartcase
set showmatch
set backspace=indent,eol,start
set autoindent
set noerrorbells
" set swapfiles
" https://stackoverflow.com/a/21026618
set directory=$HOME/.vim/swapfiles//
" messing with the path
set path+=**
let gitpath=system("git rev-parse --show-toplevel")
set path+=gitpath
" Uncomment the following to have Vim jump to the last position when
" reopening a file
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal! g'\"" | endif
" autoload template files
augroup templates
autocmd BufNewFile *.vue 0r ~/.vim/templates/skeleton.vue
autocmd BufNewFile *.sh 0r ~/.vim/templates/skeleton.sh
augroup end
endif
let g:coc_config_home = "~/.vim/coc-settings"
" Plguins
" Download vim plug if not there already
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
"CoC auto
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
let g:coc_global_extensions = ['coc-solargraph']
call plug#begin('~/.vim/plugged')
Plug 'mileszs/ack.vim'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
" Allows changing pairs of brackets easily using cs)]
Plug 'tpope/vim-surround'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'pangloss/vim-javascript'
Plug 'dense-analysis/ale'
call plug#end()
" ale
let g:ale_sign_error = '❌'
let g:ale_sign_warning = '⚠️'
let g:ale_fixers = { 'javascript': ['eslint'] }
let g:ale_fix_on_save = 1
let g:ale_linters = {
\ 'yaml': ['yamllint'],
\ 'javascript': ['eslint'],
\ 'javascript.jsx': ['eslint'],
\ 'typescript': ['eslint'],
\ 'typescript.tsx': ['eslint']
\}
" mappings
inoremap jj <Esc>
nnoremap ; :
nnoremap : ;
" pane management
nnoremap <C-w>s <C-w>s<C-w>w
nnoremap <C-w>v <C-w>v<C-w>w
" paste management
nnoremap <C-S-v> :set paste<CR>o<Esc>"*p:set nopaste<CR>