cmder: Lag returning to prompt (especially) in git repo
When using cmder with git (where it shows the name of my currently checked out branch next to the location), I’m finding that my commands are executed quickly but there is a major delay returning to the prompt so I can enter in another command. I notice this to some extent when I’m not in a git repo, but then the delay is almost not noticeable (100-200ms I’d guess), as opposed to 1-2 seconds in a repo.
To give further details, in my repo if I type ls
, the file list comes up immediately, then the current tab changes from saying “cmd.exe” to “git.exe”, and only after 1-2 seconds do I get a lambda prompt again where I can enter further commands.
I’m running Windows 8.1 and cmder.exe is installed in Program Files. Let me know if any more details would be helpful.
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Reactions: 1
- Comments: 41 (9 by maintainers)
Commits related to this issue
- Cmder: speed up clink.lua git prompt for Cmder 1.3.11 https://github.com/cmderdev/cmder/issues/447#issuecomment-480013481 — committed to mloskot/dotfiles by mloskot 5 years ago
After some searching, I’ve been able to remove git integration in the prompt, resulting in no lag when inputting commands in a git repo! The following modifications must be done to your
cmder/vender/clink.lua
file:On line 41, remove
{git}{hg}
to prevent git/mercurial branch from being printed in your prompt:Comment out lines 266-267 to prevent git and mercurial plugins from running every time you press enter:
As a note, you may want to back up this
clink.lua
file somewhere, in case it gets overridden after a cmder update.Hope this helps!
In the traditional cmd with clink, there are two
git
look-ups run inclink.lua
to refresh the prompt:get_git_branch
- fast, reads.git/HEAD
get_git_status
- slow,git status
which is used to decide about dirty/clean colourisation. In the whole git repo of Boost, this one takes annoyingly long time.So, instead of disabling git information in the prompt completely, some may prefer to just get rid of the detailed/coloured status, keeping the current branch info:
Kudos to https://github.com/cmderdev/cmder/issues/447#issuecomment-244149494 for inspiration.
@DGalt Try this
vendor\profile.ps1
checkGit($pwd.ProviderPath)
I’d also like a way to disable git looking at my current repo as it gives me 30+ sec delay. It’s a massive repo. I really don’t care about it telling me i’m in the master branch.
How can I disable any git stuff. I just want a command prompt.
I’d like to have an option to disable git showing anything on the prompt. It still slow on some occasions.
Can the dev re-open this issue? It’s still a problem and all ‘fixes’ here are overwritten on an update. This belongs somewhere in settings than hardcoded in a
profile.ps1
script.Just to summarize the quick solution in 2019, this definitely solved my complaint with Cmder, that it took over 8 seconds every time I issued a command!
Now commands are responsive! Instantaneous! Thank you to: @mloskot @justaniles Sep 1, 2016 https://github.com/cmderdev/cmder/issues/447#issuecomment-244149494
Is this post still the most up to date advice for this? Is there a configuration option to remove the SCM details from the prompt?
My bad, the diff had me confused. Would’ve been better if you included the output without diff in the first place. Either way thanks. And apologies. Have a nice day.
The earlier tweak does not work for Cmder 1.3.11, but it should be easy to adjust the new versions of the
get_git_status
andget_git_conflict
.For large repos with lots of submodules, like https://github.com/boostorg/boost/, these two tweaks are sufficient for me to greatly speed the git prompt:
Simply, add
--ignore-submodules
to these twogit
commands:https://github.com/cmderdev/cmder/blob/89499f2a6068980256ca1132714407fdbcdc282a/vendor/clink.lua#L221-L222
https://github.com/cmderdev/cmder/blob/89499f2a6068980256ca1132714407fdbcdc282a/vendor/clink.lua#L236-L237
For me, commenting the
if-else
block caused an error due to color property can’t be found. I just removed thecolor..
property on thestring.gsub
call like this:@daxgames Disabling
git status
inclink.lua
is workaround for whereverclink.lua
is used. In this context here it is for Cmder.My apologies, I wasn’t clear. In my earlier comment, I just wanted to explain that I don’t see any connection between the general slowness of
git status
that also affects Clink/Cmder and the slowness of Unix tools reported elsewhere.To summarise, the problem we are discussing here is related to
git
command and is very simple:git status
is intrinsically slow for large and submodule-arised reposclink.lua
relies ongit status
, hence the prompt update lagsgit status
calls fromclink.lua
to avoid the lagsRe: @rohitkrishna094 's https://github.com/cmderdev/cmder/issues/447#issuecomment-536690719
This is certainly not a competition but that comment may leave one quite confused.
AFAICT, the patch I presented in https://github.com/cmderdev/cmder/issues/447#issuecomment-379992066 produces this code
which, clearly, is the equivalent code to the code @TimRudy presented in https://github.com/cmderdev/cmder/issues/447#issuecomment-532752032
@rohitkrishna094 I’d suggest you analyse the snippets more carefully, then you should avoid any disappointments.