From 44ff7c9a958df70b323ce3090793f4dc0fbe70bb Mon Sep 17 00:00:00 2001 From: Sage Vaillancourt Date: Wed, 6 Oct 2021 13:41:08 -0400 Subject: [PATCH] General vim improvements. More dependent on non-defaults however. --- .vimrc | 96 +++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 68 insertions(+), 28 deletions(-) diff --git a/.vimrc b/.vimrc index e4860b9..b59d1b6 100644 --- a/.vimrc +++ b/.vimrc @@ -1,28 +1,47 @@ -"""""""""""""""""""""" -" __ _____ __ __ " -" \ \ / /_ _| \/ | " -" \ V / | || |\/| | " -" \_/ |___|_| |_| " -" " -"""""""""""""""""""""" +" \ / o _ _ +" \/ | | | | + set nocp - -so ~/.vim/user/files.vim - -colorscheme desert -syntax enable +set shell=/usr/bin/zsh set tsr+=~/.vim/thesaurus/thesaurus-vim-en set dict+=/usr/share/dict/words -set foldmethod=syntax -set foldlevelstart=5 +set tags=./tags;/ " Search up to / for tags file +set updatetime=100 +set clipboard=unnamedplus " Use system clipboard + +set termguicolors +let &t_8f = "\[38:2:%lu:%lu:%lum" +let &t_8b = "\[48:2:%lu:%lu:%lum" +syntax enable + +colorscheme jellybeans + +let mapleader=" " + +" Auto open NERDTree but focus editing window +autocmd VimEnter * NERDTree +autocmd BufEnter * NERDTreeMirror +autocmd VimEnter * wincmd w +autocmd VimEnter * NERDTreeFind +autocmd VimEnter * wincmd w +" Auto close NERDTree +autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif + +set mouse=a set backspace=indent,eol,start set splitbelow set splitright +set foldmethod=syntax +set foldlevelstart=99 + +" Leave some room when scrolling +set scrolloff=3 + nnoremap :W :w set conceallevel=0 @@ -33,9 +52,6 @@ set tabstop=8 softtabstop=0 expandtab shiftwidth=4 smarttab " Except for makefiles autocmd FileType make setlocal noexpandtab -" Search up to / for tags file -set tags=./tags;/ - " *** BINDINGS *** " Beautful escapes @@ -55,7 +71,6 @@ set number relativenumber set ignorecase smartcase set autoindent smartindent - "Yank to clipboard nnoremap "+yy vnoremap "+y @@ -81,7 +96,9 @@ tnoremap tnoremap tnoremap -nnoremap ! :! +" Jump to next/prev uppercase/underscore +nnoremap f /[A-Z_] +nnoremap F ?[A-Z_] " Map directions to end/beginning of lines nnoremap yl y$ @@ -96,14 +113,6 @@ nnoremap m`v$hp``y$ nnoremap PP :ha > ~/.vim.ps:!xdg-open ~/.vim.ps vnoremap PP :ha > ~/.vim.ps:!xdg-open ~/.vim.ps -" Return spelling corrections -iab ruetn return -iab reteun return -iab reutner return - -nnoremap cw ciw -nnoremap ciw cw - " Swap current word with next nnoremap gs "xdiwdwep"xp " Inverted @@ -124,9 +133,11 @@ nnoremap gu :!git add -u nnoremap ga :!git add % nnoremap r :source ~/.vimrc -nnoremap v :tabedit~/.vimrc nnoremap n :tabedit~/.notes +nnoremap v :vert term ++cols=80 +nnoremap t :term ++rows=20 + autocmd BufNewFile,BufRead * if expand('%:t') !~ '\.' | setl spell | endif " Expand %% to the current files dir @@ -146,3 +157,32 @@ if has ("autocmd") autocmd BufNewFile makefile 0r ~/.vim/templates/makefile augroup END endif + +let s:copypastemode = 0 +function! ToggleCopyPaste() + if s:copypastemode + set nopaste + set number + set relativenumber + let s:copypastemode = 0 + else + set paste + set nonumber + set norelativenumber + let s:copypastemode = 1 + endif +endfunction +nnoremap :call ToggleCopyPaste() +inoremap :call ToggleCopyPaste()i +nnoremap p +inoremap p + +" Spelling corrections +iab ruetn return +iab reteun return +iab reutner return + +" Keep same gutter color when errored +highlight! link SignColumn LineNr + +so ~/.vim/user/files.vim