all repos — dotfiles @ 7e7bfaf57f16fd57e9d7d2b218c0deab52932a53

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' }
 12Plug 'dag/vim-fish',
 13" plugins for writing {{{
 14Plug 'reedes/vim-pencil', { 'for': ['text',  'markdown'] }
 15Plug 'reedes/vim-wordy', { 'for': ['text',  'markdown'] }
 16Plug 'junegunn/goyo.vim', { 'for': ['text',  'markdown'] }
 17Plug 'plasticboy/vim-markdown', { 'for': ['text',  'markdown'] }
 18Plug 'kana/vim-textobj-user', { 'for': ['text', 'markdown'] }
 19Plug 'junegunn/goyo.vim'
 20Plug 'reedes/vim-textobj-quote' 
 21" }}}
 22Plug 'chriskempson/base16-vim'
 23Plug 'ervandew/supertab'
 24Plug 'yuttie/comfortable-motion.vim'
 25Plug 'zah/nim.vim'
 26Plug 'wellle/targets.vim'
 27Plug 'NerdyPepper/agila.vim'
 28Plug 'w0rp/ale'
 29" Plug 'skywind3000/vim-keysound'
 30call plug#end()
 31
 32" indentation
 33augroup indents
 34	autocmd!
 35	autocmd FileType less,css,html setlocal ts=2 sts=2 sw=2 expandtab
 36	autocmd FileType text,markdown setlocal expandtab
 37augroup END
 38
 39augroup restorecursor
 40	autocmd BufReadPost *
 41				\ if line("'\"") > 1 && line("'\"") <= line("$") |
 42				\   execute "normal! g`\"" |
 43				\ endif
 44augroup END
 45
 46" basic settings
 47set swapfile
 48set dir=/tmp
 49set nonumber
 50set smartcase
 51syntax on
 52filetype plugin indent on
 53set laststatus=2
 54set noshowmode
 55set hlsearch
 56set incsearch
 57set ignorecase
 58set scrolloff=12
 59set rtp+=~/.fzf
 60set timeout timeoutlen=3000 ttimeoutlen=100
 61set undodir=~/.vim/undodir
 62set nowrap
 63set nocursorline
 64set conceallevel=2 
 65set mouse=a
 66set wildmenu
 67set shiftwidth=4     " indent = 4 spaces
 68set tabstop=4        " tab = 4 spaces
 69set expandtab
 70set softtabstop=4    " backspace through spaces
 71set nocompatible
 72
 73" wildcard ignores
 74set wildignore+=.git,.hg,.svn
 75set wildignore+=*.aux,*.out,*.toc
 76set wildignore+=*.o,*.obj,*.exe,*.dll,*.manifest,*.rbc,*.class
 77set wildignore+=*.ai,*.bmp,*.gif,*.ico,*.jpg,*.jpeg,*.png,*.psd,*.webp
 78set wildignore+=*.avi,*.divx,*.mp4,*.webm,*.mov,*.m2ts,*.mkv,*.vob,*.mpg,*.mpeg
 79set wildignore+=*.mp3,*.oga,*.ogg,*.wav,*.flac
 80set wildignore+=*.eot,*.otf,*.ttf,*.woff
 81set wildignore+=*.doc,*.pdf,*.cbr,*.cbz
 82set wildignore+=*.zip,*.tar.gz,*.tar.bz2,*.rar,*.tar.xz,*.kgb
 83set wildignore+=*.swp,.lock,.DS_Store,._*
 84
 85" colorscheme
 86colorscheme plain
 87
 88" keybindings
 89let mapleader=' '
 90nnoremap <leader>n :nohlsearch<cr>
 91nnoremap <leader>o :only<cr>
 92nnoremap H H:exec 'norm! '. &scrolloff . 'k'<cr>
 93nnoremap L L:exec 'norm! '. &scrolloff . 'j'<cr>
 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" deoplete 
166let g:help_in_tabs = 1
167let g:deoplete#enable_at_startup = 1
168
169nmap <silent> H :let g:help_in_tabs = !g:help_in_tabs<CR
170
171" only apply to .txt files
172augroup HelpInTabs
173	autocmd!
174	autocmd BufEnter  *.txt   call HelpInNewTab()
175augroup END
176
177" only apply to help files
178function! HelpInNewTab ()
179	if &buftype == 'help' && g:help_in_tabs
180		"Convert the help window to a tab...
181		execute "normal \<C-W>T"
182	endif
183endfunction
184
185" comments are italicized
186hi Comment cterm=italic
187" color overrides
188hi CursorLine ctermbg=none
189
190
191" vim-markdown 
192let g:vim_markdown_no_default_key_mappings=1
193let g:vim_markdown_toml_frontmatter=1
194let g:vim_markdown_yaml_fromtmatter=1
195let g:vim_markdown_folding_disabled=1
196let g:vim_markdown_conceal=0
197
198" keysound
199let g:keysound_enable = 1
200let g:keysound_volume = 1000
201let g:keysound_py_version = 3
202let g:keysound_theme = 'default'
203
204" textobj_quote
205augroup textobj_quote
206  autocmd!
207  autocmd FileType markdown call textobj#quote#init({'educate': 1})
208  autocmd FileType textile call textobj#quote#init({'educate': 1})
209  autocmd FileType text call textobj#quote#init({'educate': 1})
210augroup END
211