dotfiles/nvim/init.vim

98 lines
2.5 KiB
VimL

" Baco's Neovim init file
" Some defaults to start with
runtime! defaults.vim
if !has('vms') && has('persistent_undo')
set undofile " keep an undo file (undo changes after closing)
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 clipboard+=unnamed,unnamedplus
vmap <LeftRelease> ygv
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
if has('autocmd')
augroup TerminalStuff
autocmd!
autocmd TermOpen * startinsert
autocmd TermOpen * setlocal nonumber norelativenumber
autocmd BufEnter * if &buftype == 'terminal' | :startinsert | endif
autocmd TermClose * call feedkeys('\<cr>')
augroup END
endif
command -nargs=? Terminal rightbelow 16split +terminal\ <args>
nnoremap <silent> <leader>tt :rightbelow 16split +terminal<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
silent! colorscheme onedark
if exists('g:colors_name') && g:colors_name == 'onedark'
if has('termguicolors')
set termguicolors
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