Skip to content

feat: add api.fs.copy.basename, default mapping ge #2698

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 6 commits into from
Mar 14, 2024
Merged

feat: add api.fs.copy.basename, default mapping ge #2698

merged 6 commits into from
Mar 14, 2024

Conversation

itsramiel
Copy link
Contributor

Hi there 👋

I would like to propose a new keymap, which is copying basename of a file. I believe in most OOP and functional programming language it is very common to create a file for a class/function and name the file and the class/function the same, so the process goes like creating a somelongNameThatIDontWantToTypeAgain.js file and then wanting to create a function with the same name. Currently I use y and then manually delete the extension. I personally dont think I have ever used the y as it is and only to copy and then delete the extension.

I hope you can see the value in having such a keymap. The mapping l was random. I just used what is still available and can change it to whatever you like.

Hope you find it useful too. I think it'll impact lots of users.

Copy link
Member

@alex-courtis alex-courtis left a comment

Choose a reason for hiding this comment

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

That will be really handy. Works as expected.

We do need to change the mapping:

  • users expect l to act as per default vim behaviour

@alex-courtis
Copy link
Member

Our copy mappings aren't great:

 Y              Copy Relative Path
 c              Copy
 gy             Copy Absolute Path
 y              Copy Name

I'm using

c              Copy                      
yn             Copy Name                
yr             Copy Relative Path      
yy             Copy Absolute Path

Unfortunately we can't change the defaults. ge might be the best we can do; it's somewhat consistent with gy and e.

@alex-courtis alex-courtis changed the title feat: add copy basename feat: add api.fs.copy.basename, default mapping ge Mar 9, 2024
@itsramiel
Copy link
Contributor Author

Our copy mappings aren't great:

 Y              Copy Relative Path
 c              Copy
 gy             Copy Absolute Path
 y              Copy Name

I'm using

c              Copy                      
yn             Copy Name                
yr             Copy Relative Path      
yy             Copy Absolute Path

Unfortunately we can't change the defaults. ge might be the best we can do; it's somewhat consistent with gy and e.

Nice mappings. I think I'll use them.
Btw updated mapping

Copy link
Member

@alex-courtis alex-courtis left a comment

Choose a reason for hiding this comment

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

Working, just needs style and help fixes.

First time contributors don't get automated CI ;)

@itsramiel itsramiel requested a review from alex-courtis March 10, 2024 12:32
@itsramiel
Copy link
Contributor Author

I believe it is ready

Copy link
Member

@alex-courtis alex-courtis left a comment

Choose a reason for hiding this comment

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

Many thanks for all your work!

@alex-courtis alex-courtis merged commit 8f2a50f into nvim-tree:master Mar 14, 2024
5 checks passed
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