Skip to content

Instantly share code, notes, and snippets.

@Kawsay
Created September 21, 2022 15:36
Show Gist options
  • Save Kawsay/4021c08fc75dc9ef466e98eee096fe22 to your computer and use it in GitHub Desktop.
Save Kawsay/4021c08fc75dc9ef466e98eee096fe22 to your computer and use it in GitHub Desktop.
" We're using branch names like:
" - feature/hd-1234_tiny_description
" - feature/HD_4321_tiny_description
" - chore/tiny_description
" where '1234' refers to a Jira ticket.
"
" The following, if working on a feature, extracts Jira ticket number
" and set it as branch name in vim-airline.
let g:airline#extensions#branch#format = 'GetJiraTicketNumber'
function GetJiraTicketNumber(name) abort
if a:name =~# 'feature'
return matchlist(a:name, 'feature\/HD[-_]\(\d\{4}\)')[1]
else
return a:name
endif
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment