-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdot.vimrc.symlink
246 lines (194 loc) · 5.99 KB
/
dot.vimrc.symlink
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
" General settings
"
echo "(>^.^<)"
set nocompatible
filetype plugin indent on
set splitright
set nowrap
" Settings
" ========
set rtp+=~/.vim/bundle/Vundle.vim
set number
set encoding=utf-8
set autoread
set autowrite
" indentation
set sts=4
set ts=4
set sw=4
set updatetime=100
" Autoread files whenever they are being changed outside vim
set autoread
filetype off
let @s="100|2hbi\"\\\<CR>f\"\<Esc>"
" Have numbers on the active window
augroup BgHighlight
autocmd!
autocmd WinEnter,BufRead * set nu rnu
autocmd WinLeave * setlocal nonu nornu
augroup END
au FileType python :iabbr <buffer> iff if:<left><space>
set statusline=%f
" Keymappings
let mapleader = ","
" delete that doesn't occupy register
nnoremap <leader>w :set wrap!<CR>
nnoremap <leader>r :checktime<CR>:so $MYVIMRC<CR>
nnoremap <leader>v :e $MYVIMRC<CR>
nnoremap <leader>V :!e $MYVIMRC<CR>
nnoremap <leader>b :Isort <cr> :Black <cr>
noremap / :set hlsearch <cr> /
noremap <leader>/ :set hlsearch!<CR>
noremap <leader><C-V> :set paste!<CR>
nnoremap <leader>j J
nnoremap <leader>. :<up><cr>
nnoremap ' "_
nnoremap <leader>pi $A # pylint: disable=<Esc>"+p
nnoremap <leader>f :Files <CR>
nnoremap <leader>s :Rg <CR>
nnoremap <C-n> :NERDTreeToggle<CR>
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
nnoremap <C-B> :YcmCompleter GoToDeclaration <CR>
nnoremap - ddp
nnoremap _ ddkkp
noremap <C-X> :call NERDComment(-1,"toggle")<CR>
" Zoom in Zoom out
noremap zi :NERDTreeClose<Cr><C-W>\|<C-W>\_
noremap zo :NERDTree<Cr><C-W>=
" Turbomove
noremap J 5j
noremap K 5k
noremap L 5l
noremap H 5h
inoremap jk <ESC>
inoremap JK <ESC>
inoremap Jk <ESC>
inoremap jK <ESC>
vnoremap <leader>p "\xp<cr>
vnoremap <leader>rl y:s/<C-R>"//g<left><left>
vnoremap <leader>rg y:%s/<C-R>"//g<left><left>
vnoremap <leader>rc y:%s/<C-R>"//gc<left><left><left>
vnoremap <leader>ry :s/<C-R>"//g<left><left>
onoremap ( i(
onoremap [ i[
onoremap { i{
" Abbreviations
iabbr bp __import__("pdb").set_trace() #TODO delme
iabbr pytarg from argparse import ArgumentParser<cr><cr><cr>def main(args): # pylint: disable=redefined-outer-name<cr><tab>...<cr><cr><cr><bs>if __name__ == "__main__":<cr>parser = ArgumentParser()<cr>parser.add_argument()<cr>args = parser.parse_args()<cr><cr>main(args)<esc>8k
iabbr pypejob from pype import BaseConfig<cr><cr><cr>class Config(BaseConfig):<cr>script_path = ...<cr>outputs = {}<cr><bs><cr><cr>def main(config):<cr>pass
iabbr delme # TODO delme ##########<cr>#######################
" source .vimrc after saving it
au bufwritepost .vimrc source $MYVIMRC
au bufwritepre * :%s/\s\+$//e
" PEP8
au Filetype python
\ set tabstop=4 |
\ set softtabstop=4 |
\ set shiftwidth=4 |
\ set expandtab |
\ set autoindent |
\ set fileformat=unix |
" Plugins
" =======
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'jpalardy/vim-slime' " Plugin 'vim-slime'
Plugin 'scrooloose/nerdtree' " Nerdtree
Plugin 'vim-scripts/indentpython.vim' " Proper indentation
Plugin 'unblevable/quick-scope' " Highligt first unique letter
Plugin 'morhetz/gruvbox' " Colorscheme
Plugin 'psf/black' " Black
Plugin 'junegunn/fzf', { 'do': './install --bin' } " Rg
Plugin 'junegunn/fzf.vim' "fzf
Plugin 'junegunn/vim-easy-align'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-repeat' " Let Vim Surround repeat actions
Plugin 'vim-syntastic/syntastic' " for linting
Plugin 'Krasjet/auto.pairs' " autocompletion of paranthesis
Plugin 'airblade/vim-gitgutter'
Plugin 'Valloric/YouCompleteMe' " Autocompletion and jump to definition
Plugin 'preservim/nerdcommenter' " Comment
Plugin 'davidhalter/jedi-vim'
Plugin 'fisadev/vim-isort'
call vundle#end()
" Jedi
" ====
let g:jedi#show_call_signatures = "1"
let g:jedi#popup_on_dot = "1"
let g:jedi#goto_command = ""
let g:jedi#goto_assignments_command = ""
let g:jedi#goto_stubs_command = ""
let g:jedi#goto_definitions_command = ""
let g:jedi#documentation_command = "<leader>h"
let g:jedi#usages_command = ""
let g:jedi#completions_command = ""
let g:jedi#rename_command = "<leader>R"
" Slime
" =====
let g:slime_target = "tmux"
let g:slime_default_config = {"socket_name": "default", "target_pane": 1}
" Gruvbox
" =======
colorscheme gruvbox
set background=dark
set t_Co=256
" Nerd commenter
" ==============
let g:NERDDefaultAlign = 'left'
let g:NERDCommentEmptyLines = 1
" Nerd tree
" =========
let g:NERDTreeWinSize=37
" YouCompleteMe
" =============
let g:ycm_autoclose_preview_window_after_insertion = 1
" Easy Align
" ==========
nmap ga <Plug>(EasyAlign)
xmap ga <Plug>(EasyAlign)
" GitGutter
" =========
nmap <leader>gp <Plug>(GitGutterPreviewHunk)
nmap <leader>gu <Plug>(GitGutterUndoHunk)
nmap <leader>gj <Plug>(GitGutterNextHunk)
nmap <leader>gk <Plug>(GitGutterPrevHunk)
nmap <leader>gg :GitGutterToggle <cr>
let g:gitgutter_enabled = 0
" FZF
" ===
let $FZF_DEFAULT_COMMAND='rg --files --follow'
command! -bang -nargs=? -complete=dir Files
\ call fzf#vim#files(<q-args>, {'options': ['--tiebreak', 'end', '--info=inline', '--preview', 'bat --color=always --style=numbers {}']}, <bang>0)
command! -bang -nargs=* Rg
\ call fzf#vim#grep("rg --column --line-number --no-heading --color=always --smart-case ".shellescape(<q-args>), 1,
\ fzf#vim#with_preview({'options': '--delimiter : --nth 4..'}), <bang>0)
let g:fzf_preview_window = ['right:50%', 'ctrl-/']
" Have persistent undo in vim
" ===========================
let vimDir = '$HOME/.vim'
if stridx(&runtimepath, expand(vimDir)) == -1
" vimDir is not on runtimepath, add it
let &runtimepath.=','.vimDir
endif
" Keep undo history across sessions by storing it in a file
if has('persistent_undo')
let myUndoDir = expand(vimDir . '/undodir')
" Create dirs
:silent call system('mkdir ' . vimDir)
:silent call system('mkdir ' . myUndoDir)
let &undodir = myUndoDir
set undofile
endif
" Updates
" =======
syntax on
" Have python highlight self
augroup python
autocmd!
autocmd FileType python
\ syn keyword pythonExceptions self
\ | highlight def link pythonExceptions Special
augroup end