windows 如何在 Eclipse 中打开文件并跳转到特定行?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2295414/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to open a file in Eclipse AND jump to a specific line?
提问by powtac
I can open a file in exclipse, but is there any syntax to jump to a specific line?
我可以在 exclipse 中打开一个文件,但是是否有任何语法可以跳转到特定行?
VI can do this by
VI可以通过
vi -c LINE filename
回答by VonC
Not exactly the right answer, but for Java file, you can use the package explorer, or the outline view, useful to select a group of lines) and open the file to the line matching a Java element (class, method, variable, ...)
不是完全正确的答案,但对于 Java 文件,您可以使用包浏览器或大纲视图,这对选择一组行很有用)并将文件打开到与 Java 元素(类、方法、变量、. ..)
Once the file is already opened, CTRL+Lis the way to go to a line of the currently edited file, as Adimentions in the comment.
一旦文件已经打开,CTRL+L是转到当前编辑文件的一行的方式,正如Adi在评论中提到的那样。
回答by raho
Only tested on MARS:
仅在 MARS 上测试:
Preferences > Keys > "Open from Clipboard"
首选项 > 键 > “从剪贴板打开”
Assign key binding.
分配键绑定。
- Copy i.e. log entry in format Main.java:1
- Press chosen key binding
- voilà
- 以Main.java:1格式复制 ie 日志条目
- 按选择的键绑定
- 瞧
In latest Version [Oxygen] key was ctrl+shift+v
在最新版本中 [Oxygen] 键是ctrl+ shift+v
回答by krispy
Finally fixed!!
终于修好了!!
On Windows:
在 Windows 上:
eclipsec.exe -name Eclipse --launcher.openFile %USERPROFILE%\workspace\MyClass.java:50
On Linux/Mac:
在 Linux/Mac 上:
eclipse -name Eclipse --launcher.openFile ~/workspace/MyClass.java:50
回答by Bozho
CTRL+SHIFT+R(Open Resource) or CTRL+SHIFT+T(Open Type, for classes only)
Type the name / the start of the name / the first letters of a camel case name
CTRL+L(Go to line)
CTRL+ SHIFT+ R(开放资源)或CTRL+ SHIFT+ T(开放类型,仅适用于类)
输入名称/名称的开头/驼峰式名称的第一个字母
CTRL+ L(转到行)
回答by ewerybody
Hmm. For me it works on Windows as simple as
唔。对我来说,它可以在 Windows 上运行,就像
eclipse.exe path\filename.ext:42
(I was actually looking for a consistent solution across IDEs.
Pycharm offers pycharm.exe path:number
as wellbut it does not seem to work :/)
(我实际上是在寻找跨 IDE 的一致解决方案
。Pycharm 也提供pycharm.exe path:number
,但它似乎不起作用:/)
回答by Master Yoda
Try
尝试
eclipse.exe file.txt:22
for newer versions of eclipse, and
对于较新版本的 eclipse,以及
eclipse.exe file.txt+178
for older ones.
对于年长的人。