Live data from Hacker News

Vim Anti-Patterns

sanctum.geek.nz

111–120 of 249 posts

Re: Vim Anti-Patterns

#111

Earlier quoted context omitted.

Emacs was far easier for me than Vim was. To this day, I have no idea how people learn Vim. And the scripting is awful, especially compared to Emacs, which is really a script interpreter that has a built in text-editor script and some useful primitives for text editing.

> I have no idea how people learn Vim LOL, I felt the same way about emacs when I tried to force myself to use it. Interesting that you point out that "the scripting is awful" - my sense after a year of using emacs full time was that the _only_ way to use emacs is to learn to script/reprogram it. If you don't mind my asking - how _did_ you learn emacs? Were you a lisp programmer to start with? Or did you learn it in…

Yeah, scripting a huge focus in emacs: they say it's a scripting environment that happens to have a text editor embedded in it. I don't know who "they" are, but they're quite perceptive.

Some lisp experience (especially CL) can help with learning elisp, but it's entirely possible to do so without it.

The process of learning emacs is roughly this:

-Launch emacs

-Run through the tutorial

-Learn the shortcuts and gain gradual proficiency in the editor (this step can optionally come later)

-Find something you want, or that annoys you (I wanted to have Solarized Dark as my theme)

-Google how to fix it, introducing you to .emacsrc and .emacs.d

-Copy snippets into your .emacsrc (or .emacs.d/init.el)

-Gradually learn elisp as you customize your emacsrc and snippets to your needs.

-Start writing your own snippets, with the help of the excellent documentation.

-Begin writing about how great emacs is online (I am here)

-Eventually start writing full-fledged emacs packages.

-Master the intricacies and horrors of elisp. Begin to despise the language. Comfort yourself by saying, "at least it isn't vimscript."

-Start supporting xemacs in your emacs config and packages. At this point, your config is a large hierarchy of directories. If it wasn't, it is now. If you didn't hate writing elisp already, you will now.

-Under the pressure of the demands of your users, spend more time working on emacs packages and other improvements to emacs than your actual work.

-Snap, and spend the rest of your days improving emacs and writing tributes to RMS.

Most do not follow this learning curve to its conclusion.

Re: Vim Anti-Patterns

#112
post #59

Earlier quoted context omitted.

Easier than editing a config file, but not easier than hitting jk or kj. Just take the second to map it.

The reason I'm so reluctant to remap it is that I use vim in a gadjillion different environments, and I don't want to have to worry about managing .vimrc everywhere. Or is it _vimrc? Especially under Windows, when I have cygwin and msys2 both installed, keeping .vimrc synchronized is terrible. I'm more inclined to adopt ^[, since that should work anywhere, even in vi.

