summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugin/basename.lua9
1 files changed, 6 insertions, 3 deletions
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)