Live data from Hacker News

Learn Vim (2021)

github.com

111–120 of 215 posts

Re: Learn Vim (2021)

#111
post #95

It's kind of weird to read about "learning" VIM, at least from someone who's been using it (er VI) for 40 years. It's nuts, but if asked, I don't even know how to do certain things in VI; I just do them. Ask me what keys to press to go up, or down, or right or left? I dunno - I just do it. Yea it's nuts. It's like baby duckling bonding - the first editor mindset (aka EMACS vs VI) you use, you just bond to and it just…

Slight tangent, but what's with the capitalization of VI and VIM? You surely know those are not acronyms, yet I've seen VIM miscapitalized many times, even by experienced users, and it's always slightly irritating. EMACS, while historically accurate, also isn't common anymore.

[dead]

Re: Learn Vim (2021)

#112

I'm using vim for 10 years and I know I have a lot of "bad" habits that I'm trying to eliminate, but it's hard. For example: 1. instead of doing 4j I might do jjjj 2. if I'm in the middle of a word and want to change it, I'll do bcw instead if ciw 3. if I want to copy 3 lines, I'll do Shift-V+jjj+ESC, instead of just 3yy 4. (possibly other 100 items here...) But I find it very hard to change those habits. Anyone else…

I'm definitely not a vim master but I've made an active choice to avoid 4j style movement. The main benefit of vim, for me, is the mind-body connection. Commands are either muscle memory or like saying a short phrase in my head so it flows out naturally. Counting lines before executing breaks that natural flow

Re: Learn Vim (2021)

#113

I dunno, I never sat down to learn vim, just used it every day for a couple years. I’m not one of those wizards who is, like, answering stack overflow questions or writing wiki articles, but I get the job done. Is it necessary to learn Vim? Seems like a chore. Is the text editor really a bottleneck for anyone? I find that no matter how slow I type, I need to spend more time thinking of what to type anyway, if I’m doi…

Yeah I think vim style modal editing is really useful, but honestly I get about 70% of the value from doing it "wrong"; using a fast key repeat and holding down hjkl, using visual mode a lot, etc. It really doesn't need to be this mystical uber-hacker thing to be useful.

I do the same and agree, though I’m trying to push myself to be a little more sophisticated. The beauty of doing it that way is that it takes no thought.

I want to select from here to just after that letter P. With hjkl and visual mode I’m already halfway there. Whenever I try something clever I always find myself thinking “is that the end of a block? Or maybe I should cut directly to P but oh there’s another one on the line above so it’s the second, need to amend” etc etc etc.

Re: Learn Vim (2021)

#114
post #108

I'm using vim for 10 years and I know I have a lot of "bad" habits that I'm trying to eliminate, but it's hard. For example: 1. instead of doing 4j I might do jjjj 2. if I'm in the middle of a word and want to change it, I'll do bcw instead if ciw 3. if I want to copy 3 lines, I'll do Shift-V+jjj+ESC, instead of just 3yy 4. (possibly other 100 items here...) But I find it very hard to change those habits. Anyone else…

I often use jjj and don't plan to change that. Forty years ago, when working on slow terminals, it may have made sense to optimize movement but not today. For small movements, I tend to spam keys. For larger jumps, I use an easy-motion like plugin such as Svart. Counting lines and words simply makes no sense to me for frequent operations.

Start using macros for bulk editing.

You'll slow down, reason about your next best move, which slowly helps mastering those optimizations. Not only because they are shorter, but because sometimes they work, as opposed to visual selection etc.

An example: you might find doing jjjj easier when it's a one shot task, but for macros you mainly need "down to the end of the paragraph" (}) and so on.

Re: Learn Vim (2021)

#115
post #78

Earlier quoted context omitted.

I don't understand this attitude. It's clearly more conducive to solving problems to be able to move around our environment more quickly. It's extremely useful (compared to a beginner who only knows insert and write quit) to understand the different vim modalities as well as a few commands to jump around a file or to perform regex or to call an external command. When you're not proficient with the necessary tools, yo…

I feel like at a certain point of efficiency there are diminishing returns. A good analogy is typing speed. You don't need to have 200 wpm to be productive. Everybody adapts to how efficient they need to be at what they do. Vim is not a requirement for being productive. If it was, it would be the most popular editor. I also don't think the person you are replying to is saying that it isn't important to "master" your…

