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

When bulk moving, set destination based on the directory under cursor

Open raine opened this issue 2 years ago • 4 comments

Describe the solution you'd like

When using bulk move (bmv) to move files, it would be great if the directory on the line where cursor is located would be set automatically in the prompt that appears when initiating bulk move:

Move to: /path/to/directory/where/cursor/is

Currently the prompt is set the current working directory.

Would be awesome, thanks.

raine avatar Sep 01 '23 08:09 raine

I noticed this the other day. This prompt is inconsistent with other operations e.g. paste and is not very useful.

Options:

  1. Set the path based on the node as above
  2. Just move without a prompt

We could combine the two with an option:

marks.bulk.move({opts})                      *nvim-tree-api.marks.bulk.move()*
    Move all marked nodes to the folder under the cursor.
    Uses the parent folder when the cursor is on a file.

    Parameters: ~
    • {opts} (table) optional parameters

    Options: ~
    • {prompt} (boolean) prompt for a directory before moving

It's a break, but I think it's a reasonable one. What do you reckon @gegoune ?

alex-courtis avatar Sep 02 '23 01:09 alex-courtis

I don't mind breaking changes.

But if we are breaking do we want to do anything else as well? Do we maybe want to add path that will move files to that directory. Not sure how useful it is. Actually, adding it later wouldn't really be a breaking change, would it?

gegoune avatar Sep 02 '23 08:09 gegoune

Do we maybe want to add path that will move files to that directory. Not sure how useful it is.

That would be rather useful.

opts can always be added to later without breaking, however it would be convenient to just do it now.

marks.bulk.move({opts})                      *nvim-tree-api.marks.bulk.move()*
    Move all marked nodes to the folder under the cursor.
    Uses the parent folder when the cursor is on a file.

    Parameters: ~
      • {opts} (table) optional parameters

    Options: ~
      • {prompt} (boolean) prompt for a directory before moving
      • {path}   (string) absolute or relative destination path, overriding the node's

alex-courtis avatar Sep 03 '23 01:09 alex-courtis

It may be possible to add a path to fs.paste however I think I'm feature creeping here.

alex-courtis avatar Sep 03 '23 01:09 alex-courtis