News for hackers. Stuff that matters.
Re:Vim Anti-Patterns (2012) by blunte on Sunday March 17, 2019 @04:47PM (#19416489)
Any tool you need to use more than a few times is worth learning properly. And any superior tool is worth switching to and learning if you would use it frequently.

I suppose it depends on how one's mind works. If the mind moves slowly and holds onto ideas and abstractions easily, then the slower motor movements of moving the hand back and forth from arrow keys to home keys, and to mouse and back, are not really a problem. But if you're like me, and your mind is constantly racing, you need to be fast to get your ideas out before they're gone/replaced.

It's not just the time cost of moving the hand from home row down to find the correct cursor key, do the presses, and then move back to typing position - it's also the likely visual/mental cost of looking away from your screen to aid in positioning the hand, then looking back at the screen and finding what you were looking at before. All those movements and recalibrations take time and involve mental context switches.

If you're spending a lot of time using a certain set of tools, there is no reason to avoid learning those tools well. Refusing to do so is choosing to be ignorant and subperformant.

Now, if you'll only use the tool once in a while, perhaps it's not worth the effort. But chances are, there's some other tool you use often that you could master for your long term benefit.

If you program, Vim (behavior) is very difficult to beat for getting whats in your head out and into your computer VERY quickly. As a bonus, using a full featured IDE like one of the JetBrains products, but with the Vim plugin, is win win. You get the code editing speed of vim, plus the project navigation and other benefits of the IDE. Totally worth the time investment.

Re:Vim Anti-Patterns (2012) by aboutruby on Sunday March 17, 2019 @05:05PM (#19416598)
> ... But if you're like me, and your mind is constantly racing, you need to be fast to get your ideas out before they're gone/replaced.

I write extremely fast and use arrow keys (and all kinds of vim shortcuts).

> it's also the likely visual/mental cost of looking away from your screen to aid in positioning the hand

I never look at my keyboard when using vim.

Re:Vim Anti-Patterns (2012) by blunte on Sunday March 17, 2019 @05:35PM (#19416791)
There is absolutely no way you can move your right hand to the arrow keys faster than I can hjkl move in Vim.

I don't even have to move to reach the ESC key because I use ctrl-[ instead. Even if you have perfect memory and perfect motor control to enable hand repositioning, just the act of moving the hand from one location to another and back will cost time that "power" vim users don't waste.

Re:Vim Anti-Patterns (2012) by macinjosh on Sunday March 17, 2019 @05:55PM (#19416917)
So what? How does saving a few seconds or even minutes per hour while writing code really make an impact at the end of the day? I spend way more time reading code than I do writing. As a vim user who uses hjkl sometimes and the arrow keys other times I am still well employed, my boss has never complained I waste a fraction of a second reaching for a key. If you work an environment where every second matters to that degree I feel sorry for you son. We're programmers, not elite athletes. A tenth of second doesn't matter here IMHO.
Re:Vim Anti-Patterns (2012) by chongli on Sunday March 17, 2019 @06:38PM (#19417210)
Using vim is not at all about the number of milliseconds saved, it's about lack of interruptions. An expert vim user can get into a flow state and be moving and jumping around the file, adding and deleting text, without stopping to think about how to do a command in their editor or worse, having to reach for the mouse and figure out where the cursor was left last time.

For some people, having your flow state disrupted can cause a very long delay as you have to figure out what you were doing all over again.

Re:Vim Anti-Patterns (2012) by BoorishBears on Sunday March 17, 2019 @07:18PM (#19417411)
I should count my lucky stars that my flow state is not interrupted by having to move a mouse an average of once a minute.

I'm all for people using the tools they want, and I can see the appeal of a highly customized environment you know well, but I struggle with this logic I always hear treating the mouse like some sort of world ending interruption to text input.

At that point does a sneeze interrupt your flow state?

Re:Vim Anti-Patterns (2012) by timrichard on Monday March 18, 2019 @09:00AM (#19420649)
Looking at it from another angle, I've got a suspicion that continually moving your hand from a typing position to use the mouse with a different (more of a claw) hand shape probably contributed to the rise in RSI.

When I started my career, it was the tail end of the era of the Typing Pool in large companies... when a room full of clerical people would be hammering away on electric typewriters for a full working day, but not dropping like flies with cases of RSI. So perhaps staying near the home row perhaps has other advantages.

I try and use Vim keymaps whenever possible with the dev tools available to me, and to keep hands on the keyboard whenever possible. I certainly notice less fatigue than the old days when I used to type, mouse, type, mouse.

Re:Vim Anti-Patterns (2012) by nickjj on Monday March 18, 2019 @11:43AM (#19422019)
> Looking at it from another angle, I've got a suspicion that continually moving your hand from a typing position to use the mouse with a different (more of a claw) hand shape probably contributed to the rise in RSI.

On the other hand, I always thought the opposite.

My hands fly around everywhere. My right hand goes from the main keys area to the home/end/arrow keys and the mouse pretty frequently. I keep my forearms perfectly parallel to the ground with close to 0 resistance, then I mostly use my shoulder and elbow to move my forearms, which leads to my hands being in a different spot.

I also never strain to reach any combo because I just move my hands instead of trying to break my wrist to press something like tilde + g with my ring / pinky and pointer fingers.

Been doing this for 20+ years and I have no arm, wrist, hand or finger pain and this is with years of gaming abuse where I was clicking and doing repeated key presses for 12+ hours for entire summers back in the day.

But if you ask me to type with my hands on the home row, I feel a very unnatural strain on the top of my hand when I move my fingers. After a minute it's painful. I dunno how anyone can do that without injuring themselves.

Re:Vim Anti-Patterns (2012) by BoorishBears on Monday March 18, 2019 @09:29AM (#19420817)
I suspect that’s better addressed by looking at the ergonomics of your setup.

Typing can also cause RSI, and in fact if you look at the risk factors for RSI, way more boxes are ticked by keeping a mostly static position on a keyboard than with occasional movements of a mouse (especially the parts about leaving pressure on part of the body)

I’d also imagine typewriters are very different from normal keyboards in usage, and typists were very focused on ergonomics

There’s also the fact that RSI probably wasn’t as commonly diagnosed as it is today.

Re:Vim Anti-Patterns (2012) by blunte on Sunday March 17, 2019 @08:18PM (#19417715)
"At that point does a sneeze interrupt your flow state?"

Given that it is an involuntary spasm, then yes, it does.

Re:Vim Anti-Patterns (2012) by BoorishBears on Sunday March 17, 2019 @09:29PM (#19418022)
I mean I can usually tell if I'm about to sneeze, it doesn't just sneak up on me like a seizure... I even cover my nose in anticipation subconsciously, I don't think a normal sneeze has ever interrupted my conscious thought...

But alright, just sounds dreadful I guess, to be unable to stay in flow due to the most minute actions or occurrences.

Re:Vim Anti-Patterns (2012) by jonS90 on Sunday March 17, 2019 @08:22PM (#19417734)
When making code changes feels quick and effortless, I think you become more willing to try out different things and experiment, which ultimately enables you to learn your languages and frameworks faster and make better choices. When code changes feel arduous and time-consuming, you're less inclined to experiment and more inclined to tolerate unknowns and best-guesses. I think vim helps push things towards the former scenario.
Re:Vim Anti-Patterns (2012) by aboutruby on Sunday March 17, 2019 @06:11PM (#19417034)
Ok, I edited a file in a meaningful way and tried to decipher the process (actually it become more of a normal workflow more than editing a file).

The thing is I switch all the time between vim and my terminal (it's complicated by let's say I mainly use one terminal tab for everything I'm currently writing) so using the home row I would have to switch all the time between home row and arrows when using the terminal (and other programs) (I guess I could add vim bindings to every single thing I use: web browser, terminal emulator, pry, irb, tmux, etc etc. but doesn't seem appealing to me).

The escape key isn't an issue either because I don't use the home row, so no need to remap that too.

I think this misconception comes from the manual pushing people to use the home row.

I don't claim I'm the fastest writer ever, but there are a lot of compromises I'm not willing to make (I could use vim tabs/windows, I could use Ctrl-D to switch files, I could use GVim, have the main files always open, etc.). I'm pretty sure everyone works differently and this workflow works very well for me.

What I don't like is this constant shaming of arrow vim users and people that keep saying it's only for beginners (and the manual pushing people to use the home row).

Re:Vim Anti-Patterns (2012) by jonS90 on Sunday March 17, 2019 @07:47PM (#19417569)
It might be worth learning the readline keybindings. They are supported rather ubiquitously in all terminal shells (including REPLs and SQL prompts and such). If you use MacOS they are supported across the entire OS.

You can also adopt these keybindings inside vim with the tpope/vim-rsi plugin. This approach has been quite effective in my experience.

http://readline.kablamo.org/emacs.html

Re:Vim Anti-Patterns (2012) by u801e on Sunday March 17, 2019 @06:57PM (#19417312)
> The thing is I switch all the time between vim and my terminal (it's complicated by let's say I mainly use one terminal tab for everything I'm currently writing) so using the home row I would have to switch all the time between home row and arrows when using the terminal

Starting with version 8.0, vim has a :terminal command which will open a new split window with a terminal. You can switch between the terminal and other vim windows using ctrl-w j, ctrl-w k, etc. You can enter normal mode in the terminal using the ctrl-w N key combination. In normal mode, you can scroll back and copy text into a vim register of your choice (default is "). Then you can either paste it in another window like you normally would, or you can paste it in your terminal by pressing i to return to terminal insert mode and pressing ctrl-w " " (where the second " is the name of the register that contains the yanked text you want to paste).

Re:Vim Anti-Patterns (2012) by fwip on Monday March 18, 2019 @12:57AM (#19418774)
Are you a touch typer?
Re:Vim Anti-Patterns (2012) by joesb on Monday March 18, 2019 @05:48AM (#19419761)
It's just micro-optimization that doesn't matter.

Thinking that you require perfect memory to use arrow keys while programming is just hyperbole.

Re:Vim Anti-Patterns (2012) by muststopmyths on Sunday March 17, 2019 @04:56PM (#19416529)
> As a bonus, using a full featured IDE like one of the JetBrains products, but with the Vim plugin, is win win.

I refused to use Visual Studio for code editing until ViEmu came along. These days I use VsVim. vi is fantastic for editing/writing and using the other niceties of Visual Studio is a win-win, as you said.

Re:Vim Anti-Patterns (2012) by transpostmeta on Sunday March 17, 2019 @06:00PM (#19416949)
This cannot be overstated. 90% of the advantages of VIM is the modal editing interface, which can be used beautifully in Visual Studio, Visual Studio Code, IntelliJ IDEA, and other nice IDEs.

The VIM way is a very good way of editing text. IDEs offer a lot more than editing text. Faking an IDE within a text editor with random plugins is terrible. Emulating VIM text editing within a real IDE is amazing. Just use VIM keybindings in your industry standard IDE, you will be able to use all the tips in the linked article and still not miss out on anything offered by the IDE.

The only problem is that the VIM keybindings are integrated into direct text editing, but not the IDE UI. For example, in Visual Studio, IntelliSense offers you a choice of possible completions for a variable name you are typing. You can only navigate these choices with your cursor keys, rather than with the VIM-style jkl; keys. But it's a small price to pay for really good text-editing qualities!

Re:Vim Anti-Patterns (2012) by learc83 on Monday March 18, 2019 @12:14AM (#19418651)
> You can only navigate these choices with your cursor keys, rather than with the VIM-style jkl; keys. But it's a small price to pay for really good text-editing qualities!

I have ctrl-j and ctrl-k mapped to down and up on my keyboard for just this reason. If you have a keyboard that supports macros it's easy to do and it works for all those annoying places in Visual Studio and the rest of the OS you need to use arrow keys for.

Re:Vim Anti-Patterns (2012) by sjy on Monday March 18, 2019 @05:38PM (#19425592)
There is a loss though, which is that Visual Studio is incredibly slow, and editor latency has "important effects on typist behavior and satisfaction" [1]. You wouldn't want to use Visual Studio to edit a single config file, unless you already had it open for a big programming project. Adding a Vim binding plugin makes things worse and often introduces a startup delay before the editor enters normal mode, meaning your first command gets typed into the file unless you pay attention and wait for the UI to get ready. Vim opens even ridiculously large files that have no place in a text editor instantly, every time.

[1]: https://pavelfatin.com/typing-with-pleasure

Re:Vim Anti-Patterns (2012) by higuys on Wednesday March 27, 2019 @03:40AM (#19498768)
I use vim every day. I only know i, /, :q!, And :wq. If I am actually creating something I'll use Atom, change it to LF, and paste it into Putty when I'm done.