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