Fair enough I suppose. I fall back on ctrl-[ if I'm in another environment, but it's rare enough for me to not care about it being an untrained motion.

Re: Vim Anti-Patterns

#113
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…

The first thing I do on any new computer I get is to swap the mapping for the caps lock and left ctrl keys. This makes ctrl+[ super easy (double pinky flick), and it also makes using the vim window commands (ctrl+w) easy to access, which I use a lot.

Re: Vim Anti-Patterns

#114

Earlier quoted context omitted.

I switched to Spacemacs a few months ago and didn't look back since. Its basically Emacs+Vim+Steroids+More. Just the leader key and layers alone are incredibly powerful concepts Spacemacs brings on top of Emacs/Vim :)

Did you switch to Spacemacs from Emacs or vim? I tried getting into Spacemacs from vim and found it quite overwhelming with all the config files and additional configuration that I had to do so instead I went for just Emacs + EVIL mode and built from there. I've gotten pretty used to Emacs and Elisp now, would it be worth it giving Spacemacs another shot?

i tried switching from vim to spacemacs but all i got was a bunch of keybinds brought back to my .vimrc such as fs instead of :w (:update) that saves my right pinky for less used commands.

Re: Vim Anti-Patterns

#115

While these tips are good per se, in retrospect I don't think it's that a good idea to tie your muscle memory that much to a single piece of software. I'd say enjoy the cursor keys. Moving around in insert mode is ok too.

This is normally true, except that in order to be good at your job as a developer, you have to be good with your tools. It helps that vim is installed by default in every modern OS.

But in reality you'd constrain yourself to using Vim just because it is the lowest common denominator (i.e. it is available - vi - in Sun OS 5.2 & co).

Otherwise, if it's a really modern OS, there's a plethora of modern, fast, cross-platform editors that follow CUA conventions.

Re: Vim Anti-Patterns

#116

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…

Emacs was far easier for me than Vim was. To this day, I have no idea how people learn Vim. And the scripting is awful, especially compared to Emacs, which is really a script interpreter that has a built in text-editor script and some useful primitives for text editing.

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. ^^

Re: Vim Anti-Patterns

#117
post #33

I was originally a die hard Emacs user, but I started to feel a bit of strain on the whole holding Ctrl+p, Ctrl+n etc. I was trying to find an editor/plugin that can reduce keystrokes or at least the strain. I ran across EVIL for Emacs which is just a Vim emulation and keybindings for Emacs users. Unfortunately I did not like it at first the entire hjkl felt awkward and all those modes - OMG. But after toying around…

> feel a bit of strain on the whole holding Ctrl+p others don't seem to like this, but i've found the following global key swaps effective swap ctrl->alt LCtrl::LAlt RCtrl::RAlt swap capslock->alt Capslock::Alt this enables you to hit "ctrl" with your thumb (next to the spacebar), and capslock becomes the new "alt". so no more reaching for that hard to reach LCtrl key with your pinky.

the inability to press left ctrl with the top right of your left hand palm is an unfortunate side effect of most laptop keyboards.

Re: Vim Anti-Patterns

#118
post #54

Earlier quoted context omitted.

Normal vim users aren't thinking about the most efficient way to perform an edit, but rather just go with muscle memory. Said vim users also don't write blog articles on how to be more efficient with vim.

Well after 5 years of using Vim, the muscle memory for more efficient operations never kicked in. I was either holding "h" and "l" to move around, or I was consciously thinking of the more efficient combined operations like "f.ce.com^[". And that conscious thinking was very distracting from the actual code I was editing.

I used vim for everyday use for almost ten years before I realized that navigating around with the keyboard would never be as good as clicking a mouse. All the mental overhead of trying to be efficient with vim, for me at least, ended up being a bit of a false oasis.

I happily switched to Sublime for two years and then VS Code. I still use emacs with Clojure though.

Re: Vim Anti-Patterns

#119

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 have similar habits, but use zz to recenter the cursor (instead of z.), and gg (instead of 1G) to move to the top. Very quick.

Also, with relativenumber set, it's easy to move to the exact line without counting, or to see how many lines you need to yank, etc.

But sometimes I'm just idly moving through a file with j and k, and it feels perfectly natural to do so, the same way I unconsciously move the mouse cursor over text as I read it (outside of vim).

Re: Vim Anti-Patterns

#120

Earlier quoted context omitted.

> I have no idea how people learn Vim LOL, I felt the same way about emacs when I tried to force myself to use it. Interesting that you point out that "the scripting is awful" - my sense after a year of using emacs full time was that the _only_ way to use emacs is to learn to script/reprogram it. If you don't mind my asking - how _did_ you learn emacs? Were you a lisp programmer to start with? Or did you learn it in…

Yeah, scripting a huge focus in emacs: they say it's a scripting environment that happens to have a text editor embedded in it. I don't know who "they" are, but they're quite perceptive. Some lisp experience (especially CL) can help with learning elisp, but it's entirely possible to do so without it. The process of learning emacs is roughly this: -Launch emacs -Run through the tutorial -Learn the shortcuts and gain g…

hehe - I made it to step 4, anyway.

The only thing that sort of scared me off of customizing emacs is that if I, say, SSH into a remote box or go to another co-workers computer, my customizations won't be there. That's why I do my best to stick with "out of the box" vim defaults (and vi defaults if possible): I know they'll always be there, wherever vi is.

Post reply on HN