all repos — dotfiles @ 0df91d9c0197c7acd8db85015f1b36cb12d4173c

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'
 12Plug 'NerdyPepper/vim-colors-plain', { 'branch': 'duotone' }
 13" plugins for writing {{{
 14Plug 'reedes/vim-pencil', { 'for': ['text',  'markdown'] }
 15Plug 'reedes/vim-wordy', { 'for': ['text',  'markdown'] }
 16Plug 'reedes/vim-litecorrect', { 'for': ['text',  'markdown'] }
 17Plug 'junegunn/goyo.vim', { 'for': ['text',  'markdown'] }
 18Plug 'plasticboy/vim-markdown', { 'for': ['text',  'markdown'] }
 19Plug 'kana/vim-textobj-user', { 'for': ['text', 'markdown'] }
 20Plug 'junegunn/goyo.vim'
 21Plug 'reedes/vim-textobj-quote' 
 22" }}}
 23Plug 'chriskempson/base16-vim'
 24Plug 'ervandew/supertab'
 25Plug 'yuttie/comfortable-motion.vim'
 26Plug 'zchee/deoplete-jedi'
 27Plug 'zah/nim.vim'
 28Plug 'wellle/targets.vim'
 29Plug 'NerdyPepper/agila.vim'
 30Plug 'w0rp/ale'
 31" Plug 'skywind3000/vim-keysound'
 32call plug#end()
 33
 34" indentation
 35augroup indents
 36	autocmd!
 37	autocmd FileType less,css,html setlocal ts=2 sts=2 sw=2 expandtab
 38	autocmd FileType text,markdown setlocal expandtab
 39augroup END
 40
 41augroup restorecursor
 42	autocmd BufReadPost *
 43				\ if line("'\"") > 1 && line("'\"") <= line("$") |
 44				\   execute "normal! g`\"" |
 45				\ endif
 46augroup END
 47
 48" basic settings
 49set swapfile
 50set dir=/tmp
 51set nonumber
 52set smartcase
 53syntax on
 54filetype plugin indent on
 55set laststatus=2
 56set noshowmode
 57set hlsearch
 58set incsearch
 59set ignorecase
 60set scrolloff=12
 61set rtp+=~/.fzf
 62set timeout timeoutlen=3000 ttimeoutlen=100
 63set undodir=~/.vim/undodir
 64set nowrap
 65set nocursorline
 66set conceallevel=2 
 67set mouse=a
 68set wildmenu
 69set shiftwidth=4     " indent = 4 spaces
 70set noexpandtab      " tabs are tabs
 71set tabstop=4        " tab = 4 spaces
 72set softtabstop=4    " backspace through spaces
 73set nocompatible
 74
 75" wildcard ignores
 76set wildignore+=.git,.hg,.svn
 77set wildignore+=*.aux,*.out,*.toc
 78set wildignore+=*.o,*.obj,*.exe,*.dll,*.manifest,*.rbc,*.class
 79set wildignore+=*.ai,*.bmp,*.gif,*.ico,*.jpg,*.jpeg,*.png,*.psd,*.webp
 80set wildignore+=*.avi,*.divx,*.mp4,*.webm,*.mov,*.m2ts,*.mkv,*.vob,*.mpg,*.mpeg
 81set wildignore+=*.mp3,*.oga,*.ogg,*.wav,*.flac
 82set wildignore+=*.eot,*.otf,*.ttf,*.woff
 83set wildignore+=*.doc,*.pdf,*.cbr,*.cbz
 84set wildignore+=*.zip,*.tar.gz,*.tar.bz2,*.rar,*.tar.xz,*.kgb
 85set wildignore+=*.swp,.lock,.DS_Store,._*
 86
 87" deoplete
 88let g:deoplete#enable_at_startup = 1
 89
 90" colorscheme
 91colorscheme plain
 92
 93" keybindings
 94let mapleader=' '
 95nnoremap <leader>n :nohlsearch<cr>
 96nnoremap <leader>o :only<cr>
 97nnoremap H H:exec 'norm! '. &scrolloff . 'k'<cr>
 98nnoremap L L:exec 'norm! '. &scrolloff . 'j'<cr>
 99
