Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Is it possible to paste the selected filename into the copy popup, so when I hit F5 this filename will be in the 'to' section, so I can adjust it?

For example:

I want to copy /home/piotr/testFile.log to /home/piotr/testFile2.log.
I open both panels in the same directory and hit F5, but the 'to' value is: /home/piotr and I would like it to be /home/piotr/testFile.log, so I can simply adjust the name instead of typing it from the scratch.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Use Shift-F5 instead (or Shift-F6 for renaming) – the dialog will have the to field filled with current file's name (without the path).

Sadly those combinations not work in certain circumstances. No idea if it depends on MC build, terminal or some used library. So I also added this in ~/.mc/menu as an alternative:

5       Copy
        read -e -i "%f" -p 'Copy file : ' name
        [[ "$name" && "$name" != "%f" ]] && cp "%f" "$name"

6       Rename
        read -e -i "%f" -p 'Rename file : ' name
        [[ "$name" && "$name" != "%f" ]] && mv "%f" "$name"

Then I just select the file, hit F2, 5 (or 6 for renaming) then edit the name and press Enter. It requires bash 4 or newer, due to the read's -i option.

share|improve this answer
    
Works like a charm (at least in my build)! Much obliged. –  Piotr Nowicki Feb 15 '12 at 10:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.