1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2024-11-24 14:42:44 +01:00
IntelliJ platform plugin for Vim emulation. http://plugins.jetbrains.com/plugin/164
Go to file
2021-01-26 11:04:55 +03:00
.detekt Update detekt 2021-01-22 16:18:04 +03:00
.github Check dependabot updates on wednesday 2020-12-25 09:47:12 +03:00
.idea Update inspections profile 2021-01-20 10:18:52 +03:00
.teamcity TeamCity change in 'IntelliJ IDEA plugins / IdeaVim' project: Updated cloud profile 'amazon-48' in project 'project55' 2021-01-19 18:46:29 +00:00
doc Support mapping recursion preventing 2021-01-24 23:59:14 +03:00
gradle/wrapper Update gradle wrapper to 6.8 2021-01-20 13:28:58 +03:00
resources Add information about nerdtree to changes 2021-01-26 11:04:55 +03:00
src Update extension so they register key mappings only if there isn't already registered another mapping 2021-01-26 10:52:26 +03:00
test Update extension so they register key mappings only if there isn't already registered another mapping 2021-01-26 10:52:26 +03:00
.editorconfig Use 2 spaces for Kotlin files as per the IntelliJ platform coding style 2019-05-14 14:13:11 +03:00
.gitignore Move run configurations to the .idea 2020-11-19 16:43:27 +03:00
AUTHORS.md Add Sergei Vorobyov to contributions list 2020-12-25 11:03:50 +03:00
build.gradle Bump remote-robot from 0.10.0 to 0.10.3 2021-01-23 03:04:41 +03:00
CHANGES.md Add information about nerdtree to changes 2021-01-26 11:04:55 +03:00
CODE_OF_CONDUCT.md Add Code of Conduct to project 2019-04-10 15:59:48 +03:00
CONTRIBUTING.md Update CONTRIBUTING.md 2020-11-02 14:16:44 +03:00
gradle.properties [VIM-2140] Downgrade java version to 1.8 2020-10-09 11:06:38 +02:00
gradlew Update gradle wrapper to 6.8 2021-01-20 13:28:58 +03:00
gradlew.bat Update gradle wrapper to 6.8 2021-01-20 13:28:58 +03:00
LICENSE.txt Update license formatting 2019-07-10 12:51:10 +03:00
README.md Add suggested options to README.md 2020-12-03 10:13:28 +03:00
settings.gradle Update copyright year 2021-01-20 03:07:13 +03:00

icon

IdeaVim

Official JetBrains Project Contributions welcome Downloads Rating Version Gitter Twitter

IdeaVim is a Vim emulation plugin for IntelliJ Platform-based IDEs.

Contact maintainers:
Resources:

Compatibility

IntelliJ IDEA, PyCharm, CLion, PhpStorm, WebStorm, RubyMine, AppCode, DataGrip, GoLand, Rider, Cursive, Android Studio and other IntelliJ platform based IDEs.

Setup

  • IdeaVim can be installed via Settings | Plugins. See the detailed instructions.

  • Use Tools | Vim Emulator to enable or disable emulation.

  • Use the ~/.ideavimrc file as an analog of ~/.vimrc (learn more). The XDG standard is supported, as well.

  • Shortcut conflicts can be resolved by using:

    • On Linux & Windows: File | Settings | Editor | Vim Emulation & File | Settings | Keymap,
    • On macOS: Preferences | Editor | Vim Emulation & Preferences | Keymap,
    • Regular Vim mappings in the ~/.ideavimrc file.

Get Early Access

Would you like to try new features and fixes? Join the Early Access Program and receive EAP builds as updates!

  1. Click the IdeaVim icon icon in the status bar | EAP | Get Early Access...

Or subscribe to EAP updates manually:

  1. Open Settings | Plugins
  2. Click the gear icon ⚙️, select Manage Plugin Repositories, and add the following url: https://plugins.jetbrains.com/plugins/eap/ideavim

See the changelog for the list of unreleased features.

It is important to distinguish EAP builds from traditional pre-release software. Please note that the quality of EAP versions may at times be way below even usual beta standards.

You can always leave your feedback with:

Summary of Supported Vim Features

Here are some examples of supported vim features and commands:

  • Normal / insert / visual / select / etc. modes
  • Motion / deletion / change / window / etc. commands
  • Key mappings
  • Marks / Macros / Digraphs / Registers
  • Some set commands
  • Full Vim regexps for search and search/replace
  • Vim web help
  • ~/.ideavimrc configuration file

Emulated Vim plugins:

  • vim-easymotion
  • vim-surround
  • vim-multiple-cursors
  • vim-commentary
  • argtextobj.vim
  • vim-textobj-entire
  • ReplaceWithRegister
  • vim-exchange
  • vim-highlightedyank

See also:

Files

  • ~/.ideavimrc
    • Your IdeaVim-specific Vim initialization commands
Example (click to see)
""" Map leader to space ---------------------
let mapleader=" "

""" Plugins  --------------------------------
set surround
set multiple-cursors
set commentary
set argtextobj
set easymotion
set textobj-entire
set ReplaceWithRegister

