From 04265fb7fcdac8168aa011b0f830b2f53d67fc8b Mon Sep 17 00:00:00 2001 From: Ammar Ahmed Date: Sun, 1 Dec 2024 00:27:47 -0500 Subject: [PATCH 1/4] test: change the window columns --- lua/command-completion.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/command-completion.lua b/lua/command-completion.lua index 2487b48..e05b39f 100644 --- a/lua/command-completion.lua +++ b/lua/command-completion.lua @@ -60,7 +60,7 @@ local function open_and_setup_win(height) relative = 'editor', border = user_opts.border, style = 'minimal', - width = vim.o.columns, + width = 10, height = height, row = vim.o.lines - 2, col = 0, From fcdc4bc92c0bc782daec68cb63760e085a00b103 Mon Sep 17 00:00:00 2001 From: Ammar Ahmed Date: Sun, 1 Dec 2024 00:36:58 -0500 Subject: [PATCH 2/4] test: passed parameter --- lua/command-completion.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lua/command-completion.lua b/lua/command-completion.lua index e05b39f..01b7592 100644 --- a/lua/command-completion.lua +++ b/lua/command-completion.lua @@ -22,6 +22,7 @@ local user_opts = { border = nil, max_col_num = 5, min_col_width = 20, + window_width = vim.o.columns, use_matchfuzzy = true, highlight_selection = true, highlight_directories = true, @@ -40,7 +41,7 @@ local directory_hl_nsid = n.create_namespace('__ccs_hls_namespace_directory___') local function calc_col_width() local col_width for i = 1, user_opts.max_col_num do - local test_width = math.floor(vim.o.columns / i) + local test_width = math.floor(window_width / i) if test_width <= user_opts.min_col_width then return col_width else @@ -60,7 +61,7 @@ local function open_and_setup_win(height) relative = 'editor', border = user_opts.border, style = 'minimal', - width = 10, + width = user_opts.window_width, height = height, row = vim.o.lines - 2, col = 0, From 66c032fced50d0e86b740faaeb225e6d89983968 Mon Sep 17 00:00:00 2001 From: Ammar Ahmed Date: Sun, 1 Dec 2024 00:38:41 -0500 Subject: [PATCH 3/4] fix: window width --- lua/command-completion.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/command-completion.lua b/lua/command-completion.lua index 01b7592..854fa21 100644 --- a/lua/command-completion.lua +++ b/lua/command-completion.lua @@ -41,7 +41,7 @@ local directory_hl_nsid = n.create_namespace('__ccs_hls_namespace_directory___') local function calc_col_width() local col_width for i = 1, user_opts.max_col_num do - local test_width = math.floor(window_width / i) + local test_width = math.floor(user_opts.window_width / i) if test_width <= user_opts.min_col_width then return col_width else From de764c021263d9dc3e1e91b9f822f8615f63528f Mon Sep 17 00:00:00 2001 From: Ammar Ahmed Date: Sun, 1 Dec 2024 00:46:20 -0500 Subject: [PATCH 4/4] docs: readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 454f59b..0b38dae 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ require('command-completion').setup { -- see `:help nvim_open_win()` for available options (e.g. 'single', 'double', etc.) max_col_num = 5, -- Maximum number of columns to display in the completion window min_col_width = 20, -- Minimum width of completion window columns + window_width = vim.o.columns, -- Width of the window (defaults to full width) use_matchfuzzy = true, -- Whether or not to use `matchfuzzy()` (see `:help matchfuzzy()`) -- to order completion results highlight_selection = true, -- Whether or not to highlight the currently