all repos — dotfiles @ f7e1fe39d48d550cdda8edea5992f1264880628a

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 'wellle/targets.vim'
 21Plug 'tpope/vim-rsi'
 22Plug 'zah/nim.vim'
 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
 30augroup END
 31
 32augroup restorecursor
 33	autocmd BufReadPost *
 34				\ if line("'\"") > 1 && line("'\"") <= line("$") |
 35				\   execute "normal! g`\"" |
 36				\ endif
 37augroup END
 38
 39" basic settings
 40set swapfile
 41set dir=/tmp
 42set nonumber
 43set smartcase
 44syntax on
 45filetype plugin indent on
 46set laststatus=2
 47set hlsearch
 48set incsearch
 49set ignorecase
 50set scrolloff=12
 51set rtp+=~/.fzf
 52set timeout timeoutlen=3000 ttimeoutlen=100
 53set undodir=~/.vim/undodir
 54set nowrap
 55set nocursorline
 56set nofoldenable
 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><esc> :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
 91nnoremap <leader>n :bnext<cr>
 92nnoremap <leader>p :bprev<cr>
 93
 94" Not an editor command: Wqa
 95:command! WQ wq
 96:command! Wq wq
 97:command! Wqa wqa
 98:command! W w
 99:command! Q q
100
101" statusline
102let g:currentmode={
103			\ 'n'  : 'normal ',
104			\ 'no' : 'n·operator pending ',
105			\ 'v'  : 'visual ',
106			\ 'V'  : 'v·line ',
107			\ '' : 'v·block ',
108			\ 's'  : 'select ',
109			\ 'S'  : 's·line ',
110			\ '' : 's·block ',
111			\ 'i'  : 'insert ',
112			\ 'R'  : 'replace ',
113			\ 'Rv' : 'v·replace ',
114			\ 'c'  : 'command ',
115			\ 'cv' : 'vim ex ',
116			\ 'ce' : 'ex ',
117			\ 'r'  : 'prompt ',
118			\ 'rm' : 'more ',
119			\ 'r?' : 'confirm ',
120			\ '!'  : 'shell ',
121			\ 't'  : 'terminal '}
122
123hi PrimaryBlock   ctermfg=06 ctermbg=00
124hi SecondaryBlock ctermfg=08 ctermbg=00
125hi Blanks   ctermfg=07 ctermbg=00
126
127set statusline=
128set statusline+=%#PrimaryBlock#
129set statusline+=\ %{g:currentmode[mode()]}
130set statusline+=%#SecondaryBlock#
131set statusline+=%{StatuslineGit()}
132set statusline+=%#Blanks#
133set statusline+=\ %f\ 
134set statusline+=%m
135set statusline+=%=
136set statusline+=%#SecondaryBlock#
137set statusline+=\ %l\  
138set statusline+=%#PrimaryBlock#
139set statusline+=%{&filetype}
140
141" for git branch in statusline, from nerdypepper
142function! GitBranch()
143	return system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'")
144endfunction
145
146
147" bunch of functions
148function! S_gitgutter()  " formatted git hunk summary for statusline
149	if exists('b:gitgutter')
150		let l:summary = b:gitgutter.summary
151		if l:summary[0] != 0 || l:summary[1] != 0 || l:summary[2] != 0
152			return ' +'.l:summary[0].' ~'.l:summary[1].' -'.l:summary[2].' '
153		endif
154	endif
155	return ''
156endfunction
157
158function! StatuslineGit()
159	let l:branchname = GitBranch()
160	return strlen(l:branchname) > 0?'  '.l:branchname.' ':''
161endfunction
162
163" git gutter settings
164let g:gitgutter_override_sign_column_highlight = 0
165let g:gitgutter_sign_added                     = '+'
166let g:gitgutter_sign_modified                  = '±'
167let g:gitgutter_sign_removed                   = '-'
168let g:gitgutter_sign_removed_first_line        = '^'
169let g:gitgutter_sign_modified_removed          = '#'
170
171" comments are italicized
172hi Comment cterm=italic
173" color overrides
174hi CursorLine ctermbg=none
175
176" vim-markdown 
177let g:vim_markdown_no_default_key_mappings=1
178let g:vim_markdown_toml_frontmatter=1
179let g:vim_markdown_yaml_frontmatter=1
180let g:vim_markdown_folding_disabled=1
181let g:vim_markdown_conceal=0
182
183" vim-pencil
184let g:pencil#textwidth = 72
185let g:pencil#conceallevel = 0
186augroup pencil
187  autocmd!
188  autocmd FileType markdown,mkd,text call pencil#init({'wrap': 'hard', 'autoformat': 0})
189augroup END
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