How to use multiple tabs when tagging to a function in Vim - ide

I use ctags with my Vim and I rely heavily on C-] and C-T to tag back and froth between various functions in my project.
But if the function is in a different file, I'd like Vim to automatically open it in a new tab instead of the current tab. If I pop my tag stack using the C-T, I'd like it go back to the original tab where I pressed by C-] instead of changing the file in the current tab. I don't like to have the same file opened in multiple tabs in Vim. This is the normal behavior for most IDEs and I am wondering if there is a way to do this in Vim?

nmap <C-Enter> <C-w><C-]><C-w>T
Does this help ? You could probably figure out something similar for the way back.
Well, we need to decide what would be the wanted behaviour. We can go back to the original tab (not sure how, still investigating) but then the above given mapping is gonna open a new tab next time. So you'll end up with a lot of tabs after a while.
Or we can do <C-w>C, which will close the opened tab and take us back to the original one. I, personally, prefer this way of working (that way I don't lose my position in the file)
I go to the function I want, make my corrections there then return to the original file from which I started.
Let me know, what would you like (this didn't fit in comments so I put the answer here).

This might point you in the right direction:
http://vim.wikia.com/wiki/Open_every_buffer_in_its_own_tabpage

So, this is a feature I would like to see as well.
I'm not sure if it's possible.
What I usually do is
:tabnew
:tag somepartsoffunction*
and press tab to use globbing to easily find tag.
Sure, it's not an ideal solution, but it works most of the time.
Unfortunately, with VIM tabbing isn't totally integrated since it's a new feature since 7.0. Most people I know that use VIM weren't even aware of tabs until I told them, so with that, I have a feeling there is no way to do it right now.
(I would love to be proven wrong)

Related

How to undo in Intellij IDEA replace in files?

In intellij 2022.1, I use Ctrl+Shift+R to bring up the Replace in Files window - it shows 100+ matches in 40+ files. The search string and the replace string differ in only one character, for example: this.bar.is.fooed and this.barf.is.fooed. I only need to replace certain instances based on nearby text.
I'm in the groove, clicking the Replace button, checking the next entry, clicking, checking, ... and thinking my brain can keep things straight (it can't; neither can yours:-) I'm halfway through when I realize the last few replaces were wrong.
How can I undo them? Ctrl+Z is grayed out. This related SO question doesn't say and neither does the JetBrains documentation!
Use Local History to revert the changes.
Undo/redo is not supported for Replace dialog, vote for the related request.

Ctrl+T, Ctrl+O, not working right

Neither Ctrl+T nor Ctrl+O in IdeaVim always return to the previous location when jumping to something in any way.
Yes, after something like Ctrl+], you can jump back to where you came from using Ctrl+O. But there are all kinds of different ways to jump around.
I would like a set of shortcut keys that makes it consistently jump back to where I came from, regardless of how it jumped to something. Be it through a Vim action, or an IDE action, Ctrl+O, and Ctrl+I ought to just let me go back and forth. Right now, it seems like a horrible confusing frustrating mess.
Add nmap <C-o> :action Back<CR> to your .ideavimrc file in your home folder.
This back navigation behavior will work better than the default one.
Right now IdeaVim uses its own jump history not integrated with the jump history of IntelliJ. Feel free to vote for VIM-44.

IntelliJ-IDEA Eclipse Ctrl+O equivalent that is better than Alt+7

In Eclipse I could hit Ctrl+O and get a popup which I could use to get an overview of everything in the current class, pick an entry, and jump to it.
In idea, there is Alt+7, but I have a few issues with it. First, the keyboard doesn't seem to put its focus there. I have to take my hand off the keyboard and use the mouse to place the focus on the Structure dock.
I also don't like how it's taking up real estate. I don't want to change how things are laid out if I want to see the structure. I would like a more non-invasive popup, and handier and snappier.
Is there another feature that gives me quick access in the form of a popup preferably, like Ctrl+O provides in Eclipse?
Another nice feature would be to be able to use the J and K keys to move up and down the selection, instead of having to use the cursor keys. I'm using IdeaVim, so the normal workflow when editing files, is that both hands stay in a touch-type position. It would be nice if I can use the various navigation features also using vim keys...
Perhaps there is a way to enable this, that I haven't discovered yet?
IntelliJ equivalent of Eclipse's CTRL+O is CTRL+F12 (⌘+F12 on Mac), which will give you more or less the same pop-up as in Eclipse. But I'm not sure if it can be navigated using j and k keys.
More details can be found in the IntelliJ help.

Intellij VIM mode, bookmarks across editors

I can use (ma) to bookmark the current position under (a). I can then jump back to us using ('a). However if I have two files open, I would have thought that when I have an upper case bookmark (mA), if I then in the other editor I jump to boomark (A) using ('A), that I would be taken to the editor that owns that bookmark, but it doesn't. In Eclipse it does this. Surely IDEA can be convinced to jump across editors using bookmarks?
It's a known issue that is likely to be fixed soon. Feel free to vote for VIM-523.

Custom editor commands without using a macro?

Is there any way to make custom commands without using a macro? I would like to do things like:
jump down 20 lines
jump up 20 lines
editor window scrolls when cursor moves within 15 lines of the bottom/top
jump by paragraph (meaning: jump to next empty line, or method signature start, whichever comes first)
And of course those numbers would be editable.
I've tried macros, but they're too slow. Basically I want IntelliJ to behave just a bit more like emacs. I'm hoping I don't have to make a plugin, but I will if that's the only option. Just hoping there is a way to do it that I missed.
There is no way to do what you are asking. However, there is a IdeaVIM plugin which lets you do some of the stuff you ask for (install via Preferences->Plugins). There is also an emacs plugin which may give you what you want: http://devnet.jetbrains.com/thread/441261
The IdeaVIM plugin is maintained by Jetbrains so it may be higher quality.