.vimrc for IntelliJ Idea's vim plugin - intellij-idea

I am using the vim plugin for IntelliJ Idea.
Where should I place the .vimrc for that plugin.
Using Windows XP

The latest version of the plugin will read settings from a file named .ideavimrc in the home directory.
On *nix, the home directory can be accessed at ~.
On Windows, you can use the %HOMEPATH% environment variable. (Normally, "C:\Users\<User Name>" or "C:\Documents and Settings\<User Name>", depending on your Windows version.)

If you rename your .vimrc to _ideavimrc in your ~ directory (/Users/ in windows)
Underscore is used instead of the . in windows for vim apparently
IntelliJ will honour it
Was tearing my hair out for a while getting this to work.

On my mac i simply ran ln -s "$HOME/.vimrc" "$HOME/.ideavimrc" to create a symlink so IntelliJ would use the same .vimrc as my standard vim.
My .vimrc is very simple. However, if there is config that is incompatible between IntelliJ and vim then you might have issues with this approach.

echo %homepath%
gives me my "home directory" on Windows XP,
where I need to put my .vimrc.

Unfortunately, the vim plugin for JetBrains doesn't effectively support the full functionality of a .vimrc. The file that the plugin uses is called .ideavimrc. This is what you should use and it should be placed in your home directory (see this other answer for details, particularly for Windows).
I have a very comprehensive .vimrc that I use. Unfortunately, I had to pare that down quite a bit to work as .ideavimrc. You can look at the gists to see the differences. For what it's worth, it's still provides nice functionality, including buffer switching across tabs and splits.
.ideavimrc
.vimrc
So why not just use the same file (i.e., .vimrc) for both? Well, for one thing, you need some settings in .ideavimrc that give precedence to the vim plugin for certain keyboard shortcuts that conflict with the IDE. See the top of my .ideavimrc for my settings (for example, sethandler <C-B> a:vim). The other thing is that it seemed that when my more complicated .vimrc couldn't be processed, other settings (such as just set noerrorbells) also wouldn't take effect.

Related

IntelliJ IDEA plugin to fold .conf files?

I have a Scala app built with Lift framework. It has a few .conf files. When I open those .conf files in my IntelliJ IDEA Ultimate Fancy Pants Edition, I do not see any buttons to fold those curly braces in those files. Hotkeys do not do it either. Browsed for plugins, none applicable found. Is there any solution to enable code folding in .conf files?
Update:
Here is an illustration of what would be lovely. Those "-" and "+" icons do not appear in .conf files:
The relevant plugin is the HOCON plugin.
To install, click the Get button from the above JetBrains Marketplace link. Or, from within IntelliJ, go to Settings/Preferences (Ctrl+Alt+S for Windows; ⌘+Comma for Mac) and select Plugins, then click Marketplace to search for the plugin and install it. Restart IntelliJ to enable it.
To confirm, go back to Settings/Preferences and select Editor > File Types. You should now see HOCON (Human-Optimized Config Object Notation) file types among those listed as "Recognized File Types". Click HOCON and you should see *.conf under "File name patterns".
All your .conf files should now appear in IntelliJ with syntax highlighting and code folding.
Edited Oct 2020 to remove Scala plugin reference, as it no longer seems to support HOCON files.
Those .conf files are of HOCON type ("Human-Optimized Config Object Notation"). To enable folding them, you have to force the editor treat them as such. In IntelliJ settings, configure it as illustrated:
Preferences->Editor->File Types, and there add filename patterns to HOCON filetype.
2020+
The best option is to install HOCON plugin separately. For now, HOCON file type is not bundled with Scala plugin anymore.
P.S. All credits to ghik's comment. Decided to put this into separate answer because I was not able to find the tip at first time.

How to configure IntelliJ products WITHOUT editing files in bin?

I'd like to set some specific options in idea.vmoptions and idea.properties for IntelliJ IDEA 14, but I don't have access to those files in C:\Program Files\... (yes, that's Windows, don't troll ;)
Is there a folder in %UserProfile% or an environment variable I could set to read those files (both vmoptions and properties!) from elsewhere?
Please don't suggest to copy the whole IDEA folder elsewhere, there's a reason why I can't access it. I would be interested in a Linux solution too, the same would most likely work on Windows.
My Research
For Mac there're specific instructions at Increasing Memory Heap, but for Linux and Windows it's just filename which are trivial to find out anyway.
I also found IntelliJ IDEA files locations, but it says can be modified in IDEA_HOME\bin\idea.properties which doesn't help since I can't access that file, but want to change properties in it.
Update: Simple Answer
Create IDEA_PROPERTIES and IDEA_VM_OPTIONS environment variables and point them to the files you want, restart IDE, done.
Also see documentation for more (and maybe report that it lacks any mention of IDEA_PROPERTIES).
You can use %USERPROFILE%\.IntelliJIdea14\idea%BITS%.exe.vmoptions on Windows as custom options file. I tried it and it works.
Another way that I haven't tried, but I think should work, is to copy idea.bat and edit it to use the file you need.

How to add new programming language to jEdit?

