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 diff --git a/lua/command-completion.lua b/lua/command-completion.lua index 2487b48..854fa21 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(user_opts.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 = vim.o.columns, + width = user_opts.window_width, height = height, row = vim.o.lines - 2, col = 0,