General vim improvements.

More dependent on non-defaults however.
This commit is contained in:
Sage Vaillancourt 2021-10-06 13:41:08 -04:00
parent 1ccd582a7b
commit 44ff7c9a95
1 changed files with 68 additions and 28 deletions

96
.vimrc
View File

@ -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 = "\<Esc>[38:2:%lu:%lu:%lum"
let &t_8b = "\<Esc>[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<CR> :w<CR>
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 <C-C> "+yy
vnoremap <C-C> "+y
@ -81,7 +96,9 @@ tnoremap <C-K> <C-W><C-K>
tnoremap <C-L> <C-W><C-L>
tnoremap <C-H> <C-W><C-H>
nnoremap ! :!
" Jump to next/prev uppercase/underscore
nnoremap f<cr> /[A-Z_]<cr>
nnoremap F<cr> ?[A-Z_]<cr>
" Map directions to end/beginning of lines
nnoremap yl y$
@ -96,14 +113,6 @@ nnoremap <C-P> m`v$hp``y$
nnoremap <Leader>PP :ha > ~/.vim.ps<CR>:!xdg-open ~/.vim.ps<CR>
vnoremap <Leader>PP :ha > ~/.vim.ps<CR>:!xdg-open ~/.vim.ps<CR>
" 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 <Leader>gu :!git add -u<CR>
nnoremap <Leader>ga :!git add %<CR>
nnoremap <Leader>r :source ~/.vimrc<CR>
nnoremap <Leader>v :tabedit~/.vimrc<CR>
nnoremap <Leader>n :tabedit~/.notes<CR>
nnoremap <Leader>v :vert term ++cols=80<CR>
nnoremap <Leader>t :term ++rows=20<CR>
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 <F3> :call ToggleCopyPaste()<CR>
inoremap <F3> <Esc>:call ToggleCopyPaste()<CR>i
nnoremap <RightMouse> p
inoremap <RightMouse> <Esc>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