站內搜尋

2016/12/23

[Cmder] 解決在 GIT 目錄下 Cmder 暴卡(hang住、卡住、lag住)問題

Cmder - 因最近工作性質的關係,認識到的一個好物。
能讓 Windows 的 console 環境變的極像 Linux,一些常用的 Commands 也都支援,活生生的救了我的命....
但它也有一個滿奇妙的大問題...
只要進了有大型 Git 專案的目錄,就會開始卡住,做什麼動作都卡....

仔細觀察了一下,卡住的原因應該是 Cmder 每次要顯示 bash prompt 的時候都會去做一些 Git 相關的動作,但偏偏 Git for Windows 就已經在慢了,整合起來就更慢....

所以,暫時解決的方法也很簡單,把那些東西拔掉就行了。

SOP 如下:
1. 打開 cmder.lua (cmder\config\cmder.lua)
2. 找到下面這一段 Code,用 -- 把它全部 remark 掉
--   if get_git_dir() then
--       -- if we're inside of git repo then try to detect current branch
--       local branch = get_git_branch()
--       if branch then
--           -- Has branch => therefore it is a git folder, now figure out status
--           if get_git_status() then
--               color = colors.clean
--           else
--               color = colors.dirty
--           end
--
--           clink.prompt.value = string.gsub(clink.prompt.value, "{git}", color.."("..branch..")")
--           return false
--       end
--   end
3. 重開

打完收工。

沒有留言:

張貼留言

熱門文章