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