summaryrefslogtreecommitdiffstats
path: root/vim/vimrc
blob: a3faa66c43f2e472c903bc509f94a1112ddbc079 (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
132
set nocompatible

" Environment http://tlvince.com/vim-respect-xdg
if !exists($XDG_CONFIG_HOME)
	let $XDG_CONFIG_HOME=expand('~/.config')
endif
if !exists($XDG_DATA_HOME)
	let $XDG_DATA_HOME=expand('~/.local/share')
endif
if !exists($XDG_CACHE_HOME)
	let $XDG_CACHE_HOME=expand('~/.cache')
endif

set directory=$XDG_CACHE_HOME/vim/swp//,/var/tmp//,/tmp//
set undodir=$XDG_CACHE_HOME/vim/undo//,/var/tmp//,/tmp//
set backupdir=$XDG_CACHE_HOME/vim/backup,/var/tmp,/tmp
set viminfo+=n$XDG_CACHE_HOME/vim/viminfo
set rtp=$XDG_CONFIG_HOME/vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$XDG_CONFIG_HOME/vim/after

" NeoBundle
let s:bundle_dir = $XDG_DATA_HOME . '/vim/bundle'
let s:neobundle_dir = s:bundle_dir . '/neobundle.vim'
let s:neobundle_repo = 'https://github.com/Shougo/neobundle.vim'
let s:neobundle_toml = $XDG_CONFIG_HOME . '/vim/neobundle.toml'
let s:plugrc = $XDG_CONFIG_HOME . '/vim/plugrc'
let g:neobundle#cache_file = $XDG_CACHE_HOME . '/vim/neobundlecache'
let &runtimepath.=','.s:neobundle_dir

try
	call neobundle#begin(s:bundle_dir)
catch /E117:/ " neobundle not installed
	execute "silent !git clone " . s:neobundle_repo . " " . s:neobundle_dir
	call neobundle#begin(s:bundle_dir)
	call neobundle#load_toml(s:neobundle_toml, {})
	set nomore
	NeoBundleInstall
	call neobundle#end()
	quit
endtry
if neobundle#load_cache(s:neobundle_toml)
	call neobundle#load_toml(s:neobundle_toml, {})
	NeoBundleSaveCache
endif
if neobundle#tap('unite.vim')
	nnoremap <leader>g :<C-u>Unite grep
		\ -auto-preview
		\ -no-split
		\ -no-empty<CR>
	nnoremap <leader>f :<C-u>Unite file_mru file/async file_rec/async
		\ -start-insert <CR>
	nnoremap <leader>l :<C-u>Unite buffer tab
		\ -no-split <CR>
	nnoremap <leader>r :<C-u>UniteResume
		\ -no-start-insert
		\ -force-redraw<CR>
	let neobundle#hooks.on_source = s:plugrc . '/unite.rc.vim'
	call neobundle#untap()
endif
if neobundle#tap('vimfiler.vim')
	let neobundle#hooks.on_source = s:plugrc . '/vimfiler.rc.vim'
	call neobundle#untap()
endif
if neobundle#tap('neosnippet.vim')
	let g:neosnippet#snippets_directory =
		\ $XDG_CONFIG_HOME . '/vim/snippets'
	imap <C-k> <Plug>(neosnippet_expand_or_jump)
	smap <C-k> <Plug>(neosnippet_expand_or_jump)
	xmap <C-k> <Plug>(neosnippet_expand_or_jump)
	call neobundle#untap()
endif
if neobundle#tap('clang_complete')
	let neobundle#hooks.on_source = s:plugrc . '/clang_complete.rc.vim'
	call neobundle#untap()
endif
if neobundle#tap('syntastic')
	let g:syntastic_error_symbol   = '✗'
	let g:syntastic_warning_symbol = '?'
	call neobundle#untap()
endif
if neobundle#tap('vim-racer')
	function! neobundle#hooks.on_source(bundle)
		let $RUST_SRC_PATH= $XDG_DATA_HOME . '/rustc_src_latest/src/'
	endfunction
endif
if neobundle#tap('vim-easy-align')
	nmap ga <Plug>(EasyAlign)
	call neobundle#untap()
endif
if neobundle#tap('vim-addon-local-vimrc')
	let g:local_vimrc = {'names':['.lvimrc'],'hash_fun':'LVRHashOfFile'}
	call neobundle#untap()
endif
if neobundle#tap('base16-vim')
	set bg=dark
	let base16colorspace=256
	function! neobundle#hooks.on_post_source(bundle)
		colorscheme base16-monokai
	endfunction
	call neobundle#untap()
endif
call neobundle#end()

filetype plugin indent on
syntax on

set ai
set bs=2
set cc=80
set fdm=syntax
set formatoptions+=j
set lcs=tab:\│\ ,trail:·,eol:¬
set ls=2
set nu
set rnu
set ru
set si
set sta
set sw=4
set ts=4
set ttyfast
set udf
set wmnu

if has('gui_running')
	set go=m
endif

" Filebin
com -range=% Fb :exec "<line1>,<line2>w !fb -e ".&filetype." -n ".expand("%:t")

" Write with sudo
com W w !sudo tee % > /dev/null