feat: change cursor shape based on vim mode

windows-fixes
TorchedSammy 2022-03-06 10:08:42 -04:00
parent f8f8cd0b59
commit 0b1b5bff2d
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
1 changed files with 11 additions and 1 deletions

View File

@ -1,8 +1,9 @@
-- Default Hilbish config -- Default Hilbish config
local lunacolors = require 'lunacolors' local lunacolors = require 'lunacolors'
local bait = require 'bait' local bait = require 'bait'
local ansikit = require 'ansikit'
function doPrompt(fail) local function doPrompt(fail, mode)
hilbish.prompt(lunacolors.format( hilbish.prompt(lunacolors.format(
'{blue}%u {cyan}%d ' .. (fail and '{red}' or '{green}') .. '' '{blue}%u {cyan}%d ' .. (fail and '{red}' or '{green}') .. ''
)) ))
@ -16,3 +17,12 @@ bait.catch('command.exit', function(code)
doPrompt(code ~= 0) doPrompt(code ~= 0)
end) end)
bait.catch('hilbish.vimMode', function(mode)
if mode ~= 'insert' then
ansikit.cursorStyle(ansikit.blockCursor)
else
ansikit.cursorStyle(ansikit.lineCursor)
end
doPrompt(false, mode)
end)