gusper/SongTxt-vscode

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

Opened this issue · 2 comments

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.

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.

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:

  • even though I also set:
    "[songtxt]": {
        "editor.wordSeparators": "`~!@$%^&*()-=+[{]}\\|;:'\",.<>?"
    }

(removing # and /) so that double-clicking selects a chord like G#m/B, smartSelect ignores that and only selects part of the chord in those cases (you can still double click to select the chord for those troublesome cases once you realize that).

  • key bindings over-ride cursorColumnSelectRight and cursorColumnSelectLeft (I haven't found those useful editing tabs)

  • not as robust as just typing spaces ahead of chord (but then how do you know when the intention is to actually shift everything to the right farther?)