gusper / SongTxt-vscode

Visual Studio Code extension that adds support for editing text files for songs including lyrics, chords, guitar tablature, etc.
MIT License
30 stars 7 forks source link

Chords remain fixed and independent of other chords on the same line #4

Open gusper opened 6 years ago

gusper commented 6 years ago

Normally, when you add a few spaces to move a chord over to line up correctly with the lyrics it corresponds to, you'll also move all of the other chords on that line too. Would be handy to make spaces just move the next chord but leave others where they are.

aamarks commented 5 years ago

One way would be to map the key bindings for editor.action.moveCarretLeftAction and editor.action.moveCarretRightAction to some control key(s) + left/right arrows. Then when the chord is selected you can slide it around without altering the adjacent chords as long as you stay between them. It would be nice to also change the punctuation/word rules so that double clicking something like G#m7 selects the whole chord. Not sure which control key/arrow combination as they do many things already.

aamarks commented 5 years ago

This works pretty nicely to slide the chord around with the arrow keys so that you don't even have to select the chord as long as the cursor is touching the chord:

    {
        "key": "ctrl+shift+alt+left",
        "command": "editor.action.moveCarretLeftAction",
        "when": "editorLangId == 'songtxt' && editorHasSelection"
    },
    {
        "key": "ctrl+shift+alt+right",
        "command": "editor.action.moveCarretRightAction",
        "when": "editorLangId == 'songtxt' && editorHasSelection"
    },
    {
        "key": "ctrl+shift+alt+left",
        "command": "editor.action.smartSelect.expand",
        "when": "editorLangId == 'songtxt' && !editorHasSelection"
    },
    {
        "key": "ctrl+shift+alt+right",
        "command": "editor.action.smartSelect.expand",
        "when": "editorLangId == 'songtxt' && !editorHasSelection"
    }

The last two auto select the chord under the cursor if not selected already.

The caveats: