-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
221 lines (221 loc) · 6.64 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
218
219
220
221
" ===========================
" This is a gud vim setup. Remember to update the submodules in bundle/
" ===========================
runtime bundle/vim-pathogen/autoload/pathogen.vim
execute pathogen#infect()
set runtimepath+=~/.vim
syntax on
filetype plugin indent on
" Colors ===========================
set t_Co=256
set encoding=utf-8
colorscheme dracula
" Basic UI settings ===========================
set wrap
set number
set ruler
set mouse+=a
set clipboard=unnamed
set updatetime=500
" Searching ===========================
set ignorecase
set smartcase
set incsearch
set autowrite
set hidden
" Remaps ===========================
" MacBook Touchbar
inoremap fj <ESC>
cnoremap fj <ESC>
" Buffer ===========================
" buffers to save cursor location
" au BufWinLeave mkview
" au BufWinEnter silent loadview
if has("autocmd")
au BufReadPost if line("'\"") > 0 && line("'\"") <= line("$") | exe normal! g`\"" | endif
endif
" Buffer ===========================
" set buffers to leave off where left
" au BufWinLeave * mkview
" buffers to save cursor location
" au BufWinEnter * silent loadview
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
endif
"
" Security ===========================
set noswapfile
set nobackup
set nowritebackup
" Remember :X to encrypt, to remove passwd :X and leave blank
" If not using neovim, set cryptmethod to blowfish2
if !has('nvim')
setlocal cm=blowfish2
endif
"
" Fix backspace errors ===========================
set backspace=indent,eol,start
"
set wildmenu
set wildmode=list:longest,full
" ALE ===========================
set omnifunc=ale#completion#OmniFunc
" let g:ale_completion_enabled = 0
" other fun symbols
" '⚠' '☂' '☣' '☠'
let g:ale_sign_warning = '⚠'
let g:ale_sign_error = '☠'
let b:ale_linters={
\ 'python': ['flake8', 'darglint', 'pylint'],
\ 'rust': ['analyzer'],
\ 'yaml': ['cfn-lint', 'yamllint', 'cfn_nag_scan'],
\ 'dockerfile': ['hadolint'],
\ 'terraform': ['tflint'],
\ 'markdown': ['markdownlint'],
\ 'sql': ['sqlint', 'sql-lint'],
\}
let g:ale_fixers = {
\ 'rust': ['rustfmt', 'trim_whitespace', 'remove_trailing_lines'],
\ 'python': ['trim_whitespace', 'remove_trailing_lines'],
\}
" Set this in your vimrc file to disabling highlighting
" let g:ale_set_highlights = 0
" Python Stuff ===========================
" PEP 8 Indentation
au BufNewFile, BufRead *.py set expandtab
set fileformat=unix
set omnifunc=pythoncomplete#Complete
let g:python_highlight_all = 1
let g:pymode_indent = 0
let g:ale_python_flake8_options = '--ignore=E501'
" ignore invalid-name convention
let g:ale_python_pylint_options = '--ignore=C0103'
let g:python_host_prog='$HOME/.vim/venv/bin/python'
let g:python3_host_prog='$HOME/.vim/venv/bin/python3'
" Rust Stuff ===========================
autocmd BufNewFile,BufRead *.rs set filetype=rust
" Go Stuff ===========================
autocmd BufNewFile,BufRead *.go set filetype=go
" Dockerfile
autocmd BufNewFile,BufRead *Dockerfile* set filetype=dockerfile
" BUCK2 and Starklark
autocmd BufNewFile,BufRead BUCK set filetype=starlark
" Jenkinsfile
augroup set_jenkins_groovy
au!
au BufNewFile,BufRead *.jenkinsfile,*.Jenkinsfile,Jenkinsfile,jenkinsfile setf groovy
"autocmd BufWritePost Jenkinsfile !ssh localhost -p1337 declarative-linter < %
augroup END
" Terraform (tf) and Terraform Ignore (.tfi)
autocmd BufNewFile,BufRead *.tf,*.tfi set filetype=terraform
" Tabbing and Indents ===========================
set smarttab
set expandtab
" copy indent from current line when starting a new line
set autoindent
set smartindent
set cindent
set tabstop=4
set softtabstop=4
set shiftwidth=4
" Tab remaps
nnoremap<C-S-Enter> :tabe<CR>
nnoremap<C-S-tab> :tabp<CR>
nnoremap<C-tab> :tabn<CR>
" Displays '-' for trailing space, '>-' for tabs and '_' for non breakable space
set listchars=tab:>-,trail:-,nbsp:_
set list
" No Noise ===========================
set noerrorbells
set novisualbell
set belloff=all
set tm=500
" Typos ===========================
command! Q q
command! W w
command! WQ wq
command! Wq wq
" Get rid of empty lines
command! Blanks g/^\s*$/d
" Get rid of trailing spaces
command! WS %s/\s\+$//e
" Rainbow Tabs ===========================
let g:rainbow_active=1
" supertab ===========================
let g:SuperTabDefaultCompletionType = "<c-n>"
set splitright
" NERDTree ===========================
" remap nerdtree to Ctrl + n
map <C-n> :NERDTreeToggle<CR>
let g:NERDTreeGitStatusIndicatorMapCustom = {
\ "Modified" : "♻",
\ "Staged" : "✚",
\ "Untracked" : "✭",
\ "Renamed" : "➜",
\ "Unmerged" : "═",
\ "Deleted" : "✖",
\ "Dirty" : "☭",
\ "Clean" : "♥",
\ 'Ignored' : '☹',
\ "Unknown" : "?"
\ }
" Status Line =============================
let g:lightline = { 'colorscheme': 'darcula' }
let g:airline#extensions#ale#enabled = 1
set laststatus=2
set statusline+=%#warningmsg#
set statusline+=%*
" Markdown ===============================
let g:ale_markdown_markdownlint_options = '--ignore=MD013'
let g:vim_markdown_folding_disabled = 1
let g:markdown_fenced_languages = [
\ 'css',
\ 'erb=eruby',
\ 'go',
\ 'html',
\ 'javascript',
\ 'js=javascript',
\ 'json=javascript',
\ 'markdown',
\ 'ruby',
\ 'sass',
\ 'sh',
\ 'sql',
\ 'vim',
\ 'xml',
\ 'zsh',
\ 'yaml'
\ ]
" log-highlighting =======================
" au rc Syntax log syn keyword logLevelError test
let g:ale_set_highlights = 0
let g:LanguageClient_useVirtualText = 0
" YAML specific ===========================
" Fix auto-indentation for YAML files
augroup yaml_fix
au!
au FileType yaml setlocal ts=2 sts=2 sw=2 expandtab indentkeys-=0# indentkeys-=<:>
au BufRead,BufNewFile *.template.yaml,cfn.yaml set filetype=yaml.cloudformation
let g:ale_yaml_yamllint_options='-d "{extends: relaxed, rules: {line-length: disable}}"'
augroup END
" OPA Rego Specific =======================
let g:formatdef_rego = '"opa fmt"'
let g:formatters_rego = ['rego']
let g:autoformat_autoindent = 0
let g:autoformat_retab = 0
" au BufWritePre *.rego Autoformat
" Functions ===========================
" xnoremap <leader>ips :s/0\+\([0-9a-f]\)/\1/ | *sort n /.*\./ | *sort n /\.\d\+\./ | *sort n /\./ | *sort n u
" Copilot ===========================
" I have filetypes disabled by default.
" To enable specific filetypes, add them to the dictionary below.
let g:copilot_filetypes = {
\ '*': v:false,
\ 'gitcommit': v:true,
\ 'lua': v:true,
\ 'markdown': v:true,
\ 'vim': v:true,
\ 'yaml': v:true,
\ }
" Live Diff Updates ===========================
autocmd CursorMoved,CursorMovedI * diffupdate