" \ / o _ _ " \/ | | | | set nocp set shell=/usr/bin/zsh set tsr+=~/.vim/thesaurus/thesaurus-vim-en set dict+=/usr/share/dict/words set tags=./tags;/ " Search up to / for tags file set updatetime=100 set clipboard=unnamedplus " Use system clipboard if empty($DISPLAY) && empty($SSH_CONNECTION) colorscheme monokai syntax enable else set termguicolors let &t_8f = "\[38:2:%lu:%lu:%lum" let &t_8b = "\[48:2:%lu:%lu:%lum" colorscheme monokai syntax enable endif let mapleader=" " "nnoremap w yiwq:PIe `~/.shell_aliases ws "nnoremap w yiw:let srr_back = &srr set srr=>q:PIr! /home/sage/.shell_aliases wf " TODO Check if file needs saving " TODO Set and unset srr from within map set srr=> nnoremap w yiw:wq:PIr! /home/sage/.shell_aliases wf yyuq:PIe nnoremap s yiw:wq:PIr! /home/sage/.shell_aliases wf yyuq:PIvsp " " 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 " autocmd VimEnter COMMIT_EDITMSG NERDTreeClose 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 set conceallevel=0 " Use 4 spaces set tabstop=8 softtabstop=0 expandtab shiftwidth=4 smarttab " Except for makefiles autocmd FileType make setlocal noexpandtab " *** BINDINGS *** " Beautful escapes inoremap jj l inoremap jk l inoremap kj l " C comment nnoremap // m`I//``:s-////-- " Current-file keywords inoremap " Line numbers set number relativenumber set ignorecase smartcase set autoindent smartindent " Yank to clipboard nnoremap "+yy vnoremap "+y " List buffers nnoremap b :ls:b nnoremap ^ nnoremap U ~ nnoremap ~ U " Paste last yank (not delete) nnoremap "p "0p " Window jumps nnoremap nnoremap nnoremap nnoremap tnoremap tnoremap tnoremap tnoremap " Jump to next/prev uppercase/underscore nnoremap f /[A-Z_] nnoremap F ?[A-Z_] " Map directions to end/beginning of lines nnoremap yl y$ nnoremap yh y^ nnoremap dl d$ nnoremap dh d^ " will replace text after the cursor with unnamed reg contents nnoremap m`v$hp``y$ " Generate and display a printable version nnoremap PP :ha > ~/.vim.ps:!xdg-open ~/.vim.ps vnoremap PP :ha > ~/.vim.ps:!xdg-open ~/.vim.ps " Swap current word with next nnoremap gs "xdiwdwep"xp " Inverted nnoremap gb dawbP nnoremap c :!cat % xclip -selection clipboard nnoremap p :w:!make run nnoremap gd :!git diff % nnoremap gD :!git diff nnoremap gB :!git blame % nnoremap gc :!git commit -m "" nnoremap gh :!git --help nnoremap gl :!git log nnoremap gp :!git push nnoremap gu :!git add -u nnoremap ga :!git add % nnoremap r :source ~/.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 autocmd BufNewFile,BufRead *.pbl set syntax=clojure " Expand %% to the current files dir cabbr %% expand('%:p:h') cnoreabbrev vimc tabedit ~/.vimrc " Skeletons " if has ("autocmd") augroup templates autocmd BufNewFile *.cpp 0r ~/.vim/templates/skeleton.cpp autocmd BufNewFile *.c 0r ~/.vim/templates/skeleton.c autocmd BufNewFile *.sh 0r ~/.vim/templates/skeleton.sh autocmd BufNewFile *.py 0r ~/.vim/templates/skeleton.py autocmd BufNewFile *.rb 0r ~/.vim/templates/skeleton.rb autocmd BufNewFile *.md 0r ~/.vim/templates/skeleton.md autocmd BufNewFile *.html 0r ~/.vim/templates/skeleton.html autocmd BufNewFile *.java 0r ~/.vim/templates/skeleton.java autocmd BufNewFile *.js 0r ~/.vim/templates/skeleton.js autocmd BufNewFile Makefile 0r ~/.vim/templates/Makefile augroup END endif 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 " Include hyphens in words set iskeyword+=- so ~/.vim/user/files.vim