Skip to content

Instantly share code, notes, and snippets.

@handlename
Created May 17, 2013 10:11
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 handlename/5598226 to your computer and use it in GitHub Desktop.
Save handlename/5598226 to your computer and use it in GitHub Desktop.
(defun my:chomp (str)
(replace-regexp-in-string "[\n\r]+$" "" str))
(defun my:git-project-p ()
(string=
(my:chomp
(shell-command-to-string "git rev-parse --is-inside-work-tree"))
"true"))
(defun my:tig-blame-current-file ()
(interactive)
(if (git-project-p)
(progn
(shell-command
(format "tmux new-window 'cd %s; tig blame -- %s'"
(file-name-directory buffer-file-name)
(file-name-nondirectory buffer-file-name)))
(shell-command (format "open -a iTerm")))))
(global-set-key (kbd "C-c o b") 'my:tig-blame-current-file)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment