Live data from Hacker News

To Master Vim, Use It Like Language

danielmiessler.com

51–60 of 124 posts

Re: To Master Vim, Use It Like Language

#52
post #5

Earlier quoted context omitted.

Haven't used ESC since finding out Ctrl-C.

ouch...as others have said, CAPS LOCK is your friend

Why is caps lock your friend? I can't think of any situation where it'd be more useful than another key such as ESC or my personal preference, CTRL.

Re: To Master Vim, Use It Like Language

#53
post #21
post #4

Vim is a regular expression system hooked to a 1970s user interface. If you need to apply regular expressions to text files, vim is useful. I used vi to write code for years, but that was decades ago. There's been some progress since the 1970s.

"a regular expression system hooked to a 1970's user interface" + a whole lot of awesome plugins! Incidentally, there is nothing inherently wrong with 1970's user interfaces. My car still has a steering wheel just like cars did in the 1970's. And there is a reason for that. Because it works really well.

I almost feel like everything else is dated, like the only true improvement would be a brain-machine interface.

Re: To Master Vim, Use It Like Language

#54
post #3

> inoremap jk Using two keystrokes instead of ESC to leave insert mode is definitely a personal preference and not necessarily more efficient or comfortable.

Way more useful (for me anyway) is mapping Capslock to ESC. It works with any vi anywhere as long as you are using your main machine to connect. Also with inoremap don't you have to wait for the letter j to show up until you type your next character? That would drive me crazy. Edit now that I have actually looked at the article: Yes, you can map it to Control but for me it's an awkward place to put a modifier. What i…

I have a similar remapping of Caps:

  * When I tap Caps, it's ``
  * When I hold Caps OR hit it in combination with any other key, it's ``
It really feels like the best of both worlds. I primarily develop on OSX, so I use https://pqrs.org/osx/karabiner/ to handle the remapping.

Re: To Master Vim, Use It Like Language

#55

I consider myself at least an intermediate user of Vim, and I'm glad that you mentioned the "f" motion (along with its cousins "t" and ";"). I don't think these keys get enough exposure among beginner Vim users (they aren't mentioned in vimtutor), but they allow you to quickly and efficiently move across files and do things like "ct(" (change text up to first left parentheses), which is super useful for changing func…

The commands you mentioned along with "ci'", "ci[", and "ciW" to replace all text between delimiters have been some of my favorite to use. It really annoys me when my terminal's vi-mode doesn't support "ci" (I think it's vim-only).

The "ci" and "ca" commands are part of a Vim-only feature called Text Objects (type :help objects in Vim's command mode, or search the web).

I like using yap and dap to copy/move paragraphs around when I'm editing markdown text.

Re: To Master Vim, Use It Like Language

#56
post #43

Earlier quoted context omitted.

Aiming to combat "you don't know what you don't know", here's a list of things to consider. How comfortable are you with: * find/replace/regexes * registers and macros * vim settings (spell, list, highlight, number, wrap) * the plugin ecosystem * editing multiple files simultaneously (splits, buffers, moving between them) * folds Anyone else want to chime in with stuff I've either forgotten or don't know I don't know…

I asked on /r/vim about "Who uses folds?" Didn't get any takers. I always forget they exist and haven't used them in my workflow yet. Tag files would be another good one.

I use folds for one specific thing: I have a general "notes" file for home and for work, which is a big outline where I put anything I'm thinking about or working on. I usually don't delete stuff, so the file grows over time. I make a fold for each top-level item (~project or subproject) and sometimes nested folds if things get too big. I always use fdm=marker. The automatic fold methods are too confusing.

Everyone uses tag files, in some sense, when they use :help :)

Re: To Master Vim, Use It Like Language

#57

Earlier quoted context omitted.

Way more useful (for me anyway) is mapping Capslock to ESC. It works with any vi anywhere as long as you are using your main machine to connect. Also with inoremap don't you have to wait for the letter j to show up until you type your next character? That would drive me crazy. Edit now that I have actually looked at the article: Yes, you can map it to Control but for me it's an awkward place to put a modifier. What i…

I have a similar remapping of Caps: * When I tap Caps, it's ` ` * When I hold Caps OR hit it in combination with any other key, it's ` ` It really feels like the best of both worlds. I primarily develop on OSX, so I use https://pqrs.org/osx/karabiner/ to handle the remapping.

Oh man I had no idea Karabiner could do that. Thanks!

Re: To Master Vim, Use It Like Language

#58
post #3

> inoremap jk Using two keystrokes instead of ESC to leave insert mode is definitely a personal preference and not necessarily more efficient or comfortable.

One of the best things I've done, though I personally use 'jf', since they've both got little nubs on the keys, and I occasionally have to spell "Dijkstra".

Re: To Master Vim, Use It Like Language

#59
post #48

Earlier quoted context omitted.

Aiming to combat "you don't know what you don't know", here's a list of things to consider. How comfortable are you with: * find/replace/regexes * registers and macros * vim settings (spell, list, highlight, number, wrap) * the plugin ecosystem * editing multiple files simultaneously (splits, buffers, moving between them) * folds Anyone else want to chime in with stuff I've either forgotten or don't know I don't know…

Marks (non-global, global), the quickfix list, tabs, vimscript, python bindings, there's a lot. Vimcasts ( http://vimcasts.org/ ) has some good tutorials. Vimgolf ( http://vimgolf.com/ ) also has some good exercises.

Oh neat! I didn't know about global marks before.

Re: To Master Vim, Use It Like Language

#60

My issue with getting better at vim is that I've gotten to the point where I'm comfortable moving around text, copying/pasting, and everything I would normally do with a mouse. I know vim is so much more than that, but it's one of those things where "you don't know what you don't know" and because of that, I don't have the incentive to continue learning. Hopefully this post will inspire me to incrementally advance my…

Aiming to combat "you don't know what you don't know", here's a list of things to consider. How comfortable are you with: * find/replace/regexes * registers and macros * vim settings (spell, list, highlight, number, wrap) * the plugin ecosystem * editing multiple files simultaneously (splits, buffers, moving between them) * folds Anyone else want to chime in with stuff I've either forgotten or don't know I don't know…

Opening a new buffer. Figured I'd try :new, and wound up getting good at splits. Still don't know how to just open up a new, blank buffer in the window I'm in without specifying a filename to :e.
Post reply on HN