Skip to content

Commit

Permalink
Add a zsh function to create PR of current branch
Browse files Browse the repository at this point in the history
  • Loading branch information
aifreedom committed Feb 27, 2018
1 parent 7a65b76 commit 186ef3a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .emacs.d/custom/init.el
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ that was stored with ska-point-to-register."

(add-hook 'js2-mode-hook #'js2-refactor-mode)
(js2r-add-keybindings-with-prefix "C-c C-r")
(define-key js2-mode-map (kbd "C-k") #'js2r-kill)
;; (define-key js2-mode-map (kbd "C-k") #'js2r-kill)

;; js-mode (which js2 is based on) binds "M-." which conflicts with xref, so
;; unbind it.
Expand Down
8 changes: 8 additions & 0 deletions .zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,11 @@ function enable_nvmrc() {
export NVM_DIR="$HOME/.nvm"
. "/usr/local/opt/nvm/nvm.sh"
}

function pr() {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
branch=${ref#refs/heads/}
remote=$(git config --get remote.origin.url)
[[ $remote =~ 'git@(.*):(.*).git' ]] && domain=$match[1] && repo=$match[2]
open "https://$domain/$repo/compare/$branch?expand=1"
}

0 comments on commit 186ef3a

Please sign in to comment.