|
|
" set x=y [[[ "
set autoindent
set autoread
set background=dark
" set colorcolumn=80
set clipboard+=unnamedplus
set diffopt=filler,context:3
if has('nvim-0.3.2') || has("patch-8.1.0360")
set diffopt=filler,internal,algorithm:histogram,indent-heuristic
endif
set encoding=utf-8
set expandtab
" set foldmethod=indent
set foldmethod=marker
set hlsearch
" set ignorecase
set linebreak
set linespace=5
set mouse=a
" set mouse=c
" set noswapfile
set relativenumber
set shiftwidth=4
set smartcase
set tabstop=4
" set t_Co=256
" set termguicolors
" set timeoutlen=350
set timeoutlen=200
" set tw=80
" set tw=75
set tw=70
set undodir=~/.vim/undo
set undofile
" set updatetime=1000
" set updatetime=500
set updatetime=0
autocmd VimResized * wincmd =
filetype plugin on
filetype indent on
syntax on
autocmd CursorHold * if !bufexists("[Command Line]") | checktime | endif
" cursor indicator [[[ "
" set listchars=tab:\|\
" set list
" set cursorcolumn
" set cursorline
" ]]] cursor indicator "
" ]]] set x=y "
" commands for file types [[[ "
autocmd BufNewFile,BufRead .* set syntax=sh
autocmd BufRead,BufNewFile /tmp/calcurse*,~/.calcurse/notes/* set filetype=markdown
autocmd FileType *css,gitcommit,haskell,htmldjango,html,javascript,json,lisp,markdown,
\racket,tex,text,yaml set tabstop=2 shiftwidth=2
" autocmd BufNewFile,BufRead *.md set filetype=markdown
" autocmd Filetype markdown set textwidth=0
" autocmd Filetype html set foldmarker=0
autocmd BufNewFile,BufRead *.gd set expandtab!
autocmd Filetype go set expandtab! sw=4
autocmd FileType html,javascript,python,lua set fdm=indent
" autocmd Filetype markdown set commentstring=<!---\ %s\ -->
" autocmd Filetype markdown map <F8> :LivedownToggle<CR>
autocmd Filetype markdown map <F8> :InstantMarkdownPreview<CR>
autocmd Filetype markdown map <F9> :InstantMarkdownStop<CR>:InstantMarkdownPreview<CR>
autocmd Filetype markdown nnoremap <Tab> <Esc>>>A
autocmd Filetype markdown inoremap <S-Tab> <Esc><<A
autocmd Filetype markdown inoremap < <Esc><<A
autocmd Filetype markdown inoremap << <
autocmd Filetype markdown inoremap > <Esc>>>A
autocmd Filetype markdown inoremap >> >
" format options [[[ "
" a = auto-format paragraphs
" c = wrap comments
" j = remove comment header when joining lines
" M = don't add space when joining lines
" q = format comments with gq
" t = wrap lines
" v = break lines in insert
" w = whitespace continues paragraph
" ]]] format options "
" autocmd FileType markdown,tex,text set spell spelllang=en_us formatoptions=cjMqtvw
autocmd FileType markdown,tex,text set spell spelllang=en_us formatoptions=acjMqtvw
autocmd Filetype json nnoremap <leader>j :%!python -m json.tool<CR>
autocmd Filetype json set foldmethod=marker
autocmd Filetype racket set commentstring=;%s;
autocmd FileType sh map <F8> :!clear && shellcheck %<CR>
autocmd Filetype taskdata set tw=0
autocmd FileType tex set updatetime=1000 timeoutlen=300 tw=65
autocmd FileType tex map <F8> :VimtexCompile<CR>
autocmd VimEnter *.tex VimtexCompile
autocmd VimLeave *.tex !tex-clean %:p
autocmd BufNewFile,BufRead *.tmpl set tw=0 sw=2 ft=go-template fmr=[[[,]]]
" " auto-reload vimrc [[[ "
" augroup myvimrc
" au!
" au BufWritePost .vimrc,_vimrc,vimrc,.gvimrc,_gvimrc,gvimrc so $MYVIMRC | if has('gui_running') | so $MYGVIMRC | endif
" augroup END
" " ]]] auto-reload vimrc "
" ]]] commands for file types "
" commands for specific files [[[ "
autocmd BufNewFile,BufRead watson*.fish set tabstop=2 shiftwidth=2 expandtab
autocmd BufWritePost config.def.h silent !cd %:p:h; sudo rm config.h; sudo bear make install
" autocmd BufRead config.def.h map <F8> :silent !cd %:p:h; sudo rm config.h; sudo bear make install<CR>
autocmd BufRead config.def.h map <F10> :silent !cd %:p:h<CR>:!sudo rm config.h; sudo bear make install<CR>
autocmd BufRead config.def.h set updatetime=3000
autocmd BufRead commit-msg.txt set filetype=gitcommit tw=72
autocmd VimLeave /etc/default/grub !sudo grub-mkconfig -o /boot/grub/grub.cfg
" autocmd BufWritePost key_* !sync-shortcuts
autocmd BufNewFile,BufRead key_* map <F1> :w<CR>:silent !sync-shortcuts<CR>
" map <F1> :silent !scp %:p k@192.168.0.17:/home/k/a1<CR>
" map <F2> :silent !scp -P 2222 e1.html e1_style.css kevin@127.0.0.1:/home/kevin/Downloads/e1<CR>
" map <F6> :make -C ~/Documents/resume cv<CR>
" ]]] commands for specific files "
" vim-plug [[[
" plug auto-install
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin('~/.vim/plugged')
" prequisite for other plugins
Plug 'vim-scripts/L9'
" find files from within Vim
" Plug 'vim-scripts/FuzzyFinder'
{{ if not .gui }}
" Gotham color scheme
Plug 'whatyouhide/vim-gotham'
{{ end }}
" " collection of Vim color schemes
" Plug 'flazz/vim-colorschemes'
" " preview Vim color scheme easily within Vim
" Plug 'xolox/vim-colorscheme-switcher'
" " prerequisite for above plugin
" Plug 'xolox/vim-misc'
" automatically save buffers upon returning to normal mode
Plug '907th/vim-auto-save'
let g:auto_save = 1
" let g:auto_save_events = ["CursorHold", "CursorHoldI"]
let g:auto_save_events = ["CursorHold"]
" autocmd VimEnter *.tex let g:auto_save = 0
" provides various functionality for writing LaTeX in Vim
Plug 'lervag/vimtex'
" au BufWritePost *.tex silent call Tex_RunLaTeX()
au BufWritePost *.tex silent !pkill -USR1 xdvi.bin
let g:Tex_MultipleCompileFormats = 'dvi,pdf'
let g:vimtex_view_general_viewer = 'zathura'
let g:vimtex_quickfix_latexlog = {
\ 'overfull' : 0,
\ 'underfull' : 0,
\ 'global' : 0,
\ 'references' : 0,
\ 'unused' : 0,
\}
let g:vimtex_quickfix_autoclose_after_keystrokes = 5
" let g:vimtex_compiler_latexmk = {
" \ 'continuous' : 0,
" \}
{{ if not (eq .chezmoi.username "root") }}
" auto-completion for various languages
Plug 'Valloric/YouCompleteMe'
let g:ycm_filetype_blacklist = {
\ 'tagbar': 1,
\ 'qf': 1,
\ 'notes': 1,
\ 'unite': 1,
\ 'vimwiki': 1,
\ 'pandoc': 1,
\ 'infolog': 1,
\ 'mail': 1
\}
{{ end }}
" wrote short bits of text that expand into whatever you want
" demo: https://www.youtube.com/watch?v=Zik6u0klD40
Plug 'SirVer/ultisnips'
" better key bindings for UltiSnipsExpandTrigger
let g:UltiSnipsExpandTrigger = "<tab>"
let g:UltiSnipsJumpForwardTrigger = "<tab>"
let g:UltiSnipsJumpBackwardTrigger = "<C-tab>"
let g:ultisnips_javascript = {
\ 'keyword-spacing': 'always',
\ 'semi': 'never',
\ 'space-before-function-paren': 'never',
\ }
" custom snippets
Plug 'Kevin-Mok/vim-snippets'
" to make YouCompleteMe work with UltiSnips (both use Tab)
Plug 'ervandew/supertab'
" make YCM compatible with UltiSnips (using supertab)
let g:ycm_key_list_select_completion = ['<C-n>', '<Down>']
let g:ycm_key_list_previous_completion = ['<C-p>', '<Up>']
let g:SuperTabDefaultCompletionType = '<C-n>'
" easily comment/uncomment lines
Plug 'scrooloose/nerdcommenter'
let g:NERDTrimTrailingWhitespace = 1
let g:NERDSpaceDelims = 1
" add quotes/brackets around chunks of text easily
Plug 'tpope/vim-surround'
nmap S ys
" navigate around file easily and precisely
Plug 'easymotion/vim-easymotion'
map <Space> <Plug>(easymotion-prefix)
" status bar displaying various info about the current buffer
Plug 'vim-airline/vim-airline'
let g:airline_section_c = '%F'
Plug 'vim-airline/vim-airline-themes'
let g:airline_powerline_fonts = 1
" continue Markdown lists when started
Plug 'dkarter/bullets.vim'
" coordinate Vim color scheme with terminal color scheme
Plug 'dylanaraps/wal.vim'
" repeat plugin commands
Plug 'tpope/vim-repeat'
" better Django support
Plug 'tweekmonster/django-plus.vim'
" auto-close brackets
Plug 'jiangmiao/auto-pairs'
let g:AutoPairsMapSpace = 0
Plug 'henrik/vim-indexed-search'
Plug 'PotatoesMaster/i3-vim-syntax'
" vim file explorer
Plug 'terryma/vim-multiple-cursors'
" let g:multi_cursor_select_all_word_key='<C-a>'
let g:multi_cursor_exit_from_visual_mode=0
let g:multi_cursor_exit_from_insert_mode=0
Plug 'dag/vim-fish'
" live preview Markdown"
" Plug 'shime/vim-livedown'
Plug 'suan/vim-instant-markdown', {'for': 'markdown'}
let g:instant_markdown_autostart = 0
" git helper
Plug 'tpope/vim-fugitive'
" auto reload file
Plug 'djoshea/vim-autoread'
" Plug 'mustache/vim-mustache-handlebars'
" Plug 'trapd00r/vim-syntax-vidir-ls'
Plug 'calviken/vim-gdscript3'
" display hex colors in Vim
" Plug 'RRethy/vim-hexokinase'
Plug 'junegunn/goyo.vim'
" prevent commands being executed through modelines "
Plug 'ciaranm/securemodelines/'
" different colors for each layer of surrounding brackets
Plug 'luochen1990/rainbow'
let g:rainbow_active = 1
" easy custom text objects
Plug 'kana/vim-textobj-user'
" latex custom text objects
Plug 'rbonvall/vim-textobj-latex'
" swap words
Plug 'tommcdo/vim-exchange'
" Plug 'scrooloose/nerdtree'
" let NERDTreeQuitOnOpen=1
" let NERDTreeShowHidden=1
" Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
" Plug 'junegunn/fzf.vim'
Plug 'christoomey/vim-tmux-navigator'
" mappings [[[ "
let g:tmux_navigator_no_mappings = 1
nnoremap <A-j> :TmuxNavigateDown<cr>
nnoremap <A-k> :TmuxNavigateUp<cr>
nnoremap <A-h> :TmuxNavigateLeft<cr>
nnoremap <A-l> :TmuxNavigateRight<cr>
" nnoremap <C-Down> :TmuxNavigateDown<cr>
" nnoremap <C-Up> :TmuxNavigateUp<cr>
" nnoremap <C-Left> :TmuxNavigateLeft<cr>
" nnoremap <C-Right> :TmuxNavigateRight<cr>
" ]]] mappings "
" highlight multiple words
" TODO: mapping conflicts "
" Plug 'inkarkat/vim-mark'
" Plug 'jceb/vim-orgmode'
" let g:org_todo_keywords=['TODO', 'STARTED', '|', 'DONE']
Plug 'junegunn/vim-easy-align'
" Start interactive EasyAlign in visual mode (e.g. vipga)
xmap ga <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap ga <Plug>(EasyAlign)
Plug 'wlangstroth/vim-racket'
Plug 'neovimhaskell/haskell-vim'
Plug 'masukomi/vim-markdown-folding'
" ]]] vim-plug "
" Mappings [[[ "
call plug#end()
{{ if .gui }}
colorscheme wal
{{ else }}
colorscheme gotham256
{{ end }}
" normal mappings [[[ "
nnoremap <ScrollWheelUp> <C-U>
nnoremap <ScrollWheelDown> <C-D>
" visual select across lines by default "
nnoremap v <C-V>
" last macro "
nnoremap Q @@
" toggle fold "
nnoremap , za
" jump to horizontal position for mark "
nnoremap ' `
" indenting
nnoremap > >>
nnoremap < <<
inoremap << <Esc><<A
" ]]] normal mappings "
" leader mappings [[[ "
let mapleader="\<Space>"
" find alias
nnoremap <leader>a /^ <Left>
nnoremap <leader>ac :.s/\(\w\w\)/\u\1\U\2/g<CR>
" replace until end of line
nnoremap <leader>c c$
" delete until end of line
nnoremap <leader>d d$
" delete entire buffer
nnoremap <leader>dg ggdG
" delete entire line
nnoremap <leader>dl 0d$
" delete lines matching pattern
nnoremap <leader>dls :g//d<left><left>
" show docstring for cur word
nnoremap <leader>do :YcmCompleter GetDoc<CR>
" delete line into system clipboard
nnoremap <leader>D "+dd
" delete entire buffer into system clipboard
nnoremap <leader>DA "+ggdG
" find copied text
nnoremap <leader>f q/p<CR>
" find merge conflicts
nnoremap <leader>fc /[<>=\|]\{7\}<CR>
" reload folds
nnoremap <leader>fmi :set foldmethod=indent<CR> zM
nnoremap <leader>fmm :set foldmethod=marker<CR> zM
" add marker foldmethod modeline
nnoremap <leader>fi :YcmCompleter FixIt<CR>
" check filetype
nnoremap <leader>ft :se ft?<CR>
" check todo's
nnoremap <leader>ftd /TODO<CR>
nnoremap <leader>g :YcmCompleter GoTo<CR>
" vimdiff split
nnoremap <leader>gd :Gvdiff
nnoremap <leader>gdh :Gvdiff HEAD~
nnoremap <leader>gdm :Gvdiff master<CR>
" toggle search highlighting
nnoremap <leader>h :set hlsearch! hlsearch?<CR>
" help
nnoremap <leader>he :vert help
nnoremap <leader>ht :set tabstop=2 shiftwidth=2 expandtab<CR>
nnoremap <leader>vhe :vert help
" don't add space when joining lines "
nnoremap <leader>j gJ
" join all paragraphs into single line "
nnoremap <leader>jl :set tw=9999999<CR>gggqG
" format current line
nnoremap <leader>l Vgq
" format this and next line
nnoremap <leader>ll Vjgq
" move cursor to middle of line
" nnoremap <leader>m :call cursor(0, len(getline('.'))/2)<CR>
nnoremap <leader>m :vert Man
" apply normal command to selection
vnoremap <leader>n q:anorm
" turn off autoformat"
nnoremap <leader>na :set spell spelllang=en_us formatoptions=cjMqtvw<CR>
nnoremap <leader>nt :NERDTree<CR>
" check if in neovim
nnoremap <leader>nv :echo has('nvim')<CR>
" don't wrap lines
nnoremap <leader>nw :set nowrap<CR>
" recursively open fold
nnoremap <leader>o zO
" paste from?
" nnoremap <leader>p "*p
" format paragraph
nnoremap <leader>p gqip
" Plug commands
nnoremap <leader>pli :PlugInstall<CR>
nnoremap <leader>plc :PlugClean<CR>
nnoremap <leader>plu :PlugUpdate<CR>
" don't break lines
nnoremap <leader>py :set tw=0<CR>
" replace in next x lines
nnoremap <leader>r q:i.,.+s///g<ESC>Fsi
" replace in line
nnoremap <leader>rl q:i.s///g<left><left><left>
" replace in visual selection
" remove italics tags
nnoremap <leader>rmi :%s/<\/\?i>//g<CR>
" reload vim config
nnoremap <leader>rv :source $MYVIMRC<CR>
vnoremap <leader>r q:is///g<ESC>3ha
" replace in entire file
nnoremap <leader>R q:i%s///g<ESC>2F/i
vnoremap <leader>s :sort<CR>
nnoremap <leader>sc :set spell spelllang=en_us<CR>
" run current file in shell
nnoremap <leader>sh :!%:p
" sort lines until end of file
nnoremap <leader>so q:i.,$sort<CR>
" vertical split "
nnoremap <leader>sp :sp
" sort lines
nnoremap <leader>sol q:i.,.+sort<ESC>Fsi
" set syntax to shell (for dotfiles)
nnoremap <leader>sys :set syn=sh<CR>
vnoremap <leader>t :!tac<CR>
" capitalize letter
nnoremap <leader>u vU
" horizontal split "
nnoremap <leader>vs :vs
" open vimrc in vertical split
nnoremap <leader>vv :vsp ~/.vimrc<CR>
" copy next thing to system clipboard
" nnoremap <leader>y "+
" nnoremap <leader>Y "+Y
nnoremap <leader>y y$
nnoremap <leader>yo :Goyo<CR>
" yank entire buffer
nnoremap <leader>yg ggyG
" toggle fold
nnoremap <leader>z za
" close all folds
nnoremap <leader>zm zM
" open all folds
nnoremap <leader>zr zR
" ]]] leader mappings "
" function keys [[[ "
map <F3> :wa<CR>
map <F4> :xa<CR>
map <F5> :q!<CR>
map <F6> :qa!<CR>
map <F7> :AutoSaveToggle<CR>
" reload file
nnoremap <F9> :e<CR>
nnoremap <F10> :set paste<CR>"+p:set nopaste<CR>
nnoremap <F11> :set paste<CR>"*p:set nopaste<CR>
" ]]] function keys "
map <S-Enter> O<ESC>
" swap text visually
vnoremap <C-P> <Esc>`.``gvP``P
ino <C-A> <C-O>yiW<End>=<C-R>=<C-R>0<CR>
" splits [[[ "
nnoremap <C-Down> <C-W><C-J>
nnoremap <C-Up> <C-W><C-K>
nnoremap <C-Right> <C-W><C-L>
nnoremap <C-Left> <C-W><C-H>
" Maximize height/width.
nnoremap <C-g> <C-W>_
nnoremap <C-w> <C-W>|
" ]]] splits "
" ]]] Mappings "
" Local Mappings [[[ "
let maplocalleader="\\"
" tex [[[ "
autocmd Filetype tex inoremap <localleader>bt \bowtie
autocmd Filetype tex inoremap <localleader>c \checkmark
autocmd Filetype tex inoremap <localleader>d \delta
autocmd Filetype tex inoremap <localleader>D \Delta
autocmd Filetype tex inoremap <localleader>e \exists
autocmd Filetype tex inoremap <localleader>ep \epsilon
autocmd Filetype tex inoremap <localleader>fa \forall
autocmd Filetype tex inoremap <localleader>g \geq
autocmd Filetype tex inoremap <localleader>i \in
autocmd Filetype tex inoremap <localleader>la \leftarrow
autocmd Filetype tex inoremap <localleader>le \leq
autocmd Filetype tex inoremap <localleader>ln \log n
autocmd Filetype tex inoremap <localleader>lr \Leftrightarrow
" autocmd Filetype tex inoremap <localleader>n \neg
autocmd Filetype tex inoremap <localleader>n \neq
autocmd Filetype tex inoremap <localleader>N \mathbb{N}
autocmd Filetype tex inoremap <localleader>pg \pagebreak<Enter>
autocmd Filetype tex inoremap <localleader>ph [,phantom]
autocmd Filetype tex inoremap <localleader>q \qquad
autocmd Filetype tex inoremap <localleader>r \rightarrow
autocmd Filetype tex inoremap <localleader>R \Rightarrow
autocmd Filetype tex inoremap <localleader>s \subset
autocmd Filetype tex inoremap <localleader>st such that
autocmd Filetype tex inoremap <localleader>S \Sigma
autocmd Filetype tex inoremap <localleader>t \times
" autocmd Filetype tex inoremap <localleader>T $T$
autocmd Filetype tex inoremap <localleader>T \Theta
" replace bars/underscores in URL
autocmd Filetype tex inoremap <localleader>url :.s/\([-_]\)/\\\1/g<CR>
autocmd Filetype tex inoremap <localleader>v \vee
autocmd Filetype tex inoremap <localleader>w \wedge
autocmd Filetype tex inoremap <localleader>x $x$-axis
autocmd Filetype tex inoremap <localleader>y $y$-axis
autocmd Filetype tex inoremap <localleader>Z \mathbb{Z}
" par3
autocmd Filetype tex inoremap <localleader>wx $w(x)$
autocmd Filetype tex inoremap <localleader>tx $t(x)$
" ]]] tex "
autocmd Filetype c inoremap <localleader>uc unsigned char
autocmd BufNewFile,BufRead *.h nnoremap <localleader>x 0iextern <Esc>f{hc$;<Esc>
autocmd BufNewFile,BufRead ~/.habitctl/log nnoremap <localleader>d Gy3kGpf<Tab>hV3j<C-a>$rnj.j.j$.
autocmd Filetype fish inoremap <localleader>1 $argv[1]
autocmd Filetype fish inoremap <localleader>2 $argv[2]
autocmd Filetype javascript inoremap <localleader>x process.exit()
autocmd Filetype markdown inoremap <localleader>c - [ ]
autocmd Filetype markdown nnoremap <localleader>x 0f[lrx
" nnoremap <localleader>x 0f[lrx
autocmd Filetype go-template inoremap <localleader>e {{"{{ else }}"}}
autocmd Filetype go-template inoremap <localleader>hd {{"{{ .chezmoi.homedir }}"}}
autocmd Filetype go-template nnoremap <localleader>fp :%s/{{"{{{"}}/[[[/g<CR>:%s/}}}/]]]/g<CR>
autocmd Filetype python inoremap <localleader>bp breakpoint()
autocmd Filetype python inoremap <localleader>s self.
" ]]] Local Mappings "
" vim: fdm=marker ft=vim.go-template
|