sindrets / diffview.nvim

Single tabpage interface for easily cycling through diffs for all modified files for any git rev.
Other
3.57k stars 101 forks source link

[Bug] "win_opts = { foldcolumn = '0' }" doesn't hide the fold column #502

Closed charbelnicolas closed 1 month ago

charbelnicolas commented 1 month ago

Description

I have the following config:

require('diffview').setup({
    use_icons = false,
    enhanced_diff_hl = true,
    file_panel = {
        listing_style = 'list',
        win_config = {
            position = 'bottom',
            height = 10,
            win_opts = { signcolumn = 'no', foldcolumn = '0' }
        }
    },
    file_history_panel = {
        win_config = {
            position = 'bottom',
            height = 10,
            win_opts = { signcolumn = 'no', foldcolumn = '0' }
        }
    },
    icons = {
        folder_closed = '⯀',
        folder_open = '⬒'
    },
    signs = {
        fold_closed = '⯈',
        fold_open = '⯆',
        done = '✓'
    }
})

The fold column is still displayed instead of being hidden.

Expected behavior

I would expect the fold column to be hidden when using win_opts = { foldcolumn = '0' }

Actual behavior

The fold column is still shown unless I manually change the file.lua under lua/diffview/vcs to foldcolumn = "0"

Steps to reproduce

Add win_opts = { foldcolumn = '0' } to the diffview setup

Health check

diffview: require("diffview.health").check()

Checking plugin dependencies ~
- WARNING Optional dependency 'nvim-web-devicons' not found.

Checking VCS tools ~
- The plugin requires at least one of the supported VCS tools to be valid.
- OK Git found.
- OK Git is up-to-date. (2.45.1)
- WARNING Configured `hg_cmd` is not executable: 'hg'

Log info

No response

Neovim version

NVIM v0.11.0-dev-67+g0e9c92a900
Build type: RelWithDebInfo
LuaJIT 2.1.1713773202

Operating system and version

Linux 6.9.1-arch1-2 x86_64 GNU/Linux

Minimal config

No response

sindrets commented 1 month ago

file[_history]_panel.win_config configures window options for the UI panels in diff views and history views, not the diff buffers or their windows.

To change local options for the diff buffer / windows, use the hooks. See the example under :h diffview-config-hooks. You want to use the diff_buf_win_enter hook for this.

charbelnicolas commented 1 month ago

I'll try using the hook then, thank you.