1. Autocomplete (Tab)
IntelliJ IDEA is an IDE created by the same company that invented the Kotlin language (JetBrains). So it’s no surprise that IDEA understands Kotlin better than anyone in the world.
IntelliJ IDEA has this wonderful thing called autocomplete. It analyzes all the files in your project, all connected libraries, and understands what classes, functions, and variables you have. It then uses that information to help you write code.
You just start typing a word, and it immediately suggests hints. One of the most important keys is the Tab key: “Tab”.
For example, you want to print text to the console. In Kotlin, the println() function is used for this. It’s enough to start typing pri and press “Tab”: IDEA will complete the word and add the parentheses.
If you put a dot after an object name, IDEA will offer a list of functions and properties available for that object. This is very convenient so you don’t have to memorize every method by heart.
For example, you created a variable with text. You don’t have to remember what the function is called to convert text to uppercase. Just type the variable name and put a dot:
fun main() {
val text = "Hello Kotlin"
text. // <-- At this moment, after the dot, IDEA will show a list of commands
}
Important: first type the variable name (text), and only then put the dot. In the drop-down list you’ll see properties (for example, length — the length) and functions (for example, uppercase(), replace()).
CamelHumps
Suppose you want to type the name of a long class, for example InputStreamReader. IntelliJ IDEA lets you save time: you can type only the capital letters — ISR (InputStreamReader) and press Tab. IDEA turns this abbreviation into the full class name. Almost magic.
2. Live Templates
IntelliJ IDEA has thousands of code snippets called Live Templates. Here are the most popular ones in Kotlin:
The main function
To run a program, you need a fun main() function. Typing this manually every time takes too long.
Just type 4 letters main and press Tab (or Enter).
IDEA will instantly expand it into:
fun main() {
}
By the way, the old Java template psvm also works in Kotlin files, but get used to main.
Loop (fori)
You can quickly write a loop using fori + Tab. IDEA will create the loop skeleton:
for (i in 0..index) {
}
All you need to do is specify the number up to which the counter should run.
soutv (System.out Variable) — Print a variable’s value.
If you have a variable age, type soutv and press Tab. IDEA will find the nearest variable and generate the code:
println("age = $age")
soutm (System.out Method) — Print a method name.
Useful when you need to understand whether the program entered a method or not. Generates:
println("Main.main") // Your class and method name
iter (Iterate) — Iterate over a collection.
If you have a list of elements (for example, users), this template will create a for-each loop:
for (user in users) {
}
todo — A note for the future.
Leaves a special comment that is highlighted in IDEA with a bright color and appears in the task list (the TODO tab at the bottom of the screen):
// TODO: implement this method later
fixme — A critical marker.
Similar to TODO, but used for places where the code works incorrectly or requires urgent fixing:
// FIXME: an error occurs here, needs to be fixed!
3. Postfix Completion
It lets you turn an already written expression into different code just by adding a dot at the end.
You don’t need to go back to the beginning of the line to wrap a variable in parentheses or a condition. You write code left to right without interrupting your flow of thought.
Examples:
- .sout — wraps an expression in
println(...) - .var — creates a variable from an expression.
- .not — inverts a boolean value (puts
!before the expression).
What it looks like:
| You type | Press Tab — get |
|---|---|
"Hello".sout |
println("Hello") |
10 + 5.var |
val i = 10 + 5 |
isValid.not |
!isValid |
4. Wrapping: Ctrl+Alt+T
Sometimes you need to place code you’ve already written inside an if condition, a loop, or an error-handling block try-catch.
Instead of typing braces manually and copying code, use the “Surround With” command:
- Select the lines of code.
- Press Ctrl+Alt+T (Windows/Linux) or Cmd+Opt+T (macOS).
- Select the desired construct from the list (if, while, try/catch, etc.).
Example menu in IDEA:
5. Safe renaming: Shift+F6
Never rename variables, functions, or classes by simply deleting and retyping text! If a variable is used in 10 places, you’ll have to find and fix them all manually, which practically guarantees mistakes.
Use Rename Refactoring:
- Place the cursor on the variable name.
- Press Shift + F6.
- Enter the new name and press Enter.
IntelliJ IDEA will find all usages of this variable throughout the entire project and rename them neatly.
6. Search everywhere: Shift + Shift
If you lost a file, forgot where a class is, or can’t find the setting you need in the menu — don’t panic.
Just press the Shift key twice in a row.
The Search Everywhere window will open. Start typing a file name, class name, or even the name of a setting (for example, "Font size"), and IDEA will find it instantly.
7. Local History
Imagine the situation: you wrote code for half an hour, then decided to delete everything and rewrite it. You deleted it. Then you realized it was a mistake. You pressed Ctrl+Z, but accidentally closed the file... And undo no longer works. Panic?
No! IntelliJ IDEA has its own built-in “time machine” — Local History.
It saves versions of your code every few minutes, even if you don’t use Git. To restore code from the past:
- Right-click anywhere in the code editor (or on a file in the project tree).
- Select Local History -> Show History.
- In the window that opens, select a file version on the left and click the revert button (Revert).
8. Code style: Ctrl+Alt+L
Very often, as a result of copying or quickly writing code, its formatting gets messed up: crooked indents, extra spaces, braces in the wrong places.
To make your code match the official Kotlin Style Guide, press: Ctrl+Alt+L (Windows/Linux) or Cmd+Opt+L (macOS).
IDEA will automatically insert spaces and line breaks.
Example:
| Before | After |
|---|---|
|
|
You can find style settings under Settings - Editor - Code Style:

GO TO FULL VERSION