Today we publish the last part of the series about the Top 25 Editing Tips. In case you missed the previous articles, you can go back and read part 1 and part 2 before you read this and give your productivity a boost.
Let’s see what’s in this article:
- Clipboard operations
- General tips
And here are the tips from the other articles in the series:
- Code generation
- Text selection
- Navigation between files
- Structure and navigation
A basic copy-paste operation is something you probably already very frequently use and you might be wondering what the IDE can do with something as simple as the clipboard?
Compare with clipboard
GoLand has a built-in diff viewer for code, revisions, and even images. To invoke it, select any pair of files and press Ctrl+D on Windows/Linux and ⌘D on macOS.
If you have selected a single file, the IDE will prompt you to select another file to compare it to. To quickly compare the editor with the clipboard, choose View | Compare with Clipboard.
Paste from history
Speaking of the clipboard, GoLand keeps track of everything you put in the clipboard. Anytime you want to paste one of your previously copied items, press Ctrl+Shift+V on Windows/Linux and ⌘⇧V on macOS, to go to the Choose Content to Paste popup window.
Adding a package from the clipboard
We can’t talk about the clipboard without mentioning that whenever the IDE detects a possible import path of a package in the clipboard it will suggest installing it as a module or adding it to the GOPATH, depending on the project type. This is all done locally, of course, so no data is sent to us.
Let’s close the series with some generic tips and tricks that will make your life easier whenever you use the IDE.
Switch to the editor
Throughout this article, we’ve seen a lot of (tool) windows opening or appearing. How can we quickly get back to the editor? We can press the Esc key and the focus will switch back to the editor. The tool window you’re switching from will preserve its visibility state in this case.
Hide all tool windows
You can hide all the tool windows in the IDE and quickly switch to the editor via Ctrl+Shift+F12 on Windows/Linux, and ⌘⇧F12 on macOS.
I mentioned the Speed Typing feature a few times, but what actually is it? It’s the ability to type anything in a list and have the results filtered. You can then use the arrow keys to move through the list, or press Esc to dismiss the filter.
If you need to search for anything – from IDE settings to parts of your code – then Search Everywhere, Shift+Shift, is there to help. You can even toggle the settings from the search results and it can be used with fuzzy searching.
Yes, we know, this is the 26th tip, but no tips list would be complete without mentioning the Local History feature.
Have you ever done some editing, had something working, then after a little more editing, things have stopped working? Or you accidentally deleted all the work you did that day (or week), because of a wrong command?
Then Local History will come to the rescue.
You can invoke it at any time by using the Local History command either via Search Everywhere, or by right-clicking on the folder/file.
You can also see the difference between different points in time, and you can put labels on known points in time to make sure that you can always return to a safe state. Labels get automatically added when tests pass, for example.
That’s it for today’s post. We hope you enjoyed it and discovered a few new things along the way.
As usual, let us know your thoughts in the comments section below, on our issue tracker, or via Twitter. And send your suggestions on what kind of articles or tips would you like to see next.