blob: 8b875d1be003a1c6605391904fb3a450b7d41e2c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
-- 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 with one
-- extension removed.
--
-- Useful for Java when needing to reference the class.
--
-- This register is assigned to the character '$'
local userreg = require("vim.userreg")
local api = vim.api
local handler = {}
function handler.do_yank(self, content)
return -1 -- Read-only register.
end
function handler.do_put()
return vim.fn.expand('%:t:r')
end
userreg.register_handler('$', handler)
|