From 0051d7f33763088d4801ef9db90893735731c644 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=A1vio=20Knob?= Date: Tue, 20 May 2025 17:07:00 -0300 Subject: [PATCH] fix: move new config to the end of the defaults object --- lua/which-key/config.lua | 2 ++ lua/which-key/extras.lua | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lua/which-key/config.lua b/lua/which-key/config.lua index 474a2943..1d331c92 100644 --- a/lua/which-key/config.lua +++ b/lua/which-key/config.lua @@ -175,6 +175,8 @@ local defaults = { bt = {}, }, debug = false, -- enable wk.log in the current directory + -- https://vimdoc.sourceforge.net/htmldoc/cmdline.html#filename-modifiers + filename_modifier = ":~:.", --":t", } M.loaded = false diff --git a/lua/which-key/extras.lua b/lua/which-key/extras.lua index a89ef7e0..e9ad48ec 100644 --- a/lua/which-key/extras.lua +++ b/lua/which-key/extras.lua @@ -1,3 +1,5 @@ +local Config = require("which-key.config") + local M = {} ---@type table @@ -13,7 +15,13 @@ end function M.bufname(buf) local name = vim.api.nvim_buf_get_name(buf) - return name == "" and "[No Name]" or vim.fn.fnamemodify(name, ":~:.") + local filename_modifier = ":~:." + + if Config.options.filename_modifier and Config.options.filename_modifier ~= "" then + filename_modifier = Config.options.filename_modifier + end + + return name == "" and "[No Name]" or vim.fn.fnamemodify(name, filename_modifier) end ---@param spec wk.Spec[]