1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2024-12-22 04:42:48 +01:00
IntelliJ platform plugin for Vim emulation. http://plugins.jetbrains.com/plugin/164
Go to file
2024-03-27 13:49:38 +01:00
.github Use the property to change the state of the octopus handler 2024-02-23 15:32:35 +02:00
.idea Enforce LF line separator in project code style 2024-02-20 16:31:36 +02:00
.teamcity Stop maintaining the changelog file 2024-02-23 14:05:12 +02:00
annotation-processors Bump com.google.devtools.ksp:symbol-processing-api 2024-03-13 18:04:38 +02:00
assets Cut white edges on the gif 2022-08-05 08:47:50 +03:00
doc Move the ideavim-sneak plugin into IdeaVim 2024-02-05 19:28:36 +02:00
gradle/wrapper Update gradle wrapper to version 8.6 2024-02-14 17:07:20 +02:00
scripts Bump org.eclipse.jgit:org.eclipse.jgit.ssh.apache 2024-03-13 16:06:19 +00:00
src Fix(VIM-3364): Exception with mapped Generate action 2024-03-27 13:49:27 +01:00
tests Disable plugin verifier for tests 2024-03-12 09:34:55 +02:00
vim-engine Update search register when using f/t 2024-03-22 07:06:44 +01:00
vimscript-info Update roadmap 2021-11-18 10:55:21 +03:00
.editorconfig Reformat files 2023-03-27 11:14:00 +03:00
.gitattributes Set custom plugin version 2024-03-21 23:00:06 +01:00
.gitignore fixing rebase problems 2024-02-05 16:29:49 +02:00
AUTHORS.md Add lippfi, FilipParker to contributors list 2024-02-24 09:02:05 +00:00
build.gradle.kts Bump org.eclipse.jgit:org.eclipse.jgit.ssh.apache 2024-03-13 16:06:19 +00:00
CHANGES.md Stop maintaining the changelog file 2024-02-23 14:05:12 +02:00
CODE_OF_CONDUCT.md Add Code of Conduct to project 2019-04-10 15:59:48 +03:00
CONTRIBUTING.md Add names of run confugrations so they can be started right from IJ 2023-05-19 18:03:09 +03:00
gradle.properties Set plugin version to chylex-31 2024-03-27 13:49:38 +01:00
gradlew Update gradle wrapper to version 8.6 2024-02-14 17:07:20 +02:00
gradlew.bat Update gradle version to 8 2023-04-26 11:09:39 +03:00
LICENSE.txt Update IdeaVim license to MIT 2022-11-01 20:00:07 +02:00
qodana.sarif.json Update qodana baseline 2024-02-23 15:38:33 +02:00
qodana.yaml Do not analyze test fixtures by qodana 2024-02-20 16:46:43 +02:00
README.md Add info that ideamarks works with global marks only 2023-12-01 15:26:56 +02:00
settings.gradle Extract common UI test fixtures 2024-02-09 16:22:22 +02:00
ThirdPartyLicenses.md Move the ideavim-sneak plugin into IdeaVim 2024-02-05 19:28:36 +02:00

icon

IdeaVim

Official JetBrains Project Contributions welcome Downloads Rating Version Gitter codecov Twitter

IdeaVim is a Vim engine for JetBrains 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 in the menu to enable or disable vim.

  • 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 & File | Settings | Keymap,
    • On macOS: Preferences | Editor | Vim & 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 | Early Access Program | Subscribe to EAP

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

IdeaVim plugins:

  • vim-easymotion
  • NERDTree
  • vim-surround
  • vim-multiple-cursors
  • vim-commentary
  • argtextobj.vim
  • vim-textobj-entire
  • ReplaceWithRegister
  • vim-exchange
  • vim-highlightedyank
  • vim-paragraph-motion
  • vim-indent-object
  • match.it
    etc

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

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.

IdeaVim Plugins

See doc/IdeaVim 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})
    • For the mappings you can use a special <Action> keyword. Don't forget the parentheses.
    • E.g. map gh <Action>(ShowErrorDescription) <- execute hover on gh.
    • ⚠️ Mappings to <Action> don't work with noremap. If you know the case when it's needed, please let us know.
  • :action {action_id}
    • Execute an action by {action_id}. Works from Ex command line.
    • Please don't use :action in mappings. Use <Action> instead.

Finding action ids:

  • IJ provides IdeaVim: track action Ids command to show the id of the executed actions. This command can be found in "Search everywhere" (double shift).

    "Track action Ids" Details (click to see) track action ids
  • :actionlist [pattern]

    • Find IDE actions by id or keymap pattern (E.g. :actionlist extract, :actionlist <C-D)
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)
ShowHoverInfo - Quick Documentation and Error Description
QuickImplementations - Quick Definition

Vim Script

IdeaVim can execute custom scripts that are written with Vim Script. At the moment we support all language features, but not all of the built-in functions and options are supported.

Additionally, you may be interested in the Vim Script Discussion or Vim Script Roadmap.

IDE specific options

You can evaluate the has('ide') function call and get 1 if it was called with IdeaVim or 0 if the function was called from Vim/NeoVim.
The option &ide contains the name and edition of your IDE, for example, "IntelliJ IDEA Ultimate Edition".
To see its value for the current IDE you are using, execute the :echo &ide command.
To write an IDE-specific configuration, use Vim's regexp match operators =~? (case-insensitive) / =~# (case-sensitive)

Example config:

" options and mappings that are supported by both Vim and IdeaVim
set nu
set relativenumber

if has('ide')
  " mappings and options that exist only in IdeaVim
  map <leader>f <Action>(GotoFile)
  map <leader>g <Action>(FindInPath)
  map <leader>b <Action>(Switcher)

  if &ide =~? 'intellij idea'
    if &ide =~? 'community'
      " some mappings and options for IntelliJ IDEA Community Edition
    elseif &ide =~? 'ultimate'
      " some mappings and options for IntelliJ IDEA Ultimate Edition
    endif
  elseif &ide =~? 'pycharm'
    " PyCharm specific mappings and options
  endif
else
  " some mappings for Vim/Neovim
  nnoremap <leader>f <cmd>Telescope find_files<cr>
endif

💎 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 IdeaVim global marks: set ideamarks (works for marks with capital letters only)
    • Check out more ex commands.
  • Use your vim settings with IdeaVim. Put source ~/.vimrc in ~/.ideavimrc.

  • 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.

  • You can read a post about how modes work in Vim and IdeaVim.

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

  • A lot of variables that refer to visual mode start with two uppercase letters, e.g. VIsual_active. Some examples. As mentioned here, this was done this way to avoid the clash with X11.

  • 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.

  • Fancy constants for undolevels:

    The local value is set to -123456 when the global value is to be used.

License

IdeaVim is licensed under the MIT license.

Third-party components and licenses are listed in ThirdPartyLicenses.md.

All releases before 2.0.0 were licensed under terms of GPL-2.0 or later. The last commit before switch to MIT is 05852b07c6. You can read more about the license change here: https://github.com/JetBrains/ideavim/discussions/543