Hacker News new | past | comments | ask | show | jobs | submit login

> simply to be a keyboard interface to the rest of the system

Can you expand more on what you mean by that? It's never really clicked with me what the exact value prop of vim is.




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 WYSIWYG word processor but also gives you powerful new tools to edit that have no WYSIWYG equivalent.


> 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.


Does Sublime support macros? Macros are particularly useful when fixing up semi structured text (like converting a CSV into SQL)

Even then, macros kind of have to be keyboard based, as the keyboard presents a straight forward serialization format. Similar to how macros in non-Lisp languages struggle to achieve an elegance you can't quite capture unless your language is literally a textual AST

But there's also the random things because there's so much. Like ~ to swap case, or Ctrl-A/O for increment/decrement. I find myself in non-vim editors typing "dd" all too often


3

Shift+y

3

j

p

3

>>

time yourself doing the same thing in sublime.


Vim gives a consistent and quick interface to editing operations based on a set of standard keys with modifiers. But it doesn't try to be everything to everyone. "plugins" for vi, at least in the classic sense, tend to be minimal. The editor relies more on integration with the UNIX ecosystem. This makes vi unlimited in its possibilities, without having to rely on thousands of lines of lisp code, like emacs does.


> rely on thousands of lines of lisp code, like emacs does

Millions actually.

I'm an emacs user (who does not want to get into an editor war, mmkay). The plugins are so useful. I'm just learning magit and it very much takes most of the evil and hostility out of Git and I really like it. I also have dired (a sophisticated directory editor), and about to learn loads more such as Bookmark+ which allows links and jumps to anything you set, and allows you to save your desktop layout and files.

Emacs has so much, if only you can find it (align-regexp is very useful but there is so much more). Edit: look up M-x occurs if you haven't met it. Mega useful.

Consistency is going to be lost as you add functionality. If Vim doesn't have that problem it will in time.

Emacs isn't perfect, the package library melpa has dubious quality software, but emacs really is very good indeed.


That's correct, Emacs is a platform to write applications that can connect to a text editor. This is a different proposition than vi. Like other unix tools, vi goal is to concentrate on one thing (editing), and let the rest, like email reading, git operations, etc., to be handled by other UNIX tools.


I think you misunderstand. Though I've not set up email myself, I believe most email tools export their actual operations to an external tool (gnus may be an excpetion, not sure). I know for a fact that magit, the git interface, delegates directly to git. For source file tags and tag searching it delegates to an external tagger.

I don't think it does as much as you might think.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: