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

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




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: