dotfiles/vim/vimrc

97 lines
2.6 KiB
VimL

" Baco's Vimrc file
" Some defaults to start with
runtime! defaults.vim
runtime! vimrc_example.vim
if has('persistent_undo')
set nobackup " do not keep a backup file, use undo instead
endif
" Essentials
set number
set relativenumber
set cursorline
set tabstop=4 shiftwidth=4
set softtabstop=4 " If not 0, must coincide with "tabstop" for tabs indentation
" and with "shiftwidth" for spaces indentation
set list listchars=tab:→ ,trail
let &colorcolumn = join(range(80+1, 256), ',')
set directory^=~/.local/share/vim/swap//
set undodir^=~/.local/share/vim/undo
set backupdir^=~/.local/share/vim/backup
set switchbuf+=usetab,newtab
" Coding Styles
if has('autocmd')
" Restore some :filetype defaults overrided by setting ts, sw and sts
autocmd FileType c setlocal tabstop=8 shiftwidth=8 softtabstop=0
" Ensure spelling is loaded when writting text. Also start insert
augroup GitStuff
autocmd!
autocmd FileType gitcommit setlocal spell nonumber norelativenumber
autocmd FileType gitcommit startinsert
augroup END
endif
" Extras
let g:vimsyn_embed = 'Pl'
let g:indentLine_char = '⦙'
let g:indentLine_leadingSpaceChar = '·'
let g:indentLine_leadingSpaceEnabled = v:true
runtime! language_server.vim
command -nargs=? Terminal rightbelow terminal ++rows=16 <args>
nnoremap <silent> <leader>tt :rightbelow terminal ++rows=16<CR>
tnoremap <Esc> <C-\><C-n><C-w>p
" Theming
let g:aldmeris_transparent = v:true
let g:aldmeris_termcolors = 'tango'
let g:onedark_terminal_italics = v:true
" onedark.vim override: Don't set a background color when running in a
" terminal; just use the terminal's background color
if has('autocmd') && !has('gui_running')
augroup colorset
autocmd!
autocmd ColorScheme onedark silent!
\ call onedark#extend_highlight('Normal', {'bg': {'gui': 'NONE'}})
augroup END
endif
packadd onedark.vim " Fix because Vim ignores the start dir for this package
silent! colorscheme onedark
if exists('g:colors_name') && g:colors_name == 'onedark'
if has('termguicolors')
set termguicolors
if !empty($TMUX) && (&term =~ 'tmux' || &term =~ 'screen')
" When using termguicolors :help xterm-true-color
let &t_8f = "\<Esc>[38:2:%lu:%lu:%lum"
let &t_8b = "\<Esc>[48:2:%lu:%lu:%lum"
endif
endif
endif
" Misc
let g:airline#extensions#tabline#enabled = v:true
let g:airline#extensions#tabline#buffer_min_count = 2
let g:airline_mode_map = {
\ '__': '-',
\ 'n': 'N',
\ 'i': 'I',
\ 'R': 'R',
\ 'c': 'C',
\ 'v': 'V',
\ 'V': 'V-L',
\ '': 'V',
\ 's': 'S',
\ }
let g:airline#extensions#tagbar#flags = 'f' " Requires majutsushi/tagbar plugin