forked from dstrctrng/home
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
148 lines (114 loc) · 3.3 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
" source junas
source ~/.vim/junas.vimrc
" install whatever bundles over the net
silent call Bundle(["xoria256", "Solarized"])
silent call Bundle(["surround", "repeat", "Rainbow_Parenthesis", "matchit.zip", "eregex"])
" use the xoria256 color scheme
colorscheme xoria256
" more bundles
silent call Bundle(["fugitive", "git.zip", "Gist", "cucumber.zip", "rake"])
silent call Bundle(["haml.zip"])
silent call Bundle(["vimpager"])
" override xoria colors
hi Folded ctermfg=180 guifg=#dfaf87 ctermbg=234 guibg=#1c1c1c
hi NonText ctermfg=252 guifg=#d0d0d0 ctermbg=234 guibg=#1c1c1c cterm=none gui=none
" map whatever key to leader
let mapleader = ","
" settings
set pastetoggle=<F2>
set shiftround smarttab
set autoindent smartindent
set showmatch
set hidden
set nowrap
set nonumber
set history=1000
set undolevels=1000
set title
set visualbell
set noerrorbells
set t_vb=
set scrolloff=3
set nojoinspaces
set nobackup
set noswapfile
set diffopt+=iwhite
set diffexpr="-w -b -B"
set guioptions=
" strip whitespace from end of lines
"autocmd FileType javascript,ruby,eruby autocmd BufWritePre <buffer> :call setline(1,map(getline(1,"$"),'substitute(v:val,"\\s\\+$","","")'))
" these commands open folds
set foldopen=block,insert,jump,mark,percent,quickfix,search,tag,undo
set foldmethod=syntax
set foldnestmax=3
set fillchars=vert:\|,fold:\ ,diff:-
" open/close folds with tab
map <TAB> za
set foldtext=MyFoldText()
function! MyFoldText()
return getline(v:foldstart)
endfunction
" disable folding
set nofoldenable
" always show ruby comments
let ruby_no_comment_fold=1
" fold by default in ruby
autocmd FileType ruby normal zM
" toggle reference file
nnoremap <F1> :call ToggleVimReference()<CR>
let g:vim_reference_file = "~/Dropbox/reference.txt"
let g:vim_reference_width = 45
""" FocusMode from http://paulrouget.com/e/vimdarkroom/
function! ToggleFocusMode()
if (&foldcolumn != 12)
set laststatus=0
set numberwidth=10
set foldcolumn=12
set noruler
set cmdheight=1
hi FoldColumn ctermbg=none
hi LineNr ctermfg=0 ctermbg=none
hi NonText ctermfg=0
else
set laststatus=2
set numberwidth=4
set foldcolumn=0
set ruler
set cmdheight=3
execute 'colorscheme ' . g:colors_name
endif
endfunc
nnoremap <F2> :call ToggleFocusMode()<cr>
""" simple vim window management from http://www.agillo.net/simple-vim-window-management/
function! WinMove(key)
let t:curwin = winnr()
exec "wincmd ".a:key
if (t:curwin == winnr()) "we havent moved
if (match(a:key,'[jk]')) "were we going up/down
wincmd v
else
wincmd s
endif
exec "wincmd ".a:key
endif
endfunction
map <leader>h :call WinMove('h')<cr>
map <leader>k :call WinMove('k')<cr>
map <leader>l :call WinMove('l')<cr>
map <leader>j :call WinMove('j')<cr>
map <leader>wc :wincmd q<cr>
map <leader>wr <C-W>r
map <leader>H :wincmd H<cr>
map <leader>K :wincmd K<cr>
map <leader>L :wincmd L<cr>
map <leader>J :wincmd J<cr>
nmap <left> :3wincmd <<cr>
nmap <right> :3wincmd ><cr>
nmap <up> :3wincmd +<cr>
nmap <down> :3wincmd -<cr>
""" make Y behave like other capitals from vimbits
map Y y$
""" use sudo to write files from vimbits
cmap w!! %!sudo tee > /dev/null %
""" tabs, windows, buffers
map t :tabnew