summaryrefslogtreecommitdiffstats
path: root/vim/vimrc-decent
blob: 1ffccc6e2046838ec13c9aa2ad19db67350e9ca4 (plain) (blame)
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
filetype plugin on
filetype plugin indent on

"source ~/.vim/grep.vim

let maplocalleader = "\\"
let mapleader = ","

set autoread
set foldmethod=manual
set autowrite
set backspace=indent,eol,start
"set colorcolumn=80
"set cursorline
set completeopt=menuone,longest
set display=truncate
set equalalways
set fileformat=unix
set hidden
set history=1000
set ignorecase
set incsearch
set infercase
set laststatus=2
"set list
set listchars=nbsp:%,tab:▸\ ,trail:_,eol:¬,precedes:←,extends:→
set matchtime=8
set nobackup
set nocompatible
set nohlsearch
set nojoinspaces
set nomodeline
set noshelltemp
set noswapfile
set noundofile
set nowritebackup
set path+=**
set report=0
set ruler
set scrolloff=5
set shell=bash
set shortmess+=c
set showcmd
set showmatch
set showmode
set signcolumn=number
set splitright
set tabstop=4 softtabstop=4 shiftwidth=4 expandtab
set ttimeout
set ttimeoutlen=100
"set viminfo=
set wildmenu
set wildoptions=pum
set wildmode=full
set wildignore=**/__pycache*/**
set wrap
packadd! matchit

nnoremap <leader>ev <C-w>s<C-w>j<C-w>L:e $HOME/.vim/vimrc<cr>
if (exists("*strftime"))
	noremap <silent> <leader>date "=strftime("%F")<CR>p9h
	noremap <silent> <leader>time "=strftime("%X")<CR>p7h
endif
nnoremap <leader><space> :noh<cr>:call clearmatches()<cr>
noremap <silent> J 10j
noremap <silent> K 10k
command! W w
let @x = 'o- [ ] '

" FZF

nnoremap <leader><C-p> :<C-u>FZF!<CR>
nnoremap <C-p>g :Files<CR>
nnoremap <C-p>p :GitFiles<CR>
nnoremap <leader>o :Tags<CR>
nnoremap <leader>h :History<CR>
nnoremap <silent> <leader>0 :Files<CR>
nnoremap <silent> <leader>; :BLines<CR>
nnoremap <silent> <leader>l :Lines<CR>
nnoremap <silent> <leader>o :BTags<CR>
nnoremap <C-p>b :Buffers<CR>
nnoremap <silent> <leader>? :History:<CR>
nnoremap <silent> <leader>/ :execute 'Ag ' . input('Ag/')<CR>
nnoremap <silent> <leader>ft :Filetypes<CR>
nnoremap <silent> <leader>CC :Commands<CR>

" vim-test
nmap <silent> tn :TestNearest<CR>
nmap <silent> tf :TestFile<CR>
nmap <silent> ts :TestSuite<CR>
nmap <silent> tl :TestLast<CR>
nmap <silent> <leader>tv :TestVisit<CR>
let test#strategy = "basic"
let test#python#pytest#options = '-q -s'
let test#python#runner = 'pytest'
let test#vimterminal#term_position = "belowright"

" snippets
let g:UltiSnipsEditSplit = "vertical"
let g:UltiSnipsListSnippets = "<leader>s"
let g:UltiSnipsExpandTrigger = "<c-j>"
let g:UltiSnipsJumpForwardTrigger = "<c-j>"
let g:UltiSnipsJumpBackwardTrigger = "<c-k>"


if executable('rg')
    set grepprg=rg\ --color=never\ --vimgrep
endif

" and search with ripgrep
command! -bang -nargs=* Rg
      \ call fzf#vim#grep(
      \   'rg --column --line-number --no-heading --color=always --ignore-case '.shellescape(<q-args>), 1,
      \   <bang>0 ? fzf#vim#with_preview('up:60%')
      \           : fzf#vim#with_preview('right:50%:hidden', '?'),
      \   <bang>0)

nnoremap <C-p>a :Rg 

augroup textfiles
  autocmd!
  autocmd filetype markdown setlocal spell spelllang=en
augroup end

call plug#begin()
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'mhinz/vim-signify'
Plug 'vim-test/vim-test'
Plug 'ledger/vim-ledger'
Plug 'fatih/vim-go', {'do': ':GoUpdateBinaries' }
Plug 'tpope/vim-dispatch'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-unimpaired'
Plug 'tpope/vim-fugitive'
Plug 'SirVer/UltiSnips'
Plug 'honza/vim-snippets'
Plug 'dense-analysis/ale'
call plug#end()

" ALE
let g:ale_enabled = 1
let g:ale_set_balloons = 0
let g:ale_echo_msg_format = '[%linter%] %s [%severity%]'
let g:ale_sign_error = '!'
let g:ale_sign_warning = '?'
let g:ale_lint_on_text_changed = 1
let g:ale_hover_cursor = 1
let g:ale_virtualtext_cursor = 'disabled'
let g:ale_sign_column_always = 1
let g:ale_open_list = 0
let g:ale_set_highlights = 1
let g:ale_set_signs = 1
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 1
let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'ALE Error'
let g:ale_echo_msg_format = 'ALE: %linter% - %code: %%s'
let g:ale_loclist_msg_format = 'ALE: %linter% - %code: %%s'
let g:ale_echo_msg_warning_str = 'ALE Warning'
let g:ale_linters = {'python': ['pyright', 'ruff', 'flake8', 'mypy'],
\                    'ocaml': ['merlin'],
\					 'javascript': ['eslint'],
\                    'cpp': ['clangd'],
\                    'yaml': ['yamllint'],
\                    'c': ['clangd'],
\                    'go': ['gopls', 'golint', 'gofmt'],
 \}
let g:ale_fixers = {
\           'python': ['autoimport', 'ruff', 'isort', 'yapf', 'black'],
\	        'javascript': ['eslint'],
\           'go': ['gofmt', 'goimports', 'gopls'],
\	        'cpp': ['clang-format'],
\	        'c': ['clang-format'],
\           'rust': ['rustfmt']
\           }
let g:ale_python_mypy_ignore_invalid_syntax = 1
let g:ale_python_mypy_executable = 'mypy'
let g:ale_python_mypy_options = '--config-file mypy.ini'
" let g:ale_sign_error = '>>'
let g:ale_fix_on_save = 1
let g:ale_linters_explicit = 0
let g:ale_completion_enabled = 0
" Map movement through errors without wrapping.
" nmap <silent> <C-k> <Plug>(ale_previous)
" nmap <silent> <C-j> <Plug>(ale_next)
" OR map keys to use wrapping.
nmap <silent> <C-k> <Plug>(ale_previous_wrap)
nmap <silent> <C-j> <Plug>(ale_next_wrap)

set background=dark
colorscheme koehler
"syntax off