repositories / dotfiles
dotfiles
bugabingas dorkfiles
owned by admin
neovim/lua/bugabinga/fun.lua
Rawlocal puk = require 'std.puk'
local map = require 'std.map'
-- explicit "where is my cursor" flash, on demand.
-- pure neovim: vim.hl.range highlights linewise and clears itself after the
-- timeout, no plugin, no leftover extmarks.
local flash_ns = vim.api.nvim_create_namespace 'find_cursor_flash'
map.normal {
description = 'Find cursor, for real!',
category = 'fun',
keys = '<leader><leader><leader>',
command = function ()
local window = vim.api.nvim_get_current_win()
local buffer = vim.api.nvim_win_get_buf( window )
local row = vim.api.nvim_win_get_cursor( window )[1] - 1
vim.hl.range( buffer, flash_ns, 'IncSearch', { row, 0 }, { row, 0 }, {
regtype = 'V', -- linewise: flash the whole line regardless of column
timeout = 300,
} )
end,
}
-- automatic cursor-trail animation on jumps, so the eye can follow a long
-- motion to the new cursor position. this replaces specs.nvim.
-- scroll animation is disabled on purpose: it fights fast navigation.
puk.defer 'mini.animate' ( function ( animate )
animate.setup {
cursor = {
enable = true,
timing = animate.gen_timing.linear { duration = 100, unit = 'total' },
},
scroll = { enable = false },
resize = { enable = true },
open = { enable = true },
close = { enable = true },
}
end )