-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc.local
More file actions
executable file
·190 lines (161 loc) · 5.63 KB
/
vimrc.local
File metadata and controls
executable file
·190 lines (161 loc) · 5.63 KB
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
" Stop mapping \ to :Ag
unmap \
" force vim to use configured terminal colors
" set t_Co=8
set background=dark
colorscheme moonfly
set history=100 " Default history is only 20
set undolevels=100 " Use more levels of undo
set autoindent " always set autoindenting on
set copyindent " copy the previous indentation on autoindenting
" Search Settings
set ignorecase " case insensitive search
set smartcase " If a capital letter is included in search, make it case-sensitive
set hlsearch " highlight search results
" sounds and appearance
set ruler " ruler on
set nu " Line numbers on
set noerrorbells " don't beep
set vb t_vb= " stops the beeping
set colorcolumn=0
set wrap "soft wrap at edge of window
set linebreak " done linebreak in the middle of a word
"set formatoptions-=t " don't do automatic line breaks
"map ctrl-space to no-op b/c i use it with tmux
imap <Nul> <Nop>
map <Nul> <Nop>
vmap <Nul> <Nop>
cmap <Nul> <Nop>
nmap <Nul> <Nop>
" Mappings to access buffers (don't use "\p" because a
" delay before pressing "p" would accidentally paste).
" \l : list buffers
" \b \f \g : go back/forward/last-used
" \1 \2 \3 : go to buffer 1/2/3 etc
nnoremap \l :ls<CR>
nnoremap \b :bp<CR>
nnoremap \f :bn<CR>
nnoremap \g :e#<CR>
nnoremap \1 :1b<CR>
nnoremap \2 :2b<CR>
nnoremap \3 :3b<CR>
nnoremap \4 :4b<CR>
nnoremap \5 :5b<CR>
nnoremap \6 :6b<CR>
nnoremap \7 :7b<CR>
nnoremap \8 :8b<CR>
nnoremap \9 :9b<CR>
nnoremap \0 :10b<CR>
" It's useful to show the buffer number in the status line.
set laststatus=2 statusline=%02n:%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P
" allow moving to another buffer when current buffer is unsaved
set hidden
" tab completion for filenames
set wildmode=longest,list,full
set wildmenu
" mapping for fuzzy file search
nnoremap <Leader>f :Files<CR>
nnoremap <Leader>b :Buffers<CR>
" Setup for running tests in a tmux pane
" you have to select window: 1; pane: 2 (with the tmux setup)
let test#strategy = "tslime"
let g:test#preserve_screen = 1
nnoremap <Leader>a :TestSuite<CR>
nnoremap <Leader>t :TestFile<CR>
nnoremap <Leader>n :TestNearest<CR>
nnoremap <Leader>l :TestLast<CR>
" send yank to clipboard
set clipboard=unnamed
" keep tslime from asking which session and window
let g:tslime_always_current_session = 1
let g:tslime_always_current_window = 1
" autofix rubocop
nnoremap <Leader>rc :ALEFix<CR>
let g:ale_linter_aliases = {'vue': ['vue', 'javascript']}
let g:ale_linters = {
\ 'ruby': ['rubocop'],
\ 'vue': ['eslint', 'vls']
\}
let g:ale_fixers = {
\ 'ruby': ['rubocop'],
\ 'javascript': ['eslint'],
\ 'vue': ['eslint']
\}
let g:ale_enabled = 1
let g:ale_ruby_rubocop_executable = 'bundle'
let g:ale_virtualtext_cursor = 'disabled'
" keep syntax highlighting from flickering on vue files
" https://github.com/posva/vim-vue#my-syntax-highlighting-stops-working-randomly
autocmd FileType vue syntax sync fromstart
" fix word wrapping / line breaks in markdown files
augroup auFileTypes
autocmd!
autocmd FileType markdown setlocal textwidth=0
autocmd FileType markdown setlocal wrap
autocmd FileType markdown setlocal linebreak
augroup end
" fix elixir file type detection
au BufRead,BufNewFile *.ex,*.exs set filetype=elixir
au BufRead,BufNewFile *.eex,*.heex,*.leex,*.sface,*.lexs set filetype=eelixir
au BufRead,BufNewFile mix.lock set filetype=elixir
" set search matches to yellow (current match is red/orange)
highlight Search ctermbg=DarkYellow ctermfg=0
" turn off spell checking
set nospell
" use ag via fzf to ignore files in .gitignore
let $FZF_DEFAULT_COMMAND = 'ag -g ""'
" toggle NERDTree on / off
nnoremap <Leader>nt :NERDTreeToggle<CR>
" make NERDTree jump to the location of the open buffer
nnoremap <Leader>r :NERDTreeFind<CR>
" Run Hyrax specs in the container.
function! HyraxRspec(cmd) abort
call system("cat README.md | grep 'Hyrax'")
if v:shell_error == 0
" return substitute(a:cmd, 'bundle exec \(.*\)', 'docker-compose exec -w /app/samvera/hyrax-engine app sh -c "bundle exec \1"', '')
return substitute(a:cmd, 'bundle exec \(.*\)', 'docker-compose -f docker-compose-koppie.yml exec -w /app/samvera/hyrax-engine app sh -c "bundle exec \1"', '')
else
return a:cmd
endif
endfunction
" run mix test in debug mode (put `dbg()` in code for breakpoint)
function! DebugMix(cmd) abort
if filereadable('mix.exs')
return 'iex --dbg pry -S '.a:cmd.' --trace'
else
return a:cmd
endif
endfunction
let g:test#custom_transformations = {
\ 'hyrax_ruby': function('HyraxRspec'),
\ 'iex_mix': function('DebugMix')
\ }
let g:test#transformation = 'iex_mix'
" markdown settings
let g:vim_markdown_folding_disabled = 1
let g:vim_markdown_no_default_key_mappings = 1
let g:vim_markdown_conceal = 0
let g:vim_markdown_conceal_code_blocks = 0
let g:mkdp_browser = 'firefox'
" COC configs (selected from https://github.com/neoclide/coc.nvim)
" Always show the signcolumn, otherwise it would shift the text each time
" diagnostics appear/become resolved
set signcolumn=yes
" Use `[g` and `]g` to navigate diagnostics
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list
nmap <silent><nowait> [g <Plug>(coc-diagnostic-prev)
nmap <silent><nowait> ]g <Plug>(coc-diagnostic-next)
" GoTo code navigation
nmap <silent><nowait> gd <Plug>(coc-definition)
nmap <silent><nowait> gy <Plug>(coc-type-definition)
nmap <silent><nowait> gi <Plug>(coc-implementation)
nmap <silent><nowait> gr <Plug>(coc-references)
" Use K to show documentation in preview window
nnoremap <silent> K :call ShowDocumentation()<CR>
function! ShowDocumentation()
if CocAction('hasProvider', 'hover')
call CocActionAsync('doHover')
else
call feedkeys('K', 'in')
endif
endfunction