IdeaVim : Navigate through project file - android-studio

Is it possible with the plugin IdeaVim for IntelliJ to navigate thourgh project file (in the window below) using hjkl key ? Like the CtrlP plugin for Vim.

As of 2021, this is now possible.
All you have to do is enable the NERDTree plugin in ideavim by inserting set NERDTree into your .ideavimrc

if you're looking for a CtrlP equivalent, Webstorm has a fuzzy finder that's actually much more powerful than CtrlP.
Try COMMAND+SHIFT+O (the letter O) on Mac or CTRL+SHIFT+N on Windows/Linux.
There is more here: https://www.jetbrains.com/help/phpstorm/2016.1/navigating-to-class-file-or-symbol-by-name.html?origin=old_help#d937859e425

This is old but just in case anyone is looking for marginal efficiency. I use this AutoHotKey script to achieve this exact behavior - together with as you'll figure other mapping for never needing to travel out to the Numpad, Arrow keys or Special keys.
As it is a very short repo here are the essentials:
Download autohotkey (https://autohotkey.com/).
Place the .ahk script into the startup folder (win + r, then run "shell:startup" to find on Windows) (https://autohotkey.com/docs/FAQ.htm#Startup). This allows the script to always be active, as it is ran on startup.
Run the Script to go into effect now.
The script is:
#SingleInstance
+CapsLock::CapsLock
CapsLock::Esc
Its been game changing

Related

plugin to vim that shows definition of function/macro/struct in a popup box?

Im using vim with ctag+tagbar plugin to navigate through kernel code and its amazing ! Thanks to a guide I saw here.
I read here about some nice shortcuts for ctags that helps a lot, but I couldnt find a way that a definition(of structs/function etc) would show in popup box - something like eclipse ide.
Is there a way to do so with ctag? is there a plug-in I can add to vim that would that ? so when the mouse cursor(or also keyboard cursor) on function a popup box next to it will show?
Thanks!
Generally, you should avoid trying to use Vim as an IDE. It's meant to be a modular text editor.
Having said that, if you are looking for eclipse functionality inside of Vim, you may want to consider eclim. Another good set of plugins are the Clang based tools, like clang-format and YouCompleteMe.
ctags is very useful plugin, but if you also use ctags you can then copy file http://cscope.sourceforge.net/cscope_maps.vim to your ~/.vim/plugin directory and this will add keymappings that will allow you to jump to definition or show it in horizontal or vertical split.
I also added to my cscope_maps file an extra set of mappings like so:
nmap <C-h>g :tab cs find g <C-R>=expand("<cword>")<CR><CR>
to open my search in a new tab.
Example above allows you to use Ctrl+h and then g to "find global definition(s) of the token under cursor" and open it in a new tab.
Consider using cscope- it can also work with ctags (I always use both).
I know that this is not a pop-up window, but vim is not an IDE.

How can I use vim plugins with Ideavim?

I would like to use Tim Pope's vim surround plugin in my Pycharm IDE. I've been using the IdeaVim plugin for Pycharm to use vim motions and commands.
I know I can use ~/.ideavimrc like my normal .vimrc but I cannot find
information about how to use plugins with ideavim.
Can I specify the plugins directory inside my ~/.ideavimrc or do I have to go another way? Can I use a plugin manager like pathogen?
The latest version of IdeaVim includes the vim-surround plugin. Enable it by adding
set surround
to your .ideavimrc file
https://github.com/JetBrains/ideavim#emulated-vim-plugins
Most applications only emulate Vim's / vi key bindings (and often only the basic navigation and editing commands). That goes a long way to helping vi users edit comfortably, but it isn't the real thing.
Unfortunately, to be able to use Vim plugins, you'll need the full Vimscript interpreter and infrastructure around 'runtimepath'. I'm not aware of any application that provides this, and because of the complexities and idiosyncrasies of Vim, this would be very hard indeed.
To get more of Vim's special capabilities into your IDE, use both concurrently; it is very easy to set up a external tool in your IDE that launches Vim with the current file (and position). Automatic reloading of changes allows you to edit source code in both concurrently.
If it's any comfort to you, the same applies to Emacs / Elisp as well.
The ideaVim plugin added "Support for vim-surround commands ys, cs, ds, S, enable it with set surround in your ~/.ideavimrc" since version 0.46.
No. Vote for VIM-506 for Vim scripts support (unlikely to be implemented) and for VIM-769 for vim-surround emulation (likely to appear in future versions).
This was mentioned in a changelog relatively recently.
https://github.com/JetBrains/ideavim/blob/master/CHANGES.md#features-5
I didn't mange this work. Looks like I need vim-plug installed and I use another package manager in my NeoVim and also I don't want to mix up two configs. It should work in general.

How to map cmd+s to save all?

I'm developing some front-end project with the help of Yeoman.
I run the developing webserver by grunt serverand, because there is livereload.js in the project, for watching files change and refreshing the webpage, sometimes, I need to modify multiple files for one purpose(.html, .css, .js ...) and it's kind of waste for browser when each file saves.
So is there a way for MacVim, map cmd + s to :wa ?
nnoremap <D-s> :wa in your .vimrc should do the trick.
nnoremap means this mapping is only available in Normal mode, and is not recursive.
:wa means write all, i.e. save all the current open buffers.
If you don't want to use a new mapping, you can simply type :wa to achieve the same things, but this is a matter of preferences only.
I know this is old but I came searching with the same question.
tl;dr: ⌥+⌘+S to save all.
You can, supposedly, map <D-s> to :wa but it's not as simple as adding the mapping to your .gvimrc file. See the third bullet below.
From the MacVim docs:
cmd-key cmd-shortcuts
Creating key mappings that involve the Cmd key ( in Vim notation) can
sometimes be slightly involved. Here are all the things you need to consider:
Make sure the shortcut is not used by a menu item by looking through the
menus. If it is then you need to unbind it before you can map to it. This
is described under the help for the |:macmenu| command.
Bindings to are case sensitive: is not the same as . If
you want to map something to Cmd+Shift+d, then you need to use , not
or .
Some command key shortcuts are reserved by Mac OS X and cannot be mapped to
(e.g. ). However, some of these shortcuts can be freed up in the
System Preferences under Keyboard (e.g. Cmd+Space).
The good news? In trying to sort this out I realized that MacVim is a very courteous MacVim indeed and implements, by default anyway, many standard Mac shortcuts including: ⌥+⌘+S for "Save All". Open MacVim, click the file menu and then hit the option key to see it in action.

how to configure vim commands to windows style?

My job involves working on Windows, *ix and with variety of IDE's like Eclipse, Visual Studio. Sometimes I really don't want to open Eclipse for little editing so I would prefer simple text editor like Vim, but the keys for the commands are horrible to me, I would like to setup Vim command keys to simple and modern style.
Can someone guide me how to configure Vim commands to simple keys like Ctrl+C or Ctrl+V for copy paste (through clipboard) or Shift+→, Shift+← for selecting text.
See this question: How do I configure VIM for using Ctrl-C Ctrl-V as copy paste to and from system buffer in ubuntu?
and the over all help on how to do key mapping here: How to make a keymap
It's not the answer you're looking for, but I'm with hammar. For example the Mac version of vim has the standard Mac-style copy/paste shortcut keys "baked in" yet I use the default vim keybindings now, since, like yourself, I hop about Linux/Windows/Mac, and having the same vim keyboard shortcuts.
Conversely, you'll find managing your personalized, if unorthodox, key bindings more onerous than simply "going vim."
I presume you've "worked" the vimtutor?

share eclim -friendly .vimrc

I am trying to to use eclim for my daily development requirements. My .vimrc has some issues preventing few functionalities like code completion etc.
It would be great if anyone using eclim regularly share your .vimrc.
You can find my vim setup on github. I use eclim to do Android development.
See visualstudioinvoke.vim for how I launch Vim from eclim. This isn't necessary, but it's useful to start at the current line in the current file. It also sets up my eclim menu, bindings, and settings.
It's best to start the eclim server (by opening the "Eclim" eclipse tab) before you start gvim.
I have eclim's code completion mapped to Ctrl-Space.
You won't get any code completion for classes that aren't in the scope of the current file. To import, I have a menu option under Eclim > ImportMissing.
However, my vimrc might be pretty alien to you, so you might be better served whittling down your vimrc until you figure out what's breaking things. The default map for completions is Ctrl-x Ctrl-u. You can use :verb map <C-x> to search for maps that start the same way and it will show you where they're defined.
If you use SuperTab, try disabling it. SuperTab and eclim are both maintained by
Eric Van Dewoestine so they should be compatible, but you may have a SuperTab configuration problem.
You could also try updating all of your plugins.

Resources