From 16a0fcf9ac1e0d22a0dab6017550f59b312fd863 Mon Sep 17 00:00:00 2001 From: Mikkel Svartveit Date: Tue, 21 Mar 2023 21:38:10 +0100 Subject: [PATCH] Update .vimrc --- vim/.vimrc | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/vim/.vimrc b/vim/.vimrc index 7d31c19..dce2e41 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -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 :nohlsearch + " 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 y (v:register ==# '"' ? '"+' : '') . 'y' +nnoremap yy (v:register ==# '"' ? '"+' : '') . 'yy' +nnoremap Y (v:register ==# '"' ? '"+' : '') . 'Y' +xnoremap y (v:register ==# '"' ? '"+' : '') . 'y' +xnoremap Y (v:register ==# '"' ? '"+' : '') . 'Y' + +" Map 'gp' to paste from system clipboard +nnoremap gp (v:register ==# '"' ? '"+' : '') . 'p' +nnoremap gP (v:register ==# '"' ? '"+' : '') . 'P' +xnoremap gp (v:register ==# '"' ? '"+' : '') . 'p' +xnoremap 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 :nohlsearch