Reputation: 482
MacOS:
Catalina 10.15.5 (19F101)
VSCode:
Version: 1.45.1
Commit: 5763d909d5f12fe19f215cbfdd29a91c0fa9208a
Date: 2020-05-14T08:33:47.663Z
Electron: 7.2.4
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Darwin x64 19.5.0
VSCode Vim:
v1.14.5
Often times, when I press the caps lock key in insert mode or command mode, I forget to press it again to turn it off when we enter normal mode, and that can cause a lot of trouble.
So there is a solution for it for the regular vim that you use in a terminal.
https://vim.fandom.com/wiki/Insert-mode_only_Caps_Lock
.vimrc
, I created it and put this code, but it didn't work. (This works with regular vim in the terminal)for c in range(char2nr('A'), char2nr('Z'))
execute 'lnoremap ' . nr2char(c+32) . ' ' . nr2char(c)
execute 'lnoremap ' . nr2char(c) . ' ' . nr2char(c+32)
endfor
autocmd InsertLeave * set iminsert=0
Upvotes: 2
Views: 1652
Reputation: 580
Maybe sedleds and an autocmd like
autocmd InsertLeavePre * !setleds\ -caps
untested
I tried with import pyautogui ; pyautogui.press('CAPSLOCK')
and that toggles the caps key, but I have not found a way how to detect if capslock is 'locked' or not. It would otherwise work with linux, windows and macos as it seems.
Upvotes: 1