all repos — dotfiles @ 4e51c8edd051fdcdb43f3e15a13662e0db353d27

my *nix dotfiles

config/nvim/init.vim (view raw)

  1" _       _ _         _           
  2"(_)_ __ (_) |___   _(_)_ __ ___  
  3"| | '_ \| | __\ \ / / | '_ ` _ \ 
  4"| | | | | | |_ \ V /| | | | | | |
  5"|_|_| |_|_|\__(_)_/ |_|_| |_| |_|
  6
  7
  8call plug#begin()
  9Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
 10Plug 'jiangmiao/auto-pairs'
 11Plug 'airblade/vim-gitgutter'
 12" plugins for writing {{{
 13Plug 'reedes/vim-pencil', { 'for': ['text',  'markdown'] }
 14Plug 'reedes/vim-wordy', { 'for': ['text',  'markdown'] }
 15Plug 'reedes/vim-litecorrect', { '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 'reedes/vim-textobj-quote' 
 20" }}}
 21Plug 'chriskempson/base16-vim'
 22Plug 'ervandew/supertab'
 23Plug 'yuttie/comfortable-motion.vim'
 24Plug 'zchee/deoplete-jedi'
 25Plug 'zah/nim.vim'
 26Plug 'wellle/targets.vim'
 27Plug 'NerdyPepper/agila.vim'
 28Plug 'w0rp/ale'
 29Plug '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 number
 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 cursorline
 64set conceallevel=2 
 65set mouse=a
 66set wildmenu
 67set shiftwidth=4     " indent = 4 spaces
 68set noexpandtab      " tabs are tabs
 69set tabstop=4        " tab = 4 spaces
 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" deoplete
 86let g:deoplete#enable_at_startup = 1
 87
 88" colorscheme
 89colorscheme agila
 90
 91" keybindings
 92let mapleader=' '
 93nnoremap <leader>n :nohlsearch<cr>
 94nnoremap <leader>o :only<cr>
 95nnoremap H H:exec 'norm! '. &scrolloff . 'k'<cr>
 96nnoremap L L:exec 'norm! '. &scrolloff . 'j'<cr>
 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
120set statusline=
121set statusline+=%#PrimaryBlock#
122set statusline+=\ %{g:currentmode[mode()]}
123set statusline+=%#TabLineSel#
124set statusline+=%{StatuslineGit()}
125set statusline+=%#TabLineFill#
126set statusline+=\ %f\ 
127set statusline+=%m
128set statusline+=%=
129set statusline+=%#TabLineSel#
130set statusline+=\ %l\  
131set statusline+=%#PrimaryBlock#
132set statusline+=\ %y\ 
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
164" deoplete 
165let g:help_in_tabs = 1
166let g:deoplete#enable_at_startup = 1
167
168nmap <silent> H :let g:help_in_tabs = !g:help_in_tabs<CR
169
170" only apply to .txt files
171augroup HelpInTabs
172	autocmd!
173	autocmd BufEnter  *.txt   call HelpInNewTab()
174augroup END
175
176" only apply to help files
177function! HelpInNewTab ()
178	if &buftype == 'help' && g:help_in_tabs
179		"Convert the help window to a tab...
180		execute "normal \<C-W>T"
181	endif
182endfunction
183
184" comments are italicized
185hi Comment cterm=italic
186" color overrides
187hi CursorLine ctermbg=none
188hi Visual ctermfg=white cterm=bold ctermbg=magenta
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
196
197" deoplete-jedi
198let g:python_host_prog = '/home/icy/.pynvim2/bin/python'
199let g:python3_host_prog = '/home/icy/.pynvim3/bin/python'
200
201" keysound
202let g:keysound_enable = 1
203let g:keysound_volume = 1000
204let g:keysound_py_version = 3
205let g:keysound_theme = 'default'
206
207" textobj_quote
208augroup textobj_quote
209  autocmd!
210  autocmd FileType markdown call textobj#quote#init({'educate': 1})
211  autocmd FileType textile call textobj#quote#init({'educate': 1})
212  autocmd FileType text call textobj#quote#init({'educate': 1})
213augroup END
214
215" litecorrect
216augroup litecorrect
217    autocmd!
218    autocmd FileType markdown,mkd call litecorrect#init()
219    autocmd FileType textile call litecorrect#init()
220augroup END