a vim plugin that displays stuff on an led matrix

feat: add the vim plugin and update the readme

dunkirk.sh 0e6c3c6a 0df10c1f

verified
Changed files
+160 -1
lua
braille_indicator
+5 -1
README.md
···
# Usage
-
Eventually you should download the bin from the releases and copy it to your board and then follow the vim plugin steps i will add below.
+
So the orginal goal was for keystrokes to make a nice pattern in your status bar as well as on the led matrix of daedalus but I couldn't get the serial to work from vim; not entirely sure why but it really doesn't like this for some reason.
+
+
What I do have instead is firmware for random led blinking when a serial character is detected and a vim plugin that displays random braille characters in the status bar.
+
+
You can read the [plugin](/lua/braille_indicator/README.md) for more information on installation and for the firmware you can use any serial interface set to a `115200` baud rate (screen for example `screen /dev/tty.usbmodem101 115200`).
<p align="center">
<img src="https://raw.githubusercontent.com/taciturnaxolotl/carriage/main/.github/images/line-break.svg" />
+78
lua/braille_indicator/README.md
···
+
# Braille Typing Indicator Plugin for Neovim
+
+
A simple plugin that displays a random Braille character in your statusline that changes every time you type.
+
+
## Installation
+
+
### Using a plugin manager (recommended)
+
+
#### [packer.nvim](https://github.com/wbthomason/packer.nvim)
+
+
```lua
+
use {
+
'taciturnaxolotl/daedalus',
+
config = function()
+
require('braille_indicator').setup()
+
end
+
}
+
```
+
+
#### [lazy.nvim](https://github.com/folke/lazy.nvim)
+
+
```lua
+
{
+
'taciturnaxolotl/daedalus',
+
config = function()
+
require('braille_indicator').setup()
+
end
+
}
+
```
+
+
### Manual installation
+
+
1. Clone this repository to your Neovim configuration directory:
+
+
```
+
git clone https://github.com/taciturnaxolotl/daedalus.git ~/.config/nvim/pack/plugins/start/daedalus
+
```
+
+
2. Add the following to your `init.lua`:
+
```lua
+
require('braille_indicator').setup()
+
```
+
+
## Configuration
+
+
The plugin works with minimal configuration, but you can customize it:
+
+
```lua
+
require('braille_indicator').setup({
+
update_statusline = true, -- Automatically update the statusline
+
verbose = true, -- Show setup messages
+
})
+
```
+
+
### Adding to your statusline
+
+
If you're using a custom statusline setup, add the Braille indicator with:
+
+
```lua
+
%{v:lua.getBrailleIndicator()}
+
```
+
+
For example, with lualine:
+
+
```lua
+
require('lualine').setup({
+
sections = {
+
lualine_a = {
+
function()
+
return getBrailleIndicator()
+
end,
+
'mode'
+
},
+
-- other sections...
+
}
+
})
+
```
+
+77
lua/braille_indicator/init.lua
···
+
-- Braille Typing Indicator Plugin for Neovim
+
-- This is a proper plugin structure for installation in your Neovim config
+
+
local M = {}
+
+
-- Braille unicode characters (⠀ to ⣿)
+
local brailleChars = {
+
'⠀', '⠁', '⠂', '⠃', '⠄', '⠅', '⠆', '⠇', '⠈', '⠉', '⠊', '⠋', '⠌', '⠍', '⠎', '⠏',
+
'⠐', '⠑', '⠒', '⠓', '⠔', '⠕', '⠖', '⠗', '⠘', '⠙', '⠚', '⠛', '⠜', '⠝', '⠞', '⠟',
+
'⠠', '⠡', '⠢', '⠣', '⠤', '⠥', '⠦', '⠧', '⠨', '⠩', '⠪', '⠫', '⠬', '⠭', '⠮', '⠯',
+
'⠰', '⠱', '⠲', '⠳', '⠴', '⠵', '⠶', '⠷', '⠸', '⠹', '⠺', '⠻', '⠼', '⠽', '⠾', '⠿',
+
'⡀', '⡁', '⡂', '⡃', '⡄', '⡅', '⡆', '⡇', '⡈', '⡉', '⡊', '⡋', '⡌', '⡍', '⡎', '⡏',
+
'⡐', '⡑', '⡒', '⡓', '⡔', '⡕', '⡖', '⡗', '⡘', '⡙', '⡚', '⡛', '⡜', '⡝', '⡞', '⡟',
+
'⡠', '⡡', '⡢', '⡣', '⡤', '⡥', '⡦', '⡧', '⡨', '⡩', '⡪', '⡫', '⡬', '⡭', '⡮', '⡯',
+
'⡰', '⡱', '⡲', '⡳', '⡴', '⡵', '⡶', '⡷', '⡸', '⡹', '⡺', '⡻', '⡼', '⡽', '⡾', '⡿',
+
'⢀', '⢁', '⢂', '⢃', '⢄', '⢅', '⢆', '⢇', '⢈', '⢉', '⢊', '⢋', '⢌', '⢍', '⢎', '⢏',
+
'⢐', '⢑', '⢒', '⢓', '⢔', '⢕', '⢖', '⢗', '⢘', '⢙', '⢚', '⢛', '⢜', '⢝', '⢞', '⢟',
+
'⢠', '⢡', '⢢', '⢣', '⢤', '⢥', '⢦', '⢧', '⢨', '⢩', '⢪', '⢫', '⢬', '⢭', '⢮', '⢯',
+
'⢰', '⢱', '⢲', '⢳', '⢴', '⢵', '⢶', '⢷', '⢸', '⢹', '⢺', '⢻', '⢼', '⢽', '⢾', '⢿',
+
'⣀', '⣁', '⣂', '⣃', '⣄', '⣅', '⣆', '⣇', '⣈', '⣉', '⣊', '⣋', '⣌', '⣍', '⣎', '⣏',
+
'⣐', '⣑', '⣒', '⣓', '⣔', '⣕', '⣖', '⣗', '⣘', '⣙', '⣚', '⣛', '⣜', '⣝', '⣞', '⣟',
+
'⣠', '⣡', '⣢', '⣣', '⣤', '⣥', '⣦', '⣧', '⣨', '⣩', '⣪', '⣫', '⣬', '⣭', '⣮', '⣯',
+
'⣰', '⣱', '⣲', '⣳', '⣴', '⣵', '⣶', '⣷', '⣸', '⣹', '⣺', '⣻', '⣼', '⣽', '⣾', '⣿'
+
}
+
+
-- Current braille character
+
local currentBraille = brailleChars[1]
+
+
-- Update braille character randomly
+
local function updateBrailleChar()
+
-- Use os.time() for randomness
+
math.randomseed(os.time() * 1000 + os.clock() * 10000)
+
local idx = math.random(1, #brailleChars)
+
currentBraille = brailleChars[idx]
+
return currentBraille
+
end
+
+
-- Get current braille character for statusline
+
function M.getBrailleIndicator()
+
return currentBraille
+
end
+
+
-- Setup function with options
+
function M.setup(opts)
+
opts = opts or {}
+
+
-- Make sure statusline is visible
+
vim.o.laststatus = 2
+
+
-- Key press handler
+
local function onKeyPress()
+
-- Update braille character
+
updateBrailleChar()
+
end
+
+
-- Set up autocommands
+
vim.api.nvim_create_autocmd({"InsertCharPre", "CursorMovedI"}, {
+
callback = onKeyPress,
+
group = vim.api.nvim_create_augroup("BrailleIndicator", { clear = true })
+
})
+
+
-- Make the function available globally for statusline
+
_G.getBrailleIndicator = M.getBrailleIndicator
+
+
-- Add to statusline if requested
+
if opts.update_statusline then
+
vim.o.statusline = "%{v:lua.getBrailleIndicator()} %f %m %r %= %l,%c "
+
end
+
+
-- Print setup message
+
if opts.verbose then
+
print("Braille indicator active. The character will change as you type.")
+
print("Add %{v:lua.getBrailleIndicator()} to your statusline if not already there.")
+
end
+
end
+
+
return M