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