用cmder访问,在有中文的目录,会提示错误。我这里修改了它的代码,解决这个问题。
打开cmder\vendor\clink.lua,找到function svn_prompt_filter(),然后用下面的代码替换就可以了。主要原因是带中文扩URL是%XX表示汉字的,在这里处理的时候,报错了。下面是修改后的代码:
function decodeURI(s)
s = string.gsub(s, '%%(%x%x)', function(h) return string.char(tonumber(h, 16)) end)
return s
end
function svn_prompt_filter()
-- //Colors for svn status
local colors = {
clean = "\x1b[1;37;40m",
dirty = "\x1b[31;1m",
}
if get_svn_dir() then
-- //if we are inside of svn repo then try to detect current branch
local branch = get_svn_branch()
local color
if branch then
if get_svn_status() then
color = colors.clean
else
color = colors.dirty
end
local newBranch = decodeURI(branch)
clink.prompt.value = string.gsub(clink.prompt.value, "{svn}", color.."("..newBranch..")")
return false
end
end
-- //No mercurial present or not in mercurial file
clink.prompt.value = string.gsub(clink.prompt.value, "{svn}", "")
return false
end