-
Notifications
You must be signed in to change notification settings - Fork 1
/
vimrc
111 lines (96 loc) · 3.38 KB
/
vimrc
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
"The first time run
"git clone https://github.com/gmarik/vundle.git ~/dotfiles/vim/bundle/vundle
"vim -u ~/dotfiles/bundles.vim +BundleInstall +q
"
source ~/dotfiles/bundles.vim
syntax on
set hlsearch
set incsearch
set number
set cursorline
set ruler
set ai
set si
set rtp+=~/.vim/bundle/powerline/powerline/bindings/vim
runtime! macros/matchit.vi
colorscheme vibrantink
" Mappings
" :map <C-d> :execute 'NERDTree '<CR>
:map <C-d> :NERDTreeToggle<CR>
" Number lines on/off
map <F2> :set number!<CR>
map! <F2> <ESC><F2> i
" Make trailing space visible
map <F4> :set hls<CR>/\s\+$<CR>
map! <F4> <ESC><F4>i"
" Highlight on/off
map <F7> :set hls!<CR><Bar>:echo "HLSearch: " . strpart("OffOn", 3 * &hlsearch, 3)<CR>
map! <F7> <ESC><F7>i"
inoremap <M-o> <Esc>o
inoremap <C-j> <Down>
let g:ragtag_global_maps = 1
let g:syntastic_auto_loc_list=1
let g:syntastic_enable_signs=1
" first, enable status line always
set laststatus=2
set noshowmode
set encoding=utf-8
"
" set statusline=%<%f\ %h%m%r%{fugitive#statusline()}%=%-14.(%l,%c%V%)\ %P
" set statusline+=%< " cut at start
" set statusline+=%2*[%n%H%M%R%W]%* " buffer number, and flags
" set statusline+=%-40f " relative path
" set statusline+=[%{strlen(&fenc)?&fenc:'none'}, " file encoding
" set statusline+=%{&ff}] " file format
" set statusline+=[Filetype=%Y] " file type
" set statusline+=\ %{fugitive#statusline()} " git branch
" "display a warning if &paste is set
" set statusline+=%#error#
" set statusline+=%{&paste?'[paste]':''}
" set statusline+=%*
" " set statusline+=%1*%y%*%* " file type
" set statusline+=%= " seperate between right- and left-aligned
" set statusline+=%#warningmsg# " Syntastic
" set statusline+=%{SyntasticStatuslineFlag()} " Syntastic
" set statusline+=%* " Syntastic
" set statusline+=%{StatuslineCurrentHighlight()}\ \ " current highlight
" set statusline+=%c, " cursor column
" set statusline+=%1((%l/%L)%) " line and total lines
" set statusline+=%P " percentage of file
"return the syntax highlight group under the cursor ''
function! StatuslineCurrentHighlight()
let name = synIDattr(synID(line('.'),col('.'),1),'name')
if name == ''
return ''
else
return '[' . name . ']'
endif
endfunction
function! InitializeDirectories()
let separator = "."
let parent = $HOME
let prefix = '.vim'
let dir_list = {
\ 'backup': 'backupdir',
\ 'views': 'viewdir',
\ 'swap': 'directory' }
if has('persistent_undo')
let dir_list['undo'] = 'undodir'
endif
for [dirname, settingname] in items(dir_list)
let directory = parent . '/' . prefix . dirname . "/"
if exists("*mkdir")
if !isdirectory(directory)
call mkdir(directory)
endif
endif
if !isdirectory(directory)
echo "Warning: Unable to create backup directory: " . directory
echo "Try: mkdir -p " . directory
else
let directory = substitute(directory, " ", "\\\\ ", "g")
exec "set " . settingname . "=" . directory
endif
endfor
endfunction
call InitializeDirectories()