.vimrc updates
75d4df3c0f5e929d001d5daef50352d1158a0f95
1 parent
6ec8f520
.vimrc
+13 -2
| 99 | 99 | " Per file-type indentation |
|
| 100 | 100 | au FileType haskell setlocal sts=4 sw=4 expandtab formatprg=stylish-haskell |
|
| 101 | 101 | au FileType javascript setlocal sts=4 sw=4 expandtab |
|
| 102 | 102 | au FileType css setlocal ts=4 sw=4 noexpandtab |
|
| 103 | 103 | au FileType go setlocal ts=4 sw=4 noexpandtab |
|
| 104 | - | au FileType c,cpp setlocal sw=4 noexpandtab |
|
| 104 | + | au FileType c,cpp,glsl setlocal sw=4 noexpandtab |
|
| 105 | 105 | au FileType lua setlocal sw=2 expandtab |
|
| 106 | 106 | au FileType sh,zsh setlocal ts=2 sw=2 noexpandtab |
|
| 107 | 107 | au FileType vim,ruby setlocal sts=2 sw=2 expandtab |
|
| 108 | 108 | au FileType help setlocal ts=4 sw=4 noexpandtab |
|
| 109 | 109 | au FileType txt setlocal noai nocin nosi inde= wrap linebreak |
| 115 | 115 | au BufRead,BufNewFile *.md setf markdown |
|
| 116 | 116 | au BufRead,BufNewFile *.tex setf tex |
|
| 117 | 117 | au BufRead,BufNewFile *.todo setf todo |
|
| 118 | 118 | au BufRead,BufNewFile *.tikz setf tex |
|
| 119 | 119 | ||
| 120 | + | au TermOpen * set nonumber modifiable |
|
| 121 | + | ||
| 120 | 122 | " Remove trailing whitespace on save |
|
| 121 | 123 | autocmd BufWritePre * call s:StripTrailing() |
|
| 122 | 124 | function! s:StripTrailing() |
|
| 123 | 125 | let l = line(".") |
|
| 124 | 126 | let c = col(".") |
| 147 | 149 | if executable('haskell-tags') |
|
| 148 | 150 | au BufWritePost *.hs silent !haskell-tags % '.tags' |
|
| 149 | 151 | au BufWritePost *.hsc silent !haskell-tags % '.tags' |
|
| 150 | 152 | endif |
|
| 151 | 153 | ||
| 154 | + | if executable('ctags') |
|
| 155 | + | au BufWritePost *.c silent !ctags -f .tags -R . |
|
| 156 | + | au BufWritePost *.h silent !ctags -f .tags -R . |
|
| 157 | + | endif |
|
| 158 | + | ||
| 152 | 159 | " File-type |
|
| 153 | 160 | filetype on |
|
| 154 | 161 | filetype plugin on |
|
| 155 | 162 | filetype indent on |
|
| 156 | 163 |
| 202 | 209 | nnoremap <leader>p V`] |
|
| 203 | 210 | ||
| 204 | 211 | " Switch buffers easily |
|
| 205 | 212 | nnoremap <Tab> <C-^> |
|
| 206 | 213 | ||
| 214 | + | " Switch between .c and .h files easily |
|
| 215 | + | nnoremap <silent> <S-Tab> :e %:p:s,.h$,.X123X,:s,.c$,.h,:s,.X123X$,.c,<CR> |
|
| 216 | + | ||
| 207 | 217 | " Actually easier to type and I do it by mistake anyway |
|
| 208 | 218 | cnoreabbrev W w |
|
| 209 | 219 | cnoreabbrev Q q |
|
| 210 | 220 | ||
| 211 | 221 | " Ack |
| 232 | 242 | if has("nvim") |
|
| 233 | 243 | tnoremap <Esc> <C-\><C-n> |
|
| 234 | 244 | endif |
|
| 235 | 245 | ||
| 236 | 246 | if executable('rg') |
|
| 237 | - | let g:ackprg = 'rg -S --no-heading --vimgrep' |
|
| 247 | + | let g:ackprg = 'rg -F -S --no-heading --vimgrep' |
|
| 248 | + | set grepprg=rg\ -S\ -F\ --no-heading\ --vimgrep\ $* |
|
| 238 | 249 | endif |
|
| 239 | 250 | ||
| 240 | 251 | " Syntax coloring |
|
| 241 | 252 | syntax enable |
|
| 242 | 253 |