config/nvim/init.vim (view raw)
1" _ _ _ _
2"(_)_ __ (_) |___ _(_)_ __ ___
3"| | '_ \| | __\ \ / / | '_ ` _ \
4"| | | | | | |_ \ V /| | | | | | |
5"|_|_| |_|_|\__(_)_/ |_|_| |_| |_|
6
7set shiftwidth=4 " indent = 4 spaces
8set noexpandtab " tabs are tabs
9set tabstop=4 " tab = 4 spaces
10set softtabstop=4 " backspace through spaces
11
12call plug#begin()
13Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
14Plug 'jiangmiao/auto-pairs'
15Plug 'airblade/vim-gitgutter'
16Plug 'reedes/vim-pencil'
17Plug 'chriskempson/base16-vim'
18Plug 'godlygeek/tabular'
19Plug 'tpope/vim-fugitive'
20Plug 'leafgarland/typescript-vim'
21Plug 'ervandew/supertab'
22Plug 'rust-lang/rust.vim'
23Plug 'yuttie/comfortable-motion.vim'
24Plug 'plasticboy/vim-markdown'
25Plug 'kristijanhusak/vim-carbon-now-sh'
26Plug 'zchee/deoplete-jedi'
27Plug 'zah/nim.vim'
28Plug 'wellle/targets.vim'
29Plug 'NerdyPepper/agila.vim'
30
31call plug#end()
32
33" indentation
34augroup indents
35 autocmd!
36 autocmd FileType less,css,html setlocal ts=2 sts=2 sw=2 expandtab
37 autocmd FileType text,markdown setlocal expandtab
38augroup END
39
40" basic settings
41set swapfile
42set dir=/tmp
43set number
44set smartcase
45syntax on
46filetype plugin indent on
47set laststatus=2
48set noshowmode
49set hlsearch
50set incsearch
51set ignorecase
52set scrolloff=12
53set rtp+=~/.fzf
54set timeout timeoutlen=3000 ttimeoutlen=100
55set undodir=~/.vim/undodir
56set nowrap
57set cursorline
58set conceallevel=2
59set mouse=a
60
61" colorscheme
62colorscheme agila
63
64" keybindings
65let mapleader=' '
66nnoremap <leader>n :nohlsearch<cr>
67nnoremap <leader>b :Buffers<cr>
68nnoremap <leader>o :only<cr>
69nnoremap <leader>t :call GetTabber()<cr>
70nnoremap H H:exec 'norm! '. &scrolloff . 'k'<cr>
71nnoremap L L:exec 'norm! '. &scrolloff . 'j'<cr>
72vnoremap <F5> :CarbonNowSh<CR>
73
74" statusline
75let g:currentmode={
76 \ 'n' : 'NORMAL ',
77 \ 'no' : 'N·Operator Pending ',
78 \ 'v' : 'VISUAL ',
79 \ 'V' : 'V·Line ',
80 \ '' : 'V·Block',
81 \ 's' : 'Select ',
82 \ 'S' : 'S·Line ',
83 \ '' : 'S·Block',
84 \ 'i' : 'INSERT ',
85 \ 'R' : 'REPLACE ',
86 \ 'Rv' : 'V·Replace ',
87 \ 'c' : 'Command ',
88 \ 'cv' : 'Vim Ex ',
89 \ 'ce' : 'Ex ',
90 \ 'r' : 'Prompt ',
91 \ 'rm' : 'MORE ',
92 \ 'r?' : 'CONFIRM ',
93 \ '!' : 'SHELL ',
94 \ 't' : 'TERMINAL '}
95
96set statusline=
97set statusline+=%#TabLineSel#
98set statusline+=\ %{g:currentmode[mode()]}
99set statusline+=%#TODO#
100set statusline+=%{StatuslineGit()}
101set statusline+=%#TabLineFill#
102set statusline+=\ %f\
103set statusline+=%m
104set statusline+=%#TabLineFill#
105set statusline+=%=
106set statusline+=%#TODO#
107set statusline+=\ %l\
108set statusline+=%#TabLineSel#
109set statusline+=\ %y\
110set statusline+=%#TabLine#
111
112" for git branch in statusline, from nerdypepper
113function! GitBranch()
114 return system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'")
115endfunction
116
117
118" bunch of functions
119function! S_gitgutter() " formatted git hunk summary for statusline
120 if exists('b:gitgutter')
121 let l:summary = b:gitgutter.summary
122 if l:summary[0] != 0 || l:summary[1] != 0 || l:summary[2] != 0
123 return ' +'.l:summary[0].' ~'.l:summary[1].' -'.l:summary[2].' '
124 endif
125 endif
126 return ''
127endfunction
128
129function! StatuslineGit()
130 let l:branchname = GitBranch()
131 return strlen(l:branchname) > 0?' '.l:branchname.' ':''
132endfunction
133
134
135function! GetTabber() " a lil function that integrates well with Tabular.vim
136 let c = nr2char(getchar())
137 :execute 'Tabularize /' . c
138endfunction"
139
140" git gutter settings
141let g:gitgutter_override_sign_column_highlight = 0
142let g:gitgutter_sign_added = '+'
143let g:gitgutter_sign_modified = '±'
144let g:gitgutter_sign_removed = '-'
145let g:gitgutter_sign_removed_first_line = '^'
146let g:gitgutter_sign_modified_removed = '#'
147highlight clear SignColumn
148highlight GitGutterAdd ctermfg=red
149highlight GitGutterChange ctermfg=red
150highlight GitGutterDelete ctermfg=red
151highlight GitGutterChangeDelete ctermfg=red
152
153" deoplete
154let g:help_in_tabs = 1
155let g:deoplete#enable_at_startup = 1
156
157nmap <silent> H :let g:help_in_tabs = !g:help_in_tabs<CR
158
159" only apply to .txt files
160augroup HelpInTabs
161 autocmd!
162 autocmd BufEnter *.txt call HelpInNewTab()
163augroup END
164
165" only apply to help files
166function! HelpInNewTab ()
167 if &buftype == 'help' && g:help_in_tabs
168 "Convert the help window to a tab...
169 execute "normal \<C-W>T"
170 endif
171endfunction
172
173" color overrides
174highlight LineNr ctermbg=none guibg=none
175highlight Comment cterm=italic
176hi TabLine ctermbg=black
177hi TabLineFill ctermbg=black
178hi TabLineSel ctermbg=magenta
179hi CursorLine ctermbg=none
180hi CursorLineNr ctermbg=none
181
182" vim-markdown
183let g:vim_markdown_no_default_key_mappings=1
184let g:vim_markdown_toml_frontmatter=1
185let g:vim_markdown_yaml_fromtmatter=1
186let g:vim_markdown_folding_disabled=1
187
188" deoplete-jedi
189let g:python_host_prog = '/home/icyphox/.pynvim2/bin/python'
190let g:python3_host_prog = '/home/icyphox/.pynvim3/bin/python'