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