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