forked from petobens/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
216 lines (182 loc) · 5.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
set nocompatible " required
filetype off " required
set relativenumber
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
" add all your plugins here (note older versions of Vundle
" used Bundle instead of Plugin)
Plugin 'vim-scripts/indentpython.vim'
Plugin 'davidhalter/jedi-vim'
if has('nvim')
Plugin 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
else
Plugin 'Shougo/deoplete.nvim'
Plugin 'roxma/nvim-yarp'
Plugin 'roxma/vim-hug-neovim-rpc'
endif
Plugin 'dense-analysis/ale'
" Plugin 'scrooloose/nerdtree'
Plugin 'tpope/vim-fugitive'
Plugin 'itchyny/lightline.vim'
Plugin 'airblade/vim-gitgutter'
Plugin 'preservim/nerdtree'
Plugin 'Xuyuanp/nerdtree-git-plugin'
Plugin 'ryanoasis/vim-devicons'
Plugin 'jistr/vim-nerdtree-tabs'
Plugin 'preservim/nerdcommenter'
Plugin 'ervandew/supertab'
Plugin 'mileszs/ack.vim'
Plugin 'ambv/black'
Plugin 'junegunn/goyo.vim'
Plugin 'cespare/vim-toml'
Plugin 'christoomey/vim-tmux-navigator'
Plugin 'tmux-plugins/vim-tmux-focus-events'
Plugin 'heavenshell/vim-pydocstring', { 'do': 'make install' }
Plugin 'pseewald/vim-anyfold'
Plugin 'lepture/vim-jinja'
Plugin 'jparise/vim-graphql'
Plugin 'tiagofumo/vim-nerdtree-syntax-highlight'
Plugin 'jvirtanen/vim-hcl'
Plugin 'nvim-lua/plenary.nvim'
Plugin 'nvim-telescope/telescope.nvim', { 'tag': '0.1.3' }
Plugin 'iamcco/markdown-preview.nvim'
Plugin 'tpope/vim-surround'
Plugin 'preservim/tagbar'
Plugin 'catppuccin/vim', { 'as': 'catppuccin' }
" Black fixes
let g:black_virtualenv="~/.vim/black"
" Telescope and ctrlp
if has('nvim')
nnoremap <leader>ff <cmd>Telescope find_files<cr>
nnoremap <C-p> <cmd>Telescope find_files<cr>
nnoremap <leader>fg <cmd>Telescope live_grep<cr>
nnoremap <C-g> <cmd>Telescope live_grep<cr>
else
Plugin 'kien/ctrlp.vim'
let g:ctrlp_custom_ignore = 'google-cloud-sdk\|qdrant_storage'
endif
" Tagbar
nmap <C-t> :TagbarToggle<CR>
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
let g:deoplete#enable_at_startup = 1
let g:jedi#completions_enabled = 1
autocmd FileType python setlocal completeopt-=preview
"" ALE options
let g:ale_linters = {
\ 'python': ['flake8', 'pylint', 'pyright', 'pydocstyle'],
\}
let g:ale_fixers = {
\ 'python': ['black', 'isort', 'remove_trailing_lines', 'trim_whitespace'],
\}
"" Colorschemes
colorscheme catppuccin_mocha
syntax enable
" set term=xterm-256color
if (has("termguicolors"))
set termguicolors
endif
let g:lightline = {
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ]
\ },
\ 'component_function': {
\ 'gitbranch': 'FugitiveHead'
\ },
\ }
" Spaces
let g:NERDSpaceDelims = 1
autocmd BufWritePre * %s/\s\+$//e
set backspace=indent,eol,start
" Tmux
au FocusGained,BufEnter * :checktime
" Enable folding, as stated on https://github.com/pseewald/vim-anyfold
filetype plugin indent on
syntax on
autocmd Filetype * AnyFoldActivate
set foldlevel=99 " Open all folds
nnoremap <space> za
set nowrap
" Tabs and Spaces
set expandtab
set ts=2
autocmd FileType make setlocal noexpandtab " Dont expand on makefiles
autocmd FileType python setlocal ts=4
set encoding=UTF-8
au BufNewFile,BufRead *.py
\ set tabstop=4 |
\ set softtabstop=4 |
\ set shiftwidth=4 |
\ set expandtab |
\ set autoindent |
\ set fileformat=unix
highlight BadWhitespace ctermbg=red guibg=darkred
au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/
au BufNewFile,BufRead *.j2 set ft=jinja
" Syntax
let python_highlight_all=1
syntax on
au BufReadPost Jenkinsfile.* set syntax=groovy
" NerdTree
let NERDTreeIgnore=['\.pyc$', '\.DS_Store', '^__pycache__$']
autocmd vimenter * NERDTree
nnoremap <C-o> :NERDTreeToggle<enter>
set nu
set clipboard=unnamed
set splitbelow
set splitright
set updatetime=250
" Wrap guides
autocmd FileType python,sql setlocal colorcolumn=89
autocmd FileType tex setlocal colorcolumn=101
autocmd FileType rst setlocal colorcolumn=101
highlight ColorColumn guibg=red
set textwidth=0 wrapmargin=0
autocmd FileType tex setlocal textwidth=100
autocmd FileType rst setlocal textwidth=100
" Keybindings
" Tabs
nnoremap t :tabnew<enter>
" move between panes
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>
" move between panes
nnoremap <S-Up> <C-W>+
nnoremap <S-Down> <C-W>-
nnoremap <S-Left> <C-W><
nnoremap <S-Right> <C-W>>
" Create and destroy panes
nnoremap S :w<enter>
nnoremap s :split<enter>
nnoremap V :vsplit<enter>
nnoremap x :q<enter>
nnoremap X :q!<enter>
" Undo and redo
nnoremap <S-u> <C-R>
nnoremap <C-s> :w<enter>
" Remove completion for SQL files
let g:omni_sql_no_default_maps = 1
let g:ftplugin_sql_omni_key = '<Leader>sql'
let g:ftplugin_sql_omni_key = '<Plug>DisableSqlOmni'
" Delete, not cut
nnoremap d "_d
vnoremap d "_d
vnoremap p "_dP
" Pydocstring
let g:pydocstring_formatter = 'numpy'
let g:pydocstring_doq_path = '/usr/local/bin/doq'
let g:pydocstring_enable_mapping = 0
nmap <silent> <leader><C-d> <Plug>(pydocstring)
" NerdTree colors
let g:NERDTreeFileExtensionHighlightFullName = 1
let g:NERDTreeExactMatchHighlightFullName = 1
let g:NERDTreePatternMatchHighlightFullName = 1
let g:NERDTreeGitStatusConcealBrackets = 0
let g:NERDTreeGitStatusUseNerdFonts = 0