all repos — dotfiles @ a97c3973017c223ba8a9c1d24c7802f3bce75cf6

my *nix dotfiles

home/.vimrc (view raw)

  1" _       _ _         _           
  2"(_)_ __ (_) |___   _(_)_ __ ___  
  3"| | '_ \| | __\ \ / / | '_ ` _ \ 
  4"| | | | | | |_ \ V /| | | | | | |
  5"|_|_| |_|_|\__(_)_/ |_|_| |_| |_|
  6
  7
  8call plug#begin()
  9Plug 'jiangmiao/auto-pairs'
 10Plug 'airblade/vim-gitgutter'
 11Plug 'NerdyPepper/vim-colors-plain', { 'branch': 'duotone' }
 12Plug 'dbeniamine/vim-mail'
 13Plug 'tpope/vim-surround'
 14" plugins for writing {{{
 15Plug 'reedes/vim-pencil', { 'for': ['text',  'markdown'] }
 16Plug 'plasticboy/vim-markdown', { 'for': ['text',  'markdown'] }
 17" }}}
 18Plug 'ervandew/supertab'
 19Plug 'Clavelito/indent-awk.vim'
 20Plug 'soywod/iris.vim'
 21Plug 'wellle/targets.vim'
 22Plug 'tpope/vim-rsi'
 23call plug#end()
 24
 25" indentation
 26augroup indents
 27	autocmd!
 28	autocmd FileType less,css,html setlocal ts=2 sts=2 sw=2 expandtab
 29	autocmd FileType text,markdown setlocal expandtab
 30	autocmd FileType rgbds setlocal autoindent
 31augroup END
 32
 33augroup restorecursor
 34	autocmd BufReadPost *
 35				\ if line("'\"") > 1 && line("'\"") <= line("$") |
 36				\   execute "normal! g`\"" |
 37				\ endif
 38augroup END
 39
 40" basic settings
 41set swapfile
 42set dir=/tmp
 43set nonumber
 44set smartcase
 45syntax on
 46filetype plugin indent on
 47set laststatus=2
 48set hlsearch
 49set incsearch
 50set ignorecase
 51set scrolloff=12
 52set rtp+=~/.fzf
 53set timeout timeoutlen=3000 ttimeoutlen=100
 54set undodir=~/.vim/undodir
 55set nowrap
 56set nocursorline
 57set conceallevel=2 
 58set mouse=a
 59set wildmenu
 60set shiftwidth=4     " indent = 4 spaces
 61set tabstop=4        " tab = 4 spaces
 62set expandtab
 63set softtabstop=4    " backspace through spaces
 64set nocompatible
 65set noshowmode
 66set clipboard=unnamedplus
 67
 68" wildcard ignores
 69set wildignore+=.git,.hg,.svn
 70set wildignore+=*.aux,*.out,*.toc
 71set wildignore+=*.o,*.obj,*.exe,*.dll,*.manifest,*.rbc,*.class
 72set wildignore+=*.ai,*.bmp,*.gif,*.ico,*.jpg,*.jpeg,*.png,*.psd,*.webp
 73set wildignore+=*.avi,*.divx,*.mp4,*.webm,*.mov,*.m2ts,*.mkv,*.vob,*.mpg,*.mpeg
 74set wildignore+=*.mp3,*.oga,*.ogg,*.wav,*.flac
 75set wildignore+=*.eot,*.otf,*.ttf,*.woff
 76set wildignore+=*.doc,*.pdf,*.cbr,*.cbz
 77set wildignore+=*.zip,*.tar.gz,*.tar.bz2,*.rar,*.tar.xz,*.kgb
 78set wildignore+=*.swp,.lock,.DS_Store,._*
 79
 80" colorscheme
 81colorscheme plain
 82set background=dark
 83
 84" keybindings
 85let mapleader=' '
 86nnoremap <leader>n :nohlsearch<cr>
 87nnoremap <leader>o :only<cr>
 88nnoremap H H:exec 'norm! '. &scrolloff . 'k'<cr>
 89nnoremap L L:exec 'norm! '. &scrolloff . 'j'<cr>
 90nnoremap <C-t> :tabedit
 91
 92" Not an editor command: Wqa
 93:command! WQ wq
 94:command! Wq wq
 95:command! Wqa wqa
 96:command! W w
 97:command! Q q
 98
 99" statusline
