[mini.files] traverse three styles: Left, center and right #2448
Replies: 3 comments 3 replies
-
I don't immediately like the idea of this type of event. Probably mostly because it leads to a duplication of events (if always essentially triggered after the last So it is not a "no", but "I don't think I like this at the moment". |
Beta Was this translation helpful? Give feedback.
-
|
I updated the code a little bit. If a window cannot be shown, I am using the If a window cannot show all content, I am adding a footer displaying the number of lines in the buffer: -- Added to center_set_config:
local line_count = vim.api.nvim_buf_line_count(vim.api.nvim_win_get_buf(win_id))
local footer = ''
if line_count > config.height then
footer = string.format(' %d/%d ', vim.api.nvim_win_get_cursor(win_id)[1], line_count)
end
config.footer = { { footer, 'MiniFilesTitle' } }
config.footer_pos = 'right' |
Beta Was this translation helpful? Give feedback.
-
|
this is a neat idea... I wouldn't use a "L" or "R" style, but it got me thinking what about a "F" (fullscreen) toggle, where the open explorer windows fill up the whole view? It would be useful when opening mini.files as a netrw replacement |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
mini_files_layouts.mp4
The new module, mini.input, allows the user to traverse the various styles of the view. It is mentioned in the 'Miscellaneous' section of
:h MiniInput.default_key().This is my attempt to have something similar in
mini.files. The styles are "L", "C" and "R".It's mostly for fun, but could be practical when an important piece of text is hidden by the explorer.
I admire the "custom side-scrolling layout" introduced in this discussion. That layout is, with some changes, included as style "C". Thanks @edisj for a great idea!
Since this commit, the implementation of the "custom side-scrolling layout" can be approached a bit differently. Now, when a
MiniFilesWindowUpdatefires, all windows have already been processed:vim.api.nvim_buf_get_name(ev.data.buf_id):match('^minifiles://%d+/(.*)$').colin one pass.@echasnovski, would you accept a PR adding an extra
MiniFilesExplorerUpdateevent? Its data could contain the index of the focused window instate.windows. Its purpose is similar toMiniFilesWindowUpdate, but it only fires once instead of per window.One downside of the centered layout is it being more difficult to determine that all files in a directory are shown. Perhaps it would be nice to have a footer showing a symbol when that is not the case.
The code:
files.lua
A suggestion of the "center" layout when added to
mini.filesitself:mini.files.lua
Beta Was this translation helpful? Give feedback.
All reactions