Open ariel-frischer opened 1 year ago
Would be happy to take a PR to implement something like this, maybe allowing the commands to take a visual range 🤷🏿♂️. Probably not going to work on this myself though, as I definitely don't have the time.
A vim macro should be a decent solution for this.
This is super late, but why not just use git checkout {branch_name} -- {filepath}
to checkout the file from the branch you want?
This is super late, but why not just use
git checkout {branch_name} -- {filepath}
to checkout the file from the branch you want?
Yea good point.
Hi, is this possible then? I don't know how to create that action, should we wait for a solution from the plugin author o could we implemente something on our own?
I'm for using a visual selection; that makes it much more general than the whole file.
I made a PR for this that adds visual mode remaps a few months ago, but it hasnt gotten any comments or anything from @akinsho so im not really sure if it's going to be merged
@CWood-sdf thanks for the PR I noticed it but have not really had the time to look into open source projects given work and life, let alone this is one of my smaller plugins 😅. It's on my todo list
It has been a while, but this is what I would do for this:
The command below puts all the conflicts in my quickfix list when a file with conflicts is detected (modified from the README)
vim.api.nvim_create_autocmd("User", {
pattern = "GitConflictDetected",
callback = function()
vim.notify("Conflict detected in: " .. vim.fn.expand("%:t") .. " ")
vim.schedule(function()
vim.cmd("GitConflictListQf")
vim.cmd("cclose")
end)
end,
})
I would then map this:
map('n', 'gco', '<cmd>cdo GitConflictChooseOurs<CR>)
(globally choose ours)
I have done this before! I personally do not have a mapping, as I feel this is not an action that should not be taken lightly. But i am not here to stop you!
I had a pr merged for this (#78 ) a while back. It allows you to use visual selection mode to resolve a range of conflicts. It's more powerful than having to do something for the entire file
I really like this plugin, only thing I wish it has would be some util functions Choose ours/theirs/both for the entire file. The use case is, I had a
yarn.lock
file where many conflicts occurred. It had over 400 conflicts which is actually normal for a larger codebase. Going to next conflict and resolving in this case is not feasible, I just created a quick macro and called it +400 times which worked but seems janky and inefficient. A command mode function for this situation seems appropriate.