Update .vimrc

This commit is contained in:
Mikkel Svartveit 2023-03-21 21:38:10 +01:00
parent 9684146a08
commit 16a0fcf9ac

View file

@ -1,5 +1,6 @@
" Some nice defaults borrowed from Neovim
set nocompatible
set hidden
set autoindent
set autoread
set belloff=all
@ -15,8 +16,12 @@ set ttimeoutlen=50
set ttyfast
set wildmenu
syntax on
" Set cursor to block in normal mode and line in insert mode
let &t_SI = "\e[6 q"
let &t_EI = "\e[2 q"
let &t_ti .= "\e[2 q"
let &t_te .= "\e[6 q"
" Set relative line numbers to make it easier to jump to a line
set number
@ -48,17 +53,30 @@ set breakindent
" Always show 4 lines above and below the cursor
set scrolloff=4
" Press Enter to clear search highlighting
nnoremap <silent><CR> :nohlsearch<CR>
" Allow using uppercase W and Q commands to save/quit
command WQ wq
command Wq wq
command W w
command Q q
" Make yank use system clipboard as default
nnoremap <expr> y (v:register ==# '"' ? '"+' : '') . 'y'
nnoremap <expr> yy (v:register ==# '"' ? '"+' : '') . 'yy'
nnoremap <expr> Y (v:register ==# '"' ? '"+' : '') . 'Y'
xnoremap <expr> y (v:register ==# '"' ? '"+' : '') . 'y'
xnoremap <expr> Y (v:register ==# '"' ? '"+' : '') . 'Y'
" Map 'gp' to paste from system clipboard
nnoremap <expr> gp (v:register ==# '"' ? '"+' : '') . 'p'
nnoremap <expr> gP (v:register ==# '"' ? '"+' : '') . 'P'
xnoremap <expr> gp (v:register ==# '"' ? '"+' : '') . 'p'
xnoremap <expr> gP (v:register ==# '"' ? '"+' : '') . 'P'
" Type :C to open this config file
command! -nargs=0 C :e $MYVIMRC
" Type ':R' to reload config file
command! -nargs=0 R :source $MYVIMRC
" Press Enter to clear search highlighting
nnoremap <silent><CR> :nohlsearch<CR>