把 Caps Lock 變成智慧的 Control 以及 Escape :
- 單獨輕按一下就是 Escape 。
- 若按下時同時按著其他鍵,就會是 Control 。
這應該是 Vim 和 Emacs 的最佳解了!(Emacs? Bash 的快捷鍵就是 Emacs 系列的)
- Send Escape if you tap Caps Lock alone.
#### !!! THIS GIST IS OBSOLETE !!! #### | |
# | |
# There is now built-in support for transient kubecontext | |
# in Powerlevel10k. | |
# | |
# See: https://github.com/romkatv/powerlevel10k/#show-on-command | |
# | |
#### !!! THIS GIST IS OBSOLETE !!! #### | |
# Run this function from ~/.zshrc to enable transient kubernetes and/or azure |
g_LastCtrlKeyDownTime := 0 | |
g_AbortSendEsc := false | |
g_ControlRepeatDetected := false | |
*CapsLock:: | |
if (g_ControlRepeatDetected) | |
{ | |
return | |
} |
inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a | |
function! s:align() | |
let p = '^\s*|\s.*\s|\s*$' | |
if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p) | |
let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g')) | |
let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*')) | |
Tabularize/|/l1 | |
normal! 0 | |
call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.')) |