100let g:currentmode={
101			\ 'n'  : 'normal ',
102			\ 'no' : 'n·operator pending ',
103			\ 'v'  : 'visual ',
104			\ 'V'  : 'v·line ',
105			\ '' : 'v·block ',
106			\ 's'  : 'select ',
107			\ 'S'  : 's·line ',
108			\ '' : 's·block ',
109			\ 'i'  : 'insert ',
110			\ 'R'  : 'replace ',
111			\ 'Rv' : 'v·replace ',
112			\ 'c'  : 'command ',
113			\ 'cv' : 'vim ex ',
114			\ 'ce' : 'ex ',
115			\ 'r'  : 'prompt ',
116			\ 'rm' : 'more ',
117			\ 'r?' : 'confirm ',
118			\ '!'  : 'shell ',
119			\ 't'  : 'terminal '}
120
121hi PrimaryBlock   ctermfg=06 ctermbg=00
122hi SecondaryBlock ctermfg=08 ctermbg=00
123hi Blanks   ctermfg=07 ctermbg=00
124
125set statusline=
126set statusline+=%#PrimaryBlock#
127set statusline+=\ %{g:currentmode[mode()]}
128set statusline+=%#SecondaryBlock#
129set statusline+=%{StatuslineGit()}
130set statusline+=%#Blanks#
131set statusline+=\ %f\ 
132set statusline+=%m
133set statusline+=%=
134set statusline+=%#SecondaryBlock#
135set statusline+=\ %l\  
136set statusline+=%#PrimaryBlock#
137set statusline+=%{&filetype}
138
139" for git branch in statusline, from nerdypepper
140function! GitBranch()
141	return system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'")
142endfunction
143
144
145" bunch of functions
146function! S_gitgutter()  " formatted git hunk summary for statusline
147	if exists('b:gitgutter')
148		let l:summary = b:gitgutter.summary
149		if l:summary[0] != 0 || l:summary[1] != 0 || l:summary[2] != 0
150			return ' +'.l:summary[0].' ~'.l:summary[1].' -'.l:summary[2].' '
151		endif
152	endif
153	return ''
154endfunction
155
156function! StatuslineGit()
157	let l:branchname = GitBranch()
158	return strlen(l:branchname) > 0?'  '.l:branchname.' ':''
159endfunction
160
161" git gutter settings
162let g:gitgutter_override_sign_column_highlight = 0
163let g:gitgutter_sign_added                     = '+'
164let g:gitgutter_sign_modified                  = '±'
165let g:gitgutter_sign_removed                   = '-'
166let g:gitgutter_sign_removed_first_line        = '^'
167let g:gitgutter_sign_modified_removed          = '#'
168
169" comments are italicized
170hi Comment cterm=italic
171" color overrides
172hi CursorLine ctermbg=none
173
174" vim-markdown 
175let g:vim_markdown_no_default_key_mappings=1
176let g:vim_markdown_toml_frontmatter=1
177let g:vim_markdown_yaml_frontmatter=1
178let g:vim_markdown_folding_disabled=1
179let g:vim_markdown_conceal=0
180
181" vim-pencil
182let g:pencil#textwidth = 72
183let g:pencil#conceallevel = 0
184augroup pencil
185  autocmd!
186  autocmd FileType markdown,mkd,text call pencil#init({'wrap': 'hard', 'autoformat': 0})
187augroup END
188
189au BufRead,BufNewFile *.asm set filetype=rgbds
190
191augroup setMail
192    autocmd!
193    autocmd BufRead,BufNewFile /tmp/nail-* setlocal ft=mail
194augroup END
195
196" insert date
197abclear
198cabbrev dt read !~/bin/date.sh<cr>
199cabbrev tm read !date "+\%H:\%M"
200
201" change cursor
202" doesn't actually work :(
203if exists('$TMUX')
204    let &t_SI .= "\ePtmux;\e\e[6 q\e\\"
205    let &t_EI .= "\ePtmux;\e\e[2 q\e\\"
206    let &t_SR .= "\ePtmux;\e\e[4 q\e\\"
207else
208    let &t_SI .= "\e[6 q"
209    let &t_EI .= "\e[2 q"
210    let &t_SR .= "\e[4 q"
211endif