kyoheiu / felix

tui file manager with vim-like key mapping
https://kyoheiu.dev/felix/
MIT License
737 stars 26 forks source link

How to compress #226

Closed tkkcc closed 1 year ago

tkkcc commented 1 year ago
  1. to compress a folder, i type :zip -r folder_name.zip folder_name. the bad part is type folder_name manually, even twice.
  2. seems we can't use reg in commandline. and we can't copy folder_name to system clipboard.
kyoheiu commented 1 year ago

Hi, thank you for pointing out. Yeah I feel it.

There are actually 3 key points:

  1. lack of tab completion of shell - from a quick look it seems difficult to implement this, at least in a straightforward way.
  2. feature to copy item name to clipboard - On the other hand this is technically possible: In another app I've implemented the ability to copy string to a specific clipboard (e.g. to wl-copy). Though it needs to specify which clipboard application you'd like to use, looking for environmental variable or adding optional field to config would be enough, and I feel it deserves.
  3. feature to compress item(s): 2 or 3 times I'd thought about this, but there would be many ways to implement this: Firstly which way to compress (e.g. zip, gz, zst...)? And secondly, should we allow users to choose one of them or exclusively use just one? It'd be hard to decide.

In addition, as you mentioned, it'd be useful to be able to use wildcard in shell mode, so I implemented that on feature-shell-out branch: It can execute e.g. :zip test test-*. Tested on bash, zsh and fish. If interested, please give this a try.

So, sorry for my long reply, but as a conclusion for now, I'm going to try implementing

  1. copying item name to clipboard`,
  2. and wildcard in shell mode.

If you have any comments, please let me know.

Edited:

kyoheiu commented 1 year ago

Created feature-copy-name branch: Add clipboard: <clipboard tool> to config.yaml and you can copy item name to that clipboard by pressing Ctrl + c. Tested on wl-copy for now.

tkkcc commented 1 year ago

clipboard is diverse. on server, i have to use osc52 to copy file name, full path, or parent path. it's implemented as a plugin for nnn, in several lines of bash. So a plugin system can be a solver to the diverse world. For simplicity, i use osc52 to copy in desktop too.

tkkcc commented 1 year ago

If we could use reg in commandline, which can be seen as a builtin clipboard. it also works on server.

kyoheiu commented 1 year ago

In feature-copy-name branch I implemented to spawn a new process that calls the application e.g. wl-copy, which user can define in config file, and pass the item name to it to copy to clipboard. This of course does not work if they do not have such a tool, and your case falls into this category, right? I'm unsure whether it'd be good to implement plugin to felix 🤔

Also, let me make things clear: what do you mean exactly by reg? regex?

kyoheiu commented 1 year ago

Or, :reg in Vim? It actually is implemented but in felix it means item itself: by e.g. "ayy item is yanked to register a, and can be put by "ap.

kyoheiu commented 1 year ago

If it's ok that we have just a builtin-register (in this case, of item name) and it disappears after exit, it'd be easy to work with... Just wondering which key binding would be best ;)

tkkcc commented 1 year ago

sorry. i always mean register. (o )ノ

tkkcc commented 1 year ago

vim use ctrl-r to use register in its commandline

kyoheiu commented 1 year ago

Cool. I'll give it a try!

kyoheiu commented 1 year ago

5f09a71e273269b9e83370b43ce0578a31597884 feature-copy-name now allows Ctrl + r in command line (called shell mode in this app). Currently only items in register zero are converted into its name and put into the line. Test like this: yy:<C-r>.

Todo: Allow to use other registers as well

kyoheiu commented 1 year ago

Released by v2.6.0 Thank you again!

tkkcc commented 1 year ago

tried. awesome!