--- Basename Register: returns the current filename without path and extension. --- --- This is similar to the "%" register (full filename), but returns only --- the basename with one extension removed. Useful, for example, when referencing --- Java class names based on the file name. --- --- This register is read-only and assigned to the character '$'. local userregs = require("vim.userregs") local api = vim.api ---@type table local handler = {} --- Return the current buffer's basename without extension. --- Equivalent to `expand('%:t:r')` function handler.put(regname) return vim.fn.expand('%:t:r') end -- Make this register read-only by omitting the yank handler. handler.yank = nil -- Register this handler under the user register '$'. userregs.register_handler('$', handler) return {}