t9md / atom-vim-mode-plus

vim-mode improved
https://atom.io/packages/vim-mode-plus
MIT License
1.4k stars 111 forks source link

Request: rvalue/lvalue motion #1089

Open romgrk opened 6 years ago

romgrk commented 6 years ago

Add a motion that selects what is right or left of the = or : character.

E.g.

// inside-L-value:
const value = 'hello'
//            ^-----^

// inside-R-value:
const value = 'hello' /*
^---------^ */

Working prototype: https://gist.github.com/romgrk/c6ac4cd308be811e61039ce48228e068

If you're interested I'll make a PR, otherwise I'll maybe release it as a plugin.

t9md commented 6 years ago

I think L and R are upside-down in your code comment. Currently for R-value('hello') can be selected by i , or a , text-object. It's actually argument text-object, so doesn't exactly works as you might expect.

I'm interested in PR. As long as your new text-object is not language-specific one, I can merge it.

Thanks for the suggestion!

romgrk commented 6 years ago

Yes, L and R are wrong in the code comment.

I've created a new regex that is tested here: https://regex101.com/r/SCcmEo/5/ It matches the various assignment operators that I could think of. If there's any other that you can think of, let me know I'll include it.