I've recently been learning the Processing programming language. Processing includes an IDE called the Processing Development Environment (PDE), but the editor is quite basic.
The IDE has an option to use an external editor. One of my preferred editors is jEdit due to it's cross-platform support. Jedit has built-in support for over 170 languages, but not processing which I guess is still a little bit too niche at the moment.
How do I add Processing with all the color highlights to jEdit?
The whole process for adding processing has been detailed here: http://wiki.processing.org/w/JEdit_as_External_IDE.
Basically, jEdit is using XML files to define syntax coloring rules (incl. simple checking) for its various editing modes. Each syntax definition file has a file extension mapping to tell jEdit which language mode to use for individual files. For Processing files we will use the standard .pde extension.
There are two things you need to do: (Before installing any of the files below, please make sure jEdit is not running.)
Syntax Highlighting
Download File:Processing.xml into the "modes" folder inside your jEdit installation.
On Linux/MAC this is usually /usr/share/jedit/modes
On Windows this is C:\Program Files\jEdit\modes
Then copy and paste the following XML node into the file "catalog" inside the same folder and syntax coloring/checking for PDE files should be ready: <MODE NAME="processing" FILE="Processing.xml" FILE_NAME_GLOB="*.pde" />
Abbreviations
Download Media:abbrevs_v0.1.zip and extract it into the right folder for your system:
Windows
C:\Documents and Settings\{USERNAME}\.jedit
Mac
/Users/{USERNAME}/.jedit
Note: This folder is not visible in the Finder. Unzip the file in your home folder, open a terminal window and type: mv ~/abbrevs ~/.jedit/abbrevs</source>
Linux
Find the location of the jEdit settings directory via the menu: Utilities > Troubleshooting > Activity log, then extract/copy the file in that folder.
For all systems, you'll need to restart jEdit in order for the abbreviations to come in effect.

Is there an easy way to put my entire installation of Intellij on a USB stick?

I'm considering switching from Eclipse to Intellij. One thing I like about Eclipse is that the whole installation is just a folder, and I can put that on a USB stick and copy it to another computer if I want. All of my plugins, settings, and everything else come with me and all I have to do is simply copy a folder.
Is there any way I could do this with Intellij?
Yes, it's possible, just copy the installation directory to the flash drive, then edit IDEA_HOME\bin\idea.properties file, change the values of idea.config.path and idea.plugins.path to the relative location, like: ../config and ../user-plugins (locations are relative to IDEA bin directory).
Now copy your original settings and third-party plug-ins (if any):
${user.home}/.IntelliJIdea10/config => usb:/IDEA_HOME/config
${user.home}/.IntelliJIdea10/config/plugins => usb:/IDEA_HOME/user-plugins
Note that it's not recommended to change idea.system.path variable, so that it remains on the fast local drive, otherwise it could affect IDEA performance and occupy a lot of USB drive space.
One thing you could also do is to use the ${idea.home} path variable. I described in an article how you can create a portable version of IntelliJ IDEA including a version of the JDK.
https://leolabs.org/blog/making-intellij-portable/
I hope it can help you, as this is my first article in English ;)
Regards
leolabs
In addition to the answer of CrazyCoder:
To copy the "system" folder of IntelliJ / PHPStorm to the usb memory stick is required if you want that IntelliJ / PHPStorm behave like a portable app.
To get the desired folders install IntelliJ / PHPStorm to your HDD and run it at least one time.
On Windows 7 the path is (copy the folders to your usb memory stick):
%USERNAME%\.WebIde10\config\ => usb:/IDEA_HOME/config
%USERNAME%\.WebIde10\system\ => usb:/IDEA_HOME/user-plugins
Note that user-plugins is not created at first start of IntelliJ / PHPStorm, so create it on your usb memory stick.
Edit the idea.properties as CrazyCoder told you and change all 3 values:
idea.config.path
idea.plugins.path
idea.system.path
open c:\Program Files\JetBrains\IntelliJ IDEA 14.1.3\bin\idea.properties
change # idea.config.path=${user.home}/.IntelliJIdea/config to idea.config.path=../PortableSetting/config
change # idea.system.path=${user.home}/.IntelliJIdea/system to idea.system.path=../PortableSetting/system
change # idea.plugins.path=${idea.config.path}/plugins to idea.plugins.path=../PortableSetting/config/plugins
change # idea.log.path=${idea.system.path}/log to idea.log.path=../PortableSetting/system/log
make PortableSetting folder in c:\Program Files\JetBrains\IntelliJ IDEA 14.1.3\
copy content of C:\Documents and Settings\User\.IntelliJIdea14\ to c:\Program Files\JetBrains\IntelliJ IDEA 14.1.3\PortableSetting\
copy c:\Program Files\JetBrains\IntelliJ IDEA 14.1.3 to USB and enjoy!
I wrote this answer for windows XP default directory.
for more information about default directory look at here.
I read other people answers and made an step by step answer.
You can use portableapps platform for portable intellij. Details description is here.

How to unload all the plugins from vim and change VIMRUNTIME?

I have an account at my hosting providers server and I can't install my own copy of vim.
So the only personalization I can make is editing .vimrc in my account, but it won't suffice
What I'd Like to do is:
on startup I'd like to unload all the plugins and loaded stuff, and tell vim to use other folder as its' runtime.
Any idea how to aproach it?
You can start your vim with -u NONE. From the man-page:
-u {vimrc} Use the commands in the file {vimrc} for initializations.
All the other initializations are skipped. Use this to
edit a special kind of files. It can also be used to skip
all initializations by giving the name "NONE". See ":help
initialization" within vim for more details.
For changing $VIMRUNTIME at runtime, use
:let $VIMRUNTIME = "/new/path/"
To answer your question: you just need to set the runtimepath option in your .vimrc file, because your .vimrc is read before any plugins are loaded.
However, the default runtimepath value usually includes the ~/.vim folder (use :set runtimepath? to check), so you should be able to add whatever plugins you need to the ~/.vim folder. Also you can prevent many plugins from loading by adding a line such as :let g:loaded_<plugin name> = 1 to your .vimrc file. Check the help docs for each plugin to find out how to do this.