fix: support yank line number

This commit is contained in:
2022-10-24 14:18:46 +08:00
parent f8ce101c7e
commit f76fd515d5
5 changed files with 42 additions and 8 deletions
+2
View File
@@ -0,0 +1,2 @@
vim.cmd('set ts=2') -- Insert 2 spaces for a tab
vim.cmd('set sw=2') -- Change the number of space characters inserted for indentation
+2
View File
@@ -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" },
+9
View File
@@ -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)