Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Darkly)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Uncategorized
  3. Like global search and replace but don’t like surprises?

Like global search and replace but don’t like surprises?

Scheduled Pinned Locked Moved Uncategorized
searchandreplacfindandreplacecliappserpl
18 Posts 8 Posters 25 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Aral BalkanA Aral Balkan

    Like global search and replace but don’t like surprises?

    Check out serpl – a handy little command-line app that gives you a visual preview of the changes you are about to make. You can even go in and remove the replacements you don’t want from the source previews. The regex support appears to be basic, however (I couldn’t get a negative lookbehind to work).

    https://github.com/yassinebridi/serpl#readme

    (Also, it appears they’re looking for maintainers. It’s written in Rust.)

    #searchAndReplace #findAndReplace #CLI #app #serpl #dev

    Ramin HonaryR This user is from outside of this forum
    Ramin HonaryR This user is from outside of this forum
    Ramin Honary
    wrote last edited by
    #4

    @aral@mastodon.ar.al for those of you using #Emacs it has a similar feature that can be run with M-x occur. You can also run the M-x multi-occur command to do find/replace across multiple files.

    In an occur-mode buffer, you can press e to enter "edit mode" and modify each matching line in place, then press C-c C-c to commit those changes to the file. This allows you to do search/replace using the ordinary C-M-% command.

    Robert Pluim 🇪🇺R tusharheroT 2 Replies Last reply
    0
    • Ramin HonaryR Ramin Honary

      @aral@mastodon.ar.al for those of you using #Emacs it has a similar feature that can be run with M-x occur. You can also run the M-x multi-occur command to do find/replace across multiple files.

      In an occur-mode buffer, you can press e to enter "edit mode" and modify each matching line in place, then press C-c C-c to commit those changes to the file. This allows you to do search/replace using the ordinary C-M-% command.

      Robert Pluim 🇪🇺R This user is from outside of this forum
      Robert Pluim 🇪🇺R This user is from outside of this forum
      Robert Pluim 🇪🇺
      wrote last edited by
      #5

      @ramin_hal9001 @aral Emacs has a number of modes that let you edit stuff in buffers, and then apply the changes, including wdired and wgrep.

      Ramin HonaryR 1 Reply Last reply
      0
      • ilmariI ilmari

        @aral it uses the rust regex crate, which does not support lookaround or backreferences, because they "are not known how to implement efficiently"

        Aral BalkanA This user is from outside of this forum
        Aral BalkanA This user is from outside of this forum
        Aral Balkan
        wrote last edited by
        #6

        @ilmari 🤷‍♂️

        (One person’s inefficient is another’s good enough.) 😉

        1 Reply Last reply
        0
        • Robert Pluim 🇪🇺R Robert Pluim 🇪🇺

          @ramin_hal9001 @aral Emacs has a number of modes that let you edit stuff in buffers, and then apply the changes, including wdired and wgrep.

          Ramin HonaryR This user is from outside of this forum
          Ramin HonaryR This user is from outside of this forum
          Ramin Honary
          wrote last edited by
          #7

          @rpluim@mastodon.social yes, I use wdired all the time.

          It is much, much more safe and reliable than using tools like mv when renaming things. When I need to rename files in the terminal, I often use the command emacs -nw -Q . to open the current directory and edit the filenames like I would a file. Plus you have access to copy/paste and find/replace and all the other usual editing tools you might need available to you as you choose your file names.

          Wgrep is also nice, but I don't think it comes with the standard set of built-in tools for Emacs, I think you have to install that one separately.
          Multi-occur is built-in so I tend to use that one.

          @aral@mastodon.ar.al

          1 Reply Last reply
          0
          • Ramin HonaryR Ramin Honary

            @aral@mastodon.ar.al for those of you using #Emacs it has a similar feature that can be run with M-x occur. You can also run the M-x multi-occur command to do find/replace across multiple files.

            In an occur-mode buffer, you can press e to enter "edit mode" and modify each matching line in place, then press C-c C-c to commit those changes to the file. This allows you to do search/replace using the ordinary C-M-% command.

            tusharheroT This user is from outside of this forum
            tusharheroT This user is from outside of this forum
            tusharhero
            wrote last edited by
            #8

            @ramin_hal9001 @aral I guess you just have to reinvent emacs but in a way that they are not easily interlope-able...

            Ramin HonaryR 1 Reply Last reply
            0
            • tusharheroT tusharhero

              @ramin_hal9001 @aral I guess you just have to reinvent emacs but in a way that they are not easily interlope-able...

              Ramin HonaryR This user is from outside of this forum
              Ramin HonaryR This user is from outside of this forum
              Ramin Honary
              wrote last edited by
              #9

              "I guess you just have to reinvent emacs but in a way that they are not easily interlope-able"

              @tusharhero@mathstodon.xyz what are you talking about?! You can use Unix pipes to make everything interoperable!!! (Sarcasm)

              @aral@mastodon.ar.al

              tusharheroT 1 Reply Last reply
              0
              • Ramin HonaryR Ramin Honary

                "I guess you just have to reinvent emacs but in a way that they are not easily interlope-able"

                @tusharhero@mathstodon.xyz what are you talking about?! You can use Unix pipes to make everything interoperable!!! (Sarcasm)

                @aral@mastodon.ar.al

                tusharheroT This user is from outside of this forum
                tusharheroT This user is from outside of this forum
                tusharhero
                wrote last edited by
                #10

                @ramin_hal9001 @aral That might be true for some programs. But most programs (TUI) are not at all designed for that.

                Vim, for example, is not at all like that. I don't know if you can at least pipe buffer regions into programs or not, probably can. But that is something I do all the time inside Emacs.

                (I know you are joking).

                Ramin HonaryR Omar AntolínO 2 Replies Last reply
                0
                • tusharheroT tusharhero

                  @ramin_hal9001 @aral That might be true for some programs. But most programs (TUI) are not at all designed for that.

                  Vim, for example, is not at all like that. I don't know if you can at least pipe buffer regions into programs or not, probably can. But that is something I do all the time inside Emacs.

                  (I know you are joking).

                  Ramin HonaryR This user is from outside of this forum
                  Ramin HonaryR This user is from outside of this forum
                  Ramin Honary
                  wrote last edited by
                  #11

                  @tusharhero@mathstodon.xyz yes, you gleaned the point I was making exactly.

                  Terminal apps are basically like cell phone apps, where there is no attempt (beyond copy-paste, or simple message passing, like what Android OS calls "intents") to make programs interoperable at all, because there is basically no infrastructure for it. I mean, sockets exist on most operating systems, but this just forces you to isolate functionality into a client-server architecture with well-defined protocols (DBus, for example), and a lot of these TUI app never even bother with such things. They are just GUIs that use ANSI terminal codes to draw things on screen.

                  They all operate in isolation, they all have their own unique command line syntax, their own unique configuration scripting syntax, their own unique user interface, you have to relearn everything for each TUI tool you decide to use.

                  To be fair, Lisp languages (e.g. Emacs) can be just as chaotic, but there is at least more of an attempt to unify all the disparate apps under a single configuration language and UI/UX philosophy. Everything can be scripted using the same, well-defined, turing-complete programming language, and messages are passed between apps using a well-structured and consistent protocol (S-expressions) that is built-in to the system itself.

                  @aral@mastodon.ar.al

                  1 Reply Last reply
                  0
                  • tusharheroT tusharhero

                    @ramin_hal9001 @aral That might be true for some programs. But most programs (TUI) are not at all designed for that.

                    Vim, for example, is not at all like that. I don't know if you can at least pipe buffer regions into programs or not, probably can. But that is something I do all the time inside Emacs.

                    (I know you are joking).

                    Omar AntolínO This user is from outside of this forum
                    Omar AntolínO This user is from outside of this forum
                    Omar Antolín
                    wrote last edited by
                    #12

                    @tusharhero @ramin_hal9001 @aral You definitely can pipe regions of a vim to buffer to a command. I'd say it's even encouraged among vim users.

                    mekeorM 1 Reply Last reply
                    0
                    • Omar AntolínO Omar Antolín

                      @tusharhero @ramin_hal9001 @aral You definitely can pipe regions of a vim to buffer to a command. I'd say it's even encouraged among vim users.

                      mekeorM This user is from outside of this forum
                      mekeorM This user is from outside of this forum
                      mekeor
                      wrote last edited by
                      #13

                      @tusharhero @ramin_hal9001 @aral @oantolin eshell has nice interoperability with pipes too. i'd love to see an (async-)eshell-command available everywhere in emacs

                      Ramin HonaryR 1 Reply Last reply
                      0
                      • mekeorM mekeor

                        @tusharhero @ramin_hal9001 @aral @oantolin eshell has nice interoperability with pipes too. i'd love to see an (async-)eshell-command available everywhere in emacs

                        Ramin HonaryR This user is from outside of this forum
                        Ramin HonaryR This user is from outside of this forum
                        Ramin Honary
                        wrote last edited by
                        #14

                        "i'd love to see an (async-)eshell-command available everywhere in emacs"

                        @mekeor@mastodon.catgirl.cloud do you mean, like M-x eshell-command ?

                        @tusharhero@mathstodon.xyz @aral@mastodon.ar.al @oantolin@mathstodon.xyz

                        tusharheroT 1 Reply Last reply
                        0
                        • Ramin HonaryR Ramin Honary

                          "i'd love to see an (async-)eshell-command available everywhere in emacs"

                          @mekeor@mastodon.catgirl.cloud do you mean, like M-x eshell-command ?

                          @tusharhero@mathstodon.xyz @aral@mastodon.ar.al @oantolin@mathstodon.xyz

                          tusharheroT This user is from outside of this forum
                          tusharheroT This user is from outside of this forum
                          tusharhero
                          wrote last edited by
                          #15

                          @ramin_hal9001 @aral @mekeor @oantolin You go to write it and someone has already written it (I am talking about the function not the toot.)

                          tusharheroT mekeorM 2 Replies Last reply
                          0
                          • tusharheroT tusharhero

                            @ramin_hal9001 @aral @mekeor @oantolin You go to write it and someone has already written it (I am talking about the function not the toot.)

                            tusharheroT This user is from outside of this forum
                            tusharheroT This user is from outside of this forum
                            tusharhero
                            wrote last edited by
                            #16

                            @ramin_hal9001 @aral @mekeor @oantolin happens a lot with emacs.

                            Ramin HonaryR 1 Reply Last reply
                            0
                            • tusharheroT tusharhero

                              @ramin_hal9001 @aral @mekeor @oantolin happens a lot with emacs.

                              Ramin HonaryR This user is from outside of this forum
                              Ramin HonaryR This user is from outside of this forum
                              Ramin Honary
                              wrote last edited by
                              #17

                              "You go to write it and someone has already written it. happens a lot with emacs."

                              @tusharhero@mathstodon.xyz yes, it does indeed!

                              @aral@mastodon.ar.al @mekeor@mastodon.catgirl.cloud @oantolin@mathstodon.xyz

                              1 Reply Last reply
                              0
                              • tusharheroT tusharhero

                                @ramin_hal9001 @aral @mekeor @oantolin You go to write it and someone has already written it (I am talking about the function not the toot.)

                                mekeorM This user is from outside of this forum
                                mekeorM This user is from outside of this forum
                                mekeor
                                wrote last edited by
                                #18

                                @ramin_hal9001 @aral @oantolin @tusharhero yes and perhaps also bind a handy key in dired to a new dired-(async-)eshell-command and also perhaps in embark keymaps etc 😄

                                1 Reply Last reply
                                0
                                Reply
                                • Reply as topic
                                Log in to reply
                                • Oldest to Newest
                                • Newest to Oldest
                                • Most Votes


                                • Login

                                • Don't have an account? Register

                                • Login or register to search.
                                Powered by NodeBB Contributors
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • World
                                • Users
                                • Groups