Running IntelliJ IDEA under DWM with java 7 & 8

For quite long time I’ve been using IntelliJ 12 because it was still compatible with java 6 which & was running well with DWM. Whenever I was trying a newer version of IntelliJ which required java 7, I was getting a gray screen. The IDE was loading but couldn’t see anything but a gray window. And that sucked because the newer versions of IntelliJ support multiple selections etc which are quite neat.

Today I finally found a solution to the problem (mentioned here http://comments.gmane.org/gmane.comp.misc.suckless/13490) and I basically had to run the following command before starting IntelliJ:

> wmname LG3D
> ./idea.sh

And that was it! Seems like you can use this tool/trick for any java program that has some issues!

So now I’m running IntelliJ using a little script I created inside /usr/bin/intellj (remember to sudo chmod a+x /usr/bin/intellj so other users can run it as well):

#!/bin/bash
wmname LG3D
export IDEA_JDK=/usr/lib/jvm/java-8-oracle
~/Software/idea-IC-135.690/bin/idea.sh

Update: If you want to run Webstorm, you might need to exchange IDEA_JDK with WEBIDE_JDK

Having issues with navigation in Webstorm?

Did your Ctrl+N or Ctrl+Shift+N or Ctrl+Shift+Alt+N stopped working properly in Webstorm (not considering all files, not finding all methods etc)? Then most probably there is an issue with Webstorm’s cache & needs to be invalidated. The solution is simple:

File -> Invalidate Caches .. -> Invalidate & Restart

Then the problem will be gone 🙂

Have a nice day!

How to navigate through usages in file with WebStorm

It’s quite useful sometimes to be able to navigate through the usages of a certain variable inside a file. For example, you find a method and you want to see where it’s being called, or a variable and see where it’s being used. With WebStorm it turns out it’s quite easy to do. You hit Ctrl + Shift + F7 and then you use F3 and Shift + F3 to navigate between usages.

Ctrl + Shift + F7    // Highlights all usages in file
F3 or Shift + F3     // Navigate forward or backward between usages

If you are interested in usages in other files as well, use Alt + F7 instead.

Alt + F7             // Finds usages inside the project

Sublime Text 3 – new code browsing functionality

Just tried today for the first time Sublime Text 3!

It looks quite similar to Sublime Text 2 but it’s a bit faster (though ST2 was fast enough already for me) and has the following features that I fell in love with right away:

  1. Go to definition: Just put the cursor on any function and click F12 (in Windows or Linux). Then ST3 will take you to the function’s definition. If there are more than one, it’ll ask you which one to go to. It’s amazingly helpful feature and I’ll be using it all the time
  2. Jump back & Jump forward: This is the second best feature. Whenever you use Jump to definition (F12) you can use Jump back (Alt+Keypad minus) to get back to the code you were viewing before you jumped to definition. You can also Jump forward using Alt + Shift + Keypad minus.

I actually changed the key bindings to Alt+Left and Alt+Right which I find a bit more intuitive. You can do that by going to “Preferences” -> “Key Bindings – User” and setting the key bindings in a similar way like I did:

[
	{ "keys": ["alt+left"], "command": "jump_back" },
	{ "keys": ["alt+right"], "command": "jump_forward" }
]

Hope you will enjoy Sublime Text 3. It’s a really great editor!

Multiple editing with Sublime Text 2

There are many times where you want to rename a variable that appears in many lines right? How can you do that with Sublime Text 2?

Alt + F3 <while having the cursor on what you want to rename>

Also, if Alt + F3 selects too many variables you can use to select them one by one (selects the next appearance each time you press it)

Ctrl + D <again while having the cursor on what you want to rename>

I know it’s really simple shortcut & you might be wondering why did I even post about it. Well .. the reason is that I simply forget it every time and I thought of writing it here so I know where to find it when I need it. Cause apparently I’m searching with the wrong keywords (multiple line editing in Sublime Text 2) and I don’t get the quick answer I need.

Hope this will be useful to somebody else as well 🙂

Update: Found this nice about the multiple selection keyboard shortcuts for Sublime Text 2

Have a nice day!

Gist for my little scripts & configuration files

From time to time I write some scripts to automate tasks. For example, I might write a script to upload some files using POST to a service, or a script to deploy code to a server etc. But not always I can add them to a repository so they are backed up by a version control system. And when the time comes to format my computer I need to go all around & make copies of those scripts.

Sometime ago I discovered Gist offered by Github. Gist allows you to create a repository for storing the contents of one file & keep versions whenever you re-upload it (edit it). And you can do it all through the browser & access those files anywhere and at anytime. This is perfect for backing up your scripts & configuration files. I used Gist for the following:

  • apache & nginx configuration file
  • ~/.bashrc
  • various scripts to do any sorts of tasks
  • nice terminal commands that you can never remember

And I’m planning to add there each little script I write from now and on! But I need to remember every time I modify the script to re-upload it to Gist.

Ok .. that’s all I wanted to write. Not very interesting but really useful! I’m not joking. I just moved to my new laptop & I didn’t need to move any configuration file from my previous computer cause I had them all on Gist 🙂