repositories / dotfiles
dotfiles
bugabingas dorkfiles
owned by bugabinga
neovim/lua/bugabinga/plugins/cursorword.lua
Rawlocal table = require 'std.table'
local auto = require 'std.auto'
return {
'echasnovski/mini.cursorword',
version = '0.*',
event = 'VeryLazy',
opts = {
delay = 4242,
},
config = function ( _, opts )
local cursorword_blocklist = function ()
local curword = vim.fn.expand '<cword>'
local filetype = vim.bo.filetype
-- Add any disabling global or filetype-specific logic here
local blocklist = {
'_',
'if',
'else',
'switch',
'case',
'return',
'true', 'false',
}
if filetype == 'lua' then
table.join( blocklist, {
'local',
'require',
'prequire',
'then',
'end',
'not',
'elseif',
} )
elseif filetype == 'java' then
table.join( blocklist, {
'import',
'class',
'final',
'interface',
'record',
'abstract',
'static',
'public',
'private',
} )
end
vim.b.minicursorword_disable = vim.tbl_contains( blocklist, curword )
end
-- Make sure to add this autocommand *before* calling module's `setup()`.
auto 'mini_cursorword_blocklist_update' {
description = 'Disable Cursorword for certein words.',
events = 'CursorMoved',
pattern = '*',
command = cursorword_blocklist,
}
prequire 'mini.cursorword'.setup( opts )
vim.api.nvim_set_hl( 0, 'MiniCursorwordCurrent', { reverse = true } )
end,
}