Live data from Hacker News

Bill Joy's greatest gift to man – the vi editor (2003)

theregister.co.uk

111–120 of 186 posts

Re: Bill Joy's greatest gift to man – the vi editor (2003)

#111

Earlier quoted context omitted.

I used vi and vim for about 25 years before switching to Emacs. I did this because: 1 - I got deeply interested in Lisp and Scheme, and Emacs was reputed to have the best editing environment for these languages 2 - Almost all of Emacs itself and Emacs' entire package ecosystem is written in eLisp, which is a tremendous improvement over vimscript, in which almost all vim packages are written. I'd just rather read and…

> I used vi and vim for about 25 years before switching to Emacs. Then maybe you can help:) I've tried, multiple times, to switch to emacs. And every time, I get stuck, because vim keybindings are so wired in to my muscle memory now, and even the broader interactions are hard to adopt (i.e., I expect to get a command prompt by escaping to command mode and then typing ":", and then all commands are available). Is ther…

Try something like spacemacs[1] maybe and use it only for one specific task like org-mode[2]. That way, vim is still your daily driver, but you get to play with lisp/emacs on something very cool like org-mode!

Then, you can slowly try to switch one thing at a time, for example start editing all Dockerfiles in spacemacs, or maybe do that one hello-world project/app in clojure/phoenix using spacemacs. See how you like it, tweak it a bit.

Finally, decide on using it as a daily driver for a new project and stick with it. It will grow on you.

[1] https://www.spacemacs.org/ [2] https://orgmode.org/

Re: Bill Joy's greatest gift to man – the vi editor (2003)

#112

Earlier quoted context omitted.

I used vi and vim for about 25 years before switching to Emacs. I did this because: 1 - I got deeply interested in Lisp and Scheme, and Emacs was reputed to have the best editing environment for these languages 2 - Almost all of Emacs itself and Emacs' entire package ecosystem is written in eLisp, which is a tremendous improvement over vimscript, in which almost all vim packages are written. I'd just rather read and…

Also: Emacs has shell windows, process management, and output filtering, and keyboard macros, so it can run and control and respond to sub-processes (kind of like "expect" on steroids). I could not give up running shells in an emacs shell window, capturing all the output as normal text I can edit and search with the full power of emacs, instead of a dumb scrolling terminal emulator, and the ability to make keyboard m…

So what do you do when some shell command you run chooses to spit out a bunch of really long lines?

Emacs would freeze on me when this happens.

Is there a way around this apart from running a shell under libvterm? Or is this even still an issue under libvterm too?

Re: Bill Joy's greatest gift to man – the vi editor (2003)

#113
post #98

For those who do not understand why people are fanatical about vi, here are some reasons: Vi is keyboard only. This means that actions with the mouse are optimized through the keyboard. There are "hotkeys" for most tasks you use with a mouse. Vi has the idea of objects. Words, lines and paragraphs are objects you can operate on. Vi defines a "language" for operating on objects. For instance, 'd' is delete. You can de…

"This is especially important if you have to edit a file on a remote server" This may have been true a decade ago, but editors like Visual studio code now have remote editing abilities over SSH. I regularly have 50+ files open at a time for editing/compiling and I've never found editors like VI very helpful. If I need to make a quick edit to a config file, it does the job.

Now imagine that SSH going from a Citrix windows desktop running on a Windows 10 VM on your linux laptop. Every key press reacts in around a second. Welcome to banking "security"!

Now let's say I want to `d5}`, to delete the next 5 paraghraph. In vi(m) I can do this by telling it "hey vim, delete those 5 damn paragraph!"

In fancy VScode I have to say more like... "Hey editor, wait a sec, I'm moving my cursor over there and select a couple lines which happens to be 5 paragrahs, OOOPS, I went a bit too far, now let's go back. YES, now delete them!".

Other examples:

- "increment this number by 5" - "delete this html tag recursively" - "indent the next 20 lines" - "remove all the arguments from this function call" - etc.

Vim has a language, _that_ is the powerful part.

To be fair, thankfully VSCode (and any of the other fancy IDEs) have basic vim-functionality providing plugins.

Re: Bill Joy's greatest gift to man – the vi editor (2003)

#114
post #98

For those who do not understand why people are fanatical about vi, here are some reasons: Vi is keyboard only. This means that actions with the mouse are optimized through the keyboard. There are "hotkeys" for most tasks you use with a mouse. Vi has the idea of objects. Words, lines and paragraphs are objects you can operate on. Vi defines a "language" for operating on objects. For instance, 'd' is delete. You can de…

"This is especially important if you have to edit a file on a remote server" This may have been true a decade ago, but editors like Visual studio code now have remote editing abilities over SSH. I regularly have 50+ files open at a time for editing/compiling and I've never found editors like VI very helpful. If I need to make a quick edit to a config file, it does the job.

> This may have been true a decade ago, but editors like Visual studio code now have remote editing abilities over SSH.

VS Code and vi have different use cases. Contrary to what you said, most people are not going to open VS Code to make a quick edit to a config file. If that works for you, fine, but the overhead of starting electron is significant.

Re: Bill Joy's greatest gift to man – the vi editor (2003)

#115
post #49

Earlier quoted context omitted.

Do you remember the time when every time you wanted to copy or paste something in a word processor you would dutifully hike your mouse up to the Edit button so you could select "Copy" or "Paste", and how when you learned that CTRL+C and CTRL+V was a thing your mind was blown with how much quicker it was? Vim gives you that experience, except times a gajillion because it not only speeds up what you already do in a WYS…

