1
0
mirror of https://git.decapod.one/brethil/dotfiles synced 2024-12-27 09:41:31 +01:00
dotfiles/vim/vimrc

Failed to ignore revisions in .git-blame-ignore-revs.

96 lines
2.7 KiB
VimL
Raw Normal View History

2021-09-26 17:32:11 +02:00
let g:uname = system('uname | tr -d "\n"') " Get platform name (stripping the trailing newline)
2021-12-08 23:58:55 +01:00
" Install all plugins
2020-12-06 02:29:15 +01:00
source $DOTFILES/vim/plugs.vim
" Sanity
set encoding=utf-8
scriptencoding utf-8
2021-09-26 16:07:34 +02:00
"" Style
" enable truecolor mode
2021-12-08 23:04:34 +01:00
if has("termguicolors")
set termguicolors
else
let &t_8f = "\<Esc>[38:2:%lu:%lu:%lum"
let &t_8b = "\<Esc>[48:2:%lu:%lu:%lum"
endif
2020-12-06 02:29:15 +01:00
set background=dark
2021-03-08 10:06:31 +01:00
let g:gruvbox_contrast_dark='hard'
2021-05-19 10:38:33 +02:00
let g:gruvbox_sign_column='bg0'
2021-09-26 16:07:34 +02:00
" Show some gui colors in term
let g:gruvbox_guisp_fallback='bg'
2020-12-06 02:29:15 +01:00
colorscheme gruvbox
" General stuff
set nowrap
set mouse=a
set relativenumber number
2021-01-09 23:54:20 +01:00
set foldlevelstart=3 foldmethod=indent foldenable "without nofoldenable all folds are closed at startup"
2020-12-06 02:29:15 +01:00
set ttymouse=xterm2 " fix mouse when used in tmux/byobu https://unix.stackexchange.com/q/50733
2020-12-07 15:37:55 +01:00
set nobackup nowb noswapfile " no need for backups of every file
2020-12-06 02:29:15 +01:00
set history=10000
set list listchars=tab:\ ,trail:•,extends:#,nbsp:.
set splitbelow splitright
set autoread
" Don't redraw while executing macros (good performance config)
set lazyredraw
set ignorecase smartcase " ignore case on search but be smart about it
set hlsearch "highlight search results (using *)
2020-12-09 01:54:42 +01:00
set expandtab shiftwidth=4 tabstop=4 "always use spaces
" Completion menu config (see :h completopt)
set completeopt=menu,menuone,noselect,noinsert
" Show completion suggestions in popups instead of preview window
set completeopt+=popup
2021-09-26 16:09:15 +02:00
" Highlight the line the cursor is on
set cursorline
2021-05-19 10:44:07 +02:00
autocmd FileType qf,ll setlocal wrap "quickfix,loclist
2021-10-01 11:00:42 +02:00
autocmd FileType markdown setlocal wrap spell spelllang=it,en
2020-12-06 02:29:15 +01:00
autocmd FileType yaml,yml setlocal shiftwidth=2 softtabstop=2 expandtab
2021-01-07 11:08:00 +01:00
autocmd FileType vue setlocal shiftwidth=2 softtabstop=2 expandtab
2021-10-01 16:56:32 +02:00
autocmd FileType go setlocal noexpandtab makeprg=go\ build
autocmd FileType rust set makeprg=cargo\ build
autocmd FileType python set keywordprg="pydoc"
2021-10-01 16:56:32 +02:00
2021-12-08 23:57:20 +01:00
syntax match jsonComment "//.*"
syntax match jsonComment "\(/\*\)\|\(\*/\)"
hi def link jsonComment Comment
2021-09-27 08:45:07 +02:00
au BufRead dvc.yaml let b:ale_fix_on_save=0
au BufRead *.dvc let b:ale_fix_on_save=0
au BufRead *.dvc set filetype=yaml
2021-02-19 08:52:16 +01:00
2020-12-06 23:20:21 +01:00
au BufRead,BufNewFile */playbooks/*.yml set filetype=yaml.ansible
au BufRead,BufNewFile rules.v[46] *.rules setlocal filetype=iptables
2020-12-06 23:20:21 +01:00
2020-12-09 01:54:42 +01:00
if has('persistent_undo')
set undodir=$HOME/.vim/undo
set undofile
endif
2020-12-06 02:29:15 +01:00
" Return to last edit position when opening files (from amix's vimrc)
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
" Bash like keys for the command line
cnoremap <C-A> <Home>
cnoremap <C-E> <End>
cnoremap <C-K> <C-U>
cnoremap <C-P> <Up>
cnoremap <C-N> <Down>
source $DOTFILES/vim/plugins_config.vim
source $DOTFILES/vim/shortcuts.vim
source $DOTFILES/vim/functions.vim