sublimehq / Vintage

Vintage mode adds a vi style command mode to Sublime Text 2
http://www.sublimetext.com/docs/2/vintage.html
580 stars 76 forks source link

"T" command in vintage mode does not accept a number argument #212

Open skopjanecot opened 2 years ago

skopjanecot commented 2 years ago

Description of the bug

In vintage mode, using the "T" command with a number argument (example: "2Ts") does not produce results associated with that command. The bug as reported bellow in "additional information" is easily solvable, I am reporting so it can be adjusted in the default configuration.

Steps to reproduce

  1. Switch to vintage mode.
  2. Test the behavior listed bellow.

Expected behavior

"2Ts" moves the cursor backward to the second "s" in the line.

Actual behavior

It just moves back once to the first "s", the same as using the "Ts" command without the number argument.

Sublime Text build number

4126

Operating system & version

macOS 12.04

Additional information

EDIT: Jumped on the solution to fast, this just replicates the "F" command movement and doesn't move the cursor after the specified character. The bug does exist still.

Solved this bug by creating my custom keybinding which removes the "before": true argument from the motion arguments defined in Default.sublime-keymap from the Vintage package. By doing this, the command functions works as intended and is taking the number argument into account.

Original code for the "T" keybinding:

{ "keys": ["T", "<character>"], "command": "set_motion", "args": {
    "motion": "vi_move_to_character",
    "motion_args": {"extend": true, "forward": false, "before": true },
    "inclusive": true,
    "clip_to_line": true },
    "context": [{"key": "setting.command_mode"}]
},

With removed "before": true argument placed in the file parsed by Preferences: Key Binding:

{ "keys": ["T", "<character>"], "command": "set_motion", "args": {
        "motion": "vi_move_to_character",
        "motion_args": {"extend": true, "forward": false },
        "inclusive": true,
        "clip_to_line": true },
        "context": [{"key": "setting.command_mode"}]
},
deathaxe commented 2 years ago

Vintage plugin is maintained at https://github.com/sublimehq/Vintage. It appears rather unmaintained though. Maybe https://packagecontrol.io/packages/NeoVintageous is a better option.

skopjanecot commented 2 years ago

It seems forgotten actually. I browsed around other issues that were related to the vintage plugin after I submitted the bug yesterday and figured that I should move away from it. I installed NeoVintageous, it works fantastic at the moment and seems like an amazing package, incorporates many usefull vim plugins, etc. The problem is that it's not official and who know how long it will itself get maintened and updated with new ST4 releases.

deathaxe commented 2 years ago

The package seems to be updated quite frequently and its author has been quite active for several years. Even if maintenance would stop someone else could take over - it's open source.

ST heavily relies on plugins to adapt itself to certain workflows or use cases. There are only little to no "official" plugins. "Vintage" is indeed the only one and its left unmaintained for 10 years.