Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable the effect of caps lock while in normal mode in vim?

Tags:

vim

When the CAPS lock is ON in normal mode, the vim behaves in an abnormal way. Is there a way to disable this effect of CAPS lock when editing in normal mode?

like image 201
Sagar Jain Avatar asked Jul 10 '14 12:07

Sagar Jain


People also ask

How do I remap normal mode in Vim?

If you use Vim in a terminal, simply press alt/meta+normal_mode_key. Most terminals send an escape character followed by the normal_mode_key that you pressed, removing the need to press escape yourself. Thus in insert mode pressing alt+h alt+j alt+k alt+l all take you to normal mode and move in the expected direction.

What does CAPS LOCK do in Vim?

vim - Software Caps Lock : vim online. This plugin enables a software caps lock. This is advantageous over a regular caps lock in that normal mode commands, other buffers, and other applications are unaffected. The default mapping is <C-G>c but if you use this feature regularly, you will probably want a shorter one.

Why can't I press the CAPS LOCK key in Vim?

Pressing the Caps Lock key in Vim can cause trouble due to Vim's modal nature. Have you ever used Caps Lock in insert mode, then switched back to normal mode to issue a few commands, completely forgetting that Caps Lock is still on?

How do I turn caps lock on/off in insert mode?

Instead, when in insert mode, press Ctrl- ^ (hold down Ctrl and press ^ – the 6 key on US keyboards) to toggle "Caps Lock" on or off. This "Caps Lock" does not apply in normal mode.

How do I Turn Off CapsLock in Linux?

"Insert and command-line mode Caps Lock." Lock search keymap to be the same as insert mode. set imsearch=-1 "Load the keymap that acts like capslock. set keymap=insert-only_capslock" Turn it off by default. set iminsert=0.

Should you disable the CAPS LOCK key on your keyboard?

For some, the Caps Lock key is nothing more than an annoyance that shouldn't be on keyboards. Here's how to disable it on Windows 10 and 11. The Caps Lock key capitalizes everything when enabled, and it has a pretty negative public reception.


1 Answers

Since the Caps Lock state is managed by your operating system, integrating from within Vim with it, while possible, is difficult and prone to break. Instead, I would recommend to implement a "soft" Caps Lock within Vim (for those RARE_CASES where this is needed), and avoid the Caps Lock key when using Vim. (Some argue that it's best remapped to Ctrl or Esc; I agree.)

The Insert-mode only Caps Lock page on the Vim Tips Wiki lists multiple approaches for such a soft Caps Lock. (There are also pages for remapping the key.)

like image 67
Ingo Karkat Avatar answered Nov 15 '22 04:11

Ingo Karkat