Vim icon indicating copy to clipboard operation
Vim copied to clipboard

Support `:g[lobal]/[pattern]/[command]`

Open Leekao opened this issue 7 years ago • 10 comments

One of the main reasons I love VIM so much is the option to do "g/console.log/d" to clear out all the lines with console.log on my scripts, is there any chance of supporting it?

Leekao avatar Aug 30 '18 10:08 Leekao

This should work with neovim if you want to give it a try.

jpoon avatar Aug 30 '18 20:08 jpoon

The ability to do global search and replace is CRITICAL to a VI emulation. This is the single reason I would use the program. If it doesn't support global search and replace, for example by doing:

:g/old pattern/s//new pattern/g

then that effectively breaks the program for me I'm afraid.

remler avatar Dec 05 '18 21:12 remler

@remler Until this is added please note that you can just mark the lines visually and then use "s/old/new/g"

Leekao avatar Dec 10 '18 11:12 Leekao

Hmm, 2 years ago... not having much hope for global to be implemented at this point. It's one of VIMs absolutely most powerful features... such a pity.

SHanded avatar Dec 18 '20 07:12 SHanded

:1,$<command> (i.e. :1,$s/foo/bar/) is a workaround, but I would imagine much less efficient as it's applying the command to every line instead of only lines that match a pattern as would happen with :g/foo/s//bar/.

But probably more important/annoying is just the lack of something that a lot of people have muscle-memory for.

brianjmurrell avatar Apr 10 '22 11:04 brianjmurrell

Thank you. For some reason I never thought of doing this because, like you said, "muscle memory." But this can be useful. Thanks again!

On Sun, Apr 10, 2022, 07:37 Brian J. Murrell @.***> wrote:

:1,$ (i.e. :1,$s/foo/bar/) is a workaround, but I would imagine much less efficient as it's applying the command to every line instead of only lines that match a pattern as would happen with :g/foo/s//bar/.

But probably more important/annoying is just the lack of something that a lot of people have muscle-memory for.

— Reply to this email directly, view it on GitHub https://github.com/VSCodeVim/Vim/issues/3010#issuecomment-1094252002, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHKBCPYNU264RKCOWZHA3ETVEK4Q3ANCNFSM4FSM3WUQ . You are receiving this because you were mentioned.Message ID: @.***>

remler avatar Apr 10 '22 12:04 remler

I'm interested in implementing this feature. How would I go about doing that?

martchellop avatar Mar 28 '23 23:03 martchellop

just wanted to +1 as this is the single feature I miss on vscode vim. I don't think I've noticed anything else missing to date...

airstrike avatar Nov 26 '23 22:11 airstrike

Hi,

I'm sorry -- I'm only seeing this email 15 months later!

Was this question directed towards me specifically? If so, I can only really provide guidance to how it is "supposed" to work -- although I would think you can find that from numerous sources.

But if you're asking for technical guidance -- which I suspect you are -- then I'm afraid that I'm of no use here.

However I remain curious if anything has happened in the past year or so -- I'm not sure if I've ever tried to use this since.

-- Thanks, -- Daniel

On Tue, Mar 28, 2023 at 7:04 PM martchellop @.***> wrote:

I'm interested in implementing this feature. How would I go about doing that?

— Reply to this email directly, view it on GitHub https://github.com/VSCodeVim/Vim/issues/3010#issuecomment-1487716957, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHKBCP4IDAELYBUML5ZWXELW6NU6JANCNFSM4FSM3WUQ . You are receiving this because you were mentioned.Message ID: @.***>

remler avatar Jun 30 '24 16:06 remler