PyCharm - 从shell获取光标位置

时间:2017-10-30 10:55:29

标签: intellij-idea pycharm

当我关闭并重新打开PyCharm项目时,保留了最后一个文件和光标位置(行号和行首字符数),因此它显然被保存在某个地方。

有没有办法可以从命令行访问这个光标位置数据?

1 个答案:

答案 0 :(得分:2)

有关当前项目会话的全部信息存储在.idea/workspace.xml文件中。我没有仔细检查,但这是解决方案:

$ xmllint .idea/workspace.xml --xpath '//project/component[@name="FileEditorManager"]/leaf/file[@leaf-file-name="PUT_YOUR_FILENAME_HERE"]/entry/provider/state/caret/@line'
line="501"
$ xmllint .idea/workspace.xml --xpath '//project/component[@name="FileEditorManager"]/leaf/file[@leaf-file-name="PUT_YOUR_FILENAME_HERE"]/entry/provider/state/caret/@column'
column="12"