You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
986 B
26 lines
986 B
-- Keymaps are automatically loaded on the VeryLazy event |
|
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua |
|
-- Add any additional keymaps here |
|
|
|
-- Terminal keymaps (<C-/> toggle with 99-count float, <leader>tt, <leader>ft) |
|
-- are registered by the snacks-terminal-ctl plugin (lua/plugins/terminal.lua). |
|
|
|
-- copy the current file name to the system clipboard (OSC52-aware, so it |
|
-- also works over ssh/tmux); C variant drops the extension |
|
local copy_file_name = function(with_extension) |
|
local name = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(0), ":t") |
|
if not with_extension then |
|
name = vim.fn.fnamemodify(name, ":r") |
|
end |
|
vim.fn.setreg("+", name) |
|
vim.notify("Copied: " .. name) |
|
end |
|
|
|
vim.keymap.set("n", "<leader>fc", function() |
|
copy_file_name(true) |
|
end, { desc = "Copy file name" }) |
|
|
|
vim.keymap.set("n", "<leader>fC", function() |
|
copy_file_name(false) |
|
end, { desc = "Copy file name (no extension)" }) |
|
|
|
|