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