The following is only valid when the IdeaVim plugin is installed and enabled.
That gvim user is me! I like to say I’m a vi-guy, but I’ve learned that I have to type ‘vim’ at the console to be consistently happy with the editor I get in Linux. I run Windows on the desktop, and I’ve been using gvim for years, but after inheriting another coder’s codebase, it’s clearly time for some more. Starting with IdeaVim 0.52, VIM-437 has been fixed and you can use the 'keymodel' option to enable special behaviour with shifted keys and selections. If you add:set keymodel^=startsel to your /.ideavimrc, then shift + cursor keys will change you to Visual mode (or.
The IdeaVim plugin emulates Vim in the PhpStorm editor, including normal, insert, and visual modes, Command-line and Ex modes, Vim regexp and configuration, and other features.
Install the IdeaVim plugin
In the Settings/Preferences dialog Ctrl+Alt+S, select Plugins.
Find the IdeaVim plugin in the Marketplace and click Install.
Restart PhpStorm.
After you restart the PhpStorm, Vim emulation is enabled and the editor starts operating in the Vim mode. To disable it, deselect Tools | Vim Emulator in the main menu.
Configure shortcuts
Both Vim and PhpStorm are keyboard-centric. Your keymap in PhpStorm may conflict with Vim's key combinations. To resolve this, select the shortcuts you prefer for different actions.
In the Settings/Preferences dialog Ctrl+Alt+S, select Editor | Vim Emulation.
Find the shortcut and corresponding IDE action, and select how you want to handle it when you are using Vim emulation:
Undefined: show a popup notification that suggests to either redefine the IDE shortcut or configure the handler in Vim emulation settings.
IDE: perform the IDE action associated with this shortcut.
Vim: handle it as a Vim shortcut.
Editing modes
With Vim emulation enabled, the cursor is a block when you are in the Normal mode:
Bruce faulconer dbz soundtrack zip. To change to the Insert mode, press i
, and the cursor will become a line:
In this mode you can type new code or change existing code. You can also enter other Vim modes: for example, press r
for the Replace mode.
To return to the Normal mode, press Escape.
Vim configuration
Vim is configured using a vimrc file. Similarly, the VimIdea plugin uses an ideavimrc file with the same syntax. Create the configuration file in one of the following locations depending on the operating system:
The location where PhpStorm looks for ideavimrc depends on the user.home
JVM option, which is set to the user's home directory by default. For more information, see JVM options.
If you already have a vimrc file with your configuration, you can do one of the following:
Include the configuration from vimrc with the
source
command in your ideavimrc file:source ~/.vimrcThis way you can also include other commands in your ideavimrc file, which will be applied only to your Vim emulation in PhpStorm and will not affect actual Vim configuration.
If you don't want to use your Vim configuration, you can rename .vimrc to .ideavimrc.
Create ideavimrc as a symlink to vimrc if you don't want to modify your Vim emulation in PhpStorm compared to actual Vim configuration:
Japanese version is here Dancehall rock riddim 2004 zip.
IdeaVim
IdeaVimGithub: JetBrains/ideavim
IdeaVim is a Vim emulation plugin for IntelliJ or other Jetbrains IDEs. This plugin are officially developed by Jetbrains as you can see the repository owner name.
Demo
Phpstorm Activation Code
Keymap is personally customized.
Gvim Windows 10
Why use IdeaVim
The advantages in each of IntelliJ and Vim are as follows, I think.
Vim Vs Phpstorm
- IntelliJ: Very powerful code completeion, code navigation, refactoring, and so on with easy and simple settings.
- Vim: Very various and efficient operations as a text editor. A concept of the mode(normal/insert/visual).
So, IntelliJ with Vim-like operation can take both of these advantages. IdeaVim supports many Vim features.
In this blog post, I'll introduce what features IdeaVim supports, how to setup IdeaVim, and how great IdeaVim is.
Supported Vim features
The followings are commonly used Vim features supported by IdeaVim.
Feature | Supported |
---|---|
Mode | NORMAL, INSERT and VISUAL mode |
Motions | yank(y ), delete(d ), change(c ), undo(u ), redo(Ctrl-r ), text object operation( ciw ,ci' , .. ) and so on |
Search | textsearch and highlight by / , incremental search by :set incsearch |
Replace | :s ,:%s ,:'<,'>s and so on |
Commands | :w , :q , :tabnew , :split , a part of :set command and so on |
Keymap | We can customize keymaps by same syntax with .vimrc . We can use map , set and other some commands. The details of this feature will be introduced later of this blog post. |
Macro | available |
Register | available |
Others | :set surround enables vim-surround emulation |
You can see more details at README.md of GitHub repositoy.
Install IdeaVim
In IntelliJ or other Jetbrains IDEs, you can install IdeaVim from [Preferences] > [Plugins]
.After install, you have to restart the IDE to enable IdeaVim.
EAP build
You can install an EAP (Early Access Program) build of IdeaVim by adding the following URL to [Settings] > [Plugins] > [Browse Repositories] > [Manage Repositories]
.
Currently, a new version of IdeaVim is officially released a few times for a year, so sometimes bug fixes or new features are not released soon. So I normally use the EAP build.
How to setup IdeaVim
.ideavimrc
IdeaVim loads a file ~/.ideavimrc
when the IDE started. We can write the settings to .ideavimrc
, with the same syntax as .vimrc
. A list of supported set
commands is here.
In addition, a set surround
command enables a vim-surround emulation.
Share the keymaps between Vim and IdeaVim
.vimrc
and .ideavimrc
can be written as the same syntax. This is a large advantage, because you don't need to learn new specific syntax, and you can share the settings of the common basic keymaps (e.g. nnoremap ; :
) between both of them.
To share the settings, I prepared a shared keymaps file .vimrc.keymap
. It is loaded in .vimrc
and .ideavimrc
by a source
command. Thus you can centralize the common basic keymaps to the one file.
.ideavimrc
.vimrc.keymap
The followngs are my .ideavimrc
and .vimrc.keymap
.
Vim-like keymap to IntelliJ functions
In my .ideavimrc
, a statement map XXX :action YYY
often appears. :action
is a IdeaVim-specific command. By using :action
command, you can call IntelliJ functions.
The following is an example of keymap.
GotoDeclaration
is one of an 'action'. An action corresponds to one of the IntelliJ functions. It navigates to the declaration of the symbol on the text cursor. So, nnoremap gd :action GotoDeclaration
means, 'When you type gd
in the normal mode, then you'll be navigated to the declaration of the symbol'.
Thus, by using an :action
command, you can define a vim-like keymap to any IntelliJ functions, even very powerful code modification, code navigation, refactoring, and the more functions.
You can call any IntelliJ functions, from high-level functions (e.g. refactoring) to low-level functions (e.g. move text cursor). You can also call the functions of the IntelliJ plugin you've installed.
The :action
command dramatically boosts the usability of IdeaVim-ed IntelliJ.
The followings are my recommended actions.
Examples of Action
Action | Description |
---|---|
SearchEverywhere | Navigate to any symbol |
FindInPath | Find text in the whole project |
FileStructurePopup | Navigate to any symbol in current file |
GotoDeclaration | Navigate to the declaration of a symbol |
GotoSuperMethod | Navigate to the super method of a symbol |
GotoImplementation | Navigate to the implementation of an interface |
JumpToLastChange | Navigate to the place changed at last |
FindUsages | List the usages of a symbol |
RenameElement | Rename a symbol |
ReformatCode | Format code |
CommentByLineComment | Comment out |
ShowIntentionActions | Quick fix |
GotoAction | Call anything |
An example
Search an action name
If you want to know an action name of some IntelliJ functions, you can use an :actionlist
command.By using the command you can search an action by words.
But, currently there is no way to know the action name of the IntelliJ function which you want to call from IdeaVim.
Calling :actionlist
will display assigned shortcut key for the each action. It may be a hint of the corresponded IntelliJ function.
Conclusion
In this blog post, I introduced IdeaVim. IdeaVim hasn't emulated Vim completely yet, but it's still a great plugin.
Let's enjoy IdeaVim!