config/nvim/init.vim (view raw)
1" _ _ _ _
2"(_)_ __ (_) |___ _(_)_ __ ___
3"| | '_ \| | __\ \ / / | '_ ` _ \
4"| | | | | | |_ \ V /| | | | | | |
5"|_|_| |_|_|\__(_)_/ |_|_| |_| |_|
6
7
8call plug#begin()
9" Plug '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'
24" Plug '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" colorscheme
85colorscheme agila
86
87" keybindings
88let mapleader=' '
89nnoremap <leader>n :nohlsearch<cr>
90nnoremap <leader>o :only<cr>
91nnoremap H H:exec 'norm! '. &scrolloff . 'k'<cr>
92nnoremap L L:exec 'norm! '. &scrolloff . 'j'<cr>
93
94" statusline
95let g:currentmode={
96 \ 'n' : 'NORMAL ',
97 \ 'no' : 'N·Operator Pending ',
98 \ 'v' : 'VISUAL ',
99 \ 'V' : 'V·Line ',
100 \ '' : 'V·Block',
101 \ 's' : 'Select ',
102 \ 'S' : 'S·Line ',
103 \ '' : 'S·Block',
104 \ 'i' : 'INSERT ',
105 \ 'R' : 'REPLACE ',
106 \ 'Rv' : 'V·Replace ',
107 \ 'c' : 'Command ',
108 \ 'cv' : 'Vim Ex ',
109 \ 'ce' : 'Ex ',
110 \ 'r' : 'Prompt ',
111 \ 'rm' : 'MORE ',
112 \ 'r?' : 'CONFIRM ',
113 \ '!' : 'SHELL ',
114 \ 't' : 'TERMINAL '}
115
116set statusline=
117set statusline+=%#PrimaryBlock#
118set statusline+=\ %{g:currentmode[mode()]}
119set statusline+=%#TabLineSel#
120set statusline+=%{StatuslineGit()}
121set statusline+=%#TabLineFill#
122set statusline+=\ %f\
123set statusline+=%m
124set statusline+=%=
125set statusline+=%#TabLineSel#
126set statusline+=\ %l\
127set statusline+=%#PrimaryBlock#
128set statusline+=\ %y\
129
130" for git branch in statusline, from nerdypepper
131function! GitBranch()
132 return system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'")
133endfunction
134
135
136" bunch of functions
137function! S_gitgutter() " formatted git hunk summary for statusline
138 if exists('b:gitgutter')
139 let l:summary = b:gitgutter.summary
140 if l:summary[0] != 0 || l:summary[1] != 0 || l:summary[2] != 0
141 return ' +'.l:summary[0].' ~'.l:summary[1].' -'.l:summary[2].' '
142 endif
143 endif
144 return ''
145endfunction
146
147function! StatuslineGit()
148 let l:branchname = GitBranch()
149 return strlen(l:branchname) > 0?' '.l:branchname.' ':''
150endfunction
151
152" git gutter settings
153let g:gitgutter_override_sign_column_highlight = 0
154let g:gitgutter_sign_added = '+'
155let g:gitgutter_sign_modified = '±'
156let g:gitgutter_sign_removed = '-'
157let g:gitgutter_sign_removed_first_line = '^'
158let g:gitgutter_sign_modified_removed = '#'
159
160" deoplete
161let g:help_in_tabs = 1
162let g:deoplete#enable_at_startup = 1
163
164nmap <silent> H :let g:help_in_tabs = !g:help_in_tabs<CR
165
166" only apply to .txt files
167augroup HelpInTabs
168 autocmd!
169 autocmd BufEnter *.txt call HelpInNewTab()
170augroup END
171
172" only apply to help files
173function! HelpInNewTab ()
174 if &buftype == 'help' && g:help_in_tabs
175 "Convert the help window to a tab...
176 execute "normal \<C-W>T"
177 endif
178endfunction
179
180" comments are italicized
181hi Comment cterm=italic
182" color overrides
183hi CursorLine ctermbg=none
184hi Visual ctermfg=white cterm=bold ctermbg=magenta
185
186
187" vim-markdown
188let g:vim_markdown_no_default_key_mappings=1
189let g:vim_markdown_toml_frontmatter=1
190let g:vim_markdown_yaml_fromtmatter=1
191let g:vim_markdown_folding_disabled=1
192
193" deoplete-jedi
194let g:python_host_prog = '/home/icy/.pynvim2/bin/python'
195let g:python3_host_prog = '/home/icy/.pynvim3/bin/python'
196
197" keysound
198let g:keysound_enable = 1
199let g:keysound_volume = 700
200let g:keysound_py_version = 3
201let g:keysound_theme = 'default'
202
203" textobj_quote
204augroup textobj_quote
205 autocmd!
206 autocmd FileType markdown call textobj#quote#init({'educate': 1})
207 autocmd FileType textile call textobj#quote#init({'educate': 1})
208 autocmd FileType text call textobj#quote#init({'educate': 1})
209augroup END
210
211" litecorrect
212augroup litecorrect
213 autocmd!
214 autocmd FileType markdown,mkd call litecorrect#init()
215 autocmd FileType textile call litecorrect#init()
216augroup END