a vim plugin that displays stuff on an led matrix

Compare changes

Choose any two refs to compare.

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