|
|
@ -4,12 +4,31 @@ let g:rehash256 = 1 |
|
|
|
" }}} |
|
|
|
" }}} |
|
|
|
|
|
|
|
|
|
|
|
" Functions {{{ |
|
|
|
" Functions {{{ |
|
|
|
" Removes trailing spaces {{{{ |
|
|
|
" Removes trailing spaces {{{ |
|
|
|
function TrimWhiteSpace() |
|
|
|
function TrimWhiteSpace() |
|
|
|
%s/\s\+$// |
|
|
|
%s/\s\+$// |
|
|
|
'' |
|
|
|
'' |
|
|
|
endfunction |
|
|
|
endfunction |
|
|
|
" }}}} |
|
|
|
" }}} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
" Jump to alternate file {{{ |
|
|
|
|
|
|
|
function JumpToAlternate() |
|
|
|
|
|
|
|
let l:curr_path = expand("%:h") |
|
|
|
|
|
|
|
let l:basename = expand("%:t") |
|
|
|
|
|
|
|
if stridx(basename, "test_") == 0 |
|
|
|
|
|
|
|
let l:new_file = l:basename[5:strlen(l:basename)] |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
let l:new_file = "test_" . l:basename |
|
|
|
|
|
|
|
endif |
|
|
|
|
|
|
|
let l:new_file = l:curr_path . '/' . l:new_file " WARN: Unixism |
|
|
|
|
|
|
|
let l:buffer = bufnr(l:new_file) |
|
|
|
|
|
|
|
if l:buffer == -1 |
|
|
|
|
|
|
|
exe 'tabe ' .l:new_file |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
call win_gotoid(get(win_findbuf(l:buffer), 0)) |
|
|
|
|
|
|
|
endif |
|
|
|
|
|
|
|
endfunction |
|
|
|
|
|
|
|
" }}} |
|
|
|
" }}} |
|
|
|
" }}} |
|
|
|
|
|
|
|
|
|
|
|
" Settings for all files {{{ |
|
|
|
" Settings for all files {{{ |
|
|
@ -27,29 +46,29 @@ map <Leader>c <silent> :call TrimWhiteSpace()<CR> |
|
|
|
" }}} |
|
|
|
" }}} |
|
|
|
|
|
|
|
|
|
|
|
" Plugin configuration {{{ |
|
|
|
" Plugin configuration {{{ |
|
|
|
" Airline {{{{ |
|
|
|
" Airline {{{ |
|
|
|
let g:airline_theme='minimalist' |
|
|
|
let g:airline_theme='minimalist' |
|
|
|
let g:airline#extensions#tabline#enabled = 1 |
|
|
|
let g:airline#extensions#tabline#enabled = 1 |
|
|
|
let g:airline#extensions#tabline#show_buffers = 0 |
|
|
|
let g:airline#extensions#tabline#show_buffers = 0 |
|
|
|
let g:airline#extensions#tabline#show_close_button = 0 |
|
|
|
let g:airline#extensions#tabline#show_close_button = 0 |
|
|
|
let g:airline#extensions#tabline#formatter = 'unique_tail' |
|
|
|
let g:airline#extensions#tabline#formatter = 'unique_tail' |
|
|
|
" }}}} |
|
|
|
" }}} |
|
|
|
|
|
|
|
|
|
|
|
" Skim {{{{ |
|
|
|
" Skim {{{ |
|
|
|
nmap <silent> <Leader><Space> :SK<CR> |
|
|
|
nmap <silent> <Leader><Space> :SK<CR> |
|
|
|
" }}}} |
|
|
|
" }}} |
|
|
|
" }}} |
|
|
|
" }}} |
|
|
|
|
|
|
|
|
|
|
|
" Filetype specific configurations {{{ |
|
|
|
" Filetype specific configurations {{{ |
|
|
|
" Vim files {{{{ |
|
|
|
" Vim files {{{ |
|
|
|
augroup vim |
|
|
|
augroup vim |
|
|
|
au FileType vim setlocal noexpandtab " use real tabs |
|
|
|
au FileType vim setlocal noexpandtab " use real tabs |
|
|
|
au FileType vim setlocal tabstop=4 " display tabs as 4 spaces |
|
|
|
au FileType vim setlocal tabstop=4 " display tabs as 4 spaces |
|
|
|
au FileType vim setlocal shiftwidth=4 " Use 4 spaces when auto-indenting |
|
|
|
au FileType vim setlocal shiftwidth=4 " Use 4 spaces when auto-indenting |
|
|
|
augroup END |
|
|
|
augroup END |
|
|
|
" }}}} |
|
|
|
" }}} |
|
|
|
|
|
|
|
|
|
|
|
" Python {{{{ |
|
|
|
" Python {{{ |
|
|
|
augroup python |
|
|
|
augroup python |
|
|
|
au FileType python setlocal number " show line numbers |
|
|
|
au FileType python setlocal number " show line numbers |
|
|
|
au FileType python setlocal expandtab " use spaces instead of tabs |
|
|
|
au FileType python setlocal expandtab " use spaces instead of tabs |
|
|
@ -59,25 +78,26 @@ augroup python |
|
|
|
au FileType python setlocal textwidth=79 " max line size |
|
|
|
au FileType python setlocal textwidth=79 " max line size |
|
|
|
au FileType python setlocal colorcolumn=80 " put a margin indicator |
|
|
|
au FileType python setlocal colorcolumn=80 " put a margin indicator |
|
|
|
au FileType python au BufWritePre <buffer> %s/\s\+$//e " When saving a Python file, remove tailing spaces |
|
|
|
au FileType python au BufWritePre <buffer> %s/\s\+$//e " When saving a Python file, remove tailing spaces |
|
|
|
|
|
|
|
au FileType python nmap <Leader>a <silent> :call JumpToAlternate()<CR> |
|
|
|
|
|
|
|
|
|
|
|
" Shortcut to add pylint disables |
|
|
|
" Shortcut to add pylint disables |
|
|
|
au FileType python iab lint # pylint: disable |
|
|
|
au FileType python iab lint # pylint: disable |
|
|
|
augroup END |
|
|
|
augroup END |
|
|
|
" }}}} |
|
|
|
" }}} |
|
|
|
|
|
|
|
|
|
|
|
" CSV files {{{{ |
|
|
|
" CSV files {{{ |
|
|
|
augroup csv |
|
|
|
augroup csv |
|
|
|
au FileType csv setlocal list " Display special characters, like tabs (for TSV files) |
|
|
|
au FileType csv setlocal list " Display special characters, like tabs (for TSV files) |
|
|
|
augroup END |
|
|
|
augroup END |
|
|
|
" }}}} |
|
|
|
" }}} |
|
|
|
|
|
|
|
|
|
|
|
" Rust {{{{ |
|
|
|
" Rust {{{ |
|
|
|
" Apply `rustfmt` when saving the file. Because this is related to the syntax |
|
|
|
" Apply `rustfmt` when saving the file. Because this is related to the syntax |
|
|
|
" file and not something on the buffer itself, we can set it globally. |
|
|
|
" file and not something on the buffer itself, we can set it globally. |
|
|
|
let g:rustfmt_autosave = 1 |
|
|
|
let g:rustfmt_autosave = 1 |
|
|
|
" }}}} |
|
|
|
" }}} |
|
|
|
|
|
|
|
|
|
|
|
" Markdown {{{{ |
|
|
|
" Markdown {{{ |
|
|
|
augroup markdown |
|
|
|
augroup markdown |
|
|
|
au FileType markdown setlocal iskeyword+=: " this is kinda of a "hack" to make abbr accept ":" in them |
|
|
|
au FileType markdown setlocal iskeyword+=: " this is kinda of a "hack" to make abbr accept ":" in them |
|
|
|
" This is a long abbreviation, but: |
|
|
|
" This is a long abbreviation, but: |
|
|
@ -94,13 +114,13 @@ augroup markdown |
|
|
|
au FileType markdown setlocal textwidth=79 " max line size |
|
|
|
au FileType markdown setlocal textwidth=79 " max line size |
|
|
|
au FileType markdown setlocal expandtab " use spaces instead of tabs |
|
|
|
au FileType markdown setlocal expandtab " use spaces instead of tabs |
|
|
|
augroup END |
|
|
|
augroup END |
|
|
|
" }}}} |
|
|
|
" }}} |
|
|
|
|
|
|
|
|
|
|
|
" Shell {{{{ |
|
|
|
" Shell {{{ |
|
|
|
augroup shell |
|
|
|
augroup shell |
|
|
|
au FileType sh setlocal tabstop=4 " display tabs as 4 spaces |
|
|
|
au FileType sh setlocal tabstop=4 " display tabs as 4 spaces |
|
|
|
au FileType sh setlocal shiftwidth=4 " number of spaces to use for auto-indentation |
|
|
|
au FileType sh setlocal shiftwidth=4 " number of spaces to use for auto-indentation |
|
|
|
au FileType sh setlocal softtabstop=4 " when deleting characters, consider 4 spaces as a tab |
|
|
|
au FileType sh setlocal softtabstop=4 " when deleting characters, consider 4 spaces as a tab |
|
|
|
augroup END |
|
|
|
augroup END |
|
|
|
" }}}} |
|
|
|
" }}} |
|
|
|
" |
|
|
|
" }}} |
|
|
|