all repos — dotfiles @ 78b555e3301eda41a89f4fc0caac1cc3efc1f1f2

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