-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
136 lines (110 loc) · 3.31 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
123
124
125
126
127
128
129
130
131
132
133
134
set nocompatible
" NOTE: I have symlinked this file to init.vim `ln -s ~/.vimrc init.vim`
if has('nvim')
call plug#begin(stdpath('data') . '/plugged')
else
call plug#begin('~/.vim/plugged')
endif
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'maralla/completor.vim'
Plug 'w0rp/ale'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'rakr/vim-one'
" Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} " We recommend updating the parsers on update
call plug#end()
" COC Autocomplete
set updatetime=300
nnoremap <C-P> <Cmd>FZF<Enter>
let g:fzf_action = {
\ 'Enter': 'tabe',
\ 'Tab': 'rightbelow vsplit'
\}
nnoremap <C-J> <C-W>w
inoremap jk <Esc>
inoremap Jk <Esc>
inoremap <Esc> <nop>
" Tab autocomplete
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 <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
" Linting and Code formatting
filetype plugin indent on
let g:ale_linters_explicit=1
let g:ale_linters = {
\ 'bash': ['shellcheck'],
\ 'c': ['clang'],
\ 'go': ['go vet'],
\ 'javascript': ['eslint'],
\ 'javascript.jsx': ['eslint'],
\ 'python': ['pyflakes'],
\ 'sh': ['shellcheck'],
\ 'zsh': ['shellcheck'],
\}
let g:ale_fixers = {
\ 'c': ['clang-format'],
\ 'css': ['prettier'],
\ 'go': ['goimports'],
\ 'html': ['prettier'],
\ 'javascript': ['prettier'],
\ 'javascript.jsx': ['prettier'],
\ 'json': ['prettier'],
\ 'python': ['pyflakes'],
\}
let g:ale_fix_on_save=1
let g:ale_fix_on_enter=1
let g:ale_lint_on_save=1
let g:ale_lint_on_enter=1
let g:ale_c_clangformat_options='--style=file'
let g:ale_go_gofmt_options='-s'
let g:ale_sign_column_always=1
set tabstop=4
set shiftwidth=4
set smartindent
set expandtab
set number
set mouse=a
syntax on
color slate
set backupdir=~/.vim/tmp
set directory=~/.vim/tmp
set undodir=~/.vim/tmp
set swapfile " keep a swap file
set backup " keep a backup file (restore to previous version)
set undofile " keep an undo file (undo changes after closing)
set history=50 " keep 50 lines of command line history
set ruler
" ONLY WRITES TO DISK IF CHANGES SINCE LAST WRITE
cnoreabbrev w update
" go to the position i was last at
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal g'\"" | endif
set backspace=indent,eol,start " allow backspace over everything in insertion mode
" Unix style line endings
set ff=unix
set showcmd " display incomplete
set incsearch " do incremental searching
vnoremap * "*y
" Detect filetype then load plugin file, set syntax highlighting,
" and set indentation accordingly
filetype plugin indent on
if has('langmap') && exists('+langnoremap')
" Prevent that the langmap option applies to characters that result from a
" mapping. If unset (default), this may break plugins (but it's backward
" compatible).
set langnoremap
endif
" In many terminal emulators the mouse works just fine, thus enable it.
if has('mouse')
set mouse=a
endif
" Don't autoselect an item from the completion menu, and always show the menu
let g:completor_complete_options='menuone,noinsert'
" No delay on showing the completion pop-up
let g:completor_completion_delay=0
set t_ut=