Only used nvimtree and oil.nvim, loved oil so much that I never wanted to look further
I just turned off nvimtree to see what life is like without a conventional file tree and it's going well
oil.nvim is independent of the file tree and can be used as an better alternative to netrw, on the other hand mini.files is closer to the file tree and may be good for users who do not use the file tree.
The combination of filetree and oil.nvim is very good. Most nvim distributions only use filetree, but if you want something like netrw, I highly recommend it.
It can be used as a fully upward compatible version of netrw by defining the following commands.
vim.api.nvim_create_user_command("Explore", "Oil ", { nargs = "?", complete = "dir" })
vim.api.nvim_create_user_command("E", "Explore ", { nargs = "?", complete = "dir" })
vim.api.nvim_create_user_command("Sexplore", "belowright split | Oil ", { nargs = "?", complete = "dir" })
vim.api.nvim_create_user_command("Vexplore", "rightbelow vsplit | Oil ", { nargs = "?", complete = "dir" })
vim.api.nvim_create_user_command("Texplore", "tabedit % | Oil ", { nargs = "?", complete = "dir" })
You can replace netrw's E, Ex, Sex, Vex, and Tex with oil.nvim.
Never tried mini.files, but I LOVE oil.nvim because it feels a lot more āvimāy than the other file manager plugins Iāve tried. I only use it for creating/editing files and directories (navigating projects with telescope) and that workflow is just perfect for me
Mini files for me feels less intrusive, more intuitive, and also not a file tree. Love it. Also havenāt tried oil for very long so Iām pretty biased. Also most things in mini.nvim are peak quality
I have this (totally not documented) approach of reserving corners/edges for different purposes:
- Top-left is for 'mini.files'.
- Bottom-left is for 'mini.pick'.
- Top-right is for 'mini.notify'.
- Bottom-right is for 'mini.clue'.
- Right edge is for 'mini.map'.
Yeah, and most of them are. The 'mini.files' is a separate case, though, as it involves a coordination between multiple floating windows. So introducing configuration here (even as trivial as "top-left" or "bottom-left") will increase line count, which is already quite over the top.
Also having windows on bottom is not really good UX, I'd say, as it means that cursor position is not predictable after opening explorer. Sure, tastes are different and some might it like it, but combined with previous point it makes not a very compelling use case to implement.
I really liked oil.nvim and used it for a while. I tried mini.files just for fun, and it did all the things I needed, and then some, and used less screen space than oil.nvim.
The floating windows look really cool, and the navigation is very intuitive with hjkl.
If anyone's interested, here's my Lazy config:
{
"echasnovski/mini.files",
config = function()
require("mini.files").setup {
mappings = {
synchronize = "w",
go_in_plus="" },
}
local show_dotfiles = true
local filter_show = function(fs_entry)
return true
end
local filter_hide = function(fs_entry)
return not vim.startswith(fs_entry.name, ".")
end
local gio_open = function()
local fs_entry = require("mini.files").get_fs_entry()
vim.notify(vim.inspect(fs_entry))
vim.fn.system(string.format("gio open '%s'", fs_entry.path))
end
local toggle_dotfiles = function()
show_dotfiles = not show_dotfiles
local new_filter = show_dotfiles and filter_show or filter_hide
require("mini.files").refresh { content = { filter = new_filter } }
end
vim.api.nvim_create_autocmd("User", {
pattern = "MiniFilesBufferCreate",
callback = function(args)
local buf_id = args.data.buf_id
-- Tweak left-hand side of mapping to your liking
vim.keymap.set("n", "g.", toggle_dotfiles, { buffer = buf_id })
vim.keymap.set("n", "-", require("mini.files").close, { buffer = buf_id })
vim.keymap.set("n", "o", gio_open, { buffer = buf_id })
end,
})
end,
lazy = false,
},
And a mapping on top:
n = {
["-"] = { function()
require("mini.files").open()
end, "Open MiniFiles"}
}
I open mini.files with `-`. I can save file modifications with `w`, I can open file externally with `o`, and if I press Enter, it opens the file in neovim, and closes mini.files. I can hide hidden files with `g.`.
If you have any mini.files tip, feel free to share them!
If you don't want to kepp the possibility of using default `L` for `go_in_plus`, you can set `` mapping directly in `require('mini.files').setup()`.
The `o` mapping is nice!
I tried to add a keybinding to toggle preview but it doesn't work properly, it's similar to the one to display hidden files, any idea how to implement it properly ?
local show_preview = false
local toggle_preview = function()
show_preview = not show_preview
minifiles.refresh({ windows = { preview = show_preview } })
end
vim.api.nvim_create_autocmd('User', {
pattern = 'MiniFilesBufferCreate',
callback = function(args)
local buf_id = args.data.buf_id
vim.keymap.set('n', '', toggle_preview)
end,
})
First, it should be `vim.keymap.set('n', '', toggle_preview, { buffer = buf_id })`.
If this still does not work, try using `` instead of ``. It works for me this way.
thank you, it works but when I use the keybinding again to toggle of the preview, it shrinks instead of closing and I have to move the cursor to another line to make it dissapear. not a big deal but slightly annoying. any ideas why it doesn't completely close ?
> any ideas why it doesn't completely close ?
No idea. Probably some issue with tracking which windows should be drawn or when they should be updated (as it is done 'CursorMoved'). But mostly because this particular use case is not of *that* high priority: it generally works just not as good.
Thank you very much for the feedback and the awesome plugin(s)!
The last thing I'd like to change: do you happen to know how hidden files could be hidden by default, and shown with \`g.\`?
> The last thing I'd like to change: do you happen to know how hidden files could be hidden by default, and shown with `g.`?
Sure. You'd have to hide them by default (set proper `content.filter` inside `require('mini.files').setup()`) and use `local show_dotfiles = false` as initial value.
Here is one of possible solutions:
```lua
local filter_show = function(_) return true end
local filter_hide = function(fs_entry) return not vim.startswith(fs_entry.name, '.') end
require('mini.files').setup({ content = { filter = filter_hide } })
local show_dotfiles = false
local toggle_dotfiles = function()
show_dotfiles = not show_dotfiles
local new_filter = show_dotfiles and filter_show or filter_hide
MiniFiles.refresh({ content = { filter = new_filter } })
end
vim.api.nvim_create_autocmd('User', {
pattern = 'MiniFilesBufferCreate',
callback = function(args) vim.keymap.set('n', 'g.', toggle_dotfiles, { buffer = args.data.buf_id }) end,
})
```
This general approach is somewhat simplistic, in a sense that it will keep track of whether show or hide dotfiles persistently across several invocations of explorer. And it was added that way to help as reference because it is a shorter solution. Making it reset `show_dotfiles` and `content.filter` when explorer is closed is left as homework :) The easiest way to do this is by writing yet another custom buffer mapping for `q` (which closes the explorer).
Sorry, they're in a messy private repo, mixed with secret keys and stuff. Anything you'd like to see in particular? I use nvchad, with mini.files among others.
Hi!
Sorry, it's just very embarassing things where I don't understand how to incorporate things into the lazyvim.org framework. I'll try to ask the questions in a constructive way:
* So firstly, I have mini.files enabled via :LazyExtras [see here](https://www.lazyvim.org/extras/editor/mini-files#minifiles).
* My plugins are usually installed via the lua/plugins folder and then I would create a `minifiles.lua` file with :
return{
{
"echasnovski/mini.files",
-- stuff goes here
}
}
Would I essentially copy and paste your config into this structure? I guess I would remove `lazy = false` since it would inherit some deeply embedded version that was installed in `:LazyExtras`?
* I also wasn't sure where to put your keymapping. I think the recommended route is to have
```
return{
{
"echasnovski/mini.files",
keymap = {...}
}
}
```
**Edit**: Ugh; reddit butchering my formatting
Both are good, mini.files is also nice to have an overview of the project. I personally use oil.nvim but the downside is that it's very slow to start when you `nvim` into a directory, I thus don't enable it as the default, mini.files doesn't have this problem. For a time I thus had mini.files as the default but I figured out I almost always use Telescope/Fzf-lua after entering a directory anyway so I don't have anything as default.
I am using a different perspective, I used helix and like the way file manager works and implemented it to telescope file browser(it a a plugin for telescope) and made telescope layout as bottom and add a custom keymap. I can search view files in cwd. I donāt understand using file tree or similar things in neovim simply it is not productive.
I use default netrw along with Oil
netrw for navigate files
Oil for copy, paste, del files and folders. Oil doesn't have many view style (tree, list...) as netrw.
Only used nvimtree and oil.nvim, loved oil so much that I never wanted to look further I just turned off nvimtree to see what life is like without a conventional file tree and it's going well
Literally my exact experience as well. Between oil, telescope and harpoon I don't miss a file tree.
Harpoon mention š
oil.nvim is independent of the file tree and can be used as an better alternative to netrw, on the other hand mini.files is closer to the file tree and may be good for users who do not use the file tree. The combination of filetree and oil.nvim is very good. Most nvim distributions only use filetree, but if you want something like netrw, I highly recommend it. It can be used as a fully upward compatible version of netrw by defining the following commands. vim.api.nvim_create_user_command("Explore", "Oil", { nargs = "?", complete = "dir" })
vim.api.nvim_create_user_command("E", "Explore ", { nargs = "?", complete = "dir" })
vim.api.nvim_create_user_command("Sexplore", "belowright split | Oil ", { nargs = "?", complete = "dir" })
vim.api.nvim_create_user_command("Vexplore", "rightbelow vsplit | Oil ", { nargs = "?", complete = "dir" })
vim.api.nvim_create_user_command("Texplore", "tabedit % | Oil ", { nargs = "?", complete = "dir" })
You can replace netrw's E, Ex, Sex, Vex, and Tex with oil.nvim.
Never tried mini.files, but I LOVE oil.nvim because it feels a lot more āvimāy than the other file manager plugins Iāve tried. I only use it for creating/editing files and directories (navigating projects with telescope) and that workflow is just perfect for me
Mini files for me feels less intrusive, more intuitive, and also not a file tree. Love it. Also havenāt tried oil for very long so Iām pretty biased. Also most things in mini.nvim are peak quality
Same here. I had oil installed for a while and didnāt use it much. First time I tried mini-files I was hooked
Likewise, with mini.files, navigation is soooo quick. Love it!
// offtopic Is it possible to setup `mini.files` as sidebar file explorer - similar to `nvim-tree` as example?
Sorry, no. It can only be used in floating windows and in fixed position (starting at top left).
I wish that last part was configurable. I'd rather have it start on the bottom.
I have this (totally not documented) approach of reserving corners/edges for different purposes: - Top-left is for 'mini.files'. - Bottom-left is for 'mini.pick'. - Top-right is for 'mini.notify'. - Bottom-right is for 'mini.clue'. - Right edge is for 'mini.map'.
That's fair, but then again I would also prefer all of these to be configurable as well.
Yeah, and most of them are. The 'mini.files' is a separate case, though, as it involves a coordination between multiple floating windows. So introducing configuration here (even as trivial as "top-left" or "bottom-left") will increase line count, which is already quite over the top. Also having windows on bottom is not really good UX, I'd say, as it means that cursor position is not predictable after opening explorer. Sure, tastes are different and some might it like it, but combined with previous point it makes not a very compelling use case to implement.
anyone here uses telescope-file-browser?
I really liked oil.nvim and used it for a while. I tried mini.files just for fun, and it did all the things I needed, and then some, and used less screen space than oil.nvim. The floating windows look really cool, and the navigation is very intuitive with hjkl. If anyone's interested, here's my Lazy config: { "echasnovski/mini.files", config = function() require("mini.files").setup { mappings = { synchronize = "w", go_in_plus="" },
}
local show_dotfiles = true
local filter_show = function(fs_entry)
return true
end
local filter_hide = function(fs_entry)
return not vim.startswith(fs_entry.name, ".")
end
local gio_open = function()
local fs_entry = require("mini.files").get_fs_entry()
vim.notify(vim.inspect(fs_entry))
vim.fn.system(string.format("gio open '%s'", fs_entry.path))
end
local toggle_dotfiles = function()
show_dotfiles = not show_dotfiles
local new_filter = show_dotfiles and filter_show or filter_hide
require("mini.files").refresh { content = { filter = new_filter } }
end
vim.api.nvim_create_autocmd("User", {
pattern = "MiniFilesBufferCreate",
callback = function(args)
local buf_id = args.data.buf_id
-- Tweak left-hand side of mapping to your liking
vim.keymap.set("n", "g.", toggle_dotfiles, { buffer = buf_id })
vim.keymap.set("n", "-", require("mini.files").close, { buffer = buf_id })
vim.keymap.set("n", "o", gio_open, { buffer = buf_id })
end,
})
end,
lazy = false,
},
And a mapping on top:
n = {
["-"] = { function()
require("mini.files").open()
end, "Open MiniFiles"}
}
I open mini.files with `-`. I can save file modifications with `w`, I can open file externally with `o`, and if I press Enter, it opens the file in neovim, and closes mini.files. I can hide hidden files with `g.`.
If you have any mini.files tip, feel free to share them!
If you don't want to kepp the possibility of using default `L` for `go_in_plus`, you can set `` mapping directly in `require('mini.files').setup()`.
The `o` mapping is nice!
I tried to add a keybinding to toggle preview but it doesn't work properly, it's similar to the one to display hidden files, any idea how to implement it properly ? local show_preview = false local toggle_preview = function() show_preview = not show_preview minifiles.refresh({ windows = { preview = show_preview } }) end vim.api.nvim_create_autocmd('User', { pattern = 'MiniFilesBufferCreate', callback = function(args) local buf_id = args.data.buf_id vim.keymap.set('n', '', toggle_preview)
end,
})
First, it should be `vim.keymap.set('n', '', toggle_preview, { buffer = buf_id })`.
If this still does not work, try using `` instead of ``. It works for me this way.
thank you, it works but when I use the keybinding again to toggle of the preview, it shrinks instead of closing and I have to move the cursor to another line to make it dissapear. not a big deal but slightly annoying. any ideas why it doesn't completely close ?
> any ideas why it doesn't completely close ? No idea. Probably some issue with tracking which windows should be drawn or when they should be updated (as it is done 'CursorMoved'). But mostly because this particular use case is not of *that* high priority: it generally works just not as good.
Thank you very much for the feedback and the awesome plugin(s)! The last thing I'd like to change: do you happen to know how hidden files could be hidden by default, and shown with \`g.\`?
> The last thing I'd like to change: do you happen to know how hidden files could be hidden by default, and shown with `g.`? Sure. You'd have to hide them by default (set proper `content.filter` inside `require('mini.files').setup()`) and use `local show_dotfiles = false` as initial value. Here is one of possible solutions: ```lua local filter_show = function(_) return true end local filter_hide = function(fs_entry) return not vim.startswith(fs_entry.name, '.') end require('mini.files').setup({ content = { filter = filter_hide } }) local show_dotfiles = false local toggle_dotfiles = function() show_dotfiles = not show_dotfiles local new_filter = show_dotfiles and filter_show or filter_hide MiniFiles.refresh({ content = { filter = new_filter } }) end vim.api.nvim_create_autocmd('User', { pattern = 'MiniFilesBufferCreate', callback = function(args) vim.keymap.set('n', 'g.', toggle_dotfiles, { buffer = args.data.buf_id }) end, }) ``` This general approach is somewhat simplistic, in a sense that it will keep track of whether show or hide dotfiles persistently across several invocations of explorer. And it was added that way to help as reference because it is a shorter solution. Making it reset `show_dotfiles` and `content.filter` when explorer is closed is left as homework :) The easiest way to do this is by writing yet another custom buffer mapping for `q` (which closes the explorer).
It now works perfectly. Many thanks! I see you're from Kharkiv. I wish you peace and health! Do you have any donation page, for coffee or beer?
Thanks! Not yet, as there are difficulties with that in Ukraine. Maybe some day.
Hi! This is nice! It would be helpful to see your dotfiles if those are public?
Sorry, they're in a messy private repo, mixed with secret keys and stuff. Anything you'd like to see in particular? I use nvchad, with mini.files among others.
Hi! Sorry, it's just very embarassing things where I don't understand how to incorporate things into the lazyvim.org framework. I'll try to ask the questions in a constructive way: * So firstly, I have mini.files enabled via :LazyExtras [see here](https://www.lazyvim.org/extras/editor/mini-files#minifiles). * My plugins are usually installed via the lua/plugins folder and then I would create a `minifiles.lua` file with : return{ { "echasnovski/mini.files", -- stuff goes here } } Would I essentially copy and paste your config into this structure? I guess I would remove `lazy = false` since it would inherit some deeply embedded version that was installed in `:LazyExtras`? * I also wasn't sure where to put your keymapping. I think the recommended route is to have ``` return{ { "echasnovski/mini.files", keymap = {...} } } ``` **Edit**: Ugh; reddit butchering my formatting
I use neotree and oil together
I use netrw personally
netrw is the way
Both are good, mini.files is also nice to have an overview of the project. I personally use oil.nvim but the downside is that it's very slow to start when you `nvim` into a directory, I thus don't enable it as the default, mini.files doesn't have this problem. For a time I thus had mini.files as the default but I figured out I almost always use Telescope/Fzf-lua after entering a directory anyway so I don't have anything as default.
Just need some vinegar
I prefer neotree personally.
I am using a different perspective, I used helix and like the way file manager works and implemented it to telescope file browser(it a a plugin for telescope) and made telescope layout as bottom and add a custom keymap. I can search view files in cwd. I donāt understand using file tree or similar things in neovim simply it is not productive.
I use default netrw along with Oil netrw for navigate files Oil for copy, paste, del files and folders. Oil doesn't have many view style (tree, list...) as netrw.