> powerful new tools to edit that have no WYSIWYG equivalent Can you give an example? I have heard this but I have difficulty understanding exactly what I could do in Vim that I couldn't do in Sublime Text for example

It's not that you "can't" do certain things in Sublime. But Sublime and other "normal" editors have only a few primitives in terms of editing and moving, whereas vim has a language that lets you compose more complex commands from a set of primitives.

The general form of a vim command is:

(repeat)(verb)(motion/object)

That is, I want to perform 'verb' 'repeat' times on a 'motion' or 'object'. Examples:

  fX == 'f'ind the next occurrence of character 'X'
  3fX == repeat 'fX' 3 times
  w == go to the next word on the line
  3w == repeat 'w' 3 times, i.e. go 3 words right
  dw == delete word
  3dw == delete 3 words
  dfs == delete to the next occurrence of 's'
  yw == "yank" (copy to the buffer) the next word
  y3w == yank the next 3 words to the buffer
  H, M, L == move the cursor to the top, middle, or bottom of the screen
  zz == center the current line of text in the editor window.
  8j == move the cursor 8 lines down
  ma == create a bookmark 'a'
  `a == go to bookmark 'a'
  "ay == yank to buffer 'a'
  "ap == paste buffer 'a'
  . == repeat the last editing command (insert, delete, yank...)
I like vim because its commands are both efficient and precise. I don't need to look and make sure the cursor is at the right position or that I've selected what I want to cut/copy correctly. I know it's correct because I typed it in. And I don't need to move my hand to the mouse or arrow keys. And bookmarks and buffers are great.

Re: Bill Joy's greatest gift to man – the vi editor (2003)

#116
post #95
post #47

Earlier quoted context omitted.

It honestly isn't nearly as difficult as learning Dvorak; you can be productive with Vim if you use it full-time for about a week. If you stay dedicated to learning and improving, you can get really good and become pretty productive. While I love Vim and I use it most of the time, I don't really buy it when people act like it saved them a whole lot of time. I love the Vim keystrokes and philosophy, but I don't really…

I've always considered that it's more about comfort than productivity. And perhaps that comfort leads to a small increase in productivity, but more because you enjoy it than because it's so much faster to use (as we always say, we spend more time thinking that writing). And because so many tools use vi-style keybindings, if you spend any significant amount of time in a terminal, then you're going to experience that c…

Yep yep, completely agree.

I wish most of my time was spent writing code, but a vast majority is spent reading it and swearing at my monitor because things don't work, so I don't think even a perfect editor would make me a lot more productive, at least not directly, except (as you stated) maybe through me liking the editor a bit more.

I personally spend as much time as I can in the terminal, and so my "IDE" is actually is typically NeoVim, tmux, some kind of language-server, and a command line. Am I more productive than my peers using IntelliJ because of this setup? Almost certainly not, but I find it very intuitive for me to do stuff with, since I'm super familiar with the tmux keystrokes, and I find Vim's design really intuitive for me.

Re: Bill Joy's greatest gift to man – the vi editor (2003)

#117
post #21

Earlier quoted context omitted.

I use command mode a lot, so have swapped ":" and ";". With that, :x + enter is 3 keystrokes, and hitting x is a bit easier than hitting z.

I aliased it so either : or ; work for : I admit I typed :wq for more than a decade before learning about :x

OMG. 30 years of using vi and this falls from the heavens. Thank you!

I am a proficient vi user but it’s totally weird watching the keyboard of another vi user. Totally different (and probably better) keystrokes.

Re: Bill Joy's greatest gift to man – the vi editor (2003)

#118

For those who do not understand why people are fanatical about vi, here are some reasons: Vi is keyboard only. This means that actions with the mouse are optimized through the keyboard. There are "hotkeys" for most tasks you use with a mouse. Vi has the idea of objects. Words, lines and paragraphs are objects you can operate on. Vi defines a "language" for operating on objects. For instance, 'd' is delete. You can de…

Unfortunately, the barrier I faced with even trying VI is that you cannot discover any functionality intuitively. Exaggerating (but just a little) I could not even figure out how to type without someone giving me a tutorial. That was enough to make me stop.

When given a tradeoff between intuitivity and other benefits, vi almost always breaks against intuitivity. It's this design philosophy taken to its logical extreme.

Re: Bill Joy's greatest gift to man – the vi editor (2003)

#119
post #4

He also created Berkeley sockets, which pretty much powers networking today.

I personally think that the Berkeley socket api is really really ugly. Plan9's networking api is very nice, though: https://9fans.github.io/plan9port/man/man3/dial.html

Re: Bill Joy's greatest gift to man – the vi editor (2003)

#120
post #27

Earlier quoted context omitted.

What's the story with NeoVim exactly? I am trying it out on Linux because I got some recommendations that it's better than Vim, but I've run into some problems because for instance with setting up plugins and things, lots of times the documentation seems to be geared toward Vim, and sometimes I've gotten errors it's hard to figure out because of this. It kind of gives me the perception there just aren't that many peo…

The built-in LanguageServer client and tree-sitter syntax highlighting features in upcoming releases are going to be interesting.

Thank you. I am sitting my baby on my arm was to lazy to type that. When both of this features stabilize I think they will sufficiently set NVim appart from Vim and make it its own personality.

Besides Lua as an alternative scripting language there currently is no compeling reason to switch over.

Post reply on HN