主要使用python3,所有配置以python3為例.其他語言同理.利用sublimeCodeIntel插件可以實現自動提示python3代碼、跳轉追蹤自定義函數、查看系統函數等.功能還是相當強大的。
選擇 Perference -> Package Settings -> SublimeCodeIntel -> Settings-User 復制以下配置:
{ "codeintel_language_settings": { "Python3": { "python3": "D:\\Python3.7.2", "codeintel_scan_extra_dir": [ "D:\\Python3.7.2\\DLLs", "D:\\Python3.7.2\\Lib", "D:\\Python3.7.2\\Lib\\site-packages", "D:\\Python3.7.2\\Lib\\idlelib", "D:\\Python3.7.2\\python36.zip", "D:\\Python3.7.2", "D:\\Python3.7.2\\Lib\\*", ], "codeintel_scan_files_in_project": true, "codeintel_selected_catalogs": [] }, } }
這里python路徑需要根據自己的安裝路徑定義,其中codeintel_scan_extra_dir包含的目錄可以在python IDLE中sys.path查看.
出現Error tring to parse file:Expected value in Pacjages\User\Default.sublime-XX.......錯誤
可能是上邊設置文件書寫錯誤,比如多了逗號,空格和tab互用
追蹤函數、查看系統函數
配置快捷鍵,實現ctrl+鼠標左鍵追蹤函數,alt+left/right跳轉,alt+/自動提示代碼
選擇 Perference -> Package Settings -> SublimeCodeIntel -> Key Bindings-User 復制以下配置:
[ { "keys": ["f5"], "caption": "SublimeREPL:Python", "command": "run_existing_window_command", "args": { "id": "repl_python_run", "file": "config/Python/Main.sublime-menu" } }, //自動提示代碼 { "keys": ["alt+/"], "command": "code_intel_auto_complete" }, //跳轉到函數定義 { "keys": ["alt+right"], "command": "goto_python_definition" }, //返回到跳轉位置 { "keys": ["alt+left"], "command": "back_to_python_definition" } ]
ctrl+鼠標左鍵跳轉函數
選擇 Perference -> Package Settings -> SublimeCodeIntel -> Mouse Bindings - User 復制以下配置:
[ //ctrl+鼠標左鍵跳轉函數 { "button": "button1", "modifiers": ["ctrl"], "command": "goto_python_definition", "press_command": "drag_select" } ]