Should I learn Vim without mapping keys?

2

1

I have been using vim for a few months its been a love/hate relationship. I love the concept of modal editing and never having the need to move you hands from the keyboard. The problem is that a lot of they keys seem to be in awkward locations and plugins easily conflict with each other your custom vimrc file.

I made a bunch of changes that seem more intuitive to me, so I was wondering if I am losing any benefits by not using the default configurations? Other than that Vi and Vim are everywhere in the *nix world (so it will be easier to move between computers using the defaults), is there any other benefits I'm losing by making a bunch of changes to the key mappings?

apokaliptis

Posted 2012-01-31T02:47:54.270

Reputation: 1 752

Yes, If I remember right I think that was partly a reason why I decided to ask this question. Ever since cleaned out my vimrc file, I've felt more relieved of burden of maintaining it. – apokaliptis – 2012-08-04T02:32:08.177

Answers

4

I love the concept of modal editing and never having the need to move you hands from the keyboard.

Before switching to Vim I've been using TextMate 90% without the mouse. Vim allowed me to go 100% but those 10% are hardly noticeable.

The problem is that a lot of they keys seem to be in awkward locations

No the problem is that you focus on their physical location rather than their meaning. If you know your keyboard layout, where the keys are doesn't matter; what matters is the logical connection you make between those keys. But I admit it can take a while. I've seen a number of graphical cheat-sheets that make the unforgiveable mistake to actually show the keyboard and tie the commands to the physical location of their key. With that kind of representation it's nearly impossible to make sense of Vim's language (because it is a language).

(And there seems to be a design flaw for Plugins: they easily conflict with each other and with your own vimrc file).

I don't think I've experienced that on a large scale, but of course, using two plugins bound to the same key as one of your custom mappings is the kind of strategy that will create problems.

I moved "hjkl" to "jkl;", I also switch the direction the go from to <^v> (which IMHO is easier to transition to from arrow keys)

hjkl or jkl; only make sense if:

a. you are a touch typist

b. your keyboard doesn't have arrow keys

c. you have a QWERTY keyboard

I tried to use hjkl when I switched but I didn't find it better than the arrow keys. Since I'm not a touch typist and I use a normal AZERTY keyboard I came back to the arrow keys which I don't use that much anyway: Vim's wWEeBbfFtT/? and other various motions and text-objects make character-by-character and line-by-line movement (hjkl) a joke.

Again, Mac OS X has a bunch of powerful but surprisingly widely unknown editing shortcuts which, when used to their full extent, make it very easy to navigate a file without much character-by-character movement. Here is a list of Cocoa shortcuts, both Windows and KDE/Gnome have their own, too. Moving from this system to Vim's cool motions and searches is surprisingly easy.

Moved : to <Tab> since it doesn't do anything by default.

What do you mean? Do you hit <Tab> to invoke command mode? If so, how do you actually input a Tab in insert mode?

Mapped : to jump to beginning of next word (w) and J to jump to the beginning of previous word.

Again I don't understand: : is normally used to invoke command mode, why would you use it to move to the next word? And J is used to Join lines, what would be the benefit to make it do something else? And what's wrong with beginning and word?

Mapped <C-k> to jump to beginning of file and <C-l> to jump to end of file.

Again, are G and gg too hard to type or hard to remember?

Also since I am setting it up how It works helps me remember (I also keep notes that are easy for other people to understand what I am doing).

I agree completely, customizing Vim helped me a lot.

Now that I have that out of the way, I was wondering if I am losing productivity by not using the default configurations? Other than that Vi and Vim are everywhere in the *nix world (so it will be easier to move between computers using the defaults), is there any other benefits I'm losing by making a bunch of changes to the key mappings? Or is it recommended that I make Vim more comfortable for myself and configured more for situation?

I followed a similar path in the beginning. Switching from TextMate, my reflex was to make Vim a clone of my previous editor. I copied other people's .vimrc verbatim, installed dozens of plugins, created lots of weird mappings and so on until I found out one day, while SSHed on a remote server outside of my control that I didn't know how to use Vim without all that stuff. At all. My ultra-customized MacVim wasn't Vim anymore and kept hidden all of Vim's awesomeness. So I decided to delete everything, start again from an empty ~/.vimrc and an empty ~/.vim/ and $ vimtutor.

It was the best decision of my short front-end coder's carreer.

My ~/.vimrc has grown, of course. I have a bunch of custom mappings, of course. I use plugins, of course. But I don't depend on them, now. I've learned enough of "Vim's way" to make me more productive than I ever was and I'm still a noob.

So, my answer is that your attempts to customize the hell out of Vim are misguided and you should learn the basics first.

But that is only my opinion.

romainl

Posted 2012-01-31T02:47:54.270

Reputation: 19 227

Thanks for the answer, very solid arguments. I made mappings to navigational keys that made more sense location-wise, not for memory issues. Since I have the semicolon set to "Right" movement, I have colon to be like Super-Right movement (jumps to next word). This makes more sense because I use Querty, and on my keyboard : is Shift + Semicolon. Now that I cant invoke a command with colon, I moved it to <Tab>. But all that aside I think I will just learn to use "pure" vim. Since I currently don't appreciate all the defaults, I am counting on "learning to love it". – apokaliptis – 2012-01-31T22:08:32.863

Sinced you asked, Tab still works in insert mode. The mapping commands I used (noremap) don't affect insert mode and prevent dependencies on my current mappings. – apokaliptis – 2012-01-31T22:21:19.767

3

This is an opinion rather than a firm answer, but I think you would be better off in the long term by learning Vim's keys as they are. It may take slightly longer for you to learn them with their original bindings, but I don't think it will take all that long, and after that you won't notice, plus you'll be able to use Vim on other computers without your customizations. Also, as you learn Vim, you'll discover more of its functionality and will probably want to use the functions whose keys you've now bound to other functions.

I didn't follow exactly what you did with the : (colon) key, but if you mapped it to something else, how do you invoke ex commands? Is that what your <Tab> does now?

Plugins whose functions are bound to single keys or pairs of keys often do conflict with other plugins. Sometimes plugin authors make it easy to choose other key bindings; sometimes they don't.

garyjohn

Posted 2012-01-31T02:47:54.270

Reputation: 29 085

Yes, Tab lets me invoke commands. Thanks for the answer. – apokaliptis – 2012-01-31T22:25:32.953

1

I personally think you should learn the mappings. It makes reading tips or tutorials on the more obscure functions easier.

In the future, you will run into the problem of now translating future readings on Vim features with the key mappings of your own functions. If anything, I'd suggest you create alias or macros for certain workflows. For example, I almost never can remember all the switches the for command accepts in batchfiles. So when I go to write a batchfile, I have an alias that loads a text file of all the friggin switches and options in a split window.

surfasb

Posted 2012-01-31T02:47:54.270

Reputation: 21 453