add bind to copy filename and position
This commit is contained in:
parent
2a2ebf952e
commit
780c269b7c
1 changed files with 11 additions and 0 deletions
|
|
@ -46,6 +46,17 @@ for _, key in ipairs({"A", "Z", "E", "Q", "S", "D"}) do
|
|||
s({ 'n' }, "<A-" .. string.lower(key) .. ">", "g'" .. key, { desc = "Jump to mark " .. key })
|
||||
end
|
||||
|
||||
function copy_filename_and_line ()
|
||||
local filename = vim.fn.expand("%:t")
|
||||
local line = vim.fn.line(".")
|
||||
local text = filename .. ":" .. line
|
||||
vim.fn.setreg("+", text)
|
||||
vim.print(text)
|
||||
end
|
||||
|
||||
s({ 'n' }, "y<c-g>", copy_filename_and_line, { desc = "Copy filename and line"})
|
||||
|
||||
|
||||
function moveCursorToMouse()
|
||||
local mousePos = vim.fn.getmousepos()
|
||||
vim.fn.setpos(".", { 0, mousePos.line, mousePos.column, 0 })
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue