superfile icon indicating copy to clipboard operation
superfile copied to clipboard

Action menu on selected/pointed files/folders

Open mcgru opened this issue 1 year ago • 3 comments

Is your feature request related to a problem? Please describe. I often need to do some repetitive task on a set of selected files/folders

Describe the solution you'd like Please, look how midnight commander did their user (action) menu on pressing F2 in panel mode. I'd like to propose the same functionality - keep list of tasks, run one selected on a group of selected files.

Additional context Please check F2-menu in Midnight Commander

mcgru avatar May 31 '24 11:05 mcgru

F2-@                      Run a command on the currently highlighted item, e.g.:
        F2-@ unzip                Unzip selected file
        F2-@ zip -r foo.zip       Zip current directory as foo.zip
        F2-@ 7za x                Extract selected file with 7zip
        F2-@ 7za a foo.7z         7zip current directory as foo.7z

If I understand correctly this is basically a way to put pre-written commands in a menu so that you can do repetitive tasks faster, right?

Or you can provide more information :) (sorry i didn't use middle commander before)

yorukot avatar May 31 '24 15:05 yorukot

Sorry, i'm not enough laconic to describe. If you install Midnight Commander and run it, there will be ~/.config/mc/mc.menu that contains menu items. Some of their syntax is difficult to understand, but some ones are quite easy.

For examble, these are menu items that compress/decompress gzip and bzip2 files/archives: `

  • t t Y Gzip or gunzip tagged files for i in %t do unset DECOMP case "$i" in *.gz) DECOMP=-d;; *.[zZ]) DECOMP=-d;; esac gzip $DECOMP -v "$i" done

  • ! t t b Bzip2 or bunzip2 current file unset DECOMP case %f in *.bz2) DECOMP=-d;; esac bzip2 $DECOMP -v %f ` So if you select files in panel, and press F2 followed by 'Y' - mc will gzip them, F2+b will compress them using bzip2, etc ...

mcgru avatar Jun 03 '24 04:06 mcgru

I would also be very much interested in that feature. I am using a plugin with a similar feature in nvim called nerdtree. They call their action menu NERDTreeMenu, maybe this could give you some inspiration for a potential implementation: https://github.com/preservim/nerdtree/blob/master/doc/NERDTree.txt#L641

This is how the menu looks in nerdtree when I am using it. I select a file -> click m -> select the action I want to do or just click the letter that is mapped to this action like clicking r to reveal the selected file in the finder (MacOS file explorer) Here is a screencast of that behaviour: https://github.com/yorukot/superfile/assets/37550860/2765afe6-fc8f-46a9-a501-cf79dc83bf99

I you need any feedback with this potential feature, I am always happy to help 😊 I could also try to implement it with some simple actions if you want, but I am not experienced with go at all, but could give it a try 😅

jonasherr avatar Jun 11 '24 10:06 jonasherr