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