" Default Vim options. Some have been modified. source ~/.vim/defaults.vim " Convenient command to see the difference between the current buffer and the " file it was loaded from, thus the changes you made. " Only define it when not defined already. " Revert with: ":delcommand DiffOrig". if !exists(":DiffOrig") command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis \ | wincmd p | diffthis endif if has("vms") set nobackup " do not keep a backup file, use versions instead else set backup " keep a backup file (restore to previous version) if has('persistent_undo') set undofile " keep an undo file (undo changes after closing) endif endif " Don't clutter directories with swap files. " Save them in /tmp instead. set backupdir=/tmp//,. set directory=/tmp//,. set undodir=/tmp//,. if &t_Co > 2 || has("gui_running") " Switch on highlighting the last used search pattern. set hlsearch endif " Put these in an autocmd group, so that we can delete them easily. "augroup vimrcEx " au! " For all text files set 'textwidth' to 78 characters. " autocmd FileType text setlocal textwidth=78 "augroup END " Enable syntax highlighting if the terminal supports color if &t_Co > 1 syntax enable colorscheme atom-dark " Clear 'background color erase' value to prevent " terminal background bleed. set t_ut= endif " Enable line numbers in the left margin set number set numberwidth=4 " Enable relative line numbers " set relativenumber " Display invisible characters. " Here's a helpful list of chars: " ␠ ⎵ ⏎ · set list set listchars=tab:\ \ \|,trail:·,nbsp:⎵ " Configure and load conceal chars " "set conceallevel=0 " Nothing is hidden "set conceallevel=1 " Hide stuff as concealchar, or as listchar. "set conceallevel=2 " Hide stuff as concealchar, or completely. "set conceallevel=3 " Hide completely. " "syntax keyword ConcealedX kw_hide_x conceal concealchar=x "syntax keyword ConcealedY kw_hide_y conceal concealchar=y "syntax keyword ConcealedMe kw_hide_me conceal "syntax keyword NoConceal kw_normal " "highlight ConcealedX ctermfg=2 "highlight ConcealedY ctermfg=3 "highlight ConcealedMe ctermfg=4 "highlight NoConceal ctermfg=5 " :set conceallevel=2 highlight Conceal ctermbg=NONE ctermfg=green guibg=NONE guifg=NONE source ~/.vim/conceal.vim " jh to escape in insert mode, esc is hard to reach. "inoremap jh " Clears trailing whitespace while preserving cursor. function StripTrailingWhitespaces() let l = line(".") let c = col(".") %s/\s\+$//e call cursor(l, c) endfun augroup clearwhitespace_gp autocmd! autocmd BufWritePre * :call StripTrailingWhitespaces() augroup END " Toggle invisibles in normal mode nnoremap :set list! " Tab size shortcuts " TODO: VSCode-like tab menu nnoremap :set tabstop=4 shiftwidth=4 noexpandtab nnoremap :set tabstop=8 shiftwidth=8 noexpandtab " Autodetect filetypes and set proper indentation " Default: 4, with tabs. set tabstop=4 shiftwidth=4 noexpandtab augroup tabsize_gp autocmd! autocmd Filetype py setlocal tabstop=4 shiftwidth=4 noexpandtab autocmd Filetype lua setlocal tabstop=4 shiftwidth=4 noexpandtab augroup END " Plugins call plug#begin() Plug 'ssh://git@git.betalupi.com:33/mirrors/vim-goyo.git' Plug 'ssh://git@git.betalupi.com:33/mirrors/vim-gitgutter.git' Plug 'ssh://git@git.betalupi.com:33/mirrors/vim-nerdtree.git' Plug 'ssh://git@git.betalupi.com:33/mirrors/vim-hexHighlight.git' Plug 'ssh://git@git.betalupi.com:33/mirrors/vim-pencil.git' "Plug 'ssh://git@git.betalupi.com:33/mirrors/vim-wordchipper.git' Plug 'ssh://git@git.betalupi.com:33/mirrors/vim-boxdraw.git' Plug 'ssh://git@git.betalupi.com:33/mirrors/vim-fish.git' call plug#end() " The matchit plugin makes the % command work better, but it is not backwards " compatible. " The ! means the package won't be loaded right away but when plugins are " loaded during initialization. if has('syntax') && has('eval') packadd! matchit endif nmap ToggleHexHighlight let g:pencil#textwidth = 70 augroup pencil autocmd! autocmd FileType markdown,mkd call pencil#init({'wrap': 'soft'}) autocmd FileType text call pencil#init() autocmd FileType text setlocal list augroup END