kyoheiu / felix

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

Mark mode #265

Open aminnairi opened 6 months ago

aminnairi commented 6 months ago

It would be great to include another selection in order to mark multiple non-adjacent files.

The rationale is that there already is a linewise mode that helps visually selecting multiple files, but this mode will only allow selecting files that are adjacent.

[ file1.txt ]
[ file2.txt ]
[ file3.txt ]
[ file4.txt ]
file5.txt

Here the files marked as [...] are the files that would normally get marked using the linewise mode.

However, if one would like to quickly delete/yank/bulk rename (see #264) this would mean doing it in two steps, and it can be faster to do it in one take.

The solution I would like to see in Felix is to add another keybind, I see it as a file to the list of selected files.

This would allow the user to select only the files file.txt, file2.txt, file4.txt without having to highlight the file3.txt if this one file is out of the way for the actions needed to be applied to those files.

[ file1.txt ]
[ file2.txt ]
file3.txt
[ file4.txt ]
file5.txt

However, for now, if one would like to only, let's say, delete those files, it would require using a linewise mode with a delete, followed by another delete. And for more complex file selections this can become quite tedious to do.

Hence why this would be great to introduce a new mark mode so that we can mark files for differents actions.

Here is an example of what the documentation would look like.

m (lowercase)       Switch to the mark mode.
  - V (uppercase)   In the mark mode, mark multiple adjacent files. Press ENTER to confirm.
  - v (lowercase)   In the mark mode, mark one file.
  - d               In the mark mode, delete the marked files.
  - y               In the mark mode, yank the marked files.
  - r               In the mark mode, bulk rename the marked files.
  - "ay             In the mark mode, yank items to register a.
  - "ad             In the mark mode, delete and yank items to register a.
  - "ar             In the mark mode, bulk rename items to register a.
  - "Ay             In the mark mode, yank and append items to register a.
  - "Ad             In the mark mode, delete and append items to register a.
  - "Ar             In the mark mode, bulk rename and append items to register a.

Another name for this mode could be the selection mode which is a little bit more obvious if mark is reserved and can be used for another feature (like a real mark and quick jump like in Vim).