1

I would like to see if the caps-lock is ON or OFF in my vim-airline status bar for reasons mentioned here. I installed vim-capslock in my bundle and set the variable as let g:airline#extensions#capslock#enabled = 1. However, I don't see any difference after opening the VIM. I don't see a caps-lock status in the status line. My airline configuration is as below in ~/.vimrc

let g:airline_theme='wombat'

" Enable the list of buffers
let g:airline#extensions#tabline#enabled = 1

" Show just the filename
let g:airline#extensions#tabline#fnamemod = ':t'

" Show capslock status in the statusline
let g:airline#extensions#capslock#enabled = 1

I was expecting CAPS in the status line if the caps-lock was ON. Am I doing anything wrong?

Raj
  • 3,300
  • 8
  • 39
  • 67

1 Answers1

3

I think you're misunderstanding how vim-capslock works. It implements a software caps-lock in Vim, which affects text you type, but does not affect command keys. And it exports that status so Airline can display it. But it has nothing to do with the hardware caps lock key on your keyboard. I'm not aware of a way to detect the capslock on a keyboard reliably.

Dan Lowe
  • 51,713
  • 20
  • 123
  • 112
  • oh okay ! thanks a lot for the clarification. maybe I mis-understood it completely. would it mean that there is no solution? – Raj Sep 15 '16 at 16:02
  • Maybe by modifying the caps lock keybinding at the OS level and then assigning the new bind to enable vim-capslock? Never tried something like this though. – Vitor Sep 19 '16 at 12:52
  • @Vitor sure, but one big drawback: caps lock stops working in all the other apps. – Dan Lowe Sep 19 '16 at 13:12
  • Apps other than vim? Why do you need then!? :P You could use FocusGained/Lost auto commands (if using gvim) to enable/disable the custom bindings. – Vitor Sep 19 '16 at 13:21