-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: custom text objects/motions #1096
Comments
Our current policy on extensions is that while we probably won't implement them ourselves, we're completely open to other users implementing them. We're also completely fine with merging them into VSCodeVim core (generally speaking under a flag). |
Sounds great, thanks for the fast response! |
Gonna keep this open as it's a valid feature request. |
I also would very much like to see this. Any work going on with this? |
Hey everyone, Subword support has been added to VS Code in 1.25 (microsoft/vscode#48023). Is it possible to enable subword for motion hot keys? |
Any progress on this? |
Still no progress ?? |
subword movement is supported: |
I'm particularly interested on the function text object. |
A text object not mentioned here yet that I use a lot is https://github.com/kana/vim-textobj-line |
I would also love to see xmlattr https://github.com/whatyouhide/vim-textobj-xmlattr |
For any who also ended up here when looking for line text objects, most of it can be emulated with the "before-after" functionality:
This catches the most frequent usages and is easily extended to "around-line" objects (for preceding space + trailing space). The surround command |
In the spirit of sharing hacky regexes, here's an attempt at a selecting comment block.
// Selects single-line comments blocks, starting with `#` or `/`
// <g;> doesn't expand over blank lines, <g:> does
// We have to write out the whole regex in single characters, which makes it
// illegible, unfortunately. But the regex is:
// - `^(\s*[^\s#/])` for `<g:>`
// - `^(\s*[^\s#/]|$)` for `<g;>`
{
"after": [
"?",
"^",
"(",
"\\",
"s",
"*",
"[",
"^",
"\\",
"s",
"#",
"/",
"]",
")",
"<Enter>",
"j",
"V",
"/",
"^",
"(",
"\\",
"s",
"*",
"[",
"^",
"\\",
"s",
"#",
"/",
"]",
")",
"<Enter>",
"k"
],
"before": ["g", ":"]
},
{
"after": [
"?",
"^",
"(",
"\\",
"s",
"*",
"[",
"^",
"\\",
"s",
"#",
"/",
"]",
// By hitting this key without hitting the next one yet, the top of the
// file is highlighted, which makes moves the selection to the bottom of
// the screen. TODO: find a way of entering the whole regex without a
// redraw. If we paste it, then it works, so some way is possible.
"|",
"$",
")",
"<Enter>",
"j",
"V",
"/",
"^",
"(",
"\\",
"s",
"*",
"[",
"^",
"\\",
"s",
"#",
"/",
"]",
"|",
"$",
")",
"<Enter>",
"k"
],
"before": ["g", ";"]
}, I'd very much like a a feature to define a mapping between a chord and a text selection — so rather than having to define |
I'm an Atom vim-mode-plus user who's been keeping an eye on VSCode for a while: one of the main things that's holding me back from switching is the inability to define various text objects and motions that I've grown accustomed to.
Some examples of custom text objects in other 'vimplementations':
...etc
Is there any chance that this kind of extensibility will be available for text objects and motions within VSCode Vim some day?
The text was updated successfully, but these errors were encountered: