config/plugin/git.rb in ver-2010.02 vs config/plugin/git.rb in ver-2010.08

- old
+ new

@@ -1,6 +1,6 @@ -# Copyright (c) 2009 Michael Fellinger <m.fellinger@gmail.com> +# Copyright (c) 2010 Michael Fellinger <m.fellinger@gmail.com> # # Description: # # Shortcuts to use git within VER. # This simply opens an urxvt console and embeds it into VER until you finish @@ -13,18 +13,22 @@ module VER module Methods module Git def self.git_blame(text, count = 1) - line = text.index(:insert).y + line = text.index(:insert).line from, to = line - count, line + count - open_rxvt(text, "git blame #{text.filename} -L#{from},#{to}") + spawn_rxvt(text, "git blame #{text.filename} -L#{from},#{to}") end - def self.open_rxvt(text, command) - Preview.open_rxvt(text, command) + def self.spawn_rxvt(text, command) + Preview.spawn_rxvt(command) end + + def self.spawn_cmd(text, command) + `#{command} &` + end end end if options.keymap == 'vim' minor_mode :control do @@ -32,15 +36,17 @@ end minor_mode :git do handler Methods::Git - map :git_blame, %w[g i t b] - map [:open_rxvt, 'git add -p'], %w[g i t a] - map [:open_rxvt, 'git commit'], %w[g i t c] - map [:open_rxvt, 'git diff' ], %w[g i t d] - map [:open_rxvt, 'git pull' ], %w[g i t p u l] - map [:open_rxvt, 'git push' ], %w[g i t p u s] - map [:open_rxvt, 'git status | less'], %w[g i t s] + map :git_blame, 'gitb' + map [:spawn_rxvt, 'git add -p'], 'gita' + map [:spawn_rxvt, 'git commit'], 'gitc' + map [:spawn_rxvt, 'git diff' ], 'gitd' + map [:spawn_rxvt, 'git pull' ], 'gitpul' + map [:spawn_rxvt, 'git push' ], 'gitpus' + map [:spawn_rxvt, 'git status'], 'gitst' + map [:spawn_rxvt, 'tig'], 'gitt' + map [:spawn_cmd, 'gitk --all'], 'gitk' end end end