Skip to content

Commit

Permalink
feat(window): allow customizing the border
Browse files Browse the repository at this point in the history
Neovim ships with many options for the border. Expose all the options
through yazi.

I think this should also support coloring and other highlight group
features, as well as customizing the border in a lot of detail, but I
have not tested these myself. At least the basic border type options
worked in my tests.
  • Loading branch information
mikavilpas committed Apr 19, 2024
1 parent eb7cf24 commit 410c9ed
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ You can optionally configure yazi.nvim by setting any of the options below.
-- when yazi opened multiple files. The default is to send them to the
-- quickfix list, but if you want to change that, you can define it here
yazi_opened_multiple_files = function(chosen_files, config) end,

-- the type of border to use for the floating window. Can be many values,
-- including 'none', 'rounded', 'single', 'double', 'shadow', etc. For
-- more information, see :h nvim_open_win
yazi_floating_window_border = 'rounded',
},
},
}
Expand Down
1 change: 1 addition & 0 deletions lua/yazi/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function M.default()

floating_window_scaling_factor = 0.9,
yazi_floating_window_winblend = 0,
yazi_floating_window_border = 'rounded',
}
end

Expand Down
1 change: 1 addition & 0 deletions lua/yazi/types.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
---@field public hooks? YaziConfigHooks
---@field public floating_window_scaling_factor? float "the scaling factor for the floating window. 1 means 100%, 0.9 means 90%, etc."
---@field public yazi_floating_window_winblend? float "the transparency of the yazi floating window (0-100). See :h winblend"
---@field public yazi_floating_window_border? any "the type of border to use. See nvim_open_win() for the values your neovim version supports"

---@class YaziConfigHooks
---@field public yazi_opened fun(preselected_path: string | nil, buffer: integer, config: YaziConfig):nil
Expand Down
2 changes: 1 addition & 1 deletion lua/yazi/window.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function YaziFloatingWindow:open_and_display()
col = col,
width = width,
height = height,
border = 'rounded',
border = self.config.yazi_floating_window_border,
}

local yazi_buffer = vim.api.nvim_create_buf(false, true)
Expand Down

0 comments on commit 410c9ed

Please sign in to comment.