1

I would like to define the following keys in Cmder:

Alt+Up -> move to parent directory (Ctrl+Alt+U)

Alt+Left -> move to previous directory (the one I was in before the last cd)

Alt+Right -> move to next directory


Any help ?

  • Which version of Cmder are you using? I haven't found in my version any directory-movement hotkeys. – harrymc Jun 22 '17 at 5:37
  • latest version. I don't understand what you're asking, if they were such hotkeys defined already I wouldn't be asking this ... – kofifus Jun 25 '17 at 1:30
  • Please post a link to your version. – harrymc Jun 25 '17 at 6:11
  • the 'download full' at cmder.net – kofifus Jun 25 '17 at 6:25
  • 1
    ctrl+alt+u switch to the directory above, if it doesn't work for you maybe clink did not install properly. The hotkeys are defined in vendors\clink\clink_inputrc_base but I don't know how to define alt+up there. Autohotkeys is not acceptable thx. – kofifus Jun 25 '17 at 9:01
2
+50

As you said AutoHotKeys is not acceptable, it is difficult to move to previous and next directory, but it can be done. I have added one way to achieve it, but moving up the directory is pretty simple.

  • Press Windows+Alt+P for settings and goto the Keys and Macros Section.
  • Select the Macros from the dropdown.
  • Select an empty Macro and Assign Alt+Up
  • Next in the GUI Macro, set the value as print("cd ..\n"). This will set the go back to parent directory. The \n in the print statement mimics an Enter keypress.

One way you can achieve to go back to the previous directory is by setting pushd as an alias to cd. For example, if you are using , you can set the alias like this: remove-item alias:\cd ; set-alias "cd" "pushd"

Now, you can set the Alt+Left key to print("popd\n") to go back to the previous location.

  • "Select an empty Macro and Assign Alt+Up" .. I am unable to do this, I can only capture Up but not Alt+Up .. did it work for you ? I don't want to override the default "Up" behaviour of history scrolling thx – kofifus Jun 25 '17 at 22:17
  • There are drop downs above the gui macro entry field, just select <kbd>alt</kbd> from there. – sauravsahu Jun 26 '17 at 2:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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