From 496be085b855d0192753d933313536929671a9d3 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Fri, 19 Aug 2022 11:56:52 -0600 Subject: Change basename to exclude the extension --- plugin/basename.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'plugin/basename.lua') diff --git a/plugin/basename.lua b/plugin/basename.lua index 81cc971..8b875d1 100644 --- a/plugin/basename.lua +++ b/plugin/basename.lua @@ -1,7 +1,10 @@ -- Implementation of the basename register. -- -- The basename register is like the filename register ("%), but instead of --- returning the whole filename, it will return just the basename. +-- returning the whole filename, it will return just the basename with one +-- extension removed. +-- +-- Useful for Java when needing to reference the class. -- -- This register is assigned to the character '$' @@ -11,11 +14,11 @@ local api = vim.api local handler = {} function handler.do_yank(self, content) - return + return -1 -- Read-only register. end function handler.do_put() - return vim.fn.expand('%:t') + return vim.fn.expand('%:t:r') end userreg.register_handler('$', handler) -- cgit