all repos — dotfiles @ c4d107e799393869752b629868ca934fee325921

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', { 'for': ['text', 'markdown'] }
 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
 71
 72" wildcard ignores
 73set wildignore+=.git,.hg,.svn
 74set wildignore+=*.aux,*.out,*.toc
 75set wildignore+=*.o,*.obj,*.exe,*.dll,*.manifest,*.rbc,*.class
 76set wildignore+=*.ai,*.bmp,*.gif,*.ico,*.jpg,*.jpeg,*.png,*.psd,*.webp
 77set wildignore+=*.avi,*.divx,*.mp4,*.webm,*.mov,*.m2ts,*.mkv,*.vob,*.mpg,*.mpeg
 78set wildignore+=*.mp3,*.oga,*.ogg,*.wav,*.flac
 79set wildignore+=*.eot,*.otf,*.ttf,*.woff
 80set wildignore+=*.doc,*.pdf,*.cbr,*.cbz
 81set wildignore+=*.zip,*.tar.gz,*.tar.bz2,*.rar,*.tar.xz,*.kgb
 82set wildignore+=*.swp,.lock,.DS_Store,._*
 83
 84" deoplete
 85let g:deoplete#enable_at_startup = 1
 86
 87" colorscheme
 88colorscheme agila
 89
 90" keybindings
 91let mapleader=' '
 92nnoremap <leader>n :nohlsearch<cr>
 93nnoremap <leader>o :only<cr>
 94nnoremap H H:exec 'norm! '. &scrolloff . 'k'<cr>
 95nnoremap L L:exec 'norm! '. &scrolloff . 'j'<cr>
 96
 97" statusline
 98let g:currentmode={
 99			\ 'n'  : 'NORMAL ',
100			\ 'no' : 'N·Operator Pending ',
101			\ 'v'  : 'VISUAL ',
102			\ 'V'  : 'V·Line ',
103			\ '' : 'V·Block',
104			\ 's'  : 'Select ',
105			\ 'S'  : 'S·Line ',
106			\ '' : 'S·Block',
107			\ 'i'  : 'INSERT ',
108			\ 'R'  : 'REPLACE ',
109			\ 'Rv' : 'V·Replace ',
110			\ 'c'  : 'Command ',
111			\ 'cv' : 'Vim Ex ',
112			\ 'ce' : 'Ex ',
113			\ 'r'  : 'Prompt ',
114			\ 'rm' : 'MORE ',
115			\ 'r?' : 'CONFIRM ',
116			\ '!'  : 'SHELL ',
117			\ 't'  : 'TERMINAL '}
118
119set statusline=
120set statusline+=%#PrimaryBlock#
121set statusline+=\ %{g:currentmode[mode()]}
122set statusline+=%#TabLineSel#
123set statusline+=%{StatuslineGit()}
124set statusline+=%#TabLineFill#
125set statusline+=\ %f\ 
126set statusline+=%m
127set statusline+=%=
128set statusline+=%#TabLineSel#
129set statusline+=\ %l\  
130set statusline+=%#PrimaryBlock#
131set statusline+=\ %y\ 
132
133" for git branch in statusline, from nerdypepper
134function! GitBranch()
135	return system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'")
136endfunction
137
138
139" bunch of functions
140function! S_gitgutter()  " formatted git hunk summary for statusline
141	if exists('b:gitgutter')
142		let l:summary = b:gitgutter.summary
143		if l:summary[0] != 0 || l:summary[1] != 0 || l:summary[2] != 0
144			return ' +'.l:summary[0].' ~'.l:summary[1].' -'.l:summary[2].' '
145		endif
146	endif
147	return ''
148endfunction
149
150function! StatuslineGit()
151	let l:branchname = GitBranch()
152	return strlen(l:branchname) > 0?'  '.l:branchname.' ':''
153endfunction
154
155" git gutter settings
156let g:gitgutter_override_sign_column_highlight = 0
157let g:gitgutter_sign_added                     = '+'
158let g:gitgutter_sign_modified                  = '±'
159let g:gitgutter_sign_removed                   = '-'
160let g:gitgutter_sign_removed_first_line        = '^'
161let g:gitgutter_sign_modified_removed          = '#'
162
163" deoplete 
164let g:help_in_tabs = 1
165let g:deoplete#enable_at_startup = 1
166
167nmap <silent> H :let g:help_in_tabs = !g:help_in_tabs<CR
168
169" only apply to .txt files
170augroup HelpInTabs
171	autocmd!
172	autocmd BufEnter  *.txt   call HelpInNewTab()
173augroup END
174
175" only apply to help files
176function! HelpInNewTab ()
177	if &buftype == 'help' && g:help_in_tabs
178		"Convert the help window to a tab...
179		execute "normal \<C-W>T"
180	endif
181endfunction
182
183" comments are italicized
184hi Comment cterm=italic
185" color overrides
186hi CursorLine ctermbg=none
187hi Visual ctermfg=white cterm=bold ctermbg=magenta
188
189
190" vim-markdown 
191let g:vim_markdown_no_default_key_mappings=1
192let g:vim_markdown_toml_frontmatter=1
193let g:vim_markdown_yaml_fromtmatter=1
194let g:vim_markdown_folding_disabled=1
195
196" deoplete-jedi
197let g:python_host_prog = '/home/icy/.pynvim2/bin/python'
198let g:python3_host_prog = '/home/icy/.pynvim3/bin/python'
199
200" keysound
201let g:keysound_enable = 1
202let g:keysound_volume = 1000
203let g:keysound_py_version = 3
204let g:keysound_theme = 'default'
205
206" textobj_quote
207augroup textobj_quote
208    autocmd!
209    autocmd FileType markdown call textobj#quote#init({'educate': 1})
210    autocmd FileType textile call textobj#quote#init({'educate': 1})
211    autocmd FileType text call textobj#quote#init({'educate': 1})
212augroup END
213
214" litecorrect
215augroup litecorrect
216    autocmd!
217    autocmd FileType markdown,mkd call litecorrect#init()
218    autocmd FileType textile call litecorrect#init()
219augroup END