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'
12Plug 'reedes/vim-pencil'
13Plug 'chriskempson/base16-vim'
14Plug 'godlygeek/tabular'
15Plug 'tpope/vim-fugitive'
16Plug 'ervandew/supertab'
17Plug 'rust-lang/rust.vim'
18Plug 'yuttie/comfortable-motion.vim'
19Plug 'plasticboy/vim-markdown'
20Plug 'zchee/deoplete-jedi'
21Plug 'zah/nim.vim'
22Plug 'wellle/targets.vim'
23Plug 'NerdyPepper/agila.vim'
24Plug 'w0rp/ale'
25Plug 'arrufat/vala.vim'
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 number
46set smartcase
47syntax on
48filetype plugin indent on
49set laststatus=2
50set noshowmode
51set hlsearch
52set incsearch
53set ignorecase
54set scrolloff=12
55set rtp+=~/.fzf
56set timeout timeoutlen=3000 ttimeoutlen=100
57set undodir=~/.vim/undodir
58set nowrap
59set cursorline
60set conceallevel=2
61set mouse=a
62set wildmenu
63
64set shiftwidth=4 " indent = 4 spaces
65set noexpandtab " tabs are tabs
66set tabstop=4 " tab = 4 spaces
67set softtabstop=4 " backspace through spaces
68
69set wildignore+=.git,.hg,.svn
70set wildignore+=*.aux,*.out,*.toc
71set wildignore+=*.o,*.obj,*.exe,*.dll,*.manifest,*.rbc,*.class
72set wildignore+=*.ai,*.bmp,*.gif,*.ico,*.jpg,*.jpeg,*.png,*.psd,*.webp
73set wildignore+=*.avi,*.divx,*.mp4,*.webm,*.mov,*.m2ts,*.mkv,*.vob,*.mpg,*.mpeg
74set wildignore+=*.mp3,*.oga,*.ogg,*.wav,*.flac
75set wildignore+=*.eot,*.otf,*.ttf,*.woff
76set wildignore+=*.doc,*.pdf,*.cbr,*.cbz
77set wildignore+=*.zip,*.tar.gz,*.tar.bz2,*.rar,*.tar.xz,*.kgb
78set wildignore+=*.swp,.lock,.DS_Store,._*
79" colorscheme
80colorscheme agila
81
82" keybindings
83let mapleader=' '
84nnoremap <leader>n :nohlsearch<cr>
85nnoremap <leader>b :Buffers<cr>
86nnoremap <leader>o :only<cr>
87nnoremap <leader>t :call GetTabber()<cr>
88nnoremap H H:exec 'norm! '. &scrolloff . 'k'<cr>
89nnoremap L L:exec 'norm! '. &scrolloff . 'j'<cr>
90vnoremap <F5> :CarbonNowSh<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
151function! GetTabber() " a lil function that integrates well with Tabular.vim
152 let c = nr2char(getchar())
153 :execute 'Tabularize /' . c
154endfunction"
155
156" git gutter settings
157let g:gitgutter_override_sign_column_highlight = 0
158let g:gitgutter_sign_added = '+'
159let g:gitgutter_sign_modified = '±'
160let g:gitgutter_sign_removed = '-'
161let g:gitgutter_sign_removed_first_line = '^'
162let g:gitgutter_sign_modified_removed = '#'
163
164" deoplete
165let g:help_in_tabs = 1
166let g:deoplete#enable_at_startup = 1
167
168nmap <silent> H :let g:help_in_tabs = !g:help_in_tabs<CR
169
170" only apply to .txt files
171augroup HelpInTabs
172 autocmd!
173 autocmd BufEnter *.txt call HelpInNewTab()
174augroup END
175
176" only apply to help files
177function! HelpInNewTab ()
178 if &buftype == 'help' && g:help_in_tabs
179 "Convert the help window to a tab...
180 execute "normal \<C-W>T"
181 endif
182endfunction
183
184" color overrides
185"highlight LineNr ctermbg=none guibg=none
186"highlight Comment cterm=italic
187"hi TabLine ctermbg=black
188"hi TabLineFill ctermbg=black
189"hi TabLineSel ctermbg=magenta
190hi CursorLine ctermbg=none
191"hi CursorLineNr ctermbg=none
192"
193" vim-markdown
194let g:vim_markdown_no_default_key_mappings=1
195let g:vim_markdown_toml_frontmatter=1
196let g:vim_markdown_yaml_fromtmatter=1
197let g:vim_markdown_folding_disabled=1
198
199" deoplete-jedi
200let g:python_host_prog = '/home/icy/.pynvim2/bin/python'
201let g:python3_host_prog = '/home/icy/.pynvim3/bin/python'