Is there an easy way to deal with the nested Java package folders on the command line? I'm always cd-ing (with lots of tab autocomplete) through empty folders (except hidden svn files) in bash and vim. Are there any tools to make these less frustrating?
org/my/group/team/project/subpackage/TheFileIActuallyWant.java
I'm driven towards Eclipse because of this constant issue.
The worst is CDing all the way down to create a class, and then splitting a vim window with a class in other project. Yuck!
You have two choices (IMHO):
If you are mostly editing files and not creating new ones, it may help to symlink all .java
files into a directory called quickedit
. Then you can just type vim quickedit/MyClass.java
, assuming that your class names are mostly unique.
How about this?
In your .bash_profile (or equivalent) add:
function supercd() { cd $(dirname $(find "$@" -type f | head));}
then use it!
~ $ supercd temp1
~/temp1/temp2/temp3/temp4 $ ls
test.java
~/temp1/temp2/temp3/temp4 $
supercd
will take you to the first directory containing a file under the directory you specify.
Undoubtedly buggy, but a good start :)
签出由StackOverflow同胞static_rtti编写的AutoJump 。
If you're using just vim you'll face this kind of problems. Remember that every directory will become a finer grained namespace. Namespaces are good! (From the Zen of Python: Namespaces are one honking great idea -- let's do more of those!).
So, I think it's a good choice to start using eclipse. I think that Java is an imposible language without an IDE.
您可以在* nix系统上尝试使用“ tree”
Ctags might help you.
$ ctags -f ~/.tags -R ~/myprojects/src $JAVA_HOME/src
Then tell vim to know where the tag file is. In your .vimrc:
set tags+=~/.tags
Now you can jump to declaration parts by pressing CTRL-]
on any identifiers.
pressing CTRL-t
to return again to the original position.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.