all repos — dotfiles @ d3f177dad50cfee8ad1301ce8e3f9b4245721c00

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 'junegunn/goyo.vim'
 20Plug 'reedes/vim-textobj-quote' 
 21" }}}
 22Plug 'chriskempson/base16-vim'
 23Plug 'ervandew/supertab'
 24Plug 'yuttie/comfortable-motion.vim'
 25Plug 'zchee/deoplete-jedi'
 26Plug 'zah/nim.vim'
 27Plug 'wellle/targets.vim'
 28Plug 'NerdyPepper/agila.vim'
 29Plug 'w0rp/ale'
 30" Plug 'skywind3000/vim-keysound'
 31call plug#end()
 32
 33" indentation
 34augroup indents
 35	autocmd!
 36	autocmd FileType less,css,html setlocal ts=2 sts=2 sw=2 expandtab
 37	autocmd FileType text,markdown setlocal expandtab
 38augroup END
 39
 40augroup restorecursor
 41	autocmd BufReadPost *
 42				\ if line("'\"") > 1 && line("'\"") <= line("$") |
 43				\   execute "normal! g`\"" |
 44				\ endif
 45augroup END
 46
 47" basic settings
 48set swapfile
 49set dir=/tmp
 50set number
 51set smartcase
 52syntax on
 53filetype plugin indent on
 54set laststatus=2
 55set noshowmode
 56set hlsearch
 57set incsearch
 58set ignorecase
 59set scrolloff=12
 60set rtp+=~/.fzf
 61set timeout timeoutlen=3000 ttimeoutlen=100
 62set undodir=~/.vim/undodir
 63set nowrap
 64set cursorline
 65set conceallevel=2 
 66set mouse=a
 67set wildmenu
 68set shiftwidth=4     " indent = 4 spaces
 69set noexpandtab      " tabs are tabs
 70set tabstop=4        " tab = 4 spaces
 71set softtabstop=4    " backspace through spaces
 72set nocompatible
 73
 74" wildcard ignores
 75set wildignore+=.git,.hg,.svn
 76set wildignore+=*.aux,*.out,*.toc
 77set wildignore+=*.o,*.obj,*.exe,*.dll,*.manifest,*.rbc,*.class
 78set wildignore+=*.ai,*.bmp,*.gif,*.ico,*.jpg,*.jpeg,*.png,*.psd,*.webp
 79set wildignore+=*.avi,*.divx,*.mp4,*.webm,*.mov,*.m2ts,*.mkv,*.vob,*.mpg,*.mpeg
 80set wildignore+=*.mp3,*.oga,*.ogg,*.wav,*.flac
 81set wildignore+=*.eot,*.otf,*.ttf,*.woff
 82set wildignore+=*.doc,*.pdf,*.cbr,*.cbz
 83set wildignore+=*.zip,*.tar.gz,*.tar.bz2,*.rar,*.tar.xz,*.kgb
 84set wildignore+=*.swp,.lock,.DS_Store,._*
 85
 86" deoplete
 87let g:deoplete#enable_at_startup = 1
 88
 89" colorscheme
 90colorscheme agila
 91
 92" keybindings
 93let mapleader=' '
 94nnoremap <leader>n :nohlsearch<cr>
 95nnoremap <leader>o :only<cr>
 96nnoremap H H:exec 'norm! '. &scrolloff . 'k'<cr>
 97nnoremap L L:exec 'norm! '. &scrolloff . 'j'<cr>
 98
 99" statusline
100let g:currentmode={
101			\ 'n'  : 'NORMAL ',
102			\ 'no' : 'N·Operator Pending ',
103			\ 'v'  : 'VISUAL ',
104			\ 'V'  : 'V·Line ',
105			\ '' : 'V·Block',
106			\ 's'  : 'Select ',
107			\ 'S'  : 'S·Line ',
108			\ '' : 'S·Block',
109			\ 'i'  : 'INSERT ',
110			\ 'R'  : 'REPLACE ',
111			\ 'Rv' : 'V·Replace ',
112			\ 'c'  : 'Command ',
113			\ 'cv' : 'Vim Ex ',
114			\ 'ce' : 'Ex ',
115			\ 'r'  : 'Prompt ',
116			\ 'rm' : 'MORE ',
117			\ 'r?' : 'CONFIRM ',
118			\ '!'  : 'SHELL ',
119			\ 't'  : 'TERMINAL '}
120
121set statusline=
122set statusline+=%#PrimaryBlock#
123set statusline+=\ %{g:currentmode[mode()]}
124set statusline+=%#TabLineSel#
125set statusline+=%{StatuslineGit()}
126set statusline+=%#TabLineFill#
127set statusline+=\ %f\ 
128set statusline+=%m
129set statusline+=%=
130set statusline+=%#TabLineSel#
131set statusline+=\ %l\  
132set statusline+=%#PrimaryBlock#
133set statusline+=\ %y\ 
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
189hi Visual ctermfg=white cterm=bold ctermbg=magenta
190
191
192" vim-markdown 
193let g:vim_markdown_no_default_key_mappings=1
194let g:vim_markdown_toml_frontmatter=1
195let g:vim_markdown_yaml_fromtmatter=1
196let g:vim_markdown_folding_disabled=1
197
198" deoplete-jedi
199let g:python_host_prog = '/home/icy/.pynvim2/bin/python'
200let g:python3_host_prog = '/home/icy/.pynvim3/bin/python'
201
202" keysound
203let g:keysound_enable = 1
204let g:keysound_volume = 1000
205let g:keysound_py_version = 3
206let g:keysound_theme = 'default'
207
208" textobj_quote
209augroup textobj_quote
210  autocmd!
211  autocmd FileType markdown call textobj#quote#init({'educate': 1})
212  autocmd FileType textile call textobj#quote#init({'educate': 1})
213  autocmd FileType text call textobj#quote#init({'educate': 1})
214augroup END
215
216" litecorrect
217augroup litecorrect
218    autocmd!
219    autocmd FileType markdown,mkd call litecorrect#init()
220    autocmd FileType textile call litecorrect#init()
221augroup END