When I first start to think about how to get more efficient in using my text editor, I realized that when I both navigate and edit files at the same time I have to move between keys which are far from each other. For example; arrow keys and any other letter key.
Then I thought that, the least useful key for me was caps lock. So I come up with a solution by using autohotkeys. I wrote this script to separate navigate mode and editing mode, like in VIM but much simpler. Here is the script:
#Persistent
SetCapsLockState, AlwaysOff
; Caps Lock Disable
#If GetKeyState("CapsLock", "T") = 0
;;; [CapsLock] + [i] - move up
Capslock & i::Up
; ...
;;; [CapsLock] + [l] - move right
Capslock & l::Right
; ...
;;; [CapsLock] + [k] - move down
Capslock & k::Down
; ...
;;; [CapsLock] + [j] - move left
Capslock & j::Left
; ...
;;; [CapsLock] + [;] - move far right
Capslock & `;::End
;;; ...
;;; [CapsLock] + [h] - move far left
CapsLock & h::Home
;;; ...
;;; [CapsLock] + [n] - enter
CapsLock & n::Enter
;;; ...
;;; [CapsLock] + [d] - delete
CapsLock & d::BackSpace
;;; ...
;;; [CapsLock] + [w] - pageup
CapsLock & w::PgUp
;;; ...
;;; [CapsLock] + [x] - pagedown
CapsLock & x::PgDn
;;; ...
Basically what this script does is that; when capslock is pressed you can use:
j as left arrow
i as up arrow
l as right arrow
k as down arrow
n as enter button
d as backspace
w as pageup
d as pagedown
h as home // to go to the beginning of the line
; as end // to go to the end of the line
Now it feels more intuitive and effective to navigate and edit files. Let me now in comments if it worked for you or not or maybe you have better approach.
Top comments (3)
My opinion is that you are only reinventing a wheel and the same functionality I can achieve also with any Vim plugin for Intellij Idea or MS Code.
With difference that with Vim plugin I can be more powerful and cannot still keep the Caps Lock..
Well it is quite personal. I did not mention in my post but I use vscode and VIM extension for vscode has weird bugs. Also I prefer to keep pressing capslock rather than toggling functionality because I usually find myself confused about which mode I am in. But again this is quite personal.
It is only about a habit. When you will use it for some time so then it become the new norm for you :) With toggling you can have more various modes which you can combine (normal, input, select, record macro, etc..) without using of mouse or any other additional keyboard keys. This make vim so powerful without any other plugins.
Now I am using IntelliJ Idea with Vim plugin and it works perfect. VS Code I tried in the past without any big problem but I am not using it right now so I don't know what bugs can be there.. :)