News for hackers. Stuff that matters.
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.