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