Live data from Hacker News

To Master Vim, Use It Like Language

danielmiessler.com

101–110 of 124 posts

Re: To Master Vim, Use It Like Language

#101
from config: "I remap it to Ctrl at an operating system level. This way my left pinky can simply slide to the left by one key to execute Ctrl-whatever."

Been a while since I used emacs, ctrl-everything is an emacs idiom [0] and a pinky killer. I guess the best bit is it's configurable. Really like this tute Daniel, found a nice add for my .vimrc already.

[0] http://mally.stanford.edu/~sr/computing/emacs.html

Re: To Master Vim, Use It Like Language

#102
While a tweaked configuration can be a great productivity boost, it has a major drawback. My main reason for using vim is its ubiquitousness. Whenever I need to ssh into a box to check something out, I can trust that it's there. However, I cannot trust that its configuration has been tweaked like I expect. Hence, I stay away from getting used to non-standard key mappings.

Re: To Master Vim, Use It Like Language

#103

While a tweaked configuration can be a great productivity boost, it has a major drawback. My main reason for using vim is its ubiquitousness. Whenever I need to ssh into a box to check something out, I can trust that it's there. However, I cannot trust that its configuration has been tweaked like I expect. Hence, I stay away from getting used to non-standard key mappings.

Checking something out on some server does not require remapped keys or commands: you generally just browse some file and fix a couple of things. Tweaked configuration for more involved tasks is fine, to me.

Re: To Master Vim, Use It Like Language

#104

This article is well written, but it has nothing to do with mastering Vim. It goes no further than running "vimtutor" at the command line. It has all the same tips and shortcuts as any other vanilla Vim tutorial. This is a common problem among Vim articles and tutorials. Authors title them as if it will give you Vim mastery, but instead it only offers the basics. Mastering Vim means going beyond vanilla movements and…

I heavily disagree.

For one thing, not all of the things you said must be mastered, vim is plenty big enough to support various ways of working. E.g. I never use the arglist.

For another, from a pedagogical perspective, there's different levels of "mastery", and there's nothing worse we can do to scare off people trying to learn a new editor than to tell them "oh, no, to be considered a real master you need to put in months of learning".

Re: To Master Vim, Use It Like Language

#105

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…

Here's the secret to getting good at vim, at least in the beginning (and at least for me).

Step 1: Start using it in your work.

Step 2: Find out something that bothers you. E.g., something you miss from another editor, or some kind of movement that you make a lot and would really love to automate.

Step 2': Very important for Step 2 - you have to really hate doing anything repetitive or annoying. With time you'll get a feel for what is easy to find a solution for.

Step 3: Figure out how to solve that specific problem.

Later on, you may do what other people say and look around for videos of other people using vim, look at plugins, etc. I only started doing that after I got much "better" at vim.

Just a quick example: I was editing a lot of css files, which always have lines like:

.some-rule { sometext: 234px; }

And every time, I'd want to change the number (e.g. change 234px to 200px).

If I used the "standard" vim toolset, I could just jump to the number 2, then do "change word", but then I'd have to retype the "px" every single time, and this annoyed me. Now, there are plenty of ways of dealing with this problem, but I knew about something called text objects, and decided to investigate the idea further, and soon found a plugin that makes numbers a text object.

The end result is that I now have mappings to "jump to the first number in the line" and to "change a number", so my flow is much simpler.

This is a small annoyance thing, but let me investigate the whole topic of text objects, creating custom mappings, etc. And, it solved an actual problem I had.

Re: To Master Vim, Use It Like Language

#106

Earlier quoted context omitted.

He does have a point. Using vi derivatives does seem a tad spartan today, and I've personally never been a fan of vi, nor of emacs, but much of the community has this pseudo-elitist dichotomy set up around those two editor families. I'm not really a fan of what passes as IDEs, either, but I generally am not attached to any particular editor and hop around them. (The right answer to vi vs. emacs is, of course, Acme.)

There's nothing spartan about it. Vim has tons of plugins. Using it as a Javascript editor, I've got syntax highlighting, git integration, linting, code completion, and more.

What is the JS plugin scene for vim like right now?

Re: To Master Vim, Use It Like Language

#107
I agree that knowing basics of Vim is of great help and adds value to a programmer's skill set.

I don't agree that it should be the only thing one uses for all development/writing tasks.

Yes, vim is ubiquitous. However, no one uses vim without high levels of customization. So i think there is a bigger dependency issue here.

Also, I've seen millennials struggling to cope with vim - it's like handing a cassette to a person who's grown up with an iPod.

As long as the work gets done, an editor does not matter.

Re: To Master Vim, Use It Like Language

#108
post #35

Is there a way to navigate words taking camel case into consideration? helloWorld should be treated as two words when I want to delete or move, at least sometimes when I want to edit.

I am sure there is a 'normal' way to do it, but look into easy motion. I use space in normal mode as a shortcut to go to any word in the line and that includes camel case movement.

Re: To Master Vim, Use It Like Language

#109
post #47

Earlier quoted context omitted.

I barely use the regexps. There are 2 things that vi/vim are quite good at that are very relevant today. I don't know of any alternative that is as good. First, efficiency of bandwidth over an ssh connection. You might think, "Oh but there is tons of bandwidth on the internet today". However, I actually use vim to pair program with people in the UK while I'm in Japan. Vi commands can easily deal with variable latency…

I by no means agree with the guy you're replying to, but I don't think your vocalized example is fair. With vim, your state is in the "sentence" you've written. With a typical editor your selection is in the state of your editor, primarily its selections. It's more like "Do this here." vs. "Look here. Do this." One thing I used to do is visit http://www.vimgolf.com/ and compete with the best solutions there. Aside fr…

To be clear, I it's not trimming trailing whitespace I miss; it's fuzzy, graphical command search of human-readable phrases. I'll never remember a shortcut for shuffling selections, but I'm more than happy to type "shuffle" and use my eyes.

Re: To Master Vim, Use It Like Language

#110

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…

Ag support and ctrl-p https://github.com/rking/ag.vim https://github.com/kien/ctrlp.vim Save me so much time opening files and finding matches+open-at-match

+1 ctrl-p, my favorite vim plugin
Post reply on HN