-
Notifications
You must be signed in to change notification settings - Fork 1
/
vimrc
234 lines (196 loc) · 7.08 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
222
223
224
225
226
227
228
229
230
231
232
233
234
" General
"
" ------------------------------------
set modelines=0 " prevent some security exploits w/modelines
" no compatibility with legacy vi
set nocompatible
" backups
set nobackup " don't make backup files
set directory=~/.vim/swp/
" all utf-8 all the time
set encoding=utf-8
" The markdown plugin breaks opening links in markdown documents
let g:polyglot_disabled = ['markdown']
" I got the plug
call plug#begin()
Plug 'altercation/vim-colors-solarized'
Plug 'w0rp/ale'
Plug 'itchyny/lightline.vim'
Plug 'maximbaz/lightline-ale'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-rhubarb'
"Plug 'tpope/vim-markdown'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'sheerun/vim-polyglot'
Plug 'tpope/vim-commentary'
Plug 'ledger/vim-ledger'
Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' }
Plug 'airblade/vim-gitgutter'
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
Plug 'neovim/nvim-lspconfig'
Plug 'psf/black'
" Disable polyglot for markdown
let g:polyglot_disabled = ['markdown']
" kitty-specific strikethrough/undercurl settings
if &term =~ 'xterm\|kitty\|alacritty\|tmux'
let &t_Ts = "\e[9m" " Strikethrough
let &t_Te = "\e[29m"
let &t_Cs = "\e[4:3m" " Undercurl
let &t_Ce = "\e[4:0m"
endif
" I got the plug
call plug#begin()
Plug 'altercation/vim-colors-solarized'
Plug 'dense-analysis/ale'
Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' }
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-cmdline'
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/cmp-vsnip'
Plug 'hrsh7th/vim-vsnip'
Plug 'itchyny/lightline.vim'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'ledger/vim-ledger'
Plug 'lervag/vimtex'
Plug 'maximbaz/lightline-ale'
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
Plug 'neovim/nvim-lspconfig'
Plug 'sheerun/vim-polyglot'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-fugitive'
call plug#end()
let g:lightline = {
\ 'colorscheme': 'solarized',
\ }
let g:lightline.component_expand = {
\ 'linter_checking': 'lightline#ale#checking',
\ 'linter_warnings': 'lightline#ale#warnings',
\ 'linter_errors': 'lightline#ale#errors',
\ 'linter_ok': 'lightline#ale#ok',
\ }
let g:lightline.component_type = {
\ 'linter_checking': 'left',
\ 'linter_warnings': 'warning',
\ 'linter_errors': 'error',
\ 'linter_ok': 'left',
\ }
let g:lightline.active = { 'right': [['lineinfo', 'percent', 'fileformat', 'fileencoding', 'filetype', 'linter_ok', 'linter_checking', 'linter_errors', 'linter_warnings']] }
let g:ale_linters = {}
let g:ale_linters.python =['ruff']
let g:ale_linters.hcl =['terraform', 'tflint']
let g:ale_linters.terraform = ['terraform', 'tflint']
let g:ale_linters.tf = ['terraform', 'tflint']
"let g:ale_linters.yaml = ['yamlls', 'yamllint']
let g:ale_fixers = {}
let g:ale_fixers.terraform = ['terraform']
let g:ale_fixers.tf = ['terraform']
let g:ale_fixers.hcl = ['terraform']
let g:ale_fixers.python = ['black', 'ruff']
" These are installed with pipx
let g:ale_python_flake8_use_global = '1'
let g:ale_python_flake8_options = '--ignore="W391" --max-line-length=88'
let g:ale_python_black_use_global = '1'
let g:ale_python_ruff_use_global = '1'
let g:ale_lint_on_enter = 0
let g:ale_yaml_yamllint_options = '-d "{extends: default,rules: {line-length: disable, indentation: {indent-sequences: consistent}}}"'
let g:ale_linters.go =['staticcheck']
let g:ale_python_black_use_global = '1'
let g:ale_python_ruff_use_global = '1'
"filetype plugin indent on " load file type plugins + indentation
" Colors and fonts
" ------------------------------------
" enable syntax highlighting
"syntax enable
"syntax on
set background=light
colorscheme solarized
let g:solarized_visibility="low"
highlight clear SignColumn
" set signcolumn=number
" User interface
" ------------------------------------
" directory changes depending on what file you're working with
set autochdir
" easiest for interacting with system clipboard
set clipboard=unnamedplus
" basics
set number " line numbers
set ruler " show cursor position all the time
set nojoinspaces " Do not insert 2 spaces after sentences when joining
set ttyfast " Improve smoothness of redraw for newer terminals
set whichwrap+=h,l " Allow cursor keys to line wrap
set showmode " show what mode we're in
set showcmd " display incomplete commands
set wildmenu " better tab-completion for commands
set wildmode=list:longest " list all matches, complete til longest common string
set backspace=indent,eol,start " backspace through everything in insert mode
set cursorline " highlight the current line
set splitbelow " open horizontal split below current
set splitright " open vertical split to the right
" statusline
set ls=2 " always show the status bar
set statusline=%F\ %m%r%w%y\ %{fugitive#statusline()}\ %=(%L\ loc)\ [#\%03.3b\ 0x\%02.2B]\ \ %l,%v\ \ %P
" show them listchars
set list
set listchars=nbsp:·,eol:↵,extends:>,precedes:<,tab:\|\
" searching
set hlsearch " highlight matches
set incsearch " incremental searching
set ignorecase " searches are case insensitive...
set showmatch " jump to match
set smartcase " ... unless they contain at least one capital letter
" Text handling
" ------------------------------------
" tabs and indenting
set autoindent " copy indent from current line
set expandtab " use spaces, not tabs
set tabstop=4 " a tab is 4 spaces
set shiftwidth=4 " an indent is 4 spaces
set smarttab " don't need this?
set softtabstop=4
set nowrap " don't wrap lines
" Indent bulleted lists properly
set comments=://,b:#,:%,:XCOMM,n:>,fb:-,fb:*
" Markdown handling
let g:markdown_folding = 1
"let g:markdown_fenced_languages = ['python', 'bash=sh', 'yaml', 'graphql']
"let g:markdown_minlines = 200
"let g:markdown_fenced_languages = ['python', 'bash=sh']
" Change default format options:
set formatoptions-=t " turn off auto-wrapping type
set formatoptions-=c " turn off auto-wrapping comments
set formatoptions-=r " turn off auto-inserting insert the current comment leader after hitting <Enter> in Insert mode.
set formatoptions+=q " format comments manually with gq
set formatoptions+=n " gq recognizes numbered lists
set formatoptions+=1 " prefer breaking before, not after, a one-letter word
" simply hit enter to clear highlighting after a search
nnoremap <silent> <CR> :noh<CR>
" Ctrl+P fuzzy file finding
noremap <C-p> :Files<Cr>
" For YAML
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType helm setlocal ts=2 sts=2 sw=2 expandtab
" For ledger
au BufNewFile,BufRead *.ldg,*.ledger setf ledger | comp ledger
let g:ledger_maxwidth = 120
let g:ledger_fold_blanks = 1
function LedgerSort()
:%! ledger -f - print --args-only --sort 'date, amount'
:%LedgerAlign
endfunction
command LedgerSort call LedgerSort()
" vim-tex
let g:vimtex_compiler_engine = 'lualatex'
augroup PythonRuffFixer
autocmd!
autocmd User ALEFixPre let b:ale_python_ruff_options = '--select=I'
autocmd User ALEFixPost let b:ale_python_ruff_options = ''
augroup END