Follow

I find myself frequently exiting my to use my favorite code editor, to perform an invasive text replace across many documents. Does your IDE offer text replacements across source code documents? If so, which IDE do you use?

@aeveltstra My "IDE" (#Emacs…) asks me, should it reload the file, whenever it's modified on disk and I'm attempting to edit it. Plus, M-x replace-regexp.

@ryayak1460 Doesn't vim open exactly 1 file at a time? Can it replace texts across multiple documents?

@aeveltstra The following two Ex commands set up an argument list, then substitute across those arguments, respectively:

:ar fileglob
:argdo %s/regex/replacement/g | update

@aeveltstra Yeah man, vim is super powerful! The online help is super useful, too:

:help $keyword

$keyword can be a command, setting, keystroke or even a general topic. They usually have tab-completion as well.

@aeveltstra vim even has intellisense in the form of omnicompletion using C-n in Insert mode.

@aeveltstra It can absolutely open more than one file at a time as well, not including buffers in the background.

To open a single file, use :e $filename
To open the file in a new pane, use :vne $filename
To open the file in a new tab, use :tabe $filename.

To see the current buffers open, use :ls
To switch to a buffer, use :b $bufferNumber
To delete a buffer, use :bd $bufferNumber

@aeveltstra Re: buffers, I just tested load on vim to see how many buffers it could open.

I opened all JS files in a Node.js project, including those in node_modules. 13,452 buffers and it only takes up 107.4MiB on Windows.

Sign in to participate in the conversation
Mastodon

Server run by the main developers of the project 🐘 It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!