Cmder: How to configure the Git Prompt

Created on 28 Nov 2017  路  4Comments  路  Source: cmderdev/cmder

today i updated from cmder 1.2 to 1.3 and prompt in git repos totally changed.
the real path containing a git repo of

c:\home\projects\puppet\control-repo

gets to the, for me, unreadable:

c:\home\projects -> origin\puppet\control-repo -> origin (development -> origin)

before it was the simple and clear

c:\home\projects\puppet\control-repo (development)

is this cmder specific or is this clink specific? is this a bug or a feature? how can i get the old behavior back? shouldn't we document this in the wiki?

Most helpful comment

To get rid of the -> origin from a cmder session:

  1. Type del "%cmder_root%\vendor\clink-completions\git_prompt.lua"
  2. Start a new session.

To make it permanent so it does not come back after a cmder update add the following to "%cmder_root%\config\user-profile.cmd":

if exists  "%cmder_root%\vendor\clink-completions\git_prompt.lua" del  "%cmder_root%\vendor\clink-completions\git_prompt.lua"

All 4 comments

Try this: https://github.com/AmrEldib/cmder-powerline-prompt

Need some minor config, but it's a nice customization and keep the Cmder old style prompt

@igortg thank you, i found cmder-powerline-prompt already i was looking for the official way and hoped there is an easy boolean flag for that.

Hey there, I just updated to [email protected] and I too find that -> origin line awful (Also not sure what it meant, local branches did show it too when they were not yet pushed to the remote or anything, and I felt it was misleading).

So I went for a caveman's solution. Did a grep for \-> in the vendors folder and found the culprit: clink-completions > git_prompt.lua. Now, I don't know anything about Lua language so just did a quick "this looks weird let's delete it" thing. Inside, in line 80, you have to change
clink.prompt.value = clink.prompt.value:gsub(escape(branch), '%1 -> '..text) and remove everything after the %1 (The space after the > too, but remember to leave the single quotation mark).
The line should read clink.prompt.value = clink.prompt.value:gsub(escape(branch), '%1')

image

To get rid of the -> origin from a cmder session:

  1. Type del "%cmder_root%\vendor\clink-completions\git_prompt.lua"
  2. Start a new session.

To make it permanent so it does not come back after a cmder update add the following to "%cmder_root%\config\user-profile.cmd":

if exists  "%cmder_root%\vendor\clink-completions\git_prompt.lua" del  "%cmder_root%\vendor\clink-completions\git_prompt.lua"
Was this page helpful?
0 / 5 - 0 ratings

Related issues

vincentntang picture vincentntang  路  3Comments

brunowego picture brunowego  路  3Comments

spooky picture spooky  路  3Comments

bmeverett picture bmeverett  路  3Comments

isnullxbh picture isnullxbh  路  3Comments