https://github.com/barklan/capslock.nvim
Software caps lock for Neovim.
https://github.com/barklan/capslock.nvim
Last synced: 4 months ago
JSON representation
Software caps lock for Neovim.
- Host: GitHub
- URL: https://github.com/barklan/capslock.nvim
- Owner: barklan
- License: mit
- Created: 2022-05-17T19:22:43.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2025-03-30T11:11:29.000Z (over 1 year ago)
- Last Synced: 2025-03-30T12:22:35.467Z (over 1 year ago)
- Language: Lua
- Size: 170 KB
- Stars: 20
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# capslock.nvim
Software caps lock for Neovim.
Works in normal, insert and command modes. Normal mode commands, other buffers, and other applications
are unaffected (e.g. `jk` mapped as `Escape` in insert mode will work with caps lock enabled).
Especially useful if caps lock key is acting as another `Ctrl` or `Esc`.
## Installation
Neovim 0.7.0+ required. Example via [lazy.nvim](https://github.com/folke/lazy.nvim):
```lua
{
"barklan/capslock.nvim",
lazy = true,
keys = {
{ "", "CapsLockToggle", mode = { "i", "c" } },
{ "c", "CapsLockToggle", mode = { "n" } },
},
config = true,
},
```
## Usage
- When activated in insert or command mode it toggles temporary caps lock.
It is automatically disabled after leaving insert mode or command line.
- When activated in normal mode, it toggles caps lock for both normal and insert modes
and doesn't turn off automatically.
## Statusline integration
Use `require("capslock").status_string` function as a status line component to
display `[CAPS LOCK]` when caps lock is active.
### lualine
```lua
require("lualine").setup({
sections = {
lualine_x = {
{ require("capslock").status_string },
},
},
})
```
### feline
Set the function above as a `provider` in status line component.
## Related
- Inspired by tpope's [vim-capslock](https://github.com/tpope/vim-capslock).
- Unicode support enabled thanks to
[ustring](https://github.com/wikimedia/mediawiki-extensions-Scribunto/tree/master/includes/engines/LuaCommon/lualib/ustring)
library.