Hacker News new | ask | show | jobs
by billfruit 2630 days ago
I am writing this from emacs experience (some if not all these features are in vi as well), there are features from emacs that make a real difference in writing programs especially:

* Unlimited yanking from kill rings: ie pasting text from history of the clipboard.(This is one thing I have most difficulty with when switching from emacs to modern editors)

* Macro recording and playback : recording an arbitrary set of edit operations and then replaying them any number of times.

* two or more code frames/windows side by side, even displaying the same file Surprisingly modern IDE guis seems not designed for it, eclipse can do it but clumsily.

* Remote file editing: use the IDE tools to edit file residing on another computer.

* Column edits or rectangle edits. Selecting a vertical column or rectangle of text and copying, moving it to another place.

4 comments

> some if not all these features are in vi as well

I'm not sure exactly which vim features are also in vi. Vim has been a daily use tool for me since about 2007.

Vim has really good Macro recording. Vim + Tmux is great for side by side code frames, and there are plugins for showing multiple buffers in one Vim instance. Remote file editing is good with SSH + Vim. Vim has multiple registries for yanking/putting. Vim has column editing functionality.

Almost anything Emacs does out of the box Vim can do with either a plugin or with an external program pairing. I prefer Vim's keybindings because there are less "chords" (Ctrl-C and Ctrl-V are copy and paste chords, they requiring pressing two buttons at the same time). Too many chords causing my pinky fingers to become tired. Vimscript is a surprisingly powerful language for dealing with text data, but it's cryptic the first decade you are exposed to it.

EDIT: I'm more interesting in the code people write than the way people write it, but I wanted to share some of my vim knowledge and point of view.

Unless I've misunderstood, you can use splits to show multiple buffers in Vim without any plugins.
What about manipulating of splits, like converting vertical split to a horizontal split, enabling/disabling synchronized scrolling, etc..
You can do both of those things in vim. I don't mean to be nitpicky, I'm just mentioning in case someone reading this didn't know and uses vim. You can set scrollbind and convert splits (off the top of my head I think it's Cw Ch and Cw Ct).
Remote editing, I mean using the local computer's emacs to edit file on the remote computer, where emacs does all the work of fetching and syncing the file (using ftp, ssh etc) back to remote. I think vim can do something similar too.
Friendly reply -

> Unlimited yanking from kill rings

vi has named buffers, which aren’t the same thing you’re talking about, but definitely more than a single clipboard

> Macro recording and playback

vi can “execute a buffer” which are arbitrary commands, and at least nvi can do automatic substitutions as well in a “dumb macro” sort of way

> Two or more code frames...

Same for vi. In nvi it’s :E for vertically stacked or :vsplit for side-by-side. Like emacs, you can even run an interactive shell in a buffer (frame) and cut/copy/paste with another.

> Remote file editing

I presume you’re talking Tramp. Not out of the box with nvi, but it interacts with the Unix shell fantastically if you’re lucky enough to be developing in such an env. I’d be surprised if vim doesn’t have a decent Tramp-like feature.

I think vim does columnar edits, but I’m not a vim user; nvi is out of luck there, unless again one finds a solution punting to the shell - which isn’t the end of the world. But this case I think would disappoint you the most from your feature list (speaking for nvi).

All of these features are also in "graphical" editors, despite the claims. M$ had been doing it for decades.

I remember a friend of mine showing how easy it was to block select in vim. I waited 30 secs or so. I showed him the same in visual c++ (circa 2000s). We then had a "vim-off". eg. Find/replace/regex across a range of things -- using only the keyboard. The best I conceded was how the highlighting of results was probably superior... (sublime text, and vs code are as good as that now)

I know a lot of people here love vi (and Emacs), but personally, the only command I'm happy to learn is :q (and I presume negative karma for this comment will result) :D

I always install le for my terminal connections, and fall back to nano where needed. I've been meaning to write a console editor of my own that matches ye-o olde vc++ and visual studio...

I think there's something in the vi evangelism that I haven't quite grasped... otherwise I'm sure I'd have been using it for decades.

edit: not sure about the yank/ clipboard history... but that's part of the os in gui world.

> two or more code frames/windows side by side, even displaying the same file Surprisingly modern IDE guis seems not designed for it, eclipse can do it but clumsily.

It's embarrassing how much better emacs/vim/tmux/others are at windowing compared to supposedly advanced IDE's built on advanced windowing systems.