Skip to content

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

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
raine opened this issue Sep 1, 2023 · 4 comments · Fixed by #2688
Closed

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

raine opened this issue Sep 1, 2023 · 4 comments · Fixed by #2688

Comments

@raine
Copy link

raine commented Sep 1, 2023

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.

@alex-courtis
Copy link
Member

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 ?

@gegoune
Copy link
Collaborator

gegoune commented Sep 2, 2023

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?

@alex-courtis
Copy link
Member

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
Copy link
Member

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

fastndead added a commit to fastndead/nvim-tree.lua that referenced this issue Mar 2, 2024
…logic to the default path resolution; adds bulk_move_get_default_path option
fastndead added a commit to fastndead/nvim-tree.lua that referenced this issue Mar 2, 2024
…logic to the default path resolution; adds bulk_move_get_default_path option
fastndead added a commit to fastndead/nvim-tree.lua that referenced this issue Mar 6, 2024
fastndead added a commit to fastndead/nvim-tree.lua that referenced this issue Mar 6, 2024
fastndead added a commit to fastndead/nvim-tree.lua that referenced this issue Mar 9, 2024
fastndead added a commit to fastndead/nvim-tree.lua that referenced this issue Mar 10, 2024
fastndead added a commit to fastndead/nvim-tree.lua that referenced this issue Mar 14, 2024
alex-courtis added a commit that referenced this issue Mar 15, 2024
* fix(#2395): marks.bulk.move defaults to directory at cursor

* fix(#2395): adds check if node_at_cursor.parent is nil

---------

Co-authored-by: Alexander Courtis <alex@courtis.org>
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants