1
0
mirror of https://github.com/gryf/.vim.git synced 2026-02-19 17:45:47 +01:00

Added switch for current VCS, updated buffergator and sorcerer

This commit is contained in:
2011-11-06 10:43:14 +01:00
parent 52a8266c56
commit 8c12d9bb0d
4 changed files with 172 additions and 7 deletions

66
.vimrc
View File

@@ -216,9 +216,36 @@ map ]b :call OpenInWebBrowser()<cr>
"remove search highlight and refresh
nnoremap <silent> <C-l> :nohl<CR>:syn sync fromstart<CR><C-l>
map <F3> :call <SID>ChangeVCS()<cr>
map <F4> :call <SID>ToggleHex()<cr>
" }}}
" FUNCTIONS: usefull functions for all of th files {{{
" Switch VCSCommand current used VCS system
function <SID>ChangeVCS()
echo ""
let l:vcs = ["HG", "SVN", "CVS", "GIT"]
let l:scv = {1: "HG", 2: "SVN", 3: "CVS", 4: "GIT"}
let l:cho = ""
let l:current = 0
if exists("VCSCommandVCSTypeExplicitOverride") &&
\ index(vcs, g:VCSCommandVCSTypeExplicitOverride) != -1
let l:current = vcs[g:VCSCommandVCSTypeExplicitOverride]
endif
let l:choice = confirm('Switch VCS: ', "&" . join(l:vcs, "\n&"), l:current)
execute ':redraw!'
if has_key(l:scv, l:choice)
let g:VCSCommandVCSTypeExplicitOverride=l:scv[l:choice]
echohl Statement
echo "Switched to " . g:VCSCommandVCSTypeExplicitOverride
echohl None
endif
endfunction
" Simple wrapper for :make command
function <SID>Make()
echohl Statement
@@ -316,6 +343,45 @@ function OpenInWebBrowser()
echohl None
endfunction
" helper function to toggle hex mode
function <SID>ToggleHex()
" hex mode should be considered a read-only operation
" save values for modified and read-only for restoration later,
" and clear the read-only flag for now
let l:modified=&mod
let l:oldreadonly=&readonly
let &readonly=0
let l:oldmodifiable=&modifiable
let &modifiable=1
if !exists("b:editHex") || !b:editHex
" save old options
let b:oldft=&ft
let b:oldbin=&bin
" set new options
setlocal binary " make sure it overrides any textwidth, etc.
let &ft="xxd"
" set status
let b:editHex=1
" switch to hex editor
%!xxd
else
" restore old options
let &ft=b:oldft
if !b:oldbin
setlocal nobinary
endif
" set status
let b:editHex=0
" return to normal editing
%!xxd -r
endif
" restore values for modified and read only state
let &mod=l:modified
let &readonly=l:oldreadonly
let &modifiable=l:oldmodifiable
endfunction
"Toggle
"}}}
" GUI: detect graphics mode, set colorscheme {{{
if has('gui_running')