all repos — dotfiles @ f158d1fa05f036a187d999c2555d19b322d5ce21

my *nix dotfiles

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