Skip to content

Instantly share code, notes, and snippets.

@qickstarter
Created December 17, 2013 17:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qickstarter/8008989 to your computer and use it in GitHub Desktop.
Save qickstarter/8008989 to your computer and use it in GitHub Desktop.
" コピペで貼付けているので、これで動作しなかったら賢く書き換えてください。
NeoBundleLazy 'kmnk/vim-unite-giti', {
\ 'autoload': {
\ 'unite_sources': [
\ 'giti', 'giti/branch', 'giti/branch/new', 'giti/branch_all',
\ 'giti/config', 'giti/log', 'giti/remote', 'giti/status'
\ ]
\ }}
NeoBundleLazy 'Shougo/git-vim', {
\ 'autoload' : {
\ 'function_prefix' : 'git',
\ 'functions' : 'git#get_current_branch',
\ 'commands': [
\ { 'name': 'GitDiff', 'complete' : 'customlist,git#list_commits' },
\ { 'name': 'GitVimDiff', 'complete' : 'customlist,git#list_commits' },
\ { 'name': 'Git', 'complete' : 'customlist,git#list_commits' },
\ { 'name': 'GitCheckout', 'complete' : 'customlist,git#list_commits' },
\ { 'name': 'GitAdd', 'complete' : 'file' },
\ 'GitLog', 'GitCommit', 'GitBlame', 'GitPush'] }}
NeoBundleLazy 'tpope/vim-fugitive', { 'autoload': {
\ 'functions' : ['fugitive#head', 'fugitive#detect'],
\ 'commands': ['Gcommit', 'Gblame', 'Ggrep', 'Gdiff', 'Gcd'] }}
" git-vim
let g:git_bin = executable('hub') ? 'hub' : 'git'
let g:git_command_edit = 'vnew'
let g:git_no_default_mappings = 1
nnoremap gA :<C-U>GitAdd<Space>
nnoremap <silent>ga :<C-U>GitAdd<CR>
nnoremap gp :<C-U>Git push<Space>
nnoremap gD :<C-U>GitDiff<Space>
nnoremap gDD :<C-U>GitDiff HEAD<CR>
nnoremap git :<C-U>Git<Space>
" fugitive
nnoremap <silent>gM :Gcommit --amend<CR>
nnoremap <silent>gb :Gblame<CR>
nnoremap <silent>gB :Gbrowse<CR>
nnoremap <silent>gm :Gcommit<CR>
let hooks = neobundle#get_hooks('vim-fugitive')
function! hooks.on_source(bundle)
augroup MyGitCmd
autocmd!
autocmd FileType fugitiveblame vertical res 25
autocmd FileType gitcommit,git-diff nnoremap <buffer>q :q<CR>
augroup END
let g:fugitive_git_executable = executable('hub') ? 'hub' : 'git'
endfunction
function! hooks.on_post_source(bundle)
call fugitive#detect(expand('<amatch>:p'))
endfunction
command! FugitiveReload call fugitive#detect(expand('<amatch>:p'))
unlet hooks
" vim-unite-giti
nnoremap <silent>gl :Unite giti/log -no-start-insert -horizontal<CR>
nnoremap <silent>gP :Unite giti/pull_request/base -no-start-insert -horizontal<CR>
nnoremap <silent>gs :Unite giti/status -no-start-insert -horizontal<CR>
nnoremap <silent>gh :Unite giti/branch_all -no-start-insert<CR>
augroup MyUniteCmd
autocmd!
autocmd FileType unite call <SID>unite_my_settings()
augroup END
function s:unite_my_settings()
let profile_name = substitute(unite#get_current_unite().profile_name, '[-/]', '_', 'g')
if !empty(profile_name) && has_key(s:unite_hooks, profile_name)
call s:unite_hooks[profile_name]()
endif
endfunction
let s:unite_hooks = {}
function! s:unite_hooks.source_giti_status()
" nnoremap <silent><buffer><expr>gM unite#do_action('ammend')
" nnoremap <silent><buffer><expr>gm unite#do_action('commit')
nnoremap <silent><buffer><expr>ga unite#do_action('stage')
nnoremap <silent><buffer><expr>gc unite#do_action('checkout')
nnoremap <silent><buffer><expr>gd unite#do_action('diff')
nnoremap <silent><buffer><expr>gu unite#do_action('unstage')
endfunction
function! s:unite_hooks.source_giti_branch()
nnoremap <silent><buffer><expr>d unite#do_action('delete')
nnoremap <silent><buffer><expr>D unite#do_action('delete_force')
endfunction
function! s:unite_hooks.source_giti_branch_all()
call s:unite_hooks.source_giti_branch()
endfunction
function! s:unite_hooks.source_giti_log()
nnoremap <silent><buffer><expr>gd unite#do_action('diff')
nnoremap <silent><buffer><expr>d unite#do_action('diff')
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment