1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-04-28 10:15:42 +02:00

Add documentation as raw md files

This commit is contained in:
Alex Plate 2021-12-01 09:47:23 +03:00
parent 3796d9f8b4
commit d57359b2ff
No known key found for this signature in database
GPG Key ID: 0B97153C8FFEC09F
9 changed files with 583 additions and 0 deletions

View File

@ -0,0 +1,58 @@
Some examples of join command with `ideajoin` option enabled.
Put `set ideajoin` to your `~/.ideavimrc` to enable this functionality.
* Automatic join concatenated lines:
```
"Hello" + -> "Hello world"
" world!"
```
* Nested if's:
```
if (a) { -> if (a && b) {
if (b) { ...
... }
}
}
```
* Comments:
```
// Hello -> // Hello world
// world
```
* Remove braces from one line for / if / while:
```
if (fail) { -> if (fail) return;
return;
}
```
* Kotlin one line method:
```
fun myNumber(): Int { -> fun myNumber(): Int = 42
return 42
}
```
* Join declaration and initialization:
```
int a; -> int a = 5;
a = 5;
```
* Chain call:
```
sb.append("a"); -> sb.append("a").append("b");
sb.append("b");
```
And other features provided by the plugins.

140
doc/"set"-commands.md Normal file
View File

@ -0,0 +1,140 @@
List of Supported Set Commands
==============================
The following `:set` commands can appear in `~/.ideavimrc` or be set manually in the command mode:
'clipboard' 'cb' clipboard options
Standard clipboard options plus
`ideaput` (default on) - IdeaVim ONLY
enable native idea paste action for put operations
'digraph' 'dg' enable the entering of digraphs in Insert mode
'gdefault' 'gd' the ":substitute" flag 'g' is by default
'history' 'hi' number of command-lines that are remembered
'hlsearch' 'hls' highlight matches with the last search pattern
'ignorecase' 'ic' ignore case in search patterns
'iskeyword' 'isk' defines keywords for commands like 'w', '*', etc.
'incsearch' 'is' show where search pattern typed so far matches
`keymodel` `km` String (default "continueselect,stopselect")
List of comma separated words, which enable special things that keys
can do. These values can be used:
startsel Using a shifted special[1] key starts selection (either
Select mode or Visual mode, depending on "key" being
present in 'selectmode').
stopsel Using a NOT-shifted special[1] key stops selection.
Automatically enables `stopselect` and `stopvisual`
stopselect Using a NOT-shifted special[1] key stops - IdeaVim ONLY
select mode and removes selection.
stopvisual Using a NOT-shifted special[1] key stops - IdeaVim ONLY
visual mode and removes selection.
continueselect Using a shifted arrow key doesn't - IdeaVim ONLY
start selection, but in select mode
acts like startsel is enabled
continuevisual Using a shifted arrow key doesn't - IdeaVim ONLY
start selection, but in visual mode
acts like startsel is enabled
'matchpairs' 'mps' pairs of characters that "%" can match
'maxmapdepth' 'mmd' Maximum depth of mappings
'more' 'more' When on, listings pause when the whole screen is filled.
'nrformats' 'nf' number formats recognized for CTRL-A command
'number' 'nu' print the line number in front of each line
'relativenumber' 'rnu' show the line number relative to the line with
the cursor
'scroll' 'scr' lines to scroll with CTRL-U and CTRL-D
'scrolljump' 'sj' minimum number of lines to scroll
'scrolloff' 'so' minimum number of lines above and below the cursor
'selection' 'sel' what type of selection to use
`selectmode` `slm` String (default "")
This is a comma-separated list of words, which specify when to start
Select mode instead of Visual mode, when a selection is started.
Possible values:
mouse when using the mouse
key when using shifted special[1] keys
cmd when using "v", "V", or <C-V>
ideaselection when IDE sets a selection - IdeaVim ONLY
(examples: extend selection, wrap with while, etc.)
`startofline` `sol` When "on" some commands move the cursor to the first non-blank of the line.
When off the cursor is kept in the same column (if possible).
'showmode' 'smd' message on the status line to show current mode
'showcmd' 'sc' show (partial) command in the status bar
'sidescroll' 'ss' minimum number of columns to scroll horizontally
'sidescrolloff' 'siso' min. number of columns to left and right of cursor
'smartcase' 'scs' no ignore case when pattern is uppercase
'timeout' 'to' use timeout for mapped key sequences
'timeoutlen' 'tm' timeout duration for a mapped key sequence
'undolevels' 'ul' maximum number of changes that can be undone
'viminfo' 'vi' information to remember after restart
'visualbell' 'vb' use visual bell instead of beeping
'wrapscan' 'ws' searches wrap around the end of file
IdeaVim only commands:
`ideamarks` `ideamarks` Boolean (default true)
If true, creation of global mark will trigger creation of IDE's bookmark
and vice versa.
`idearefactormode` `idearefactormode` String(default "select")
Define the mode that would be enabled during
the refactoring (renaming, live template, introduce variable, etc)
Use one of the following values:
- keep - keep the mode that was enabled before starting a refactoring
- select - start refactoring in select mode
- visual - start refactoring in visual mode
This option has effect if you are in normal, insert or replace mode before refactoring start.
Visual or select mode are not changed.
`ideajoin` `ideajoin` Boolean (default false)
If true, join command will be performed via IDE
See wiki/`ideajoin` examples
`ideastatusicon` `ideastatusicon` String(default "enabled")
Define the behavior of IdeaVim icon in the status bar.
Use one of the following values:
- enabled - icon is shown in the status bar
- gray - use the gray version of the icon
- disabled - hide the icon
`ideawrite` `ideawrite` String (default "all")
"file" or "all". Defines the behaviour of ":w" command.
Value "all" enables execution of ":wa" (save all) command on ":w" (save).
This feature exists because some IJ options like "Prettier on save" or "ESlint on save"
work only with "save all" action. If this option is set to "all", these actions work
also with ":w" command.
`lookupkeys` `lookupkeys` List of strings
List of keys that should be processed by the IDE during the active lookup (autocompletion).
For example, <Tab> and <Enter> are used by the IDE to finish the lookup,
but <C-W> should be passed to IdeaVim.
Default value:
"<Tab>", "<Down>", "<Up>", "<Enter>", "<Left>", "<Right>",
"<C-Down>", "<C-Up>", "<PageUp>", "<PageDown>",
"<C-J>", "<C-Q>"
`ideavimsupport` `ideavimsupport` List of strings (default "dialog")
Define the list of additional buffers where IdeaVim is enabled.
- dialog - enable IdeaVim in dialogs
- singleline - enable IdeaVim in single line editors (not suggested)
----------
[1] - cursor keys, <End>, <Home>, <PageUp> and <PageDown>

248
doc/Emulated-plugins.md Normal file
View File

@ -0,0 +1,248 @@
Emulated Vim Plugins
--------------------
IdeaVim extensions emulate plugins of the original Vim. In order to use
IdeaVim extensions, you have to enable them via this command in your `~/.ideavimrc`:
```
Plug '<extension-github-reference>'
```
If you reuse your existing `.vimrc` file using `source ~/.vimrc`, IdeaVim can parse and enable plugins that are defined
using [vim-plug](https://github.com/junegunn/vim-plug) or [vundle](https://github.com/VundleVim/Vundle.vim).
No additional set commands in `~/.ideavimrc` are required.
If you'd like to disable some plugin that's enabled in `.vimrc`, you can use `set no<extension-name>`
in `~/.ideavimrc`. E.g. `set nosurround`.
Available extensions:
## easymotion
* Setup:
* Install [IdeaVim-EasyMotion](https://plugins.jetbrains.com/plugin/13360-ideavim-easymotion/)
and [AceJump](https://plugins.jetbrains.com/plugin/7086-acejump/) plugins.
* `Plug 'easymotion/vim-easymotion'`
* <details>
<summary>Alternative syntax</summary>
<code>Plug 'https://github.com/easymotion/vim-easymotion'</code>
<br/>
<code>Plug 'vim-easymotion'</code>
<br/>
<code>set easymotion</code>
</details>
* Emulates [vim-easymotion](https://github.com/easymotion/vim-easymotion)
* Commands: All commands with the mappings are supported. See the [full list of supported commands](https://github.com/AlexPl292/IdeaVim-EasyMotion#supported-commands).
## NERDTree
* Setup: `Plug 'preservim/nerdtree'`
* <details>
<summary>Alternative vim-plug / vundle syntax</summary>
<code>Plug 'https://github.com/preservim/nerdtree'</code>
<br/>
<code>Plug 'nerdtree'</code>
<br/>
<code>set NERDTree</code>
</details>
* Emulates [NERDTree](https://github.com/preservim/nerdtree)
* Commands: [[see here|NERDTree-support]]
## surround
* Setup: `Plug 'tpope/vim-surround'`
* <details>
<summary>Alternative vim-plug / vundle syntax</summary>
<code>Plug 'https://github.com/tpope/vim-surround'</code>
<br/>
<code>Plug 'vim-surround'</code>
<br/>
<code>Plug 'https://www.vim.org/scripts/script.php?script_id=1697'</code>
<br/>
<code>set surround</code>
</details>
* Emulates [vim-surround](https://github.com/tpope/vim-surround)
* Commands: `ys`, `cs`, `ds`, `S`
## multiple-cursors
* Setup: `Plug 'terryma/vim-multiple-cursors'`
* <details>
<summary>Alternative vim-plug / vundle syntax</summary>
<code>Plug 'https://github.com/terryma/vim-multiple-cursors'</code>
<br/>
<code>Plug 'vim-multiple-cursors'</code>
<br/>
<code>set multiple-cursors</code>
</details>
* Emulates [vim-multiple-cursors](https://github.com/terryma/vim-multiple-cursors)
* Commands: `<A-n>`, `<A-x>`, `<A-p>`, `g<A-n>`
## commentary
* Setup: `Plug 'tpope/vim-commentary'`
* <details>
<summary>Alternative vim-plug / vundle syntax</summary>
<code>Plug 'https://github.com/tpope/vim-commentary'</code>
<br/>
<code>Plug 'vim-commentary'</code>
<br/>
<code>Plug 'https://www.vim.org/scripts/script.php?script_id=3695'</code>
<br/>
<code>Plug 'tomtom/tcomment_vim'</code>
<br/>
<code>Plug 'tcomment_vim'</code>
<br/>
<code>Plug 'https://www.vim.org/scripts/script.php?script_id=1173'</code>
<br/>
<code>set commentary</code>
</details>
* Emulates [commentary.vim](https://github.com/tpope/vim-commentary)
* Commands: `gcc`, `gc + motion`, `v_gc`
* By [Daniel Leong](https://github.com/dhleong)
## ReplaceWithRegister
* Setup: `Plug 'vim-scripts/ReplaceWithRegister'`
* <details>
<summary>Alternative vim-plug / vundle syntax</summary>
<code>Plug 'https://github.com/vim-scripts/ReplaceWithRegister'</code>
<br/>
<code>Plug 'ReplaceWithRegister'</code>
<br/>
<code>Plug 'https://github.com/inkarkat/vim-ReplaceWithRegister'</code>
<br/>
<code>Plug 'inkarkat/vim-ReplaceWithRegister'</code>
<br/>
<code>Plug 'vim-ReplaceWithRegister'</code>
<br/>
<code>Plug 'https://www.vim.org/scripts/script.php?script_id=2703'</code>
<br/>
<code>set ReplaceWithRegister</code>
</details>
* Emulates [ReplaceWithRegister](https://github.com/vim-scripts/ReplaceWithRegister)
* Commands: `gr`, `grr`
* By [igrekster](https://github.com/igrekster)
## argtextobj
* Setup:
* `Plug 'vim-scripts/argtextobj.vim'`
* <details>
<summary>Alternative vim-plug / vundle syntax</summary>
<code>Plug 'https://github.com/vim-scripts/argtextobj.vim'</code>
<br/>
<code>Plug 'argtextobj.vim'</code>
<br/>
<code>Plug 'https://www.vim.org/scripts/script.php?script_id=2699'</code>
<br/>
<code>set argtextobj</code>
</details>
* By default, only the arguments inside parenthesis are considered. To extend the functionality
to other types of brackets, set `g:argtextobj_pairs` variable to a comma-separated
list of colon-separated pairs (same as VIM's `matchpairs` option), like
`let g:argtextobj_pairs="(:),{:},<:>"`. The order of pairs matters when
handling symbols that can also be operators: `func(x << 5, 20) >> 17`. To handle
this syntax parenthesis, must come before angle brackets in the list.
* Emulates [argtextobj.vim](https://www.vim.org/scripts/script.php?script_id=2699)
* Additional text objects: `aa`, `ia`
## exchange
* Setup: `Plug 'tommcdo/vim-exchange'`
* <details>
<summary>Alternative vim-plug / vundle syntax</summary>
<code>Plug 'https://github.com/tommcdo/vim-exchange'</code>
<br/>
<code>Plug 'vim-exchange'</code>
<br/>
<code>set exchange</code>
</details>
* Emulates [vim-exchange](https://github.com/tommcdo/vim-exchange)
* Commands: `cx`, `cxx`, `X`, `cxc`
* By [fan-tom](https://github.com/fan-tom)
## textobj-entire
* Setup: `Plug 'kana/vim-textobj-entire'`
* <details>
<summary>Alternative vim-plug / vundle syntax</summary>
<code>Plug 'https://github.com/kana/vim-textobj-entire'</code>
<br/>
<code>Plug 'vim-textobj-entire'</code>
<br/>
<code>Plug 'https://www.vim.org/scripts/script.php?script_id=2610'</code>
<br/>
<code>set textobj-entire</code>
</details>
* Emulates [vim-textobj-entire](https://github.com/kana/vim-textobj-entire)
* Additional text objects: `ae`, `ie`
* By [Alexandre Grison](https://github.com/agrison)
## highlightedyank
* Setup:
* `Plug 'machakann/vim-highlightedyank'`
* <details>
<summary>Alternative vim-plug / vundle syntax</summary>
<code>Plug 'https://github.com/machakann/vim-highlightedyank'</code>
<br/>
<code>Plug 'vim-highlightedyank'</code>
<br/>
<code>set highlightedyank</code>
</details>
* if you want to optimize highlight duration, assign a time in milliseconds:
`let g:highlightedyank_highlight_duration = "1000"`
A negative number makes the highlight persistent.
`let g:highlightedyank_highlight_duration = "-1"`
* if you want to change background color of highlight you can provide the rgba of the color you want e.g.
`let g:highlightedyank_highlight_color = "rgba(160, 160, 160, 155)"`
* Emulates [vim-highlightedyank](https://github.com/machakann/vim-highlightedyank)
* By [KostkaBrukowa](https://github.com/KostkaBrukowa)
## vim-paragraph-motion
* Setup: `Plug 'dbakker/vim-paragraph-motion'`
* <details>
<summary>Alternative vim-plug / vundle syntax</summary>
<code>Plug 'https://github.com/dbakker/vim-paragraph-motion'</code>
<br/>
<code>Plug 'vim-paragraph-motion'</code>
<br/>
<code>Plug 'https://github.com/vim-scripts/Improved-paragraph-motion'</code>
<br/>
<code>Plug 'vim-scripts/Improved-paragraph-motion'</code>
<br/>
<code>Plug 'Improved-paragraph-motion'</code>
<br/>
<code>set vim-paragraph-motion</code>
</details>
* Emulates [vim-paragraph-motion](https://github.com/dbakker/vim-paragraph-motion)
## vim-indent-object
* Setup: `Plug 'michaeljsmith/vim-indent-object'`
* <details>
<summary>Alternative vim-plug / vundle syntax</summary>
<code>Plug 'https://github.com/michaeljsmith/vim-indent-object'</code>
<br/>
<code>Plug 'vim-indent-object'</code>
<br/>
<code>set textobj-indent</code>
</details>
* Emulates [vim-indent-object](https://github.com/michaeljsmith/vim-indent-object)
* Additional text objects: `ai`, `ii`, `aI`
* By [Shrikant Sharat Kandula](https://github.com/sharat87)
## matchit.vim
* Setup: `packadd matchit`
* <details>
<summary>Alternative vim-plug / vundle syntax</summary>
<code>Plug 'vim-matchit'</code>
<br/>
<code>Plug 'chrisbra/matchit'</code>
<br/>
<code>set matchit</code>
</details>
* Emulates [matchit.vim](https://github.com/chrisbra/matchit)
* Currently works for HTML/XML and ruby
* By [Martin Yzeiri](https://github.com/myzeiri)

6
doc/Home.md Normal file
View File

@ -0,0 +1,6 @@
Welcome to the IdeaVim wiki!
- List of emulated plugins: [[plugins|Emulated-plugins]]
- Examples of `ideajoin` option (also known as "smart join"): [["ideajoin" examples|"ideajoin"-examples]]
- List of "set" commands: [["set" commands|"set"-commands]]
- Docs about "select" mode in vim: [[select mode|Select-mode]]

73
doc/NERDTree-support.md Normal file
View File

@ -0,0 +1,73 @@
# NERDTree
IdeaVim supports emulation of the NERDTree plugin. Update your `~/.ideavimrc` to turn it on:
```vim
Plug 'preservim/nerdtree`
```
or
```vim
set NERDTree
```
Use `set noNERDTree` to disable this extension.
<details>
<summary>Full list of aliases</summary>
```vim
set NERDTree
Plug 'preservim/nerdtree`
Plug 'https://github.com/preservim/nerdtree'
Plug 'https://github.com/scrooloose/nerdtree'
Plug 'scrooloose/nerdtree'
Plug 'nerdtree'
```
</details>
### Preview
<details>
<summary>Click to the the preview</summary>
<img src="images/nerdtree.gif" alt="NERDTree example"/>
</details>
### Supported commands
- `:NERDTree`
- `:NERDTreeFocus`
- `:NERDTreeToggle`
- `:NERDTreeClose`
- `:NERDTreeFind`
- `:NERDTreeRefreshRoot`
| Key | Description | Map Setting |
|---------|---------------------------------------------------------|--------------------------------|
| `o` | Open files, directories and bookmarks | `g:NERDTreeMapActivateNode` |
| `go` | Open selected file, but leave cursor in the NERDTree | `g:NERDTreeMapPreview` |
| `t` | Open selected node/bookmark in a new tab | `g:NERDTreeMapOpenInTab` |
| `T` | Same as 't' but keep the focus on the current tab | `g:NERDTreeMapOpenInTabSilent` |
| `i` | Open selected file in a split window | `g:NERDTreeMapOpenSplit` |
| `gi` | Same as i, but leave the cursor on the NERDTree | `g:NERDTreeMapPreviewSplit` |
| `s` | Open selected file in a new vsplit | `g:NERDTreeMapOpenVSplit` |
| `gs` | Same as s, but leave the cursor on the NERDTree | `g:NERDTreeMapPreviewVSplit` |
| `O` | Recursively open the selected directory | `g:NERDTreeMapOpenRecursively` |
| `x` | Close the current nodes parent | `g:NERDTreeMapCloseDir` |
| `X` | Recursively close all children of the current node | `g:NERDTreeMapCloseChildren` |
| `P` | Jump to the root node | `g:NERDTreeMapJumpRoot` |
| `p` | Jump to current nodes parent | `g:NERDTreeMapJumpParent` |
| `K` | Jump up inside directories at the current tree depth | `g:NERDTreeMapJumpFirstChild` |
| `J` | Jump down inside directories at the current tree depth | `g:NERDTreeMapJumpLastChild` |
| `<C-J>` | Jump down to next sibling of the current directory | `g:NERDTreeMapJumpNextSibling` |
| `<C-K>` | Jump up to previous sibling of the current directory | `g:NERDTreeMapJumpPrevSibling` |
| `r` | Recursively refresh the current directory | `g:NERDTreeMapRefresh` |
| `R` | Recursively refresh the current root | `g:NERDTreeMapRefreshRoot` |
| `m` | Display the NERDTree menu | `g:NERDTreeMapMenu` |
| `q` | Close the NERDTree window | `g:NERDTreeMapQuit` |
| `A` | Zoom (maximize/minimize) the NERDTree window | `g:NERDTreeMapToggleZoom` |
### Troubleshooting
If you see the the file is opened automatically on every movement in the Project View (`j`, `k`, etc.)
please make sure that you have "Open Files with Single click" disabled.
<img src="images/disable-one-click.png" alt="Disable one click"/>

24
doc/Select-mode.md Normal file
View File

@ -0,0 +1,24 @@
# FAQ
## What is select mode?
This mode is where the selection works the same as system selection. When you start typing, the text in the selected area is removed and replaced by the new characters that are being typed in.
## Why is select mode enabled during refactoring?
With the help of the select mode, you can immediately enter the variable name during refactoring. You can go to the beginning or the end of a variable using the arrow keys. If you need to make more complex changes, you can always go back to normal mode with `<ESC>`.
## What if I want to use visual mode during refactoring?
Select mode is controlled by the `keymodel`, `selectmode` and `idearefactormode` options. Set `idearefactormode` to `visual` to adjust this behavior.
`set idearefactormode=visual`
## What if I don't want to change the mode during refactoring?
`set idearefactormode=keep`
# See Also
* IdeaVim options: https://github.com/JetBrains/ideavim/blob/master/doc/set-commands.md
* Vim documentation about select mode: https://vimhelp.org/visual.txt.html#Select-mode
* Stackoverflow explanation: https://vi.stackexchange.com/questions/4891/what-is-the-select-mode-and-when-is-it-relevant-to-use-it

Binary file not shown.

After

(image error) Size: 223 KiB

BIN
doc/images/nerdtree.gif Normal file

Binary file not shown.

After

(image error) Size: 32 MiB

34
doc/sethandler.md Normal file
View File

@ -0,0 +1,34 @@
# Configuring conflicting keys via .ideavimrc
IdeaVim allows defining handlers for the shortcuts that exist for both IDE and Vim (e.g. `<C-C>`).
```vim
" Use ctrl-c as an ide shortcut in normal and visual modes
sethandler <C-C> n-v:ide i:vim
```
This option consist of an optional shortcut and a list of space separated list of handlers:
`mode-list:handler mode-list:handler ...`
The `mode-list` is a dash separated list of modes that is similar to `guicursor` notation
and defines the following modes:
- n - normal mode
- i - insert mode
- x - visual mode
- v - visual and select modes
- a - all modes
The `handler` is an argument that may accept the following values:
- ide - use IDE handler
- vim - use Vim handler
Examples:
- `n:ide` - use IDE handler in normal mode
- `i-v:vim` - use Vim handler in normal, visual, and select modes
- `a:ide` - use IDE handler in all modes
By using `sethandler` you can define handlers:
- For a single shortcut: `sethandler <C-A> n:vim i-x:ide` - use Vim handler in normal mode and IDE handler in insert and visual modes,
- For all shortcuts: `sethandler n:vim i:ide` - use Vim handlers in normal mode and IDE handlers in insert mode.
If the definition of the handler is missing for some mode, it defaults to `vim`:
`sethandler <C-X> i:ide` - use IDE handler in insert mode and Vim handler in all other modes.