Skip to content

Add cut,copy and paste functionality. #52

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 21, 2020

Conversation

kristijanhusak
Copy link
Contributor

This PR adds cut, copy and paste functionality that I mentioned in issue #51

Note that I don't have much experience with Lua, so do as detailed review as possible.

@kristijanhusak kristijanhusak force-pushed the feature/cut-copy-paste branch from 85850dd to 9b20fcb Compare July 16, 2020 09:50
@kyazdani42
Copy link
Member

thanks :) I'll review this PR in depth later but it looks already pretty good imo.

@kristijanhusak
Copy link
Contributor Author

kristijanhusak commented Jul 21, 2020

I think handling of existing files on copy/move needs to be handled. Now it will just throw an error, but I guess it should prompt for override/cancel. Will try to add it.

Edit: Prompt added.

@kristijanhusak kristijanhusak force-pushed the feature/cut-copy-paste branch from dd511d0 to 86ff3b7 Compare July 21, 2020 06:58
Copy link
Member

@kyazdani42 kyazdani42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work.
I wonder if you could add some kind of popup information or buffer list that would show information about the state of the clipboard ? This could also be done in another PR.

lua/lib/fs.lua Outdated
if not success then
api.nvim_err_writeln('Could not '..action_type..' '..entry.absolute_path..' - '..msg)
end
::continue::
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

goto is not available for some distributions of neovim (as neovim uses lua 5.1 where goto is not available). You could leave it for now as i still have some piece of code with gotos but this issue will need to be addressed in another PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the logic to not use continue.

@kristijanhusak
Copy link
Contributor Author

Yeah I can add something. Maybe echo will be sufficient?
Do you want to have it like a mapping or command?

@kyazdani42
Copy link
Member

a command would be more appropriate. Echo should be enough indeed

@kristijanhusak
Copy link
Contributor Author

I added :LuaTreeClipboard command. See if the format is ok.

Copy link
Member

@kyazdani42 kyazdani42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ! Thanks :)

@kyazdani42 kyazdani42 merged commit 7743d90 into nvim-tree:master Jul 21, 2020
Almo7aya pushed a commit to Almo7aya/nvim-tree.lua that referenced this pull request Oct 11, 2022
…paste

Add cut,copy and paste functionality.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants