config/nvim/init.vim (view raw)
1" _ _ _ _
2"(_)_ __ (_) |___ _(_)_ __ ___
3"| | '_ \| | __\ \ / / | '_ ` _ \
4"| | | | | | |_ \ V /| | | | | | |
5"|_|_| |_|_|\__(_)_/ |_|_| |_| |_|
6
7
8call plug#begin()
9Plug 'jiangmiao/auto-pairs'
10Plug 'airblade/vim-gitgutter'
11Plug 'NerdyPepper/vim-colors-plain', { 'branch': 'duotone' }
12Plug 'dag/vim-fish',
13" plugins for writing {{{
14Plug 'reedes/vim-pencil', { 'for': ['text', 'markdown'] }
15Plug 'reedes/vim-wordy', { '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 'zah/nim.vim'
26Plug 'wellle/targets.vim'
27Plug 'NerdyPepper/agila.vim'
28Plug 'w0rp/ale'
29" Plug '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 nonumber
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 nocursorline
64set conceallevel=2
65set mouse=a
66set wildmenu
67set shiftwidth=4 " indent = 4 spaces
68set tabstop=4 " tab = 4 spaces
69set expandtab
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" colorscheme
86colorscheme plain
87set background=dark
88
89" keybindings
90let mapleader=' '
91nnoremap <leader>n :nohlsearch<cr>
92nnoremap <leader>o :only<cr>
93nnoremap H H:exec 'norm! '. &scrolloff . 'k'<cr>
94nnoremap L L:exec 'norm! '. &scrolloff . 'j'<cr>
95
96" statusline
97let g:currentmode={
98 \ 'n' : 'normal ',
99 \ 'no' : 'n·operator pending ',
100 \ 'v' : 'visual ',
101 \ 'V' : 'v·line ',
102 \ '' : 'v·block ',
103 \ 's' : 'select ',
104 \ 'S' : 's·line ',
105 \ '' : 's·block ',
106 \ 'i' : 'insert ',
107 \ 'R' : 'replace ',
108 \ 'Rv' : 'v·replace ',
109 \ 'c' : 'command ',
110 \ 'cv' : 'vim ex ',
111 \ 'ce' : 'ex ',
112 \ 'r' : 'prompt ',
113 \ 'rm' : 'more ',
114 \ 'r?' : 'confirm ',
115 \ '!' : 'shell ',
116 \ 't' : 'terminal '}
117
118hi PrimaryBlock ctermfg=06 ctermbg=00
119hi SecondaryBlock ctermfg=08 ctermbg=00
120hi Blanks ctermfg=07 ctermbg=00
121
122set statusline=
123set statusline+=%#PrimaryBlock#
124set statusline+=\ %{g:currentmode[mode()]}
125set statusline+=%#SecondaryBlock#
126set statusline+=%{StatuslineGit()}
127set statusline+=%#Blanks#
128set statusline+=\ %f\
129set statusline+=%m
130set statusline+=%=
131set statusline+=%#SecondaryBlock#
132set statusline+=\ %l\
133set statusline+=%#PrimaryBlock#
134set statusline+=%{&filetype}
135
136" for git branch in statusline, from nerdypepper
137function! GitBranch()
138 return system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'")
139endfunction
140
141
142" bunch of functions
143function! S_gitgutter() " formatted git hunk summary for statusline
144 if exists('b:gitgutter')
145 let l:summary = b:gitgutter.summary
146 if l:summary[0] != 0 || l:summary[1] != 0 || l:summary[2] != 0
147 return ' +'.l:summary[0].' ~'.l:summary[1].' -'.l:summary[2].' '
148 endif
149 endif
150 return ''
151endfunction
152
153function! StatuslineGit()
154 let l:branchname = GitBranch()
155 return strlen(l:branchname) > 0?' '.l:branchname.' ':''
156endfunction
157
158" git gutter settings
159let g:gitgutter_override_sign_column_highlight = 0
160let g:gitgutter_sign_added = '+'
161let g:gitgutter_sign_modified = '±'
162let g:gitgutter_sign_removed = '-'
163let g:gitgutter_sign_removed_first_line = '^'
164let g:gitgutter_sign_modified_removed = '#'
165
166" deoplete
167let g:help_in_tabs = 1
168let g:deoplete#enable_at_startup = 1
169
170nmap <silent> H :let g:help_in_tabs = !g:help_in_tabs<CR
171
172" only apply to .txt files
173augroup HelpInTabs
174 autocmd!
175 autocmd BufEnter *.txt call HelpInNewTab()
176augroup END
177
178" only apply to help files
179function! HelpInNewTab ()
180 if &buftype == 'help' && g:help_in_tabs
181 "Convert the help window to a tab...
182 execute "normal \<C-W>T"
183 endif
184endfunction
185
186" comments are italicized
187hi Comment cterm=italic
188" color overrides
189hi CursorLine ctermbg=none
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
197let g:vim_markdown_conceal=0
198
199" vim-pencil
200let g:pencil#textwidth = 72
201let g:pencil#conceallevel = 0
202augroup pencil
203 autocmd!
204 autocmd FileType markdown,mkd call pencil#init({'wrap': 'hard', 'autoformat': 0})
205augroup END
206
207" keysound
208let g:keysound_enable = 1
209let g:keysound_volume = 1000
210let g:keysound_py_version = 3
211let g:keysound_theme = 'default'
212
213" textobj_quote
214augroup textobj_quote
215 autocmd!
216 autocmd FileType markdown call textobj#quote#init({'educate': 1})
217 autocmd FileType textile call textobj#quote#init({'educate': 1})
218 autocmd FileType text call textobj#quote#init({'educate': 1})
219augroup END
220