""" Plugin settings -------------------------
let g:argtextobj_pairs="[:],(:),<:>"

""" Common settings -------------------------
set showmode
set so=5
set incsearch
set nu

""" Idea specific settings ------------------
set ideajoin
set ideastatusicon=gray
set idearefactormode=keep

""" Mappings --------------------------------
map <leader>f <Plug>(easymotion-s)
map <leader>e <Plug>(easymotion-f)

map <leader>d <Action>(Debug)
map <leader>r <Action>(RenameElement)
map <leader>c <Action>(Stop)
map <leader>z <Action>(ToggleDistractionFreeMode)

map <leader>s <Action>(SelectInProjectView)
map <leader>a <Action>(Annotate)
map <leader>h <Action>(Vcs.ShowTabbedFileHistory)
map <S-Space> <Action>(GotoNextError)

map <leader>b <Action>(ToggleLineBreakpoint)
map <leader>o <Action>(FileStructurePopup)
Suggested options (click to see)

Here is also a list of the suggested options from defaults.vim

" Show a few lines of context around the cursor.  Note that this makes the
" text scroll if you mouse-click near the start or end of the window.
set scrolloff=5

" Do incremental searching
set incsearch

" Don't use Ex mode, use Q for formatting.
map Q gq

You can read your ~/.vimrc file from ~/.ideavimrc with this command:

source ~/.vimrc

⚠️ Please note that IdeaVim currently parses ~/.ideavimrc & ~/.vimrc files via simple pattern-matching. See VIM-669 for proper parsing of VimL files.

Also note that if you have overridden the user.home JVM option, this will affect where IdeaVim looks for your .ideavimrc file. For example, if you have -Duser.home=/my/alternate/home then IdeaVim will source /my/alternate/home/.ideavimrc instead of ~/.ideavimrc.

Alternatively, you can set up initialization commands using XDG standard. Put your settings to $XDG_CONFIG_HOME/ideavim/ideavimrc file.

Emulated Vim Plugins

See doc/emulated-plugins.md

Executing IDE Actions

IdeaVim adds various commands for listing and executing arbitrary IDE actions as Ex commands or via :map command mappings:

Executing actions:

  • :action {action_id}
    • Execute an action by id. Works from Ex command line.
  • <Action>(*action_id*)
    • For the mappings you can use a special <Action> keyword. Don't forget the parentheses.

Finding actions:

  • :actionlist [pattern]

    • Find IDE actions by id or keymap pattern (E.g. :actionlist extract, :actionlist <C-D)
  • In addition to :actionlist command, IdeaVim provides IdeaVim: track action Ids option to extract the ids of executed command. This option can be found in "Search everywhere" (double shift).

    "Track action Ids" Details (click to see) track action ids

Examples:

" Map \r to the Reformat Code action
:map \r <Action>(ReformatCode)

" Map <leader>d to start debug
:map <leader>d <Action>(Debug)

" Map \b to toggle the breakpoint on the current line
:map \b <Action>(ToggleLineBreakpoint)

💎 Contributing

The power of contributing drives IdeaVim 💪. Even small contributions matter!

See CONTRIBUTING.md to start bringing your value to the project.

Authors

See AUTHORS.md for a list of authors and contributors.

IdeaVim tips and tricks

  • Use the power of IJ and Vim:

    • set ideajoin to enable join via the IDE. See the examples.
    • Make sure ideaput is enabled for clipboard to enable native IJ insertion in Vim.
    • Sync IJ bookmarks and Vim marks: set ideamarks
    • Check out more ex commands.
  • Use your vim settings with IdeaVim. Put source ~/.vimrc in ~/.ideavimrc.

    ⚠️ Please note that IdeaVim currently parses ~/.ideavimrc & ~/.vimrc files via simple pattern-matching. See VIM-669 for proper parsing of VimL files.

  • Control the status bar icon via the ideastatusicon option.

  • Not familiar with the default behaviour during a refactoring? See the idearefactormode option.

Some facts about Vim

Lets relax and have some fun now! Here are a few things we've found interesting during development and would like to share with you.

  • There are no such commands as dd, yy, or cc. For example, dd is not a separate command for deleting the line, but a d command with a d motion.
    Wait, but there isn't a d motion in Vim! Thats right, and thats why Vim has a dedicated set of commands for which it checks whether the command equals to motion and if so, it executes _ motion instead.
    _ is an interesting motion that isn't even documented in vi, and it refers to the current line. So, commands like dd, yy, and similar ones are simply translated to d_, y_, etc. Here is the source of this knowledge.

  • x, D, and & are not separate commands either. They are synonyms of dl, d$, and :s\r, respectively. Here is the full list of synonyms.

  • Have you ever used U after dd? Don't even try.

  • A lot of variables that refers to visual mode start with two uppercase letters, e.g. VIsual_active. Some examples.

  • Other strange things from vi:

    • ":3" jumps to line 3
    • ":3|..." prints line 3
    • ":|" prints current line
  • Vim script doesn't skip white space before comma. F(a ,b) => E475.

License

IdeaVim is licensed under the terms of the GNU Public License version 2 or any later version.