VSCodeVim / Vim

:star: Vim for Visual Studio Code
http://aka.ms/vscodevim
MIT License
13.95k stars 1.32k forks source link

Support for Wildfire (visual selection expansion using text objects) #2834

Open expelledboy opened 6 years ago

expelledboy commented 6 years ago

Hey guys, love the idea of using vim in vscode!

Would it be possible atm to implement something similar to vim's wildfire plugin? It expands the visual selection according to next recognized text objects, searching in order of a configurable list.

Wildfire Preview

I use it so much I actually cant use vim anywhere that doesn't support it, just breaks my concentration.

xconverge commented 6 years ago

did you try our keybinding of af https://github.com/VSCodeVim/Vim#-vscodevim-tricks

You can rebind something else to af if that makes you more comfortable as well

expelledboy commented 6 years ago

@xconverge Wow! That was easy, you should add it to the readme!

    "vim.normalModeKeyBindingsNonRecursive": [
        {
            "before": ["enter"],
            "after": ["v", "a", "f"],
        }
    ],
    "vim.visualModeKeyBindingsNonRecursive": [
        {
            "before": ["enter"],
            "after": ["a", "f"],
        }
    ]

The only other powerful feature lacking here is then, having custom rules for text object expansions per language. For example in Erlang I expand inside { character according to what its encapulating, but these do no apply to any other lanugage. Even the order matters, if we cant define our own custom text objects.

But now I am invested, I think I am going to have a read through how this all works. This project has come along way!

Zyst commented 6 years ago

@expelledboy I think it is, what do you think is missing there?

https://github.com/VSCodeVim/Vim#-vscodevim-tricks

If necessary it's possible to write more detailed docs for it.

expelledboy commented 6 years ago

@Zyst My bindings with af posted above is what I was looking for, but the final step to get the full wildfire goodness is to have custom rules for text expansion per filetype.

If anyone could point me to where its implemented I would appreciate it!

cursorzz commented 5 years ago

Is there any command that support select Inside block? for the example below

af - visual mode command which selects increasingly large blocks of text. For example, if you had "blah (foo [bar 'ba|z'])" then it would select 'baz' first. If you pressed af again, it'd then select [bar 'baz'], and if you did it a third time it would select "(foo [bar 'baz'])".

I would like to select baz instead of 'baz'

Glench commented 4 years ago

Yes, is it possible to get af to work just like VSCode's Expand Selection command? It would be awesome if they were consistent.

kronaemmanuel commented 1 year ago

Is there a way to Reduce the selection? If you've accidentally pressed af one too many times accidentally?

d1y commented 1 year ago

FYI, I use https://github.com/jhasse/vscode-bracket-select the plugin

    {
      "before": [
        "enter"
      ],
      "commands": [ "bracket-select.select" ],
      // "after": [
      //   "v",
      //   "a",
      //   "f"
      // ]
    },

demo.gif

expelledboy commented 1 year ago

Amazing! Thanks @d1y, perhaps I can modify this code to be customizable.