Skip to content

Instantly share code, notes, and snippets.

@marcelohenrique180
Created June 9, 2018 16:39
Show Gist options
  • Save marcelohenrique180/b2fdd22ecbfad7981ab9314e71493c2d to your computer and use it in GitHub Desktop.
Save marcelohenrique180/b2fdd22ecbfad7981ab9314e71493c2d to your computer and use it in GitHub Desktop.
Auto Prefix Commit While Writing It
function GitBranchIssue()
let current_branch = system("git rev-parse --abbrev-ref HEAD")
let prefix = substitute(current_branch, '\([A-Z]\+-[0-9]\+\).\+', '\1 ', '')
return prefix
endfunction
iab commit <C-R>=GitBranchIssue()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment