cmder icon indicating copy to clipboard operation
cmder copied to clipboard

Modifying [cmder_prompt_config.lua] does not change "λ" prompt in bash/powershell

Open SkinAir opened this issue 2 years ago • 8 comments

图片 图片

SkinAir avatar Jul 07 '22 16:07 SkinAir

Found many articles, but failed to modify them“ λ "And line breaks, thank, help me answer

SkinAir avatar Jul 07 '22 16:07 SkinAir

I don't understand the issue. I change this file and my prompt changes.

Please clarify.

daxgames avatar Jul 18 '22 16:07 daxgames

I don't understand the issue. I change this file and my prompt changes.

Please clarify.

thank you.

SkinAir avatar Jul 19 '22 01:07 SkinAir

The issue is that cmder_prompt_config.lua is for cmd.exe/clinks shell while for bash, PS1 needs to be edited instead:

https://github.com/cmderdev/cmder/blob/711fe2895e5331e183ee72c200a3f67349f1fa12/vendor/git-prompt.sh#L71

Currently it seems that the ~/.config/git/git-prompt.sh file needs to be edited/created and lines 41-71 be copied into it in order to change the prompt.

@daxgames The documentation needs to be updated in order to make this clear that the .lua files affect only the clink shell and not the bash shell. In the meantime, I added it to the wiki.

DRSDavidSoft avatar Sep 09 '22 18:09 DRSDavidSoft

@DRSDavidSoft I did not even know that was a thing. It is more a Git-for Windows convention since cmder/vendor/git-prompt.sh most likely came from there and just we changed the $ to λ character.

I think it would be better to take advantage of this, now that we know about it, and make a more Cmder like solution and put user prompt configurability like we have for cmd/lua prompts into $CMDER_ROOT/config/cmder_prompt_config.sh

daxgames avatar Oct 09 '22 18:10 daxgames

@daxgames Good idea! In fact I think if we could leverage the same .lua files for both Bash and Powershell, it'd be awesome to share the cmder_prompt_config file across different shells. This will however require a lua parser for both of those environments. In #1695, I proposed a shared config storage (e.g. ala .ini-style files, or even json) that could be parsed by all three environments, or so.

Other than that, we could use separate cmder_prompt_config . sh, lua, ps1 files, too.

DRSDavidSoft avatar Oct 09 '22 18:10 DRSDavidSoft

How about a simple X = Y file format that can be read (or maybe included) but all the various scripting languages?

That way the configuration could be independent from script languages.

I.e. configure once, and take effect in all the shells.

chrisant996 avatar Oct 10 '22 00:10 chrisant996

@chrisant996 exactly what I was thinking.

daxgames avatar Oct 10 '22 01:10 daxgames

Clink v1.4.8 looks like it may have solved the width problems with the lambda character in the prompt.

Well, maybe not entirely -- the input line no longer gets garbled, but also there is no longer a space after the lambda. There's nothing Clink can do about that, though.

chrisant996 avatar Jan 12 '23 03:01 chrisant996