all repos — dotfiles @ 34967f2735d2094d62af462fc58c71ef17c4b5ee

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'
 22call plug#end()
 23
 24" indentation
 25augroup indents
 26	autocmd!
 27	autocmd FileType less,css,html setlocal ts=2 sts=2 sw=2 expandtab
 28	autocmd FileType text,markdown setlocal expandtab
 29	autocmd FileType rgbds setlocal autoindent
 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 conceallevel=2 
 57set mouse=a
 58set wildmenu
 59set shiftwidth=4     " indent = 4 spaces
 60set tabstop=4        " tab = 4 spaces
 61set expandtab
 62set softtabstop=4    " backspace through spaces
 63set nocompatible
 64set noshowmode
 65set clipboard=unnamedplus
 66
 67" wildcard ignores
 68set wildignore+=.git,.hg,.svn
 69set wildignore+=*.aux,*.out,*.toc
 70set wildignore+=*.o,*.obj,*.exe,*.dll,*.manifest,*.rbc,*.class
 71set wildignore+=*.ai,*.bmp,*.gif,*.ico,*.jpg,*.jpeg,*.png,*.psd,*.webp
 72set wildignore+=*.avi,*.divx,*.mp4,*.webm,*.mov,*.m2ts,*.mkv,*.vob,*.mpg,*.mpeg
 73set wildignore+=*.mp3,*.oga,*.ogg,*.wav,*.flac
 74set wildignore+=*.eot,*.otf,*.ttf,*.woff
 75set wildignore+=*.doc,*.pdf,*.cbr,*.cbz
 76set wildignore+=*.zip,*.tar.gz,*.tar.bz2,*.rar,*.tar.xz,*.kgb
 77set wildignore+=*.swp,.lock,.DS_Store,._*
 78
 79" colorscheme
 80colorscheme plain
 81set background=dark
 82
 83" keybindings
 84let mapleader=' '
 85nnoremap <leader>n :nohlsearch<cr>
 86nnoremap <leader>o :only<cr>
 87nnoremap H H:exec 'norm! '. &scrolloff . 'k'<cr>
 88nnoremap L L:exec 'norm! '. &scrolloff . 'j'<cr>
 89nnoremap <C-t> :tabedit
 90
 91" Not an editor command: Wqa
 92:command! WQ wq
 93:command! Wq wq
 94:command! Wqa wqa
 95:command! W w
 96:command! Q q
 97
 98" statusline
 99let g:currentmode={
100			\ 'n'  : 'normal ',
101			\ 'no' : 'n·operator pending ',
102			\ 'v'  : 'visual ',
103			\ 'V'  : 'v·line ',
104			\ '' : 'v·block ',
105			\ 's'  : 'select ',
106			\ 'S'  : 's·line ',
107			\ '' : 's·block ',
108			\ 'i'  : 'insert ',
109			\ 'R'  : 'replace ',
110			\ 'Rv' : 'v·replace ',
111			\ 'c'  : 'command ',
112			\ 'cv' : 'vim ex ',
113			\ 'ce' : 'ex ',
114			\ 'r'  : 'prompt ',
115			\ 'rm' : 'more ',
116			\ 'r?' : 'confirm ',
117			\ '!'  : 'shell ',
118			\ 't'  : 'terminal '}
119
120hi PrimaryBlock   ctermfg=06 ctermbg=00
121hi SecondaryBlock ctermfg=08 ctermbg=00
122hi Blanks   ctermfg=07 ctermbg=00
123
124set statusline=
125set statusline+=%#PrimaryBlock#
126set statusline+=\ %{g:currentmode[mode()]}
127set statusline+=%#SecondaryBlock#
128set statusline+=%{StatuslineGit()}
129set statusline+=%#Blanks#
130set statusline+=\ %f\ 
131set statusline+=%m
132set statusline+=%=
133set statusline+=%#SecondaryBlock#
134set statusline+=\ %l\  
135set statusline+=%#PrimaryBlock#
136set statusline+=%{&filetype}
137
138" for git branch in statusline, from nerdypepper
139function! GitBranch()
140	return system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'")
141endfunction
142
143
144" bunch of functions
145function! S_gitgutter()  " formatted git hunk summary for statusline
146	if exists('b:gitgutter')
147		let l:summary = b:gitgutter.summary
148		if l:summary[0] != 0 || l:summary[1] != 0 || l:summary[2] != 0
149			return ' +'.l:summary[0].' ~'.l:summary[1].' -'.l:summary[2].' '
150		endif
151	endif
152	return ''
153endfunction
154
155function! StatuslineGit()
156	let l:branchname = GitBranch()
157	return strlen(l:branchname) > 0?'  '.l:branchname.' ':''
158endfunction
159
160" git gutter settings
161let g:gitgutter_override_sign_column_highlight = 0
162let g:gitgutter_sign_added                     = '+'
163let g:gitgutter_sign_modified                  = '±'
164let g:gitgutter_sign_removed                   = '-'
165let g:gitgutter_sign_removed_first_line        = '^'
166let g:gitgutter_sign_modified_removed          = '#'
167
168" comments are italicized
169hi Comment cterm=italic
170" color overrides
171hi CursorLine ctermbg=none
172
173" vim-markdown 
174let g:vim_markdown_no_default_key_mappings=1
175let g:vim_markdown_toml_frontmatter=1
176let g:vim_markdown_yaml_frontmatter=1
177let g:vim_markdown_folding_disabled=1
178let g:vim_markdown_conceal=0
179
180" vim-pencil
181let g:pencil#textwidth = 72
182let g:pencil#conceallevel = 0
183augroup pencil
184  autocmd!
185  autocmd FileType markdown,mkd,text call pencil#init({'wrap': 'hard', 'autoformat': 0})
186augroup END
187
188au BufRead,BufNewFile *.asm set filetype=rgbds
189
190augroup setMail
191    autocmd!
192    autocmd BufRead,BufNewFile /tmp/nail-* setlocal ft=mail
193augroup END
194
195" insert date
196abclear
197cabbrev dt read !~/bin/date.sh<cr>
198cabbrev tm read !date "+\%H:\%M"