100" statusline
101let g:currentmode={
102			\ 'n'  : 'normal ',
103			\ 'no' : 'n·operator pending ',
104			\ 'v'  : 'visual ',
105			\ 'V'  : 'v·line ',
106			\ '' : 'v·block ',
107			\ 's'  : 'select ',
108			\ 'S'  : 's·line ',
109			\ '' : 's·block ',
110			\ 'i'  : 'insert ',
111			\ 'R'  : 'replace ',
112			\ 'Rv' : 'v·replace ',
113			\ 'c'  : 'command ',
114			\ 'cv' : 'vim ex ',
115			\ 'ce' : 'ex ',
116			\ 'r'  : 'prompt ',
117			\ 'rm' : 'more ',
118			\ 'r?' : 'confirm ',
119			\ '!'  : 'shell ',
120			\ 't'  : 'terminal '}
121
122hi PrimaryBlock   ctermfg=06 ctermbg=00
123hi SecondaryBlock ctermfg=08 ctermbg=00
124hi Blanks   ctermfg=07 ctermbg=00
125
126set statusline=
127set statusline+=%#PrimaryBlock#
128set statusline+=\ %{g:currentmode[mode()]}
129set statusline+=%#SecondaryBlock#
130set statusline+=%{StatuslineGit()}
131set statusline+=%#Blanks#
132set statusline+=\ %f\ 
133set statusline+=%m
134set statusline+=%=
135set statusline+=%#SecondaryBlock#
136set statusline+=\ %l\  
137set statusline+=%#PrimaryBlock#
138set statusline+=%{&filetype}
139
140" for git branch in statusline, from nerdypepper
141function! GitBranch()
142	return system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'")
143endfunction
144
145
146" bunch of functions
147function! S_gitgutter()  " formatted git hunk summary for statusline
148	if exists('b:gitgutter')
149		let l:summary = b:gitgutter.summary
150		if l:summary[0] != 0 || l:summary[1] != 0 || l:summary[2] != 0
151			return ' +'.l:summary[0].' ~'.l:summary[1].' -'.l:summary[2].' '
152		endif
153	endif
154	return ''
155endfunction
156
157function! StatuslineGit()
158	let l:branchname = GitBranch()
159	return strlen(l:branchname) > 0?'  '.l:branchname.' ':''
160endfunction
161
162" git gutter settings
163let g:gitgutter_override_sign_column_highlight = 0
164let g:gitgutter_sign_added                     = '+'
165let g:gitgutter_sign_modified                  = '±'
166let g:gitgutter_sign_removed                   = '-'
167let g:gitgutter_sign_removed_first_line        = '^'
168let g:gitgutter_sign_modified_removed          = '#'
169
170" deoplete 
171let g:help_in_tabs = 1
172let g:deoplete#enable_at_startup = 1
173
174nmap <silent> H :let g:help_in_tabs = !g:help_in_tabs<CR
175
176" only apply to .txt files
177augroup HelpInTabs
178	autocmd!
179	autocmd BufEnter  *.txt   call HelpInNewTab()
180augroup END
181
182" only apply to help files
183function! HelpInNewTab ()
184	if &buftype == 'help' && g:help_in_tabs
185		"Convert the help window to a tab...
186		execute "normal \<C-W>T"
187	endif
188endfunction
189
190" comments are italicized
191hi Comment cterm=italic
192" color overrides
193hi CursorLine ctermbg=none
194
195
196" vim-markdown 
197let g:vim_markdown_no_default_key_mappings=1
198let g:vim_markdown_toml_frontmatter=1
199let g:vim_markdown_yaml_fromtmatter=1
200let g:vim_markdown_folding_disabled=1
201
202" deoplete-jedi
203let g:python_host_prog = '/home/icy/.pynvim2/bin/python'
204let g:python3_host_prog = '/home/icy/.pynvim3/bin/python'
205
206" keysound
207let g:keysound_enable = 1
208let g:keysound_volume = 1000
209let g:keysound_py_version = 3
210let g:keysound_theme = 'default'
211
212" textobj_quote
213augroup textobj_quote
214  autocmd!
215  autocmd FileType markdown call textobj#quote#init({'educate': 1})
216  autocmd FileType textile call textobj#quote#init({'educate': 1})
217  autocmd FileType text call textobj#quote#init({'educate': 1})
218augroup END
219
220" litecorrect
221augroup litecorrect
222    autocmd!
223    autocmd FileType markdown,mkd call litecorrect#init()
224    autocmd FileType textile call litecorrect#init()
225augroup END
226