aboutsummaryrefslogtreecommitdiff
path: root/vim/.vimrc
blob: 8e03ec20518b28a0919c4f8b27a904c2a4826ee8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
"           ██
"          ░░
"  ██    ██ ██ ██████████  ██████  █████
" ░██   ░██░██░░██░░██░░██░░██░░█ ██░░░██
" ░░██ ░██ ░██ ░██ ░██ ░██ ░██ ░ ░██  ░░
"  ░░████  ░██ ░██ ░██ ░██ ░██   ░██   ██
"   ░░██   ░██ ███ ░██ ░██░███   ░░█████
"    ░░    ░░ ░░░  ░░  ░░ ░░░     ░░░░░
"
"  ▓▓▓▓▓▓▓▓▓▓
" ░▓ author ▓ xero <x@xero.nu>
" ░▓ code   ▓ http://code.xero.nu/dotfiles
" ░▓ mirror ▓ http://git.io/.files
" ░▓▓▓▓▓▓▓▓▓▓
" ░░░░░░░░░░
"
" use vim settings, rather than vi settings
" must be first, because it changes other options as a side effect
set nocompatible

" paste without auto indentation
set paste

" maintain undo history between sessions
set undofile
set undodir=~/.vim/undo
set noswapfile

" file name tab completion
set wildmode=longest,list,full
set wildmenu

" make backspace behave in a sane manner
set backspace=indent,eol,start

" disable startup message
set shortmess+=I

" syntax highlighting and colors
syntax on
colorscheme sourcerer
filetype plugin indent on

" stop unnecessary rendering
set lazyredraw

" show line numbers
set number

" no line wrapping
set nowrap

" searching
set hlsearch
set incsearch

" no folding
set foldlevel=99
set foldminlines=99
 
" enable file type detection and do language-dependent indenting
if has("autocmd")
  filetype on
  filetype indent on
  filetype plugin on
endif

" let mapleader=","
vnoremap <silent> <leader>y :w !xsel -i -b<CR>
nnoremap <silent> <leader>y V:w !xsel -i -b<CR>
nnoremap <silent> <leader>p :silent :r !xsel -o -b<CR>

" remap code completion to ^space
inoremap <Nul> <C-x><C-o>

" █▓▒░ wizard status line
set laststatus=2

hi BgColor guibg=#3A3A3A guifg=#ffffff ctermbg=237 ctermfg=255
hi ModColor guibg=#3A3A3A guifg=#afaf00 ctermbg=237 ctermfg=142
hi StatColor guibg=#3a3a3a guifg=#ffffff ctermbg=237 ctermfg=255
hi GitColor guibg=#4e4e4e guifg=#ffffff ctermbg=239 ctermfg=255
hi VoidColor guibg=#222222 guifg=#4e4e4e ctermbg=NONE ctermfg=239
hi TypeColor guibg=#D78700 guifg=#262626 ctermbg=66 ctermfg=235
hi PosColor guibg=#8787AF guifg=#262626 ctermbg=103 ctermfg=235

function! WizardStatus(mode)
    let statusline="%#BgColor#"
    if &modified == 1
	let statusline.="%#ModColor# »» "
    else
    	let statusline.="    " 
    endif
    if &readonly != ''
        hi StatColor guifg=#af0000 ctermfg=124
    endif
    let statusline.="%#StatColor#%F " 
    "let branch = system("git branch 2> /dev/null | sed -e '/^[^*]/d'")
    let branch = system("git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* //'")
    if branch != ''
        let statusline .= '%#VoidColor#▓%#GitColor# ' . substitute(branch, '\n', '', 'g') . ' %#VoidColor#▓▒░ '
    else
	let statusline .= '%#VoidColor#▒░ '
    endif
    let statusline .= "%=%h%w\ %#TypeColor#▓"
    if &filetype != ''
        let statusline .="▒ %Y "
    endif
    let statusline .="▒ %{&encoding}:%{&fileformat} %#PosColor#▒ %p%% ░ %l/%L\.\%c\ ▒"
    return statusline
endfunction

au WinEnter * setlocal statusline=%!WizardStatus('Enter')
au WinLeave * setlocal statusline=%!WizardStatus('Leave')
set statusline=%!WizardStatus('Enter')

function! Colorize(mode)
  if a:mode == 'i'
    hi StatColor guibg=#D78700 guifg=#222222 ctermbg=110 ctermfg=235
  elseif a:mode == 'r'
    hi StatColor guibg=#D78700 guifg=#222222 ctermbg=172 ctermfg=235
  elseif a:mode == 'v'
    hi StatColor guibg=#D78700 guifg=#222222 ctermbg=172 ctermfg=235
  else
    hi StatColor guibg=#af0000 guifg=#222222 ctermbg=124  ctermfg=235
  endif
endfunction 

au InsertEnter * call Colorize(v:insertmode)
au InsertLeave * hi StatColor guibg=#3a3a3a guifg=#ffffff ctermbg=237 ctermfg=255