Use cat -n for printing history to show cmd index

Currently the "history" command in Cmder prints commands without any index associated with any command, so you can copy/paste a command or use "!!" to execute a command from the history but, unlike BASH, you can't do "!<command_index>".

"cat" has a switch, "-n", which prints line numbers of the file being printed. This, in conjunction with "history_io=3" in Clink settings (to read/write history when editing a command") works just like BASH, i.e., you can use the index printed next to a command in the history to execute that command as "!<command_index>".
This commit is contained in:
Shahzeb Ihsan 2017-03-17 10:26:57 +08:00 committed by GitHub
parent 46d5936806
commit 0a5d1ac156

View File

@ -9,7 +9,7 @@ gl=git log --oneline --all --graph --decorate $*
ls=ls --show-control-chars -F --color $*
pwd=cd
clear=cls
history=cat %CMDER_ROOT%\config\.history
history=cat -n %CMDER_ROOT%\config\.history
unalias=alias /d $1
vi=vim $*
cmderr=cd /d "%CMDER_ROOT%"