I am newbie to plugins in vim. I am using vim for a year but without any experience with plugins. So i installed Vim-plug, then add Plug vim-javacomplete2' to my .vimrc and :PlugInstall it. It was installed. Then I add autocmd FileType java setlocal omnifunc=javacomplete#Complete to my .vimrc as well - as is in github. But then, ther is nothing else. So some commands works. I Tried for example JCgenerateAccessors - which generate getter and setter upon my private fields. So commands works. But The autocompletation doesn (such main function). I am making classes within a file in my directory. Then javac Test.java and java Test - which runs it. But still, when editting in vim the Test.java, no autocompletation. What I did wrong?
Might a a bit late
<C-x><C-o> (ctrl + x,ctrl + o) will bring up a list of options.
Press this in insert mode wherever you would press ctrl + space in other IDEs
i.e.: after System.
Expanding upon #iaquobe's answer, autocompletion while typing or more specifically after the dot notation, isn't enabled by default with this plugin, unless triggered manually using C-x,C-o, which can -and will- become tedious over time.
There're other autocompletion plugins that can be installed along with other completion engines, and be configured to integrate with them, namely: vim-mucomplet, youcompleteme, and neocomplete.vim.
Related
I made a Java application (JDK 1.7) using Netbeans 8.1 and JavaFX.
The basic idea is a grid filled with letters, the rows and columns are sequentially highlighted to allow a person to chose a letter with a single key press (spacebar). Once the number of characters is equal or greater than 3, I implemented an autocomplete feature that fetches word starting with those letters and ranks them by lexical frequency.
It works really well when I run the project from inside the IDE but when I try to run it outside the following happens:
when I start the program, input doesn't work for a long time (10-15 seconds... although sometimes it works almost instantly and sometimes it takes even more time)... but once it starts detecting my key presses again, it works 100% of the time. It's not limited to the spacebar (also "+" and "-" used to manipulate the speed of the highlighting). Also, the program isn't frozen, I can resize stuff just fine and the row/columns are animated.
I also put a label next to the row where I put my autocomplete suggestions. Said label is supposed to be tilted -90°. Whenever I run it from outside Netbeans, it loses its rotation. Note: I don't use a CSS file, I used .SetStyle().
How can it behave differently just because I don't run the application from Netbeans?
Thank you for your answer!
Some possible reasons:
The .jar file is not up to date.
Netbeans runs from the .class files while running externally uses the .jar file.
Do a clean and rebuild and try again.
Different classpath.
Netbeans specifies the classpath to all the libraries it wants the app to use on the command line. What command line are you using? Are there any differences?
You can see the command line used in the output window when Netbeans runs your app (you may need to enable a verbose form of output - with Maven you can add --debug).
Security problems that take some time to resolve if you have reduced privileges.
Many people give Netbeans administrator rights (allows it to create jar files for example). This may not be the case on the command line.
Try running the .jar from a command prompt with admin rights.
(Inspired by the actual problem - thank you #BlackRainbow) - The Netbeans project will be bound to a specific Java version. When run from the command line using just Java ... -jar ... you will get the latest Java version which may be different.
Try running it from the command line selecting a specific version of Java. Something like "C:\Program Files\Java\jdk7\jre\bin\java" ... or similar.
I'm trying to create a portable environment (USB Flash/Disk) that can be copied from one device to another - and work "out of the box" on a Mac/OSX (10.10.x environment) specifically. My purpose for this, is I'm teaching a "Portable Programming" class next semester, and I want to be able to just copy (or give the student a .zip file), have them expand it on a specifically named volume, and the environment works. This includes the SDK version(s), AVDs, etc. I've got everything apparently working (so far), but have a problem with the AVDs.
This is a new install, using latest Eclipse, etc.
I'd hoped to find these directories, etc. within an XML/INI file, and use an editor or sed to change the strings, but can't seem to find the directory names of anything I've needed to change so far within an XML/INI file within the unzipped Android directory - but don't see them.
I do see a reference within Preferences->Android->Build "Default debug keystore" that references ~./android - but it is not editable. There IS a "custom" debug keystore setting on the same dialog page, but changing it does not seem to have an effect on the AVDs and their location. So far, that's the ONLY reference I've found for my home directory. I've looked at the Eclipse CLI at eclipse.org, but don't seem to see anything relating to this issue (at least not anything that's ringing a bell with me).
So - how can I change my default "home" directory (without boogering up the environment, etc.) for Eclipse/Android, so my AVDs (and whatever else I HAVEN'T run into yet), can be installed and used/run from the USB drive/stick?
Please - I DO NOT WANT links to other "portable" packages, as I'm not sure what's actually been altered in them (and probably not current, and an update is likely to hose everything anyway), and don't want to pass along anything to students. I'm downloading official packages from official locations, and want to keep it that way. So I'm only looking for things that can be fixed/edited within an officially installed environment to get the effect I'm looking for. Thanks!
Found this at Launch mac eclipse with environment variables set
There is an alternate solution which involves replacing the executable that is run by MacOS X when the user launches the Eclipse application with a shell wrapper that sets up the environment.
Create an empty text file called "eclipse.sh" in the Eclipse application bundle directory /Applications/eclipse/Eclipse.app/Contents/MacOS.
Open the eclipse.sh in a text editor an enter the following contents:
#!/bin/sh
export ENV_VAR1=value
export ENV_VAR2=value
logger "`dirname \"$0\"`/eclipse"
exec "`dirname \"$0\"`/eclipse" $#
In the example ENV_VAR1 and ENV_VAR2 are the environment variables being set up. These variables will be visible to processes launched from within Eclipse. The logger command will just log the path of the eclipse executable to the system.log as a debugging aid.
In the Terminal set the executable flag of the shell script eclipse.sh, i.e.:
chmod +x /Applications/eclipse/Eclipse.app/Contents/MacOS/eclipse.sh
Open the Eclipse.app Info.plist and change the value for the key CFBundleExecutable from eclipse to eclipse.sh.
MacOS X does not automatically detect that the Eclipse.app's Info.plist has changed. Therefore you need to force update the LaunchService database in the Terminal by using the lsregister command:
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -v -f /Applications/eclipse/Eclipse.app
The next time you launch Eclipse.app from the Dock or from the Finder the environment variables should be set.
It took me a while to research, as that info was from Sep. '09, which was back in Snow Leopard (OSX 10.6) days. I'm now running 10.10, and while some things don't change - a LOT has changed, so it took a while to research the above approach and make sure it wasn't going to do some potential damage to the installation. A LOT of under-the-cover stuff has changed in those 4 versions, and I wasn't willing to just take off with it. I've also not found a good explanation of exactly what ANDROID_SDK_HOME actually controls - although this above approach seems to work - so far.
I am a beginning programmer that has been using an IDE to learn to code. However I want to try using a text editor to see which one I would like more. My question is, once you download a text editor, what tools do you need to compile and run a program and how do you set them up?
You just need the JDK. Installing it (it has an installer) should set it up sufficiently.
When you want to compile something, use the javac tool:
> javac MyClass.java
When you want to run something, most likely you'll want the java tool (although of course if you're doing servlets or such, you'd use something else):
> java MyClass
Or of course, go ahead and use a separate text editor if you like but continue to use the IDE to compile, not least because presumably any IDE you were using had an integrated debugger, and a debugger is an essential tool.
If you want to use a text editor for java programming don't forget to add java to your Environment Variables Path. You can check if java is already added to your path by running java -version in your command line. If you get nothing you have to add C:\Program Files\Java\jdk1.8.0; to your path (your version of the jdk may be different, change it to the name you have). Don’t forget that semi-colon ; at the end.
Now you are set and ready to compile and run java programs just as explained by #T.J. Crowder in the answer above.
I have many Java files from a project which have not been formatted properly. Also due to enforcement of a common style many people have introduced their own coding style. I want to bring all this code to one consistent format. Are there any auto-formatters available which I can run as script on all the files. I would like to rethink and fine tune following options:
Number of spaces used for indentation.
Spaces around operators like + - * / etc.
Separation between parentheses.
etc.
I was looking at Netbeans auto format and looked cool. Moreover the parameters can be set from the option dialog. However I am not able to completely grasp how to use the API
You can use the Eclipse JavaCodeFormatter from the command line:
The following example runs the formatting of code specified by the
configuration file D:/formatter.prefs on the files Java belonging
(directly or indirectly) to the directory D:/tmp/src :
eclipse -application org.eclipse.jdt.core.JavaCodeFormatter -config D:/formatter.prefs D:/tmp/src
See http://wiyoo.blogspot.com/2007/05/batch-formatting-java-source-code-with.html for details.
Why use the API? Bring it in as a NetBeans project. Same with Eclipse or IntelliJ; they can all format all source files in a project.
For standalone, try Jalopy. It can also be set up to run as part of a build, as a commit hook, etc.
Try JIndent. Or here're a bunch of open source code formatters for Java, some of them can be run as standalone products, others as plugins inside an IDE (Eclipse, NetBeans).
Well I don't know if you use eclipse, but to do spacing and parenthasis you just press ctrl + shift + f and to do auto indentation is ctrl + i
Is there a way/bundle/shortcut to format the Java Source in TextMate?
(As we do with Shift+Command+F in Eclipse).
It must be
Command + Option + [
which is also Text>Indent Selection
Ctrl+Q
Although It may not be what you expect :(
alt text http://img27.imageshack.us/img27/97/capturadepantalla200910w.png
Warning: I got to the end and realized format was the one feature this DOESN'T have. I currently use this process, and then alt+tab to Eclipse to format. Neither TextMate nor Eclipse seem to have a problem with concurrently editing the same file and it works beautifully. However I realize this wasn't the original question.
I use eclim and the eclim TextMate bundle. I'm not gonna lie, you do have to run Eclipse to use it. However you can disable the GUI and run Eclipse as a headless daemon or just minimize Eclipse in case you need it for something later. It's a good compromise and well worth it for the features it provides to TextMate.
This gives me :
Code Completion
Auto-import missing classes
Java Rename (Refactor)
Window with build errors
Each of these features provides the same functionality as Eclipse itself.
Currently the bundle only supports Java, but eclim itself (which is an Eclipse plugin originally written for vim) supports many more features and languages, and is just waiting for the right person to come along and implement Eclipse features for everything.
You can find eclim here:
http://eclim.org/
And the eclim bundle is in GetBundles.
If you don't have GetBundles, I recommend it. It's a bundle that allows you easily download new bundles from several repositories, all from within TextMate.
run these commands in terminal to install it:
cd ~/Library/Application\ Support/TextMate/Bundles
svn co http://svn.textmate.org/trunk/Review/Bundles/GetBundles.tmbundle/
If you prefer not to install it, the eclim textmate bundle is here:
https://github.com/JulianEberius/Eclim.tmbundle
When you run the eclim setup, choose the Eclipse folder that contains 'plugins'. Then, when you launch Eclipse, go to Window->Show View->Other. Choose 'eclim' from 'eclim'. This view needs to be running for the TextMate bundle to detect the eclim server. You should see some information go through the console window, with the last line saying something like: Eclim Server Started on port 9091. If so, it should work in TextMate.
You know what, I just went to grab the keyboard shortcut for you, and realized 'format' is the one I always switch to Eclipse to use. Sorry bout that. But hey, eclim is fantastic anyway and maybe when I have some time I'll write the format command for TextMate. The source is in Python and looks relatively straightforward.
Probably what you want is this
Command + Shift + {
Works for any language