1

I decided to remap the arrow keys to C-h, C-j, etc. in my vimrc. Then I decided to allow half-page scrolling (which I use a lot) with C-u and C-d. But now I'm realizing that I rarely use hotkeys in insert mode otherwise, and it would be possible to remap most of the normal navigation commands by prefixing them with C or M (Alt).

Do you think this is this against the modal philosophy of Vim, or is otherwise bad practice? Kind of feels like my world is breaking down; isn't the idea of "normal mode" just switching Read Only Mode on and off, with the clever allocation of hotkeys that could be achieved instead by prefixing all of them? Also are there some examples of useful Insert Mode hotkeys I'm not aware of that I should want to preserve?

closed as primarily opinion-based by Antony, DJMcMayhem, nobe4, statox, EvergreenTree Jul 6 '16 at 12:22

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

  • One thing you might like to consider while doing this, is the fact that, without a certain degree of tinkering, Vim's u command will undo in a single keystroke all the edits made while in a single occasion of insert mode. If you extend the length of time that you spend in each instance of insert mode, you are making Vim's undo less granular, and possibly less useful. There are ways to get around this, if necessary (see :help i_CTRL-G_u). – Rich Jul 6 '16 at 9:03
  • Another thing you'll miss is the ability to chain up commands with operators and to prefix commands with numbers. In normal mode you can type 5j to move the cursor down five lines at once. In insert mode I can't imagine how you could achieve this behavior; if you type 5Ctrl-j, how would vim know you wanted to move 5 lines rather than insert the character 5 and then move one line? – lwassink Jul 6 '16 at 15:43
  • Congratulations, you invented Emacs, except with a much better scripting language. Doing what you propose would break things like the repetition operator (.) and would have the effect of negating a lot of the automation possible in vi. – Tyler Durden Jul 7 '16 at 15:51
4

The philosophy of vim, is that it's extremely customizable, and whatever workflow is most efficient for you is completely up to you. So, no I don't think this goes against the philosophy of vim. I have <C-H> <C-J> <C-K> <C-L> remapped to cursor keys in my .vimrc. If it makes you more productive, who cares if it goes against the norm of vim?

Isn't the idea of "normal mode" just switching Read Only Mode on and off, with the clever allocation of hotkeys that could be achieved instead by prefixing all of them?

Not really. I'm not sure what you mean "switching read only mode on and off". Vim does have a read-only mode, but this has nothing to do with normal vs insert mode. The way I think of normal mode means "each key is a composable function".

As for philosophical thoughts on this, the workflow you're proposing sounds very emacs-ey. Emacs heavily relies on modifiers (such as ctrl-alt-super, etc.) for the equivalent of normal mode commands in vim. It might be worth a shot to try out emacs if that sounds appealing. Disclaimer: I have never used emacs before.

However, if you want to use vim with your own fusion of normal and insert mode, I see no problem with that. You'll find the i_CTRL-o and gi commands both very useful while you're creating your mappings.

Also are there some examples of useful Insert Mode hotkeys I'm not aware of that I should want to preserve?

This is very subjective. What I find useful, another might find annoying, and vice-versa. For example, I find <C-V> <C-N> and <C-O> extremely useful. In the end, only you can decide which i_CTRL-* keystrokes are useful to you or not. I would recommend just checking :help i-CTRL-<some key> whenever you want to map something new in insert mode.

  • 1
    Thanks for your input. "Philosophy" was mostly tongue-in-cheek; just wanted to start a discussion on this. Also I now see why we don't prefix everything after trying some remaps: it makes multi-character commands really cumbersome and some nearly impossible (e.g. C+7E for back 7 end-of-words). Which is why I guess we have C-o and the dedicated normal mode. That should have been obvious to me. – Luke Davis Jun 18 '16 at 18:15
0

There is absolutely nothing wrong with remapping keys. Though, I discourage doing it simply to match the feel of another editor. If you're going to override what a built-in key does, you should at least be sure that you won't miss it. You can see what's built in with :h normal-index, :h insert-index, and :h visual-index.

In normal and visual mode, it's usually best to use <leader> or <localleader> if you want custom key mappings.

isn't the idea of "normal mode" just switching Read Only Mode on and off

normal mode is not a readonly mode. It's a context where you're not directly inserting text.

In fact, why even have Normal Mode?

Think of how you use a GUI text editor with a mouse. If you're typing, both hands are on the keyboard and all fingers are dedicated to inserting text. This is insert mode. But, when you want to move the cursor or select text, you remove one hand to operate the mouse or hold down a modifier key. Since all of your fingers aren't dedicated to inserting text, you are no longer in "insert mode".

If you are using the mouse to access the editor's menus or are using one hand to hold a modifier key, you could think of that as doing normal mode operations. Selecting text would be visual mode until you clear the selection.

Vim's normal mode is how you get things done without a mouse.

Not the answer you're looking for? Browse other questions tagged or ask your own question.