Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tabby.nvim

Move notes inside an ASCII guitar tab without breaking the bar's width and alignment

Consider the following couple of bars

E|----------3-----2---------------------|--------------------------------------|
B|-5------3-----------------------------|---------3--------------3-------------|
G|--------------------------------------|-----4----------4---------------------|
D|--------------------------------------|-----2--------------------------------|
A|--------------------------------------|--------------------------------------|
E|--------------------------------------|--------------------------------------|

Suppose the '5' on the B string is a bit too close to the beginning of the bar and you wanna move it, and the '3' a bit further down the bar. Put the cursor behind the '5' and press <leader>tl three times (or press once and then tab . if you have tpope's vim-repeat installed). The output would look like this

E|----------3-----2---------------------|--------------------------------------|
B|-------5------3-----------------------|---------3--------------3-------------|
G|--------------------------------------|-----4----------4---------------------|
D|--------------------------------------|-----2--------------------------------|
A|--------------------------------------|--------------------------------------|
E|--------------------------------------|--------------------------------------|

You can also move individual notes and add/append bars

Here's a summary of features:

  • Put the cursor behind a run, <leader>th / <leader>tl move the whole run left/right
  • Put the cursor between two notes, <leader>tH pushes the left note back, <leader>tL pushes the right note forward
  • Two-digit frets (e.g., 12) move as one unit
  • A note left of the cursor stays put and acts as a wall
  • Moves are scoped to the current bar and never change its width
  • <leader>tB (or :TabbyAddBar) appends an empty measure to every string of the block at once, so all six stay aligned. The tuning prefix is left alone

Blocked or invalid moves (on a |, in the tuning, empty bar, jammed against an edge) do nothing and say why

Installing

Using lazy.nvim:

{
'afjoseph/tabby',
dependencies = { 'tpope/vim-repeat' },
config = function()
  require('tabby').setup({
    -- All the configs below are also the default ones. I'm leaving them here
    -- for reference
    keymap_group_left = '<leader>th',
    keymap_group_right = '<leader>tl',
    keymap_note_left = '<leader>tH',
    keymap_note_right = '<leader>tL',
    keymap_add_bar = '<leader>tB',
    bar_width = 38,
  })
end,
}

Testing

The string manipulation logic is in ./lua/tabby/core.lua and it's tested in pure lua with just test (you need Justfile)

About

Guitar tabs manipulation plugin

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages