-
Contributing guidelines
Module(s)mini.files QuestionPressing , they are not affected by I like my P.S. Unrelated, but is possible to extend the preview to "the rest of the available space" (width/length-wise)? I tried |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
|
Hello @csswright, Thanks for the questions!
There is,
I think they are affected by timeoutlen: vim.pack.add({ 'https://github.com/nvim-mini/mini.nvim' })
require('mini.files').setup()
-- The default timeoutlen is 1000ms
vim.keymap.set('n', 'gy', function() vim.notify('gy') end)
vim.keymap.set('n', 'gY', function() vim.notify('gY') end)
If I run
I don't think this is possible, but I am not sure. @echasnovski?
You can try this code: local full_preview = function(args)
local state = MiniFiles.get_explorer_state()
if state == nil then return end
-- Return when event is not for focused window
local focused_path = state.branch[state.depth_focus]
local idx_focused
for i, win in ipairs(state.windows) do
if win.path == focused_path and win.win_id == args.data.win_id then idx_focused = i end
end
if idx_focused == nil then return end
-- Given focused window, the preview window must be the next
local preview_idx = idx_focused + 1
-- Only maximize when preview window is the last window
if preview_idx ~= #state.windows then return end
local preview_id = state.windows[preview_idx].win_id
local preview_config = vim.api.nvim_win_get_config(preview_id)
preview_config.width = vim.o.columns - (preview_config.col + 2)
vim.api.nvim_win_set_config(preview_id, preview_config)
end
require('mini.files').setup({ windows = { preview = true } })
local gr = vim.api.nvim_create_augroup('custom-config', {})
local new_autocmd = function(event, pattern, callback, desc)
local opts = { group = gr, pattern = pattern, callback = callback, desc = desc }
vim.api.nvim_create_autocmd(event, opts)
end
new_autocmd('User', 'MiniFilesWindowUpdate', full_preview, 'Ensure full preview')
|
Beta Was this translation helpful? Give feedback.
-
I am not quite sure what that means. Is it "press Could you please elaborate on this? |
Beta Was this translation helpful? Give feedback.
Hello @csswright,
Thanks for the questions!
There is,
g?itselfI think they are affected by timeoutlen:
If I run
nvimwith only the code above, press g, wait for more than a second and press y, nothing happens. EDIT: As expected...