-
-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Opening DiffViewFileHistory without Folds #132
Comments
I'm glad to hear it!
There was a problem with the order in which hooks were called before, but after the latest commit you should be able to do something like: require("diffview").setup({
hooks = {
diff_buf_read = function(bufnr)
vim.cmd("norm! gg]ckzt") -- Set cursor on the first hunk
end,
diff_buf_win_enter = function(bufnr)
vim.opt_local.foldlevel = 99
end,
},
}) If you only want it to apply to file history views, you could do: diff_buf_win_enter = function(bufnr)
local FileHistoryView = require("diffview.views.file_history.file_history_view").FileHistoryView
local view = require("diffview.lib").get_current_view()
if view and view:instanceof(FileHistoryView) then
vim.opt_local.foldlevel = 99
end
end You could obviously also do Although, I have to ask: what is the point of this? In large files this will show a lot of irrelevant information, no? |
Closing due to inactivity from OP. |
This works great, apologies I didn't see this notification. Thank you! |
I can't seem to get this to work, is it possible that I have some local plugin that might be overriding the hooks? I'm trying the following: require("diffview").setup({
enhanced_diff_hl = true,
hooks = {
diff_buf_read = function(bufnr)
vim.opt_local.foldlevel = 99
vim.opt_local.foldenable = false
end,
diff_buf_win_enter = function(bufnr)
vim.opt_local.foldlevel = 99
vim.opt_local.foldenable = false
end
}
}) And I'm still seeing folds when using |
@norbertkeri Sorry, there was a regression related to the order of execution for hooks after a recent refactor. I just fixed this in the latest commit. Setting local options from these hooks should work as expected now. |
No worries, works perfect now, thank you! |
First off, thank you for the awesome plugin, I use it regularly.
Is it possible to configure the
:DiffviewFileHistory
command to open the diffs without folds? There's a similar discussion about Vim's built-in diff functionality here which is the same functionality that I'm hoping to accomplish.Hopping into each buffer and running
zR
to expand them every time I switch a entry in the history isn't really a practical way of accomplishing this. Thanks again!The text was updated successfully, but these errors were encountered: