Live data from Hacker News

Vim Anti-Patterns

sanctum.geek.nz

151–160 of 249 posts

Re: Vim Anti-Patterns

#151

Not trying to start a flame war here, but I in recent few years I am seeing Vim being more popular, and I feel it adoption in terms of younger developers (those who weren't programming when original Vi was around) grows. (Ok, please forget about GUI editors, they have their audience, and I am not comparing any of those facts to them) I used Vim for 3 years, and found philosophy and implementation of modal editing ama…

I’m primarily a Vim user, but I use Emacs for some stuff like Common Lisp programming, Org mode, etc. But what I sometimes miss from Vim is the filtering with external commands. For example if I want to pipe my file through awk, I can just do

    :%!awk ''
Does Emacs have something like this out of the box?

Re: Vim Anti-Patterns

#152
While I prefer vim for text-mode editing, it is so frustrating that it just has to use its own damn keyboard shortcuts and that the ones burned into muscle memory from 20+ years of using pretty much every text editor under the Windows/DOS sun don't work without significant hacking.

Re: Vim Anti-Patterns

#153
post #142

Earlier quoted context omitted.

Best of both worlds: http://spacemacs.org/ Modal editing is far superior, once you learn it. Emacs runtime and configurability thanks to Elisp is far superior to VimL. So just use Spacemacs. ^^

It works until one wants to create their own configuration stuff and functions and stuff. Much rather just stick with normal emacs configs and stuff and put in EVIL-mode once my pinky finger can no longer reach Ctrl (Not a worry seeing as I need Ctrl for gaming as well). Also, installing plugins requires one to create one's own layer? Eww.

It's complicated, true.

But it does a lot of work for you.

I started to create my own setup from scratch with Evil etc.

But recreating all that Spacemacs has, especially with customizing all the plugins for Vim keybindings, is countless hours of work.

You can skip the layers and side-install custom plugins quite easily though.

Re: Vim Anti-Patterns

#154

I never got into the habit of using { and }. I just use H M L (high/medium/low) to get approximately in the right part of the screen, then go line-by-line. You can also do 5H or 10L to get "5 lines from the top" or "10 lines from the bottom". I make pretty good use of vim features, but I like to mix some sloppiness with the precision. I don't often count things before typing commands, because that breaks the second-n…

I find normal mode much more pleasant with space mapped to 10j and backspace mapped to 10k. This combined with / and ? make navigation pretty quick without having to mentally switch context to think about the vimgolf way of getting places.

Re: Vim Anti-Patterns

#155
post #104
post #103

"Hitting Escape is usually unnecessary; Ctrl+[ is a lot closer, and more comfortable." I agree with a lot of the things in this article, but wow, I could not possibly disagree with this quote more. Ctrl+[ is WAY more uncomfortable than using the Escape key. Granted, I have many years of vim usage that have made hitting Escape a habit, and that probably plays a big part in it, but Ctrl+[ is downright painful for me (a…

I suggest remapping Caps Lock to CTRL if you haven't remapped it already.

I prefer remapping Caps Lock to Escape. Ctrl is already positioned pretty conveniently.

Re: Vim Anti-Patterns

#156
post #85

Moving to the far left-corner of the keyboard to reach Escape has been a major annoyance for me. On the other hand, the Caps Lock key on my keyboard is almost useless. I never use that key. Is there a way to map Caps Lock to Escape in Vim?

Run setxkbmap in your .xinitrc if applicable:

  setxkbmap -option caps:escape
Linux desktop environments’ keyboard configuration tools should also let you do this.

Re: Vim Anti-Patterns

#157

works likes escape almost all the time. Mapping the caps lock key to Ctrl makes hitting super easy. I usually use that instead of escape. In general I would agree 1 character at a time is an anti-pattern but it needs to be balanced with the cognitive load of counting how many words or deciding what is or is not a boundary when there are symbol characters.

This is why `f` is really my workhorse key in vim.

Re: Vim Anti-Patterns

#158
post #13

Earlier quoted context omitted.

Honest question: How does Emacs help with this particular problem ? I feel like with every editor, it involves repeatedly hitting J, Ctrl+N or down arrow, which is inefficient. Do you have a way to get to a particular line that does not force you to think too much about how to get there ?

Of course we do: You can jump by searching for line contents with C-s, you can do an operation a certain number of times with M- , and do an operation four times with C-u , which chains, so you can do an operation 16 times with C-u C-u . If you want to jump to a specific line number, you can use M-g M-g , or (because C-u also provides numerical arguments) C-u M-g M-g. Finally, many motion commands set the mark, so yo…

Wait, how’s this different from Vim? You can use : to go to a line and C-o to return to where you were.

Re: Vim Anti-Patterns

#159
post #72
post #13

Earlier quoted context omitted.

Honest question: How does Emacs help with this particular problem ? I feel like with every editor, it involves repeatedly hitting J, Ctrl+N or down arrow, which is inefficient. Do you have a way to get to a particular line that does not force you to think too much about how to get there ?

1. place hand on mouse 2. move mouse cursor to desired position 3. click mouse If you're just looking to put the cursor somewhere you can see, this is actually quite quick.

:set mouse=a

Re: Vim Anti-Patterns

#160
post #151

Not trying to start a flame war here, but I in recent few years I am seeing Vim being more popular, and I feel it adoption in terms of younger developers (those who weren't programming when original Vi was around) grows. (Ok, please forget about GUI editors, they have their audience, and I am not comparing any of those facts to them) I used Vim for 3 years, and found philosophy and implementation of modal editing ama…

I’m primarily a Vim user, but I use Emacs for some stuff like Common Lisp programming, Org mode, etc. But what I sometimes miss from Vim is the filtering with external commands. For example if I want to pipe my file through awk, I can just do :%!awk ' ' Does Emacs have something like this out of the box?

C-u M-!
Post reply on HN