Skip to main content
edited tags
Link
romainl
  • 42.3k
  • 5
  • 87
  • 118
Source Link
Marc
  • 113
  • 3

Insert current branch name in insert mode in Neovim

I'd like to create a hotkey to insert the current branch name directly in insert mode with the hotkey <C-b>. I use the plugin gitsigns which has a variable vim.b.gitsigns_head containing the current branch but I can't seem to find a way to input it. I figured I need to add something like

vim.keymap.set('i', '<C-b>', vim.b.gitsigns_head)

but I can't find any way to reference and print the variable.