fix: support yank line number
This commit is contained in:
@@ -136,11 +136,13 @@ local mappings = {
|
||||
t = { "<cmd>NvimTreeToggle<cr>", "toggle nvim tree" },
|
||||
r = { "<cmd>RnvimrToggle<cr>", "toggle rnvimr" },
|
||||
y = { "<cmd>lua require'utils'.yank_filepath()<cr>", "copy the file path" },
|
||||
d = { "<cmd>lua require'utils'.yank_file_dir()<cr>", "copy the file path" },
|
||||
l = { "<cmd>NvimTreeFindFile<CR>", "find file" },
|
||||
-- T = {"<cmd>let @+ = 'go test -v -run='+expand('<cword>')<cr>", "get current word in go test"},
|
||||
},
|
||||
g = {
|
||||
name = "+Git",
|
||||
m = {"<cmd>Gvdiff master:%<cr>", "Diff with master"},
|
||||
j = { "<cmd>lua require 'gitsigns'.next_hunk()<cr>", "Next Hunk" },
|
||||
k = { "<cmd>lua require 'gitsigns'.prev_hunk()<cr>", "Prev Hunk" },
|
||||
l = { "<cmd>lua require 'gitsigns'.blame_line()<cr>", "Blame" },
|
||||
|
||||
@@ -4,10 +4,19 @@ local lv_utils = {}
|
||||
-- copy current filepath to clipboard
|
||||
function lv_utils.yank_filepath()
|
||||
local p = vim.fn.expand('%:p')
|
||||
local line = vim.fn.line(".")
|
||||
p = p..":"..line
|
||||
print(p)
|
||||
vim.fn.setreg('+',p)
|
||||
end
|
||||
|
||||
function lv_utils.yank_file_dir()
|
||||
local p = vim.fn.expand('%:p:h')
|
||||
print(p)
|
||||
vim.fn.setreg('+',p)
|
||||
end
|
||||
|
||||
|
||||
function lv_utils.open_md()
|
||||
local p = vim.fn.expand('%:p')
|
||||
vim.fn.system("open -a typora "..p)
|
||||
|
||||
Reference in New Issue
Block a user