You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
170 lines
5.6 KiB
170 lines
5.6 KiB
" Colors {{{ |
|
color molokai |
|
set background=dark |
|
let g:rehash256 = 1 |
|
" }}} |
|
|
|
" Functions {{{ |
|
" Removes trailing spaces {{{ |
|
function TrimWhiteSpace() |
|
%s/\s\+$// |
|
'' |
|
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 {{{ |
|
set cursorline " highlight the line in which the cursor is |
|
set foldmethod=marker " folding will use markers |
|
set nowrap " instead of wrapping the text to the next line, scroll left and right |
|
set laststatus=2 " Always display the status line |
|
set showtabline=2 " Always display the tab bar |
|
set scrolloff=2 " Lines around the cursor that should be visible |
|
set splitright " Open new vertical splits on the right side, instead of left |
|
set splitbelow " Opne new horizontal splits below the current on, not on top |
|
let mapleader=" " " Leader (special character for plugins) is Space |
|
|
|
let g:rainbow_active = 1 " This is part of the Rainbow brackets, enabling it globally. |
|
" }}} |
|
|
|
" Mappings {{{ |
|
nnoremap - :Ex<CR> |
|
nnoremap <silent> <leader>c :call TrimWhiteSpace()<CR> |
|
" }}} |
|
|
|
" Plugin configuration {{{ |
|
" Airline {{{ |
|
let g:airline_theme='minimalist' |
|
let g:airline#extensions#tabline#enabled = 1 |
|
let g:airline#extensions#tabline#show_buffers = 0 |
|
let g:airline#extensions#tabline#show_close_button = 0 |
|
let g:airline#extensions#tabline#formatter = 'unique_tail' |
|
" }}} |
|
|
|
" Skim {{{ |
|
nmap <silent> <Leader><Space> :SK<CR> |
|
" }}} |
|
|
|
" Polyglot {{{ |
|
" let g:polyglot_disabled = ["csv"] |
|
let g:polyglot_disabled = ['sensible', 'csv'] |
|
" }}} |
|
|
|
" LanguageClient {{{ |
|
" Available analyzers. |
|
let g:LanguageClient_serverCommands = { |
|
\ 'rust': ['rust-analyzer'], |
|
\ 'python': ['pyls'], |
|
\ } |
|
" Display hints in the location list (default is QuickFix, which conflicts |
|
" with `:grep`). |
|
let g:LanguageClient_selectionUI = 'location-list' |
|
let g:LanguageClient_diagnosticsList = 'Location' |
|
" No signs in the gutter |
|
let g:LanguageClient_diagnosticsSignsMax = 0 |
|
|
|
nnoremap <silent> <leader>] :call LanguageClient#textDocument_definition()<CR> |
|
nnoremap <silent> <leader>k :call LanguageClient#textDocument_hover()<CR> |
|
nnoremap <silent> <leader>r :call LanguageClient#textDocument_rename()<CR> |
|
nnoremap <silent> <leader>f :call LanguageClient#textDocument_codeAction()<CR> |
|
nnoremap <silent> <leader>? :call LanguageClient_contextMenu()<CR> |
|
" }}} |
|
|
|
" }}} |
|
|
|
" Filetype specific configurations {{{ |
|
" Vim files {{{ |
|
au FileType vim setlocal noexpandtab " use real tabs |
|
au FileType vim setlocal tabstop=4 " display tabs as 4 spaces |
|
au FileType vim setlocal shiftwidth=4 " Use 4 spaces when auto-indenting |
|
" }}} |
|
|
|
" Python {{{ |
|
au FileType python setlocal number " show line numbers |
|
au FileType python setlocal expandtab " use spaces instead of tabs |
|
au FileType python setlocal tabstop=4 " number of spaces to use for indentation |
|
au FileType python setlocal shiftwidth=4 " number of spaces to use for auto-indentation |
|
au FileType python setlocal softtabstop=4 " when deleting characters, consider 4 spaces as a tab |
|
au FileType python setlocal textwidth=79 " max line size |
|
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 nmap <silent> <Leader>a :call JumpToAlternate()<CR> |
|
" }}} |
|
|
|
" CSV files {{{ |
|
au FileType csv setlocal list " Display special characters, like tabs (for TSV files) |
|
" }}} |
|
|
|
" Rust {{{ |
|
let g:rustfmt_autosave = 1 " Apply `rustfmt` when saving the file. |
|
|
|
au FileType rust setlocal number " show line numbers |
|
au FileType rust setlocal expandtab " use spaces instead of tabs |
|
au FileType rust setlocal tabstop=4 " number of spaces to use for indentation |
|
au FileType rust setlocal shiftwidth=4 " number of spaces to use for auto-indentation |
|
au FileType rust setlocal softtabstop=4 " when deleting characters, consider 4 spaces as a tab |
|
au FileType rust setlocal textwidth=79 " max line size |
|
au FileType rust setlocal colorcolumn=80 " put a margin indicator |
|
" }}} |
|
|
|
" Markdown {{{ |
|
au FileType markdown setlocal spell " enable spell checking |
|
au FileType markdown setlocal textwidth=79 " max line size |
|
au FileType markdown setlocal expandtab " use spaces instead of tabs |
|
" }}} |
|
|
|
" Shell {{{ |
|
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 softtabstop=4 " when deleting characters, consider 4 spaces as a tab |
|
" }}} |
|
|
|
" SQL {{{ |
|
au FileType sql setlocal softtabstop=2 |
|
au FileType sql setlocal shiftwidth=2 |
|
au FileType sql setlocal tabstop=2 |
|
" }}} |
|
|
|
" HTMLDjango {{{ |
|
au FileType htmldjango setlocal tabstop=4 |
|
au FileType htmldjango setlocal shiftwidth=4 |
|
au FileType htmldjango setlocal softtabstop=4 |
|
au FileType htmldjango setlocal list |
|
au FileType htmldjango setlocal et |
|
" }}} |
|
|
|
" HTML {{{ |
|
au FileType html setlocal tabstop=4 |
|
au FileType html setlocal shiftwidth=4 |
|
au FileType html setlocal softtabstop=4 |
|
au FileType html setlocal list |
|
au FileType html setlocal et |
|
" }}} |
|
" }}} |
|
|
|
" GUI configuration {{{ |
|
set guifont=Cascadia\ Mono:h40 |
|
let g:neovide_no_idle=v:true |
|
let g:neovide_fullscreen=v:true |
|
let g:neovide_cursor_antialiasing=v:true |
|
let g:neovide_cursor_animation_length=0.05 |
|
" }}}
|
|
|