dotfiles/fake_home/.vimrc

207 lines
5.4 KiB
VimL
Raw Normal View History

" \ / o _ _
" \/ | | | |
2020-04-21 12:29:05 -04:00
set nocp
set shell=/usr/bin/zsh
2020-04-21 12:29:05 -04:00
set tsr+=~/.vim/thesaurus/thesaurus-vim-en
set dict+=/usr/share/dict/words
2020-04-21 13:31:21 -04:00
set tags=./tags;/ " Search up to / for tags file
set updatetime=100
set clipboard=unnamedplus " Use system clipboard
2023-12-13 13:42:44 -05:00
if empty($DISPLAY) && empty($SSH_CONNECTION)
colorscheme monokai
syntax enable
2021-12-29 19:15:04 -05:00
else
set termguicolors
let &t_8f = "\<Esc>[38:2:%lu:%lu:%lum"
let &t_8b = "\<Esc>[48:2:%lu:%lu:%lum"
2023-09-27 12:21:12 -04:00
colorscheme monokai
syntax enable
2021-12-29 19:15:04 -05:00
endif
2020-04-21 12:29:05 -04:00
let mapleader=" "
2022-01-31 19:46:19 -05:00
"nnoremap <Leader>w yiwq:PIe `~/.shell_aliases ws <Esc>
"nnoremap <Leader>w yiw:let srr_back = &srr <BAR> set srr=><CR>q:PIr! /home/sage/.shell_aliases wf <Esc>
" TODO Check if file needs saving
" TODO Set and unset srr from within map
set srr=>
nnoremap <Leader>w yiw:w<CR>q:PIr! /home/sage/.shell_aliases wf <CR>yyuq:PIe <ESC><CR>
nnoremap <Leader>s yiw:w<CR>q:PIr! /home/sage/.shell_aliases wf <CR>yyuq:PIvsp <ESC><CR>
nnoremap <Leader>. :vert resize +4<CR>
nnoremap <Leader>, :vert resize -4<CR>
" " 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
2020-04-21 12:29:05 -04:00
2020-04-22 13:39:45 -04:00
set backspace=indent,eol,start
2020-04-21 12:29:05 -04:00
set splitbelow
set splitright
set foldmethod=syntax
set foldlevelstart=99
" Leave some room when scrolling
set scrolloff=3
2020-04-21 12:29:05 -04:00
set conceallevel=0
2020-04-21 13:31:21 -04:00
" Use 4 spaces
2020-06-12 18:47:51 -04:00
set tabstop=8 softtabstop=0 expandtab shiftwidth=4 smarttab
2020-04-21 13:31:21 -04:00
2020-04-21 12:29:05 -04:00
" Except for makefiles
autocmd FileType make setlocal noexpandtab
2020-04-21 13:31:21 -04:00
" *** BINDINGS ***
2020-04-21 12:29:05 -04:00
2020-04-21 13:31:21 -04:00
" Beautful escapes
inoremap jj <Esc>l
inoremap jk <Esc>l
inoremap kj <Esc>l
2020-04-21 12:29:05 -04:00
2024-02-17 14:49:22 -05:00
2020-04-21 13:31:21 -04:00
" C comment
nnoremap // m`I//<Esc>``:s-////--<Cr>
2020-04-21 12:29:05 -04:00
2020-04-21 13:31:21 -04:00
" Current-file keywords
2024-02-17 14:49:22 -05:00
inoremap <C-N> <C-X><C-N>
2020-04-21 13:31:21 -04:00
inoremap <C-J> <C-X><C-N>
2020-04-21 12:29:05 -04:00
2020-04-21 13:31:21 -04:00
" Line numbers
set number relativenumber
2020-04-21 12:29:05 -04:00
2020-04-21 13:31:21 -04:00
set ignorecase smartcase
set autoindent smartindent
" Yank to clipboard
2020-04-21 13:31:21 -04:00
nnoremap <C-C> "+yy
vnoremap <C-C> "+y
2020-04-21 12:29:05 -04:00
2020-04-21 13:31:21 -04:00
" List buffers
nnoremap <Leader>b :ls<CR>:b<Space>
2020-04-21 12:29:05 -04:00
nnoremap <C-I> ^
2020-04-21 13:31:21 -04:00
2020-04-21 12:29:05 -04:00
nnoremap U ~
2020-04-21 13:31:21 -04:00
nnoremap ~ U
2020-04-21 12:29:05 -04:00
" Paste last yank (not delete)
2020-04-21 12:29:05 -04:00
nnoremap "p "0p
" Window jumps
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
2020-05-15 15:49:38 -04:00
tnoremap <C-J> <C-W><C-J>
tnoremap <C-K> <C-W><C-K>
tnoremap <C-L> <C-W><C-L>
tnoremap <C-H> <C-W><C-H>
2020-04-21 12:29:05 -04:00
" Jump to next/prev uppercase/underscore
nnoremap f<cr> /[A-Z_]<cr>
nnoremap F<cr> ?[A-Z_]<cr>
2020-04-21 12:29:05 -04:00
" Map directions to end/beginning of lines
nnoremap yl y$
nnoremap yh y^
nnoremap dl d$
nnoremap dh d^
" <C-P> will replace text after the cursor with unnamed reg contents
nnoremap <C-P> m`v$hp``y$
2024-06-13 08:35:48 -04:00
nnoremap <Leader>jq ggVG:.!cat % <Bar> jq<CR>
nnoremap <Leader><Leader> :w<CR>ggVG:.!cat % <Bar>
2020-04-21 12:29:05 -04:00
" Generate and display a printable version
nnoremap <Leader>PP :ha > ~/.vim.ps<CR>:!xdg-open ~/.vim.ps<CR>
vnoremap <Leader>PP :ha > ~/.vim.ps<CR>:!xdg-open ~/.vim.ps<CR>
" Swap current word with next
nnoremap gs "xdiwdwep"xp
" Inverted
nnoremap gb dawbP
2024-01-20 17:38:45 -05:00
nnoremap <Leader>c :!cat % <Bar> xclip -selection clipboard<CR><CR>
2020-04-23 12:37:37 -04:00
2020-04-21 14:33:53 -04:00
nnoremap <Leader>p :w<CR>:!make run<CR>
2020-04-21 12:29:05 -04:00
nnoremap <Leader>gd :!git diff %<CR>
nnoremap <Leader>gD :!git diff<CR>
nnoremap <Leader>gB :!git blame %<CR>
nnoremap <Leader>gc :!git commit -m ""<Left>
nnoremap <Leader>gh :!git --help<CR>
nnoremap <Leader>gl :!git log<CR>
nnoremap <Leader>gp :!git push<CR>
nnoremap <Leader>gu :!git add -u<CR>
nnoremap <Leader>ga :!git add %<CR>
nnoremap <Leader>r :source ~/.vimrc<CR>
nnoremap <Leader>n :tabedit ~/.notes<CR>
2020-04-21 12:29:05 -04:00
nnoremap <Leader>v :vert term ++cols=80<CR>
nnoremap <Leader>t :term ++rows=20<CR>
2020-04-21 12:29:05 -04:00
autocmd BufNewFile,BufRead * if expand('%:t') !~ '\.' | setl spell | endif
autocmd BufNewFile,BufRead *.pbl set syntax=clojure
2020-04-21 12:29:05 -04:00
" Expand %% to the current files dir
cabbr <expr> %% 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 *.lua 0r ~/.vim/templates/skeleton.lua
2024-01-21 22:41:16 -05:00
autocmd BufNewFile *.php 0r ~/.vim/templates/skeleton.php
autocmd BufNewFile *.md 0r ~/.vim/templates/skeleton.md
2024-01-20 18:06:03 -05:00
autocmd BufNewFile *.html 0r ~/.vim/templates/skeleton.html
2024-01-20 18:24:56 -05:00
autocmd BufNewFile *.java 0r ~/.vim/templates/skeleton.java
2024-01-20 18:33:31 -05:00
autocmd BufNewFile *.js 0r ~/.vim/templates/skeleton.js
autocmd BufNewFile *.jsx 0r ~/.vim/templates/skeleton.jsx
autocmd BufNewFile *.tsx 0r ~/.vim/templates/skeleton.tsx
2024-01-20 18:41:28 -05:00
autocmd BufNewFile *.json 0r ~/.vim/templates/skeleton.json
2024-01-22 11:45:43 -05:00
autocmd BufNewFile *.toml 0r ~/.vim/templates/skeleton.toml
2024-01-22 11:17:11 -05:00
autocmd BufNewFile *.yaml 0r ~/.vim/templates/skeleton.yaml
autocmd BufNewFile *.go 0r ~/.vim/templates/skeleton.go
autocmd BufNewFile Makefile 0r ~/.vim/templates/Makefile
2024-01-20 19:10:18 -05:00
autocmd BufNewFile Dockerfile 0r ~/.vim/templates/Dockerfile
2020-04-21 12:29:05 -04:00
augroup END
endif
nnoremap <RightMouse> p
inoremap <RightMouse> <Esc>p
" Spelling corrections
iab ruetn return
iab reteun return
iab reutner return
" Keep same gutter color when errored
2023-09-27 12:21:12 -04:00
" highlight! link SignColumn LineNr
" Include hyphens in words
set iskeyword+=-
so ~/.vim/user/files.vim