原來(lái)在mac上使用完全沒(méi)啥問(wèn)題,換成windows后總是報(bào)錯(cuò),網(wǎng)上資料也比較少,最后還是在github的issue里找到的解決辦法菩貌。
現(xiàn)在總結(jié)下:
安裝之后autojump --help都能出來(lái)提示消息
問(wèn)題出在一旦 j xx時(shí)就報(bào)如下錯(cuò)誤
```
Traceback (most recent call last):
? File "C:\Program Files (x86)\CowShell\Vendor\AutoJump\bin\\autojump", line 320, in <module>
? ? sys.exit(main(parse_arguments()))
? File "C:\Program Files (x86)\CowShell\Vendor\AutoJump\bin\\autojump", line 314, in main
? ? ['.'])))
? File "C:\Program Files (x86)\CowShell\Vendor\AutoJump\bin\autojump_utils.py", line 42, in first
? ? return it.next()
? File "C:\Program Files (x86)\CowShell\Vendor\AutoJump\bin\autojump_match.py", line 86, in <lambda>
? ? flags=regex_flags,
? File "F:\Programs\Python\lib\re.py", line 146, in search
? ? return _compile(pattern, flags).search(string)
? File "F:\Programs\Python\lib\re.py", line 251, in _compile
? ? raise error, v # invalid expression
sre_constants.error: unexpected end of regular expression
```
解決辦法如下:
然后將你 python?./install.py 生成的文件路徑bin目錄下的autojump_match.py文件中
```
regex_no_sep = '[^' + os.sep + ']*'
regex_no_sep_end = regex_no_sep + '$'
regex_one_sep = regex_no_sep + os.sep + regex_no_sep
替換成下面這段即可解決
sep = os.sep if os.sep != '\\' else '\\\\'
regex_no_sep = '[^' + sep + ']*'
regex_no_sep_end = regex_no_sep + '$'
regex_one_sep = regex_no_sep + sep + regex_no_sep
```