nvim-tree.lua icon indicating copy to clipboard operation
nvim-tree.lua copied to clipboard

Menu for file management

Open marioortizmanero opened this issue 4 years ago • 7 comments

Hi there,

I love this plugin, but the only thing holding me back from switching from NERDTree is that AFAIK there's no menu for file management. I really would rather not learn a lot of bindings for just a file manager (mainly because I only use them occasionally), and NERDTree makes this easy with its menu, activated by pressing m:

image

I haven't found any issues or discussion about this, does nvim-tree plan on implementing something like this?

marioortizmanero avatar May 04 '21 16:05 marioortizmanero

Hi, I don't think it would be hard to implement, if someone wants too, i'd accept a PR :)

kyazdani42 avatar May 17 '21 19:05 kyazdani42

Can I get this? I'm currently started implementing this feature!

lrnzlo avatar Apr 08 '22 15:04 lrnzlo

go for it !

kyazdani42 avatar Apr 08 '22 16:04 kyazdani42

As #362 as pointed out it can be cool to have a floating menu to select actions instead of using key map. This feature is currently under development but I've think that can help let people try it out and express their desired feature or suggestions.

I think that is better to leave this feature on this branch until give the code a refactoring for better implementation. As for now there is 3 actions avaible: copy path, copy name, edit no picker.

Run the plugin from this branch then press 'm' inside NvimTreeExplorer to open the menu and select the desired action. From packer this can be done via the branch options

use { 'kyazdani42/nvim-tree.lua', branch = 'file-management-menu-#362', config = function()
    require("nvim-tree").setup {} end
}

once @kyazdani42 as accepted the pull request without merging into master or via lrnzlo/nvim-tree.lua if for technical/development reason that's not possible.

Please @kyazdani42 and @marioortizmanero let me know if something idea :) As for now, I don't have update any documentation as I don't consider this a official version of the feature and I don't think is stable/mature enough to be merged into the main repo.

I keep working on this to get to a better result. This as to be intended as an EXPERIMENTAL feature.

lrnzlo avatar Apr 13 '22 15:04 lrnzlo

I think a long running branch is a good idea. The first PR looks good, but it is a work in progress. Feedback/testing/additions from users would be valuable.

alex-courtis avatar Apr 14 '22 00:04 alex-courtis

I've keep working on the feature this morning. I've implemented the setup function and the logic behind the action exec. At this point only the actions present in nvim-tree.actions.mappings can be executed, custom function will be avaible soon. Now the user can add or remove options via

setup {
    menu = {
        actions = {
            ['title_of_options'] = 'action_from_nvim-tree.actions.mappings',
            ['Copy File Name'] = 'copy_name'
        }
    }
}

I think it's ok to keep a default set of options. Which options should be? 4-5? Example: copy_paste, open_file etc.... @marioortizmanero which options has you in mind when open this issue? :smiley:

lrnzlo avatar Apr 14 '22 10:04 lrnzlo

I had in mind the same ones configured for NERDTree, basically. But it can be tweaked if you consider it better in another way, of course.

marioortizmanero avatar Apr 18 '22 10:04 marioortizmanero

Any updates on this one @lrnzlo ? This will be a useful feature.

alex-courtis avatar Oct 23 '22 04:10 alex-courtis

If someone was interested, I implemented something similar using Telescope as a custom dropdown (cursor) picker. You can see it here

Tolomeo avatar Dec 16 '22 17:12 Tolomeo

If someone was interested, I implemented something similar using Telescope as a custom dropdown (cursor) picker. You can see it here

That's amazing!

I'd be grateful if you could add that Recipe to the wiki

alex-courtis avatar Dec 18 '22 04:12 alex-courtis

See https://github.com/Tolomeo/nvim-tree.lua/wiki/Recipes#creating-an-actions-menu-using-telescope for a full solution.

alex-courtis avatar Dec 22 '22 23:12 alex-courtis