Skip Navigation

Vis: Vi Improved, on Steroids

phroxy.z3bra.org Vis: Vi Improved, on Steroids - SDF Chatter

TL;DR: I use a vim like editor which tackles Vim’s greatest weakness: vis [https://github.com/martanne/vis].

TL;DR: I use a vim like editor which tackles Vim's greatest weakness: vis.

12

You're viewing a single thread.

12 comments
  • Isn't your x covered by: https://vim.fandom.com/wiki/Power_of_g

    • Well, partly. g/pattern/cmd will let you select lines where you want to apply cmd. For the use case I present in the post, it solves the problem. But the g command, has the same limitation as every command in vim: it works on line only. On the other hand, the x command in sam applies to the whole text. It doesn't matter whether or not you have new lines in the pattern.

      Imagine that you have a text file, and you want to make sure that all paragraphs are separated by only one blank new line. I cannot think of a way of doing it easily in vim, while with sam expressions, you can do: x/\n+/ c/\n\n/ and call it a day :) Another cool feature is that as x is a command like any other, which applies to any predefined selection. For example, you can do stuff like that:

      Emacs is considered an advanced editor.
      And while Vim users tend to swear on Emacs.
      Emacs users are still convinced that Emacs rules!

      x/Emacs rules/ x/Emacs/ c/Sam/
      

      This will first extract "Emacs rules" from the whole text, then extract "Emacs" from it, then change it to "Sam". This means that you can narrow down the parts of the text that your commands will apply to portions of the line. The g command here would simply select the last line for you, but then you'd have to be very careful not to substitute the first occurrence of "Emacs", leading to the following in vim (I'm exaggerating the command for the example of course) :

      g/Emacs rules/s/Emacs rules/Sam rules/
      
12 comments