2017-11-13 07:53:14 +03:00
< h2 align = "center" > < img src = "https://raw.githubusercontent.com/VSCodeVim/Vim/master/images/icon.png" height = "128" > < br > VSCodeVim< / h2 >
< p align = "center" > < strong > Vim emulation for Visual Studio Code< / strong > < / p >
2017-06-24 23:52:58 +03:00
2017-06-28 18:24:38 +03:00
[![http://aka.ms/vscodevim ](https://vsmarketplacebadge.apphb.com/version/vscodevim.vim.svg )](http://aka.ms/vscodevim)
2017-06-29 20:18:29 +03:00
[![https://travis-ci.org/VSCodeVim/Vim ](https://travis-ci.org/VSCodeVim/Vim.svg?branch=master )](https://travis-ci.org/VSCodeVim/Vim)
2017-06-24 23:52:58 +03:00
2017-11-13 07:53:14 +03:00
VSCodeVim is a [Visual Studio Code ](https://code.visualstudio.com/ ) extension that enables:
2016-01-07 02:59:32 +03:00
2017-11-13 07:53:14 +03:00
* Keybindings and command combinations (`c3w`, `daw` , `2dd` , etc)
2017-04-24 03:26:04 +03:00
* Modes: normal, insert, command-line, visual, visual line, visual block
2017-11-13 07:53:14 +03:00
* Command remapping (`jj` to `<Esc>` , `:` to command panel, etc.)
2016-10-28 22:14:08 +03:00
* Incremental search with `/` and `?`
2016-07-07 09:59:05 +03:00
* Marks
2017-04-24 03:26:04 +03:00
* Popular vim plugin features built-in (easymotion, surround, commentary)
* Multi-cursor support, run vim commands everywhere!
2017-11-13 07:53:14 +03:00
* Refer to our [roadmap ](ROADMAP.md ) for a full list
2017-01-10 08:15:59 +03:00
2017-11-13 07:53:14 +03:00
Please report missing features/bugs on [GitHub ](https://github.com/VSCodeVim/Vim/issues ) and join us on [Slack ](https://vscodevim-slackin.azurewebsites.net ).
2017-01-09 04:52:32 +03:00
2017-04-24 03:26:04 +03:00
## Contents
2017-02-14 07:16:57 +03:00
2017-05-06 05:43:51 +03:00
* [Getting Started ](#getting-started )
2017-04-24 03:26:04 +03:00
* [Mac setup ](#mac-setup )
* [Windows setup ](#windows-setup )
* [Settings ](#settings )
* [VSCodeVim settings ](#vscodevim-settings )
2017-05-22 09:45:46 +03:00
* [Neovim Integration ](#neovim-integration )
2017-04-24 03:26:04 +03:00
* [Key remapping ](#key-remapping )
* [Vim settings ](#vim-settings )
* [Status bar colors (vim-airline) ](#status-bar-color-settings )
* [Multi-cursor mode ](#multi-cursor-mode )
* [Emulated plugins ](#emulated-plugins )
* [vim-easymotion ](#vim-easymotion )
* [vim-surround ](#vim-surround )
* [vim-commentary ](#vim-commentary )
2017-04-27 10:04:50 +03:00
* [vim-indent-object ](#vim-indent-object )
2017-04-24 03:26:04 +03:00
* [VSCodeVim tricks ](#vscodevim-tricks )
* [F.A.Q / Troubleshooting ](#faq )
* [Contributing ](#contributing )
2017-02-14 07:16:57 +03:00
2017-04-24 03:26:04 +03:00
## Getting started
2017-02-14 07:16:57 +03:00
2017-11-13 07:53:14 +03:00
VSCodeVim is automatically enabled following [installation ](https://marketplace.visualstudio.com/items?itemName=vscodevim.vim ) and the reloading of VSCode.
2017-04-24 03:26:04 +03:00
### Vim compatibility
2017-11-13 07:53:14 +03:00
All common Vim commands are supported. For a detailed list of supported features, refer to our [roadmap ](ROADMAP.md ). Vimscript is *not* supported, so you aren't able to load your `.vimrc` or use `.vim` plugins. You have to replicate these using our [Settings ](#settings ) and [Emulated plugins ](#emulated-plugins ).
2017-04-24 03:26:04 +03:00
### Mac setup
If key repeating isn't working for you, execute this in your Terminal.
```sh
defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool false # For VS Code
defaults write com.microsoft.VSCodeInsiders ApplePressAndHoldEnabled -bool false # For VS Code Insider
2018-01-23 04:48:38 +03:00
defaults delete -g ApplePressAndHoldEnabled # If necessary, reset global default
2017-02-14 07:16:57 +03:00
```
2017-04-24 03:26:04 +03:00
2017-11-13 07:53:14 +03:00
We also recommend going into *System Preferences -> Keyboard* and increasing the Key Repeat and Delay Until Repeat settings to improve your speed.
2017-04-24 03:26:04 +03:00
### Windows setup
VSCodeVim will take over your control keys, just like real vim, so you get the _full_ vim experience. This behaviour can be adjusted with the [`useCtrlKeys` ](#vimusectrlkeys ) and [`handleKeys` ](#vimhandlekeys ) settings.
## Settings
### Quick example settings
2017-11-13 07:53:14 +03:00
Below is an example of a [settings.json ](https://code.visualstudio.com/Docs/customization/userandworkspace ) file for VSCode settings applicable to this extension.
2017-04-24 03:26:04 +03:00
```json
2017-02-14 07:16:57 +03:00
{
"vim.easymotion": true,
"vim.incsearch": true,
"vim.useSystemClipboard": true,
"vim.useCtrlKeys": true,
"vim.hlsearch": true,
"vim.insertModeKeyBindings": [
{
"before": ["j","j"],
"after": ["< Esc > "]
}
],
"vim.otherModesKeyBindingsNonRecursive": [
{
"before": ["< leader > ","d"],
"after": ["d", "d"]
2017-04-16 08:58:25 +03:00
},
{
2017-04-24 03:26:04 +03:00
"before":["< C-n > "],
"after":[],
2017-04-16 08:58:25 +03:00
"commands": [
{
"command": ":nohl"
}
]
2017-04-24 03:26:04 +03:00
}
2017-02-14 07:16:57 +03:00
],
2017-03-25 08:48:06 +03:00
"vim.leader": "< space > ",
"vim.handleKeys":{
"< C-a > ": false,
"< C-f > ": false
}
2017-02-14 07:16:57 +03:00
}
```
2017-11-13 07:53:14 +03:00
The following is a subset of the supported settings; the full list is described in the `Contributions` tab in the extensions menu of VSCode.
2017-04-24 03:26:04 +03:00
### VSCodeVim settings
These settings are specific to VSCodeVim.
#### `"vim.startInInsertMode"`
* Have VSCodeVim start in Insert Mode rather than Normal Mode.
* We would be remiss in our duties as Vim users not to say that you should really be staying in Normal mode as much as you can, but hey, who are we to stop you?
#### `"vim.overrideCopy"`
* Override VSCode's copy command with our own, which works correctly with VSCodeVim.
2017-11-13 07:53:14 +03:00
* If cmd-c or ctrl-c is giving you issues, set this to false and complain [here ](https://github.com/Microsoft/vscode/issues/217 ).
2017-04-24 03:26:04 +03:00
* Type: Boolean (Default: `true` )
2016-07-04 20:05:53 +03:00
2017-04-24 03:26:04 +03:00
#### `"vim.useSystemClipboard"`
* Enable yanking to the system clipboard by default
* Type: Boolean (Default: `false` )
2016-08-03 09:47:10 +03:00
2017-04-24 03:26:04 +03:00
#### `"vim.searchHighlightColor"`
* Set the color of search highlights.
* Type: Color String (Default: `rgba(150, 150, 150, 0.3)` )
2017-07-06 18:28:09 +03:00
#### `"vim.substituteGlobalFlag"`
* Similar to Vim's `gdefault` setting.
* `/g` flag in a substitute command replaces all occurrences in the line.
Without this argument, replacement occurs only for the first occurrence in each line.
* When `"vim.substituteGlobalFlag"` is `true` , the 'g' is default on.
This means that all matches in a line are substituted instead of one.
When a 'g' flag is given to a ":substitute" command, this will toggle the substitution
of all or one match.
2017-04-24 03:26:04 +03:00
#### `"vim.useCtrlKeys"`
2017-11-13 07:53:14 +03:00
* Enable Vim ctrl keys thus overriding common VSCode operations such as copy, paste, find, etc. Enabling this setting will result in the following keybindings:
2016-12-04 08:55:09 +03:00
* `ctrl+c` , `ctrl+[` => `<Esc>`
* `ctrl+f` => Full Page Forward
* `ctrl+d` => Half Page Back
* `ctrl+b` => Half Page Forward
* `ctrl+v` => Visual Block Mode
* etc.
2017-04-24 03:26:04 +03:00
* Type: Boolean (Default: `true` )
2016-12-04 08:55:09 +03:00
2017-10-12 19:31:10 +03:00
#### `"vim.cmdLineInitialColon"`
* Set this to have VSCodeVim mimick Vim, showing the ':' colon character in the Vim command line when it is called.
* Type: Boolean (Default: `false` )
2017-04-24 03:26:04 +03:00
#### `"vim.handleKeys"`
2017-11-13 07:53:14 +03:00
* Delegate certain keybindings to be handled natively by VSCode instead of by the VSCodeVim extension
* Complete list of key combinations supported by this setting can be found under the `keybindings` section of our [package.json ](https://github.com/VSCodeVim/Vim/blob/master/package.json ). Each key that has a `vim.use<C-...>` in the when argument can be delegated back to vscode by setting `"<C-...>": false` .
* Example: user wants to use `ctrl+f` for find (native VSCode behaviour), but wants to have [`useCtrlKeys` ](#vimusectrlkeys ) set to true so that other vim bindings work:
2017-03-25 08:48:06 +03:00
2017-04-24 03:26:04 +03:00
```json
"vim.handleKeys": {
2017-03-25 08:48:06 +03:00
"< C-a > ": false,
"< C-f > ": false
}
2017-04-24 03:26:04 +03:00
```
2017-03-25 08:48:06 +03:00
2017-04-30 23:23:58 +03:00
#### `"vim.visualstar"`
2017-11-13 07:53:14 +03:00
* In visual mode, start a search with `*` or `#` using the current selection
2017-04-30 23:23:58 +03:00
* Type: Boolean (Default: `false` )
2017-10-06 04:30:09 +03:00
#### `"vim.cursorStylePerMode"`
2017-11-13 07:53:14 +03:00
* Configure a specific cursor style per mode; omitted modes will use default cursor type
* Supported modes: normal, insert, replace, visual, visualline, and visualblock
* Supported cursors: line, block, underline, line-thin, block-outline, and underline-thin
2017-10-06 04:30:09 +03:00
2017-11-13 07:53:14 +03:00
```json
2017-10-06 04:30:09 +03:00
"vim.cursorStylePerMode" : {
"normal": "underline",
"insert": "line-thin",
"replace": "block-outline"
}
```
2017-11-13 07:53:14 +03:00
2017-11-12 22:04:28 +03:00
#### `"vim.disableExtension"`
2017-11-13 07:53:14 +03:00
* Disable VSCodeVim (Note: this is different from disabling extension through VSCode)
* This setting can be changed through the settings or via `toggleVim` command in the Command Palette
2017-11-12 22:04:28 +03:00
* Type: Boolean (Default: `false` )
2017-10-06 04:30:09 +03:00
2017-05-22 09:45:46 +03:00
### Neovim Integration
2017-11-13 07:53:14 +03:00
> :warning: Experimental feature. Please leave feedback on neovim integration [here](https://github.com/VSCodeVim/Vim/issues/1735).
2017-05-22 09:45:46 +03:00
2017-11-13 07:53:14 +03:00
We now have neovim integration for Ex-commands. To enable,
2017-06-08 21:10:31 +03:00
2017-11-13 07:53:14 +03:00
1. install [neovim ](https://github.com/neovim/neovim/wiki/Installing-Neovim )
2. add the following configurations:
```json
"vim.enableNeovim": true
"vim.neovimPath": < path to neovim >
```
Here's some ideas on what you can do with neovim integration:
2017-06-08 21:10:31 +03:00
* [The power of g ](http://vim.wikia.com/wiki/Power_of_g )
* [The :normal command ](https://vi.stackexchange.com/questions/4418/execute-normal-command-over-range )
* Faster search and replace!
2017-04-24 03:26:04 +03:00
### Key remapping
2017-11-13 07:53:14 +03:00
There's several different mechanisms you can use to define custom remappings. Also see the [`useCtrlKeys` ](#vimusectrlkeys ) and [`handleKeys` ](#vimhandlekeys ) settings.
2017-04-24 03:26:04 +03:00
#### `"vim.insertModeKeyBindings"`/`"vim.otherModesKeyBindings"`
* Keybinding overrides to use for insert and other (non-insert) modes.
2017-11-13 07:53:14 +03:00
* Bind `jj` to `<Esc>` in insert mode:
2016-07-04 20:05:53 +03:00
2017-04-24 03:26:04 +03:00
```json
"vim.insertModeKeyBindings": [
{
"before": ["j", "j"],
"after": ["< Esc > "]
}
]
2016-12-04 07:50:07 +03:00
```
2017-04-24 03:26:04 +03:00
2017-11-13 07:53:14 +03:00
* Bind `:` to show the command palette:
2016-07-04 20:05:53 +03:00
2017-04-24 03:26:04 +03:00
```json
2016-12-04 08:55:09 +03:00
"vim.otherModesKeyBindingsNonRecursive": [
2017-04-24 03:26:04 +03:00
{
"before": [":"],
"after": [],
"commands": [
{
"command": "workbench.action.showCommands",
"args": []
}
]
}
2016-12-04 08:55:09 +03:00
]
2016-12-04 07:50:07 +03:00
```
2017-11-13 07:53:14 +03:00
* Bind `ZZ` to save and close the current file:
2016-12-04 07:50:07 +03:00
2017-04-24 03:26:04 +03:00
```json
2016-12-04 07:50:07 +03:00
"vim.otherModesKeyBindingsNonRecursive": [
{
"before": ["Z", "Z"],
2016-12-04 21:33:00 +03:00
"after": [],
2016-12-04 07:50:07 +03:00
"commands": [
{
"command": "workbench.action.files.save",
"args": []
},
{
"command": "workbench.action.closeActiveEditor",
"args": []
}
]
}
]
2017-04-24 03:26:04 +03:00
```
2016-12-04 07:50:07 +03:00
2017-11-13 07:53:14 +03:00
* Bind `ctrl+n` to turn off search highlighting and `<leader>w` to save the current file:
2016-12-21 00:19:15 +03:00
2017-04-24 03:26:04 +03:00
```json
2016-12-21 00:19:15 +03:00
"vim.otherModesKeyBindingsNonRecursive": [
2017-04-16 08:58:25 +03:00
{
2017-04-24 03:26:04 +03:00
"before":["< C-n > "],
"after":[],
2017-04-16 08:58:25 +03:00
"commands": [
{
"command": ":nohl",
"args": []
}
]
},
2016-12-21 00:19:15 +03:00
{
"before": ["leader", "w"],
"after": [],
"commands": [
{
"command": "workbench.action.files.save",
"args": []
}
]
}
]
2017-04-24 03:26:04 +03:00
```
2016-12-01 23:31:33 +03:00
2017-02-28 03:22:35 +03:00
2017-04-24 03:26:04 +03:00
#### `"vim.insertModeKeyBindingsNonRecursive"`/`"otherModesKeyBindingsNonRecursive"`
* Non-recursive keybinding overrides to use for insert and other (non-insert) modes (similar to `:noremap` )
* *Example:* Bind `j` to `gj` . Notice that if you attempted this binding normally, the j in gj would be expanded into gj, on and on forever. Stop this recursive expansion using insertModeKeyBindingsNonRecursive and/or otherModesKeyBindingNonRecursive.
2016-09-05 10:59:57 +03:00
2017-04-24 03:26:04 +03:00
```json
2017-09-18 21:12:09 +03:00
"vim.otherModesKeyBindingsNonRecursive": [
2017-04-24 03:26:04 +03:00
{
"before": ["j"],
"after": ["g", "j"]
}
]
```
2016-12-05 04:14:14 +03:00
2017-04-24 03:26:04 +03:00
### Status bar color settings
2016-09-05 10:59:57 +03:00
2017-04-24 03:26:04 +03:00
Almost like vim-airline in VSCode!
2017-04-19 06:06:23 +03:00
2017-04-24 03:26:04 +03:00
#### `"vim.statusBarColorControl"`
2017-11-13 07:53:14 +03:00
> :warning: Experimental feature. Due to VSCode API limitations, this function modifies settings.json in the workspace resulting in latency and a constant changing diff in your working directory (see [issue#2124](https://github.com/VSCodeVim/Vim/issues/2124)).
2017-04-24 03:26:04 +03:00
* Control status bar color based on current mode
* Type: Boolean (Default: `false` )
2017-04-19 06:06:23 +03:00
2017-11-13 07:53:14 +03:00
Once enabled, configure `"vim.statusBarColors"` .
2017-04-19 06:06:23 +03:00
2017-04-24 03:26:04 +03:00
```json
2017-04-19 06:06:23 +03:00
"vim.statusBarColorControl": true,
"vim.statusBarColors" : {
"normal": "#005f5f",
"insert": "#5f0000",
"visual": "#5f00af",
"visualline": "#005f87",
"visualblock": "#86592d",
"replace": "#000000"
}
```
2017-04-24 03:26:04 +03:00
### Vim settings
2016-12-01 02:14:17 +03:00
2017-11-13 07:53:14 +03:00
Configuration settings that have been copied from vim. Vim settings are loaded in the following sequence:
2016-09-05 10:59:57 +03:00
2017-04-24 03:26:04 +03:00
1. `:set {setting}`
2. `vim.{setting}` from user/workspace settings.
3. VSCode settings
4. VSCodeVim default values
2016-09-23 09:08:20 +03:00
2017-04-24 03:26:04 +03:00
#### `"vim.ignorecase"`
* Ignore case in search patterns
* Type: Boolean (Default: `true` )
2016-11-29 21:44:01 +03:00
2017-04-24 03:26:04 +03:00
#### `"vim.smartcase"`
* Override the 'ignorecase' setting if the search pattern contains upper case characters
* Type: Boolean (Default: `true` )
2016-07-04 20:05:53 +03:00
2017-04-24 03:26:04 +03:00
#### `"vim.hlsearch"`
* When there is a previous search pattern, highlight all its matches
* Type: Boolean (Default: `false` )
2016-12-05 01:25:57 +03:00
2017-04-24 03:26:04 +03:00
#### `"vim.incsearch"`
* Show the next search match while you're searching.
* Type: Boolean (Default: `true` )
2016-12-04 22:14:50 +03:00
2017-04-24 03:26:04 +03:00
#### `"vim.autoindent"`
* Copy indent from current line when starting a new line
* Type: Boolean (Default: `true` )
2016-12-04 03:50:03 +03:00
2017-04-24 03:26:04 +03:00
#### `"vim.timeout"`
* Timeout in milliseconds for remapped commands
* Type: Number (Default: `1000` )
2016-12-05 04:21:36 +03:00
2017-04-24 03:26:04 +03:00
#### `"vim.showcmd"`
* Show the text of any command you are in the middle of writing.
* Type: Boolean (Default: `true` )
2016-12-01 02:14:17 +03:00
2017-10-13 08:01:09 +03:00
#### `"vim.showmodename"`
* Show the name of the current mode in the statusbar.
* Type: Boolean (Default: `true` )
2017-04-24 03:26:04 +03:00
#### `"vim.textwidth"`
* Width to word-wrap to when using `gq` .
* Type: number (Default: `80` )
2016-12-01 02:14:17 +03:00
2017-04-24 03:26:04 +03:00
#### `"vim.leader"`
* What key should `<leader>` map to in key remappings?
* Type: string (Default: `\` )
2016-12-01 02:14:17 +03:00
2017-04-24 03:26:04 +03:00
## Multi-Cursor mode
2016-10-28 22:14:08 +03:00
2017-11-13 07:53:14 +03:00
> :warning: Multi-Cursor mode is experimental. Please report issues in our [feedback thread.](https://github.com/VSCodeVim/Vim/issues/824)
2016-10-28 22:14:08 +03:00
2017-11-13 07:53:14 +03:00
### Entering into multi-cursor mode
2016-10-28 22:14:08 +03:00
2017-11-13 07:53:14 +03:00
Enter multi-cursor mode by:
2016-10-28 22:14:08 +03:00
2017-11-13 07:53:14 +03:00
* Pressing `cmd-d` on OSX.
2016-12-01 02:14:17 +03:00
* Running "Add Cursor Above/Below" or the shortcut on any platform.
2017-11-13 07:53:14 +03:00
* Pressing `gb` , a new shortcut we added which is equivalent to `cmd-d` on OSX or `ctrl-d` on Windows. (It adds another cursor at the next word that matches the word the cursor is currently on.)
2016-10-28 22:14:08 +03:00
2017-04-24 03:26:04 +03:00
### Doing stuff
2016-10-28 22:14:08 +03:00
2017-11-13 07:53:14 +03:00
Now that you have multiple cursors, you should be able to use Vim commands as you see fit. Most should work; some are unsupported (ref [PR#587 ](https://github.com/VSCodeVim/Vim/pull/587 )).
2016-10-28 22:14:08 +03:00
2017-11-13 07:53:14 +03:00
* Each cursor has its own clipboard.
* Pressing Escape in Multi-Cursor Visual Mode will bring you to Multi-Cursor Normal mode. Pressing it again will return you to Normal mode.
2016-10-28 22:14:08 +03:00
2017-04-24 03:26:04 +03:00
## Emulated plugins
2016-10-28 22:14:08 +03:00
2017-04-24 03:26:04 +03:00
### vim-easymotion
2016-10-28 22:14:08 +03:00
2017-11-13 07:53:14 +03:00
Based on [vim-easymotion ](https://github.com/easymotion/vim-easymotion ). To activate easymotion, you need to make sure that `easymotion` is set to `true` in settings.json (default is `false` ).
2016-12-05 09:24:44 +03:00
2017-11-13 07:53:14 +03:00
Once easymotion is active, initiate motions using the following commands. After you initiate the motion, text decorators/markers will be displayed and you can press the keys displayed to jump to that position. `leader` is configurable and is `\` by default.
2017-03-26 20:26:15 +03:00
2016-12-05 09:24:44 +03:00
Motion Command | Description
---|--------
2017-08-27 20:11:41 +03:00
`<leader><leader> s <char>` |Search character
`<leader><leader> f <char>` |Find character forwards
`<leader><leader> F <char>` |Find character backwards
`<leader><leader> t <char>` |Til character forwards
`<leader><leader> T <char>` |Til character backwards
`<leader><leader> w` |Start of word forwards
`<leader><leader> b` |Start of word backwards
`<leader><leader> e` |End of word forwards
`<leader><leader> ge` |End of word backwards
`<leader><leader> j` |Start of line forwards
`<leader><leader> k` |Start of line backwards
`<leader><leader> / <char>... <CR>` |Search n-character
2017-09-14 16:01:40 +03:00
`<leader><leader><leader> bdt` |Til character
`<leader><leader><leader> bdw` |Start of word
`<leader><leader><leader> bde` |End of word
`<leader><leader><leader> bdjk` |Start of line
2017-08-27 20:11:41 +03:00
2017-09-14 16:01:40 +03:00
`<leader><leader> (2s|2f|2F|2t|2T) <char><char>` and `<leader><leader><leader> bd2t <char>char>` are also available.
2017-08-27 20:11:41 +03:00
The difference is character count required for search.
For example, `<leader><leader> 2s <char><char>` requires two characters, and search by two characters.
This mapping is not a standard mapping, so it is recommended to use your custom mapping.
2016-12-05 09:24:44 +03:00
2017-11-13 07:53:14 +03:00
You can customize the appearance of easymotion markers (the boxes with letters) using the following settings:
2017-04-11 21:11:09 +03:00
Setting | Description
---|--------
`vim.easymotionMarkerBackgroundColor` |The background color of the marker box.
`vim.easymotionMarkerForegroundColorOneChar` |The font color for one-character markers.
2017-04-11 21:16:20 +03:00
`vim.easymotionMarkerForegroundColorTwoChar` |The font color for two-character markers, used to differentiate from one-character markers.
2017-04-11 21:11:09 +03:00
`vim.easymotionMarkerWidthPerChar` |The width in pixels allotted to each character.
`vim.easymotionMarkerHeight` |The height of the marker.
`vim.easymotionMarkerFontFamily` |The font family used for the marker text.
`vim.easymotionMarkerFontSize` |The font size used for the marker text.
`vim.easymotionMarkerFontWeight` |The font weight used for the marker text.
2017-04-11 21:12:16 +03:00
`vim.easymotionMarkerYOffset` |The distance between the top of the marker and the text (will typically need some adjusting if height or font size have been changed).
2017-09-03 08:40:04 +03:00
`vim.easymotionKeys` |The characters used for jump marker name
2016-12-05 09:24:44 +03:00
2017-04-24 03:26:04 +03:00
### vim-surround
2017-03-19 10:53:15 +03:00
2017-11-13 07:53:14 +03:00
Based on [surround.vim ](https://github.com/tpope/vim-surround ), the plugin is used to work with surrounding characters like parenthesis, brackets, quotes, and XML tags.
2017-03-19 10:53:15 +03:00
2017-04-24 03:26:04 +03:00
`t` or `<` as `<desired char>` or `<existing char>` will do tags and enter tag entry mode.
2017-03-19 10:53:15 +03:00
2017-11-13 07:53:14 +03:00
Surround is enabled by default, but can be disabled by setting `"vim.surround": false` .
2017-04-11 05:23:59 +03:00
2017-03-19 10:53:15 +03:00
Surround Command | Description
---|--------
`d s <existing char>` |Delete existing surround
`c s <existing char> <desired char>` |Change surround existing to desired
`y s <motion> <desired char>` |Surround something with something using motion (as in "you surround")
`S <desired char>` |Surround when in visual modes (surrounds full selection)
Some examples:
* `"test"` with cursor inside quotes type cs"' to end up with `'test'`
* `"test"` with cursor inside quotes type ds" to end up with `test`
* `"test"` with cursor inside quotes type cs"t and enter 123> to end up with `<123>test</123>`
* `test` with cursor on word test type ysaw) to end up with `(test)`
2017-04-24 03:26:04 +03:00
### vim-commentary
2017-04-16 13:52:51 +03:00
2017-11-13 07:53:14 +03:00
Similar to [vim-commentary ](https://github.com/tpope/vim-commentary ), but uses the VSCode native "Toggle Line Comment" and "Toggle Block Comment" features.
2017-04-16 13:52:51 +03:00
Usage examples:
2017-05-18 09:54:55 +03:00
* `gc` - toggles line comment. For example `gcc` to toggle line comment for current line and `gc2j` to toggle line comments for the current line and the next line.
* `gC` - toggles block comment. For example `gCi)` to comment out everything within parenthesis.
2017-04-16 13:52:51 +03:00
2017-04-27 10:04:50 +03:00
### vim-indent-object
2017-11-13 07:53:14 +03:00
Based on [vim-indent-object ](https://github.com/michaeljsmith/vim-indent-object ), it allows for treating blocks of code at the current indentation level as text objects. Useful in languages that don't use braces around statements (e.g. Python).
2017-04-27 10:04:50 +03:00
Provided there is a new line between the opening and closing braces / tag, it can be considered an agnostic `cib` /`ci{`/`ci[`/`cit`.
Command | Description
---|--------
`<operator>ii` |This indentation level
`<operator>ai` |This indentation level and the line above (think `if` statements in Python)
`<operator>aI` |This indentation level, the line above, and the line after (think `if` statements in C/C++/Java/etc)
2017-04-24 03:26:04 +03:00
## VSCodeVim tricks!
2015-11-26 13:40:42 +03:00
2017-11-13 07:53:14 +03:00
Vim has a lot of nifty tricks and we try to perserve some of them:
2017-03-18 11:19:50 +03:00
2017-11-13 07:53:14 +03:00
* `gd` - jump to definition.
* `gq` - on a visual selection reflow and wordwrap blocks of text, preserving commenting style. Great for formatting documentation comments.
* `gb` - adds another cursor on the next word it finds which is the same as the word under the cursor.
* `af` - visual mode command which selects increasingly large blocks of text. For example, if you had "blah (foo [bar 'ba|z'])" then it would select 'baz' first. If you pressed `af` again, it'd then select [bar 'baz'], and if you did it a third time it would select "(foo [bar 'baz'])".
* `gh` - equivalent to hovering your mouse over wherever the cursor is. Handy for seeing types and error messages without reaching for the mouse!
2017-03-03 13:23:52 +03:00
2017-04-24 03:26:04 +03:00
## F.A.Q.
2017-11-13 07:53:14 +03:00
### None of the vim `ctrl` (e.g. `ctrl+f`, `ctrl+v`) commands work
2017-04-24 03:26:04 +03:00
Set the [`useCtrlKeys` setting ](#vimusectrlkeys ) to `true` .
2017-11-13 07:53:14 +03:00
### Moving `j`/`k` over folds opens up the folds!
2017-05-22 09:45:46 +03:00
2017-11-13 07:53:14 +03:00
Try setting `vim.foldfix` to `true` . This is a hack; it works fine, but there are side effects (see [issue#22276 ](https://github.com/Microsoft/vscode/issues/22276 )).
2017-05-22 09:45:46 +03:00
2017-11-13 07:53:14 +03:00
### Key repeat doesn't work!
2017-05-22 09:45:46 +03:00
2017-11-13 07:53:14 +03:00
Are you on a Mac? Did you go through our [mac-setup ](#mac-setup ) instructions?
2017-05-22 09:45:46 +03:00
2017-06-20 09:40:41 +03:00
### There are annoying intellisense/notifications/popups that I can't close with `<esc>`! Or I'm in a snippet and I want to close intellisense!
2017-05-22 09:45:46 +03:00
Press `shift+<esc>` to close all of those boxes.
2017-04-24 03:26:04 +03:00
## Contributing
This project is maintained by a group of awesome [people ](https://github.com/VSCodeVim/Vim/graphs/contributors ) and contributions are extremely welcome :heart:. For a quick tutorial on how you can help, see our [contributing guide ](/.github/CONTRIBUTING.md ).
### Special shoutouts to cool contributors
2016-12-30 22:38:29 +03:00
* Thanks to @xconverge for making over 100 commits to the repo. If you're wondering why your least favorite bug packed up and left, it was probably him.
* Thanks to @Metamist for implementing EasyMotion!
* Thanks to @sectioneight for implementing text objects!
* Special props to [Kevin Coleman ](http://kevincoleman.io ), who created our awesome logo!
2017-11-12 22:04:28 +03:00
* Shoutout to @chillee aka Horace He for his contributions and hard work.