cmderdev / cmder

Lovely console emulator package for Windows
https://cmder.app
MIT License
25.86k stars 2.03k forks source link

[Bug] loss of folder highlighting when calling "ls" #2873

Closed TNSaturday closed 11 months ago

TNSaturday commented 1 year ago

Version Information

Cmder version: 1.3.20.151
Operating system: Windows 11 22H2

Cmder Edition

Cmder Full (with Git)

Description of the issue

Prepend "ls -lah" command with a leading space and the output loses syntax highlighting (i.e. folders being shown in blue): image

How to reproduce

In any folder press space, then "ls -lah"

Additional context

No response

Checklist

daxgames commented 1 year ago

Then don't do that! 😉

chrisant996 commented 1 year ago

(Updated)

There is an ls doskey macro which expands to ls --show-control-chars -F --color.

Doskey macros are how aliases are done in cmd on Windows. Doskey macros are designed to only expand if they are the first thing on the command line. A space or command or >nul or anything else at the beginning of a command line disables doskey macro expansion.

It's not bug, it's just how they're designed to work. It means whenever you need to bypass a doskey macro, you can simply insert a space (similar to how you can bypass aliases in bash by adding quotes, e.g. ls runs an alias and 'ls' runs the raw ls program).

If you dislike how doskey macros behave, then you could use a batch script instead of a doskey macro.