-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
218 lines (178 loc) · 6.4 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
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
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" More intelligent line numbers
Plugin 'myusuf3/numbers.vim'
" Status bar with useful info
Plugin 'vim-airline/vim-airline'
" in-editor linting
Plugin 'vim-syntastic/syntastic'
" Easier commenting out lines
Plugin 'scrooloose/nerdcommenter'
" Easier directory navigation from within vim
Plugin 'scrooloose/nerdtree'
" Display git status inline on directory tree
Plugin 'Xuyuanp/nerdtree-git-plugin'
" Display git status of specific lines within vim
Plugin 'airblade/vim-gitgutter'
" yaml syntax highlighting (mediocre, tbh, but the best I could find)
Plugin 'chase/vim-ansible-yaml'
" Enhanced python syntax highlighting
Plugin 'vim-python/python-syntax'
" Repeat motions with counts
Plugin 'Houl/repmo-vim'
" Jinja2 syntax highlighter
Plugin 'Glench/Vim-Jinja2-Syntax'
" git wrapper for vim
Plugin 'tpope/vim-fugitive'
" Python formatter
Plugin 'ambv/black'
" Python documetation
Plugin 'davidhalter/jedi-vim'
" Tmux splits
Plugin 'christoomey/vim-tmux-navigator'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
" set laststatus=2
" set statusline+=%#warningmsg#
" set statusline+=%{SyntasticStatuslineFlag()}
" set statusline+=%*
let g:python_highlight_all = 1
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 0
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntanstic_auto_jump = 0
let g:syntastic_aggregate_errors = 1
let g:syntastic_python_checkers = ['pylint', 'mypy']
let g:syntastic_python_mypy_args = "--ignore-missing-imports --no-strict-optional"
let g:syntastic_shell_checkers = ['shellcheck']
let g:syntastic_yaml_checkers = ['yamllint']
let g:syntastic_rst_checkers = ['sphinx']
" Toggle location list. Super useful for syntastic
function! ToggleErrors()
let old_last_winnr = winnr('$')
lclose
if old_last_winnr == winnr('$')
" Nothing was closed, open syntastic error location panel
Errors
endif
endfunction
" nnoremap <Leader>e :call ToggleErrors()<Enter>
" NERDTree settings
" Open NERDTree when opening vim
"autocmd vimenter * NERDTree
" Sane toggle key
nnoremap <Leader>f :NERDTreeToggle<Enter>
" Close NERDTree when opening a file
" let NERDTreeQuitOnOpen = 1
" Disable help message
let NERDTreeMinimalUI = 1
let NERDTreeDirArrows = 1
set colorcolumn=73,89
highlight ColorColumn ctermbg=0 guibg=lightgrey
set nowrap
set sidescroll=1
" I literally never want an indent to be anything other than 4 spaces
filetype plugin indent on
" show existing tab with 4 spaces width
set tabstop=4
set softtabstop=4
" when indenting with '>', use 4 spaces width
set shiftwidth=4
" On pressing tab, insert 4 spaces
set expandtab
" My white cursor shows up poorly on a bright yellow background
set hlsearch
hi Search ctermbg=DarkBlue
hi Search ctermfg=LightYellow
"Make nerdtree open splits to the right
set splitright
"Save and close buffer
command Wbd write|bdelete
"repmo doesn't have default mappings :(
" map a motion and its reverse motion:
:noremap <expr> h repmo#SelfKey('h', 'l')|sunmap h
:noremap <expr> l repmo#SelfKey('l', 'h')|sunmap l
" if you like `:noremap j gj', you can keep that:
:map <expr> j repmo#Key('gj', 'gk')|sunmap j
:map <expr> k repmo#Key('gk', 'gj')|sunmap k
" repeat the last [count]motion or the last zap-key:
:map <expr> ; repmo#LastKey(';')|sunmap ;
:map <expr> , repmo#LastRevKey(',')|sunmap ,
" add these mappings when repeating with `;' or `,':
:noremap <expr> f repmo#ZapKey('f')|sunmap f
:noremap <expr> F repmo#ZapKey('F')|sunmap F
:noremap <expr> t repmo#ZapKey('t')|sunmap t
:noremap <expr> T repmo#ZapKey('T')|sunmap T
"With argument, you can make `f` remember the count (same for `F`, `t` and `T`):
:noremap <expr> f repmo#ZapKey('f', 1)|sunmap f
"Scroll commands work too:
:noremap <expr> <C-E> repmo#SelfKey('<C-E>', '<C-Y>')
:noremap <expr> <C-Y> repmo#SelfKey('<C-Y>', '<C-E>')
"Alternative repetition keys (also working in addition to `;` and `,`):
" repeat the last [count]motion:
" :map <expr> <Space> repmo#LastKey('')|sunmap <Space>
" :map <expr> <BS> repmo#LastRevKey('')|sunmap <BS>
"If non-zero, a repetition key like `;` only repeats the last motion for
"which a count was given. This used to be the only available option.
"If zero, `;` repeats any last motion, this is the new default!
:let g:repmo_require_count = 1
" Turn off autocomplete
" let g:jedi#completions_enabled = 0
" Have jedi use splits
let g:jedi#use_splits_not_buffers = "right"
" Don't show call signatures
" let g:jedi#show_call_signatures = "0"
" Don't autocomplete imports
" let g:jedi#smart_auto_mappings = 0
" Prevent bad autotabbing
autocmd FileType python setlocal indentkeys-=<:>
autocmd FileType python setlocal indentkeys-=:
" tmux colors
set background=dark
set t_Co=256
" airline slow insert to normal
set ttimeoutlen=10
" Enable the list of buffers
let g:airline#extensions#tabline#enabled = 1
" Show just the filename
let g:airline#extensions#tabline#fnamemod = ':t'
" Allows buffers to be hidden if you've modified a buffer
set hidden
noremap <Leader>- :split<cr>
noremap <Leader><Bar> :vsplit<cr>
" Add spaces after comment delimiters by default
let g:NERDSpaceDelims = 1
" To open a new empty buffer
nmap <leader>t :enew<cr>
" Open last buffer
nnoremap <BS> <C-^>
" Move to the next buffer
nnoremap <RIGHT> :bnext<CR>
nnoremap <LEFT> :bprev<CR>
" Open new split panes to right and bottom, which feels more natural
set splitbelow
set splitright
" make backspace work in more situations
set backspace=indent,eol,start
" Always start git commit messages on the first line
autocmd FileType gitcommit call setpos('.', [0, 1, 1, 0])