fix: support yank line number
This commit is contained in:
@@ -110,12 +110,16 @@ export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebr
|
||||
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"
|
||||
export HOMEBREW_NO_AUTO_UPDATE=true # 禁止 brew 每次安装软件都 upate
|
||||
|
||||
# git
|
||||
export REVIEW_BASE="master"
|
||||
|
||||
# go
|
||||
export GOPATH=$HOME/go
|
||||
export PATH=$PATH:$GOPATH/bin
|
||||
export GOPROXY=goproxy.cn
|
||||
export GOSUMDB="sum.golang.google.cn"
|
||||
|
||||
|
||||
[ -f ~/.zprofile ] && source ~/.zprofile
|
||||
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
|
||||
|
||||
|
||||
+25
-8
@@ -6,6 +6,14 @@
|
||||
quotepath = false
|
||||
editor = /usr/local/bin/nvim
|
||||
excludesfile = ~/.dotfile/git/.gitignore
|
||||
[push]
|
||||
default = current
|
||||
[merge]
|
||||
tool = vimdiff
|
||||
[include]
|
||||
path = ~/.subgitconfig
|
||||
[branch]
|
||||
autoSetupMerge = always
|
||||
[alias]
|
||||
au = add -u
|
||||
co = checkout
|
||||
@@ -20,11 +28,20 @@
|
||||
delbr = "!f(){ git branch -D $(git branch | grep \"\b$1\"); };f"
|
||||
can = commit --amend --no-edit
|
||||
cleanbr = "!git branch --merged master | grep -v '\\*\\|master\\|main' | xargs -n 1 git branch -d"
|
||||
[push]
|
||||
default = current
|
||||
[merge]
|
||||
tool = vimdiff
|
||||
[include]
|
||||
path = ~/.subgitconfig
|
||||
[branch]
|
||||
autoSetupMerge = always
|
||||
# list files which have changed since REVIEW_BASE
|
||||
# (REVIEW_BASE defaults to 'master' in my zshrc)
|
||||
files = !git diff --name-only $(git merge-base HEAD \"$REVIEW_BASE\")
|
||||
|
||||
# Same as above, but with a diff stat instead of just names
|
||||
# (better for interactive use)
|
||||
stat = !git diff --stat $(git merge-base HEAD \"$REVIEW_BASE\")
|
||||
# Open all files changed since REVIEW_BASE in Vim tabs
|
||||
# Then, run fugitive's :Gdiff in each tab, and finally
|
||||
# tell vim-gitgutter to show +/- for changes since REVIEW_BASE
|
||||
review = !vim -p $(git files) +\"tabdo Gdiffsplit $REVIEW_BASE\" +\"let g:gitgutter_diff_base = '$REVIEW_BASE'\"
|
||||
|
||||
# Same as the above, except specify names of files as arguments,
|
||||
# instead of opening all files:
|
||||
# git reviewone foo.js bar.js
|
||||
reviewone = !vim -p +\"tabdo Gdiff $REVIEW_BASE\" +\"let g:gitgutter_diff_base = '$REVIEW_BASE'\"
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -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