You don't need to hit 200 wpm but I haven't seen too many programmers who hunt-and-pecks at the keyboard and can't touch type. Even on a Qwerty keyboard you should be able to get high double digits, if not hit/exceed 100 wpm. The two sites I like for practice are:

https://monkeytype.com/

https://play.typeracer.com/

Re: Learn Vim (2021)

#116

I dunno, I never sat down to learn vim, just used it every day for a couple years. I’m not one of those wizards who is, like, answering stack overflow questions or writing wiki articles, but I get the job done. Is it necessary to learn Vim? Seems like a chore. Is the text editor really a bottleneck for anyone? I find that no matter how slow I type, I need to spend more time thinking of what to type anyway, if I’m doi…

It’s not a bottleneck for anyone. Some people just like playing with tools. They do it for loads of reasons, but end of the day it’s basically a hobby tangentially related to software development. I torment a friend of mine who talks all the time about VIM and their most recent config/workflow. But end of day, he’s happy and having fun while being productive.

I feel that your last point is underappreciated. I enjoy my work more if I enjoy using my tools, and I enjoy using vim.

Re: Learn Vim (2021)

#117
post #27

Earlier quoted context omitted.

> Can you make a case for me to learn Vim? If you're coming from nano, I'd point to: 1) UI improvements like better syntax highlighting, split windows and tabs, and mouse support. 2) A cohesive language of key bindings that allows you to easily construct and perform commands like "delete everything from the cursor up to the next quotation mark" or "lower-case this paragraph". 3) A huge library of scripts and extensio…

Usually when nano is mentioned, it’s not a full development context, but instead e.g. crafting a systemd service file or editing crontab on a remote server. Do you really pull extensions and use mouse there? I think there’s nothing important that vim could add for gp, realistically. Speaking as a life-long vim user.

Even without any plugins Vim has useful stuff you might need in a pinch.

Eg:

  Column editing using visual mode.
  Syntax highlighting
  Tree-based undo features.
  Fuzzy file finding in a project path.
  Spell checking
  Support for c tags
  Line numbers
  Mouse support
  File navigation
On top of that you might want to learn vi for systems built with busybox.

Or tools that use readline like repls and sql clients.

Re: Learn Vim (2021)

#118
post #23

I've re-built my neovim config like 3 times this year as I have played with several 'distributions' and styles. SpaceVim, LunarVim, AstroVim, and NVChad to name a few. This last weekend I gave LazyVim a try and it is by far the most sane config setup I have used and I will now be sticking with it. There is a starter repo where you clone it, delete the .git directory and start customizing. https://github.com/LazyVim/L…

https://github.com/helix-editor/helix is the answer mate

Helix doesn't have tabs or folding, I find it really hard to use an editor without those features. The preconfigured LSP stuff is nice, but after you set it up in vim you usually don't have to mess with it unless you want too.

Re: Learn Vim (2021)

#120

I dunno, I never sat down to learn vim, just used it every day for a couple years. I’m not one of those wizards who is, like, answering stack overflow questions or writing wiki articles, but I get the job done. Is it necessary to learn Vim? Seems like a chore. Is the text editor really a bottleneck for anyone? I find that no matter how slow I type, I need to spend more time thinking of what to type anyway, if I’m doi…

You are right and wrong. I paired with a lot of juniors, and especially in the beginning stage of your career it is important to write as fast as your thoughts are. And in the same way, to be able to jump directly to the place where you want to change something. I belong to the Emacs tribe, and macros were really so impressive while doing my Masters for a lot of people, mass-changing classes definition through "programming" without really thinking. Still, mastery in macros impressed people and saved projects through really fast iterations, it's faster than Excel or Python. It's that a lot of times, you have a thought and want to execute on it, seeing the result immediately. What I don't like about Emacs and Vim is the lack of great debugger support. I would love a world where unit testing, functional data structures and static typing obliterate debugging, but we're not there yet. What I encountered is, that actually real mastery of tools made or broke projects. The 80/20 rule is not what I observed in reality. It is really long tails all the way.
Post reply on HN