mirror of
https://github.com/VSCodeVim/Vim.git
synced 2024-11-11 06:39:50 +03:00
Merge pull request #2138 from VSCodeVim/clean-up
cleanup: simplification of configurations. upgrade clipboardy.
This commit is contained in:
commit
e471388277
@ -29,7 +29,7 @@ install:
|
||||
|
||||
script:
|
||||
- git ls-tree -r HEAD --name-only | grep ".*.[t|j]s$" | xargs ./node_modules/prettier/bin/prettier.js --write --print-width 100 --single-quote --trailing-comma es5
|
||||
- if [[ $(git diff-index HEAD --) ]]; then { ./node_modules/prettier/bin/prettier.js -v; git diff; echo "Compile with gulp first (to format things properly with prettier) before pushing!"; sleep 1; exit 1; }; else echo "Prettier passed."; fi
|
||||
- if [[ $(git diff-index HEAD --) ]]; then { ./node_modules/prettier/bin/prettier.js -v; git diff; echo "Prettier Failed. Run `gulp` or `gulp forceprettier`"; exit 1; }; else echo "Prettier passed."; fi
|
||||
- gulp
|
||||
- npm test --silent;
|
||||
|
||||
|
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@ -38,7 +38,7 @@
|
||||
"stopOnEntry": false,
|
||||
"sourceMaps": true,
|
||||
"outFiles": [ "${workspaceRoot}/{out, node_modules}/**/*.js" ],
|
||||
"preLaunchTask": "build",
|
||||
"preLaunchTask": "gulp: default",
|
||||
"internalConsoleOptions": "openOnSessionStart"
|
||||
}
|
||||
]
|
||||
|
161
README.md
161
README.md
@ -1,35 +1,21 @@
|
||||
<h1 align="center"><img src="https://raw.githubusercontent.com/VSCodeVim/Vim/master/images/icon.png" height="128"><br>VSCodeVim</h1>
|
||||
<p align="center"><strong>Vim emulation for Visual Studio Code.</strong></p>
|
||||
<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>
|
||||
|
||||
[![http://aka.ms/vscodevim](https://vsmarketplacebadge.apphb.com/version/vscodevim.vim.svg)](http://aka.ms/vscodevim)
|
||||
[![https://travis-ci.org/VSCodeVim/Vim](https://travis-ci.org/VSCodeVim/Vim.svg?branch=master)](https://travis-ci.org/VSCodeVim/Vim)
|
||||
[Slack](https://vscodevim-slackin.azurewebsites.net)
|
||||
|
||||
<hr>
|
||||
|
||||
VSCodeVim is a [Visual Studio Code](https://code.visualstudio.com/) extension that enables Vim keybindings, including:
|
||||
VSCodeVim is a [Visual Studio Code](https://code.visualstudio.com/) extension that enables:
|
||||
|
||||
* Keybindings and command combinations (`c3w`, `daw`, `2dd`, etc)
|
||||
* Modes: normal, insert, command-line, visual, visual line, visual block
|
||||
* Command combinations (`c3w`, `daw`, `2dd`, etc)
|
||||
* Highly versatile command remapping (`jj` to `<Esc>`, `:` to command panel, etc.)
|
||||
* Command remapping (`jj` to `<Esc>`, `:` to command panel, etc.)
|
||||
* Incremental search with `/` and `?`
|
||||
* Marks
|
||||
* Popular vim plugin features built-in (easymotion, surround, commentary)
|
||||
* Vim settings similar to those found in .vimrc
|
||||
* Multi-cursor support, run vim commands everywhere!
|
||||
* And much more! Refer to the [roadmap](ROADMAP.md) for everything we support.
|
||||
* Refer to our [roadmap](ROADMAP.md) for a full list
|
||||
|
||||
Please [report missing features/bugs on GitHub](https://github.com/VSCodeVim/Vim/issues), which will help us get to them faster.
|
||||
|
||||
Ask us questions, talk about contributing, or just say hi on [Slack](https://vscodevim-slackin.azurewebsites.net)!
|
||||
|
||||
## Donations
|
||||
|
||||
[![Donate](https://www.paypalobjects.com/webstatic/en_US/i/btn/png/btn_donate_92x26.png)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FNUBXQADN5VG4)
|
||||
|
||||
[Make a donation to VSCodeVim here!](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FNUBXQADN5VG4)
|
||||
|
||||
Donations help convince me to work on this project rather than my other (non-open-source) projects. I'd love to work on VSCodeVim full time, but I need money to live!
|
||||
Please report missing features/bugs on [GitHub](https://github.com/VSCodeVim/Vim/issues) and join us on [Slack](https://vscodevim-slackin.azurewebsites.net).
|
||||
|
||||
## Contents
|
||||
|
||||
@ -55,13 +41,11 @@ Donations help convince me to work on this project rather than my other (non-ope
|
||||
|
||||
## Getting started
|
||||
|
||||
The plugin will be automatically enabled after [installing](https://marketplace.visualstudio.com/items?itemName=vscodevim.vim) it and reloading VSCode. The plugin can only be disabled from the Extension manager in VSCode, with no quick way to switch between modal and modeless editing.
|
||||
|
||||
Just like real vim, your editor will now be in Normal mode, which is reported to VSCode's status bar. From here, all your regular vim commands will work as normal, hooray!
|
||||
VSCodeVim is automatically enabled following [installation](https://marketplace.visualstudio.com/items?itemName=vscodevim.vim) and the reloading of VSCode.
|
||||
|
||||
### Vim compatibility
|
||||
|
||||
All common Vim commands are supported. For an in-depth look at what Vim features are supported, check out the [roadmap](ROADMAP.md). Vimscript isn't 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).
|
||||
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).
|
||||
|
||||
### Mac setup
|
||||
|
||||
@ -72,7 +56,7 @@ defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool false
|
||||
defaults write com.microsoft.VSCodeInsiders ApplePressAndHoldEnabled -bool false # For VS Code Insider
|
||||
```
|
||||
|
||||
We also recommend going into *System Preferences -> Keyboard* and cranking up the Key Repeat and Delay Until Repeat settings to improve your speed.
|
||||
We also recommend going into *System Preferences -> Keyboard* and increasing the Key Repeat and Delay Until Repeat settings to improve your speed.
|
||||
|
||||
### Windows setup
|
||||
|
||||
@ -82,7 +66,7 @@ VSCodeVim will take over your control keys, just like real vim, so you get the _
|
||||
|
||||
### Quick example settings
|
||||
|
||||
Below is an example of a [settings.json](https://code.visualstudio.com/Docs/customization/userandworkspace) file for VSCode settings applicable to this extension. Continue on below for more in-depth documentation.
|
||||
Below is an example of a [settings.json](https://code.visualstudio.com/Docs/customization/userandworkspace) file for VSCode settings applicable to this extension.
|
||||
|
||||
```json
|
||||
{
|
||||
@ -120,7 +104,7 @@ Below is an example of a [settings.json](https://code.visualstudio.com/Docs/cust
|
||||
}
|
||||
```
|
||||
|
||||
The following is a subset of the supported settings; the full list is described in the `Contributions` tab for this extension, or in our [package.json](https://github.com/VSCodeVim/Vim/blob/master/package.json#L175).
|
||||
The following is a subset of the supported settings; the full list is described in the `Contributions` tab in the extensions menu of VSCode.
|
||||
|
||||
### VSCodeVim settings
|
||||
|
||||
@ -132,7 +116,7 @@ These settings are specific to VSCodeVim.
|
||||
|
||||
#### `"vim.overrideCopy"`
|
||||
* Override VSCode's copy command with our own, which works correctly with VSCodeVim.
|
||||
* If cmd-c or ctrl-c is giving you issues, set this to false and complain at https://github.com/Microsoft/vscode/issues/217.
|
||||
* If cmd-c or ctrl-c is giving you issues, set this to false and complain [here](https://github.com/Microsoft/vscode/issues/217).
|
||||
* Type: Boolean (Default: `true`)
|
||||
|
||||
#### `"vim.useSystemClipboard"`
|
||||
@ -143,9 +127,6 @@ These settings are specific to VSCodeVim.
|
||||
* Set the color of search highlights.
|
||||
* Type: Color String (Default: `rgba(150, 150, 150, 0.3)`)
|
||||
|
||||
#### `"vim.useSolidBlockCursor"`
|
||||
We have removed this option, due to it making VSCodeVim's performance suffer immensely.
|
||||
|
||||
#### `"vim.substituteGlobalFlag"`
|
||||
* Similar to Vim's `gdefault` setting.
|
||||
* `/g` flag in a substitute command replaces all occurrences in the line.
|
||||
@ -156,7 +137,7 @@ We have removed this option, due to it making VSCodeVim's performance suffer imm
|
||||
of all or one match.
|
||||
|
||||
#### `"vim.useCtrlKeys"`
|
||||
* Enable Vim ctrl keys overriding common VS Code operations (eg. copy, paste, find, etc). Enabling this setting will:
|
||||
* Enable Vim ctrl keys thus overriding common VSCode operations such as copy, paste, find, etc. Enabling this setting will result in the following keybindings:
|
||||
* `ctrl+c`, `ctrl+[` => `<Esc>`
|
||||
* `ctrl+f` => Full Page Forward
|
||||
* `ctrl+d` => Half Page Back
|
||||
@ -170,9 +151,9 @@ We have removed this option, due to it making VSCodeVim's performance suffer imm
|
||||
* Type: Boolean (Default: `false`)
|
||||
|
||||
#### `"vim.handleKeys"`
|
||||
* Allows user to select certain modifier keybindings and delegate them back to VSCode so that VSCodeVim does not process them.
|
||||
* Complete list of keys that can be delegated back to VSCode can be found in our [package.json](https://github.com/VSCodeVim/Vim/blob/master/package.json#L44). Each key that has a vim.use<C-...> in the when argument can be delegated back to vscode by doing "<C-...>":false.
|
||||
* An example would be if a user wanted to continue to use ctrl + f for find, but wants to have [`useCtrlKeys`](#vimusectrlkeys) set to true so that other vim bindings work.
|
||||
* 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:
|
||||
|
||||
```json
|
||||
"vim.handleKeys": {
|
||||
@ -182,34 +163,42 @@ We have removed this option, due to it making VSCodeVim's performance suffer imm
|
||||
```
|
||||
|
||||
#### `"vim.visualstar"`
|
||||
* In visual mode, start a search with * or # using the current selection
|
||||
* In visual mode, start a search with `*` or `#` using the current selection
|
||||
* Type: Boolean (Default: `false`)
|
||||
|
||||
#### `"vim.cursorStylePerMode"`
|
||||
* Configure a specific cursor style per mode, any modes omitted will use default cursor type
|
||||
* Modes available are normal, insert, replace, visual, visualline, and visualblock
|
||||
* Cursors available are line, block, underline, line-thin, block-outline, and underline-thin
|
||||
* 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
|
||||
|
||||
```
|
||||
```json
|
||||
"vim.cursorStylePerMode" : {
|
||||
"normal": "underline",
|
||||
"insert": "line-thin",
|
||||
"replace": "block-outline"
|
||||
}
|
||||
```
|
||||
|
||||
#### `"vim.disableExtension"`
|
||||
* VSCodeVim will be in "Disabled" mode
|
||||
* This can be changed at any time using the `toggleVim` command in the Command Palette
|
||||
* Note that this is not the same as disabling the VSCodeVim extension through VS Code
|
||||
* 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
|
||||
* Type: Boolean (Default: `false`)
|
||||
|
||||
### Neovim Integration
|
||||
|
||||
We now have neovim integration for Ex-commands. If you want to take advantage of this integration, set `"vim.enableNeovim"` to `true`, and set your `"vim.neovimPath"`. If you don't have neovim installed, [install neovim here](https://github.com/neovim/neovim/wiki/Installing-Neovim). If you don't want to install neovim, all of the old functionality should still work as is (we would really suggest neovim installing though. The new Ex support is super cool, and we'd like to integrate neovim more in the future).
|
||||
> :warning: Experimental feature. Please leave feedback on neovim integration [here](https://github.com/VSCodeVim/Vim/issues/1735).
|
||||
|
||||
Please leave feedback on neovim [here](https://github.com/VSCodeVim/Vim/issues/1735).
|
||||
We now have neovim integration for Ex-commands. To enable,
|
||||
|
||||
Here's some ideas on what you can do with your newfound neovim integration!
|
||||
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:
|
||||
|
||||
* [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)
|
||||
@ -217,12 +206,11 @@ Here's some ideas on what you can do with your newfound neovim integration!
|
||||
|
||||
### Key remapping
|
||||
|
||||
There's several different settings you can use to define custom remappings. Also related are the [`useCtrlKeys`](#vimusectrlkeys) and [`handleKeys`](#vimhandlekeys) settings.
|
||||
There's several different mechanisms you can use to define custom remappings. Also see the [`useCtrlKeys`](#vimusectrlkeys) and [`handleKeys`](#vimhandlekeys) settings.
|
||||
|
||||
#### `"vim.insertModeKeyBindings"`/`"vim.otherModesKeyBindings"`
|
||||
* Keybinding overrides to use for insert and other (non-insert) modes.
|
||||
|
||||
Bind `jj` to `<Esc>` in insert mode:
|
||||
* Bind `jj` to `<Esc>` in insert mode:
|
||||
|
||||
```json
|
||||
"vim.insertModeKeyBindings": [
|
||||
@ -233,7 +221,7 @@ Bind `jj` to `<Esc>` in insert mode:
|
||||
]
|
||||
```
|
||||
|
||||
Bind `:` to show the command palette:
|
||||
* Bind `:` to show the command palette:
|
||||
|
||||
```json
|
||||
"vim.otherModesKeyBindingsNonRecursive": [
|
||||
@ -250,7 +238,7 @@ Bind `:` to show the command palette:
|
||||
]
|
||||
```
|
||||
|
||||
Bind `ZZ` to save and close the current file:
|
||||
* Bind `ZZ` to save and close the current file:
|
||||
|
||||
```json
|
||||
"vim.otherModesKeyBindingsNonRecursive": [
|
||||
@ -271,7 +259,7 @@ Bind `ZZ` to save and close the current file:
|
||||
]
|
||||
```
|
||||
|
||||
Or bind ctrl+n to turn off search highlighting and `<leader>w` to save the current file:
|
||||
* Bind `ctrl+n` to turn off search highlighting and `<leader>w` to save the current file:
|
||||
|
||||
```json
|
||||
"vim.otherModesKeyBindingsNonRecursive": [
|
||||
@ -317,11 +305,13 @@ Or bind ctrl+n to turn off search highlighting and `<leader>w` to save the curre
|
||||
Almost like vim-airline in VSCode!
|
||||
|
||||
#### `"vim.statusBarColorControl"`
|
||||
|
||||
> :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)).
|
||||
|
||||
* Control status bar color based on current mode
|
||||
* Type: Boolean (Default: `false`)
|
||||
* Notes: Experimental feature, currently due to VSCode API limitations, this function MUST modify settings.json in the workspace. This causes a slight amount of latency and a constant changing diff in your working directory. [Issue #1565](https://github.com/VSCodeVim/Vim/issues/1565)
|
||||
|
||||
Once this is set, you need to set `"vim.statusBarColors"` as well with these exact strings for modenames. The colors can be adjusted to suit the user.
|
||||
Once enabled, configure `"vim.statusBarColors"`.
|
||||
|
||||
```json
|
||||
"vim.statusBarColorControl": true,
|
||||
@ -337,9 +327,7 @@ Once this is set, you need to set `"vim.statusBarColors"` as well with these exa
|
||||
|
||||
### Vim settings
|
||||
|
||||
Configuration settings that have been copied from vim.
|
||||
|
||||
Vim settings are loaded in the following sequence:
|
||||
Configuration settings that have been copied from vim. Vim settings are loaded in the following sequence:
|
||||
|
||||
1. `:set {setting}`
|
||||
2. `vim.{setting}` from user/workspace settings.
|
||||
@ -388,31 +376,30 @@ Vim settings are loaded in the following sequence:
|
||||
|
||||
## Multi-Cursor mode
|
||||
|
||||
> ⚡ Multi-Cursor mode is currently in beta. Please report things you expected to work but didn't [to our feedback thread.](https://github.com/VSCodeVim/Vim/issues/824)
|
||||
> :warning: Multi-Cursor mode is experimental. Please report issues in our [feedback thread.](https://github.com/VSCodeVim/Vim/issues/824)
|
||||
|
||||
### Getting into multi-cursor mode
|
||||
### Entering into multi-cursor mode
|
||||
|
||||
You can enter multi-cursor mode by:
|
||||
Enter multi-cursor mode by:
|
||||
|
||||
* Pressing cmd-d on OSX.
|
||||
* Pressing `cmd-d` on OSX.
|
||||
* Running "Add Cursor Above/Below" or the shortcut on any platform.
|
||||
* 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.)
|
||||
* 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.)
|
||||
|
||||
### Doing stuff
|
||||
|
||||
Now that you have multiple cursors, you should be able to use Vim commands as you see fit. Most of them should work. There is a list of things I know of which don't [here](https://github.com/VSCodeVim/Vim/pull/587). If you find yourself wanting one of these, please [add it to our feedback thread.](https://github.com/VSCodeVim/Vim/issues/824)
|
||||
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)).
|
||||
|
||||
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.
|
||||
* 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.
|
||||
|
||||
## Emulated plugins
|
||||
|
||||
### vim-easymotion
|
||||
|
||||
Easymotion is 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 (as the default is `false`).
|
||||
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`).
|
||||
|
||||
Once easymotion is active, you can 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.
|
||||
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.
|
||||
|
||||
Motion Command | Description
|
||||
---|--------
|
||||
@ -438,7 +425,7 @@ 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.
|
||||
|
||||
You can customize the appearance of your easymotion markers (the boxes with letters) using the following settings:
|
||||
You can customize the appearance of easymotion markers (the boxes with letters) using the following settings:
|
||||
|
||||
Setting | Description
|
||||
---|--------
|
||||
@ -455,11 +442,11 @@ Setting | Description
|
||||
|
||||
### vim-surround
|
||||
|
||||
Surround plugin based on tpope's [surround.vim](https://github.com/tpope/vim-surround) plugin is used to work with surrounding characters like parenthesis, brackets, quotes, and XML tags.
|
||||
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.
|
||||
|
||||
`t` or `<` as `<desired char>` or `<existing char>` will do tags and enter tag entry mode.
|
||||
|
||||
Surround can be disabled by setting vim.surround : false
|
||||
Surround is enabled by default, but can be disabled by setting `"vim.surround": false`.
|
||||
|
||||
Surround Command | Description
|
||||
---|--------
|
||||
@ -477,7 +464,7 @@ Some examples:
|
||||
|
||||
### vim-commentary
|
||||
|
||||
Commentary in VSCodeVim works similarly to tpope's [vim-commentary](https://github.com/tpope/vim-commentary) but uses the VSCode native "Toggle Line Comment" and "Toggle Block Comment" features.
|
||||
Similar to [vim-commentary](https://github.com/tpope/vim-commentary), but uses the VSCode native "Toggle Line Comment" and "Toggle Block Comment" features.
|
||||
|
||||
Usage examples:
|
||||
* `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.
|
||||
@ -486,7 +473,7 @@ Usage examples:
|
||||
|
||||
### vim-indent-object
|
||||
|
||||
Indent Objects in VSCodeVim are identical to [michaeljsmith/vim-indent-object](https://github.com/michaeljsmith/vim-indent-object) and allow you to treat blocks of code at the current indentation level as text objects. This is very useful in languages that don't use braces around statements, like Python.
|
||||
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).
|
||||
|
||||
Provided there is a new line between the opening and closing braces / tag, it can be considered an agnostic `cib`/`ci{`/`ci[`/`cit`.
|
||||
|
||||
@ -498,31 +485,27 @@ Command | Description
|
||||
|
||||
## VSCodeVim tricks!
|
||||
|
||||
**Awesome Features You Might Not Know About**
|
||||
Vim has a lot of nifty tricks and we try to perserve some of them:
|
||||
|
||||
Vim has a lot of nooks and crannies. VSCodeVim preserves some of the coolest nooks and crannies of Vim. And then we add some of our own! Some of our favorite include:
|
||||
|
||||
* `gd` - jump to definition. _Astoundingly_ useful in any language that VSCode provides definition support for. I use this one probably hundreds of times a day.
|
||||
* `gq` - on a visual selection - Reflow and wordwrap blocks of text, preserving commenting style. Great for formatting documentation comments.
|
||||
* `gb` - which adds another cursor on the next word it finds which is the same as the word under the cursor.
|
||||
* `af` - a command that I added in visual mode, which selects increasingly large blocks of text. e.g. 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` - another custom VSCodeVim command. This one is equivalent to hovering your mouse over wherever the cursor is. Handy for seeing types and error messages without reaching for the mouse!
|
||||
|
||||
(The mnemonic: selecting blocks is fast af! :wink:)
|
||||
* `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!
|
||||
|
||||
## F.A.Q.
|
||||
|
||||
### Help! None of the vim `ctrl` (e.g. `ctrl+f`, `ctrl+v`) commands work
|
||||
### None of the vim `ctrl` (e.g. `ctrl+f`, `ctrl+v`) commands work
|
||||
|
||||
Set the [`useCtrlKeys` setting](#vimusectrlkeys) to `true`.
|
||||
|
||||
### Moving j and k over folds opens up the folds! This extension is unusable!
|
||||
### Moving `j`/`k` over folds opens up the folds!
|
||||
|
||||
You can try setting `vim.foldfix` to `true`. Note, however, that it is a hack. It works fine, but there are side effects. We are unable to fix this issue properly due to VSCode API limitations. Go to [here](https://github.com/Microsoft/vscode/issues/22276) for updates on the issue.
|
||||
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)).
|
||||
|
||||
### Key repeat doesn't work! And I'm on Mac!
|
||||
### Key repeat doesn't work!
|
||||
|
||||
Take a look [here](#mac-setup).
|
||||
Are you on a Mac? Did you go through our [mac-setup](#mac-setup) instructions?
|
||||
|
||||
### 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!
|
||||
|
||||
|
50
extension.ts
50
extension.ts
@ -7,6 +7,7 @@
|
||||
import * as vscode from 'vscode';
|
||||
import * as _ from 'lodash';
|
||||
import { showCmdLine } from './src/cmd_line/main';
|
||||
import { EditorIdentity } from './src/editorIdentity';
|
||||
import { ModeHandler } from './src/mode/modeHandler';
|
||||
import { taskQueue } from './src/taskQueue';
|
||||
import { Position } from './src/common/motion/position';
|
||||
@ -36,36 +37,6 @@ const packagejson: {
|
||||
};
|
||||
} = require('../package.json'); // out/../package.json
|
||||
|
||||
export class EditorIdentity {
|
||||
private _fileName: string;
|
||||
private _viewColumn: vscode.ViewColumn;
|
||||
|
||||
constructor(textEditor?: vscode.TextEditor) {
|
||||
this._fileName = (textEditor && textEditor.document.fileName) || '';
|
||||
this._viewColumn = (textEditor && textEditor.viewColumn) || vscode.ViewColumn.One;
|
||||
}
|
||||
|
||||
get fileName() {
|
||||
return this._fileName;
|
||||
}
|
||||
|
||||
get viewColumn() {
|
||||
return this._viewColumn;
|
||||
}
|
||||
|
||||
public hasSameBuffer(identity: EditorIdentity): boolean {
|
||||
return this.fileName === identity.fileName;
|
||||
}
|
||||
|
||||
public isEqual(identity: EditorIdentity): boolean {
|
||||
return this.fileName === identity.fileName && this.viewColumn === identity.viewColumn;
|
||||
}
|
||||
|
||||
public toString() {
|
||||
return this.fileName + this.viewColumn;
|
||||
}
|
||||
}
|
||||
|
||||
let extensionContext: vscode.ExtensionContext;
|
||||
|
||||
/**
|
||||
@ -81,22 +52,6 @@ export async function getAndUpdateModeHandler(): Promise<ModeHandler> {
|
||||
|
||||
let curHandler = modeHandlerToEditorIdentity[activeEditorId.toString()];
|
||||
if (!curHandler) {
|
||||
if (!Configuration.disableAnnoyingNeovimMessage) {
|
||||
vscode.window
|
||||
.showInformationMessage(
|
||||
'We have now added neovim integration for Ex-commands.\
|
||||
Enable it with vim.enableNeovim in settings',
|
||||
'Never show again'
|
||||
)
|
||||
.then(result => {
|
||||
if (result !== 'Close') {
|
||||
vscode.workspace
|
||||
.getConfiguration('vim')
|
||||
.update('disableAnnoyingNeovimMessage', true, true);
|
||||
Configuration.disableAnnoyingNeovimMessage = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
const newModeHandler = await new ModeHandler();
|
||||
if (Configuration.enableNeovim) {
|
||||
await Neovim.initNvim(newModeHandler.vimState);
|
||||
@ -319,10 +274,9 @@ export async function activate(context: vscode.ExtensionContext) {
|
||||
async function toggleExtension(isDisabled: boolean) {
|
||||
await vscode.commands.executeCommand('setContext', 'vim.active', !isDisabled);
|
||||
if (isDisabled) {
|
||||
let cursorStyle = await vscode.workspace.getConfiguration().get('editor.cursorStyle', 'line');
|
||||
vscode.window.visibleTextEditors.forEach(editor => {
|
||||
let options = editor.options;
|
||||
switch (cursorStyle) {
|
||||
switch (Configuration.userCursorString) {
|
||||
case 'line':
|
||||
options.cursorStyle = vscode.TextEditorCursorStyle.Line;
|
||||
break;
|
||||
|
@ -53,9 +53,9 @@ gulp.task('prettier', function() {
|
||||
});
|
||||
|
||||
gulp.task('forceprettier', function() {
|
||||
// Enumerate files managed by git
|
||||
// files managed by git
|
||||
runPrettier('git ls-files');
|
||||
// Enumerate untracked files
|
||||
// untracked files
|
||||
runPrettier('git ls-files --others --exclude-standard');
|
||||
});
|
||||
|
||||
@ -65,7 +65,9 @@ function runPrettier(command) {
|
||||
for (const file of files) {
|
||||
if (file.endsWith('.ts') || file.endsWith('.js')) {
|
||||
exec(
|
||||
`node ./node_modules/prettier/bin/prettier.js --write --print-width 100 --single-quote --trailing-comma es5 ${file}`
|
||||
`node ./node_modules/prettier/bin/prettier.js --write --print-width 100 --single-quote --trailing-comma es5 ${
|
||||
file
|
||||
}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
27
package-lock.json
generated
27
package-lock.json
generated
@ -21,9 +21,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"@types/mocha": {
|
||||
"version": "2.2.43",
|
||||
"resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-2.2.43.tgz",
|
||||
"integrity": "sha512-xNlAmH+lRJdUMXClMTI9Y0pRqIojdxfm7DHsIxoB2iTzu3fnPmSMEN8SsSx0cdwV36d02PWCWaDUoZPDSln+xw==",
|
||||
"version": "2.2.44",
|
||||
"resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-2.2.44.tgz",
|
||||
"integrity": "sha512-k2tWTQU8G4+iSMvqKi0Q9IIsWAp/n8xzdZS4Q4YVIltApoMA00wFBFdlJnmoaK1/z7B0Cy0yPe6GgXteSmdUNw==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/node": {
|
||||
@ -430,11 +430,11 @@
|
||||
}
|
||||
},
|
||||
"clipboardy": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/clipboardy/-/clipboardy-1.1.4.tgz",
|
||||
"integrity": "sha1-UbF1dPxoJYji3Slc+m5qoQnqte4=",
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/clipboardy/-/clipboardy-1.2.1.tgz",
|
||||
"integrity": "sha512-Gby+Dngii8wM9ExbBeql94RaNG6i+BEX1Nx3T0VhM+XpKw7Fx32ZyKAq3Nqt06w+M/ykvirPPTuV98H9Sp1A9w==",
|
||||
"requires": {
|
||||
"execa": "0.6.3"
|
||||
"execa": "0.8.0"
|
||||
}
|
||||
},
|
||||
"clone": {
|
||||
@ -910,9 +910,9 @@
|
||||
}
|
||||
},
|
||||
"execa": {
|
||||
"version": "0.6.3",
|
||||
"resolved": "https://registry.npmjs.org/execa/-/execa-0.6.3.tgz",
|
||||
"integrity": "sha1-V7aaWU8IF1nGnlNw8NF7nLEWWP4=",
|
||||
"version": "0.8.0",
|
||||
"resolved": "https://registry.npmjs.org/execa/-/execa-0.8.0.tgz",
|
||||
"integrity": "sha1-2NdrvBtVIX7RkP1t1J08d07PyNo=",
|
||||
"requires": {
|
||||
"cross-spawn": "5.1.0",
|
||||
"get-stream": "3.0.0",
|
||||
@ -4216,9 +4216,10 @@
|
||||
"dev": true
|
||||
},
|
||||
"prettier": {
|
||||
"version": "1.7.4",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-1.7.4.tgz",
|
||||
"integrity": "sha1-XoYkrpNjyA+V7GRFhOzfVddPk/o="
|
||||
"version": "1.8.2",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-1.8.2.tgz",
|
||||
"integrity": "sha512-fHWjCwoRZgjP1rvLP7OGqOznq7xH1sHMQUFLX8qLRO79hI57+6xbc5vB904LxEkCfgFgyr3vv06JkafgCSzoZg==",
|
||||
"dev": true
|
||||
},
|
||||
"pretty-hrtime": {
|
||||
"version": "1.0.3",
|
||||
|
12
package.json
12
package.json
@ -33,6 +33,7 @@
|
||||
"activationEvents": [
|
||||
"*"
|
||||
],
|
||||
"qna": "https://vscodevim-slackin.azurewebsites.net/",
|
||||
"main": "./out/extension",
|
||||
"contributes": {
|
||||
"commands": [
|
||||
@ -543,11 +544,6 @@
|
||||
"description": "Path to run neovim executable. For example, /usr/bin/nvim, or C:\\Program Files\\Neovim\\bin\\nvim.exe",
|
||||
"default": "nvim"
|
||||
},
|
||||
"vim.disableAnnoyingNeovimMessage": {
|
||||
"type": "boolean",
|
||||
"description": "Get rid of that annoying message that shows up everytime you make a new file",
|
||||
"default": false
|
||||
},
|
||||
"vim.substituteGlobalFlag": {
|
||||
"type": "boolean",
|
||||
"description": "Automatically apply the global flag, /g, to substitute commands. When set to true, use /g to mean only first match should be replaced.",
|
||||
@ -572,16 +568,15 @@
|
||||
"postinstall": "node ./node_modules/vscode/bin/install && gulp init"
|
||||
},
|
||||
"dependencies": {
|
||||
"clipboardy": "^1.1.4",
|
||||
"clipboardy": "^1.2.1",
|
||||
"diff-match-patch": "^1.0.0",
|
||||
"lodash": "^4.17.4",
|
||||
"neovim-client": "^2.1.0",
|
||||
"prettier": "^1.7.4",
|
||||
"promised-neovim-client": "^2.0.2",
|
||||
"untildify": "^3.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/mocha": "^2.2.43",
|
||||
"@types/mocha": "^2.2.44",
|
||||
"@types/node": "^6.0.89",
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-bump": "^2.8.0",
|
||||
@ -593,6 +588,7 @@
|
||||
"gulp-typings": "^2.0.4",
|
||||
"merge-stream": "^1.0.1",
|
||||
"mocha": "^4.0.1",
|
||||
"prettier": "^1.8.2",
|
||||
"tslint": "^5.7.0",
|
||||
"typescript": "^2.5.3",
|
||||
"vscode": "^1.1.6"
|
||||
|
@ -3481,32 +3481,33 @@ class ActionOverrideCmdDInsert extends BaseCommand {
|
||||
// Since editor.action.addSelectionToNextFindMatch uses the selection to
|
||||
// determine where to add a word, we need to do a hack and manually set the
|
||||
// selections to the word boundaries before we make the api call.
|
||||
vscode.window.activeTextEditor!.selections = vscode.window
|
||||
.activeTextEditor!.selections.map((x, idx) => {
|
||||
const curPos = Position.FromVSCodePosition(x.active);
|
||||
if (idx === 0) {
|
||||
return new vscode.Selection(
|
||||
curPos.getWordLeft(false),
|
||||
curPos
|
||||
.getLeft()
|
||||
.getCurrentWordEnd(true)
|
||||
.getRight()
|
||||
);
|
||||
} else {
|
||||
// Since we're adding the selections ourselves, we need to make sure
|
||||
// that our selection is actually over what our original word is
|
||||
const matchWordPos = Position.FromVSCodePosition(
|
||||
vscode.window.activeTextEditor!.selections[0].active
|
||||
);
|
||||
const matchWordLength =
|
||||
matchWordPos
|
||||
.getLeft()
|
||||
.getCurrentWordEnd(true)
|
||||
.getRight().character - matchWordPos.getWordLeft(false).character;
|
||||
const wordBegin = curPos.getLeftByCount(matchWordLength);
|
||||
return new vscode.Selection(wordBegin, curPos);
|
||||
vscode.window.activeTextEditor!.selections = vscode.window.activeTextEditor!.selections.map(
|
||||
(x, idx) => {
|
||||
const curPos = Position.FromVSCodePosition(x.active);
|
||||
if (idx === 0) {
|
||||
return new vscode.Selection(
|
||||
curPos.getWordLeft(false),
|
||||
curPos
|
||||
.getLeft()
|
||||
.getCurrentWordEnd(true)
|
||||
.getRight()
|
||||
);
|
||||
} else {
|
||||
// Since we're adding the selections ourselves, we need to make sure
|
||||
// that our selection is actually over what our original word is
|
||||
const matchWordPos = Position.FromVSCodePosition(
|
||||
vscode.window.activeTextEditor!.selections[0].active
|
||||
);
|
||||
const matchWordLength =
|
||||
matchWordPos
|
||||
.getLeft()
|
||||
.getCurrentWordEnd(true)
|
||||
.getRight().character - matchWordPos.getWordLeft(false).character;
|
||||
const wordBegin = curPos.getLeftByCount(matchWordLength);
|
||||
return new vscode.Selection(wordBegin, curPos);
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
await vscode.commands.executeCommand('editor.action.addSelectionToNextFindMatch');
|
||||
vimState.allCursors = await allowVSCodeToPropagateCursorUpdatesAndReturnThem();
|
||||
return vimState;
|
||||
|
@ -56,17 +56,14 @@ class ConfigurationClass {
|
||||
return ConfigurationClass._instance;
|
||||
}
|
||||
|
||||
updateConfiguration() {
|
||||
/**
|
||||
* Load Vim options from User Settings.
|
||||
*/
|
||||
let vimOptions = vscode.workspace.getConfiguration('vim');
|
||||
public updateConfiguration() {
|
||||
let vimConfigs = getConfiguration('vim');
|
||||
/* tslint:disable:forin */
|
||||
// Disable forin rule here as we make accessors enumerable.`
|
||||
for (const option in this) {
|
||||
const vimOptionValue = vimOptions[option] as any;
|
||||
if (vimOptionValue !== null && vimOptionValue !== undefined) {
|
||||
this[option] = vimOptionValue;
|
||||
const val = vimConfigs[option] as any;
|
||||
if (val !== null && val !== undefined) {
|
||||
this[option] = val;
|
||||
}
|
||||
}
|
||||
|
||||
@ -75,36 +72,17 @@ class ConfigurationClass {
|
||||
this.leader = ' ';
|
||||
}
|
||||
|
||||
// Get the cursor type from vscode
|
||||
const cursorStyleString = vscode.workspace
|
||||
.getConfiguration()
|
||||
.get('editor.cursorStyle') as string;
|
||||
this.userCursor = this.cursorStyleFromString(cursorStyleString);
|
||||
if (this.userCursor === undefined) {
|
||||
this.userCursor = this.cursorStyleFromString('line');
|
||||
}
|
||||
|
||||
// Get configuration setting for handled keys, this allows user to disable
|
||||
// certain key combinations
|
||||
const handleKeys = vscode.workspace
|
||||
.getConfiguration('vim')
|
||||
.get<IHandleKeys[]>('handleKeys', []);
|
||||
|
||||
// Enable/Disable certain key combinations
|
||||
for (const bracketedKey of this.boundKeyCombinations) {
|
||||
// Set context for key that is not used
|
||||
// This either happens when user sets useCtrlKeys to false (ctrl keys are not used then)
|
||||
// Or if user uses vim.handleKeys configuration option to set certain combinations to false
|
||||
// By default, all key combinations are used so start with true
|
||||
// By default, all key combinations are used
|
||||
let useKey = true;
|
||||
|
||||
// Check for configuration setting disabling combo
|
||||
if (handleKeys[bracketedKey] !== undefined) {
|
||||
if (handleKeys[bracketedKey] === false) {
|
||||
useKey = false;
|
||||
}
|
||||
if (this.handleKeys[bracketedKey]) {
|
||||
// disabled through `vim.handleKeys`
|
||||
useKey = false;
|
||||
} else if (!this.useCtrlKeys && bracketedKey.slice(1, 3) === 'C-') {
|
||||
// Check for useCtrlKeys and if it is a <C- ctrl> based keybinding.
|
||||
// However, we need to still capture <C-c> due to overrideCopy.
|
||||
// user has disabled CtrlKeys and the current key is a CtrlKey
|
||||
// <C-c>, still needs to be captured to overrideCopy
|
||||
if (bracketedKey === '<C-c>' && this.overrideCopy) {
|
||||
useKey = true;
|
||||
} else {
|
||||
@ -112,7 +90,6 @@ class ConfigurationClass {
|
||||
}
|
||||
}
|
||||
|
||||
// Set the context of whether or not this key will be used based on criteria from above
|
||||
vscode.commands.executeCommand('setContext', 'vim.use' + bracketedKey, useKey);
|
||||
}
|
||||
}
|
||||
@ -127,13 +104,14 @@ class ConfigurationClass {
|
||||
'underline-thin': vscode.TextEditorCursorStyle.UnderlineThin,
|
||||
};
|
||||
|
||||
if (cursorType[cursorStyle] !== undefined) {
|
||||
return cursorType[cursorStyle];
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
return cursorType[cursorStyle];
|
||||
}
|
||||
|
||||
/**
|
||||
* Delegate certain key combinations back to VSCode to be handled natively
|
||||
*/
|
||||
handleKeys: IHandleKeys[] = [];
|
||||
|
||||
/**
|
||||
* Use the system's clipboard when copying.
|
||||
*/
|
||||
@ -262,10 +240,15 @@ class ConfigurationClass {
|
||||
@overlapSetting({ codeName: 'tabSize', default: 8 })
|
||||
tabstop: number;
|
||||
|
||||
@overlapSetting({ codeName: 'cursorStyle', default: 'line' })
|
||||
userCursorString: string;
|
||||
|
||||
/**
|
||||
* Type of cursor user is using native to vscode
|
||||
*/
|
||||
userCursor: number | undefined;
|
||||
get userCursor(): number | undefined {
|
||||
return this.cursorStyleFromString(this.userCursorString);
|
||||
}
|
||||
|
||||
/**
|
||||
* Use spaces when the user presses tab?
|
||||
@ -315,17 +298,13 @@ class ConfigurationClass {
|
||||
}
|
||||
set disableExt(isDisabled: boolean) {
|
||||
this.disableExtension = isDisabled;
|
||||
vscode.workspace
|
||||
.getConfiguration('vim')
|
||||
.update('disableExtension', isDisabled, ConfigurationTarget.Global);
|
||||
getConfiguration('vim').update('disableExtension', isDisabled, ConfigurationTarget.Global);
|
||||
}
|
||||
|
||||
enableNeovim = true;
|
||||
|
||||
neovimPath = 'nvim';
|
||||
|
||||
disableAnnoyingNeovimMessage = false;
|
||||
|
||||
/**
|
||||
* Automatically apply the /g flag to substitute commands.
|
||||
*/
|
||||
@ -349,6 +328,15 @@ class ConfigurationClass {
|
||||
cmdLineInitialColon = false;
|
||||
}
|
||||
|
||||
function getConfiguration(section: string): vscode.WorkspaceConfiguration {
|
||||
let resource: vscode.Uri | undefined = undefined;
|
||||
let activeTextEditor = vscode.window.activeTextEditor;
|
||||
if (activeTextEditor) {
|
||||
resource = activeTextEditor.document.uri;
|
||||
}
|
||||
return vscode.workspace.getConfiguration(section, resource);
|
||||
}
|
||||
|
||||
function overlapSetting(args: {
|
||||
codeName: string;
|
||||
default: OptionValue;
|
||||
@ -361,15 +349,12 @@ function overlapSetting(args: {
|
||||
return this['_' + propertyKey];
|
||||
}
|
||||
|
||||
if (args.codeValueMapping) {
|
||||
let val = vscode.workspace.getConfiguration('editor').get(args.codeName);
|
||||
|
||||
if (val !== undefined) {
|
||||
return args.codeValueMapping[val as string];
|
||||
}
|
||||
} else {
|
||||
return vscode.workspace.getConfiguration('editor').get(args.codeName, args.default);
|
||||
let val = getConfiguration('editor').get(args.codeName, args.default);
|
||||
if (args.codeValueMapping && val !== undefined) {
|
||||
val = args.codeValueMapping[val as string];
|
||||
}
|
||||
|
||||
return val;
|
||||
},
|
||||
set: function(value) {
|
||||
this['_' + propertyKey] = value;
|
||||
@ -385,7 +370,11 @@ function overlapSetting(args: {
|
||||
codeValue = args.codeValueMapping[value];
|
||||
}
|
||||
|
||||
await vscode.workspace.getConfiguration('editor').update(args.codeName, codeValue, true);
|
||||
await getConfiguration('editor').update(
|
||||
args.codeName,
|
||||
codeValue,
|
||||
vscode.ConfigurationTarget.Global
|
||||
);
|
||||
}, 'config');
|
||||
},
|
||||
enumerable: true,
|
||||
|
31
src/editorIdentity.ts
Normal file
31
src/editorIdentity.ts
Normal file
@ -0,0 +1,31 @@
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
export class EditorIdentity {
|
||||
private _fileName: string;
|
||||
private _viewColumn: vscode.ViewColumn;
|
||||
|
||||
constructor(textEditor?: vscode.TextEditor) {
|
||||
this._fileName = (textEditor && textEditor.document.fileName) || '';
|
||||
this._viewColumn = (textEditor && textEditor.viewColumn) || vscode.ViewColumn.One;
|
||||
}
|
||||
|
||||
get fileName() {
|
||||
return this._fileName;
|
||||
}
|
||||
|
||||
get viewColumn() {
|
||||
return this._viewColumn;
|
||||
}
|
||||
|
||||
public hasSameBuffer(identity: EditorIdentity): boolean {
|
||||
return this.fileName === identity.fileName;
|
||||
}
|
||||
|
||||
public isEqual(identity: EditorIdentity): boolean {
|
||||
return this.fileName === identity.fileName && this.viewColumn === identity.viewColumn;
|
||||
}
|
||||
|
||||
public toString() {
|
||||
return this.fileName + this.viewColumn;
|
||||
}
|
||||
}
|
@ -3,7 +3,7 @@ import { SurroundInputMode } from './surroundInputMode';
|
||||
import * as vscode from 'vscode';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { EditorIdentity } from './../../extension';
|
||||
import { EditorIdentity } from './../../src/editorIdentity';
|
||||
import {
|
||||
isTextTransformation,
|
||||
TextTransformations,
|
||||
@ -2018,9 +2018,9 @@ export class ModeHandler implements vscode.Disposable {
|
||||
}
|
||||
|
||||
private _renderStatusBar(): void {
|
||||
const modeText = `-- ${this.currentMode.text.toUpperCase()} ${this._vimState.isMultiCursor
|
||||
? 'MULTI CURSOR'
|
||||
: ''} --`;
|
||||
const modeText = `-- ${this.currentMode.text.toUpperCase()} ${
|
||||
this._vimState.isMultiCursor ? 'MULTI CURSOR' : ''
|
||||
} --`;
|
||||
const macroText = this._vimState.isRecordingMacro
|
||||
? 'Recording @' + this._vimState.recordedMacro.registerName
|
||||
: '';
|
||||
|
@ -21,10 +21,12 @@ export function getTestingFunctions() {
|
||||
: 'no stack available :(';
|
||||
|
||||
test(testObj.title, async () =>
|
||||
testIt.bind(null, await getAndUpdateModeHandler())(testObj).catch((reason: Error) => {
|
||||
reason.stack = niceStack;
|
||||
throw reason;
|
||||
})
|
||||
testIt
|
||||
.bind(null, await getAndUpdateModeHandler())(testObj)
|
||||
.catch((reason: Error) => {
|
||||
reason.stack = niceStack;
|
||||
throw reason;
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
@ -39,10 +41,12 @@ export function getTestingFunctions() {
|
||||
: 'no stack available :(';
|
||||
|
||||
test.only(testObj.title, async () =>
|
||||
testIt.bind(null, await getAndUpdateModeHandler())(testObj).catch((reason: Error) => {
|
||||
reason.stack = niceStack;
|
||||
throw reason;
|
||||
})
|
||||
testIt
|
||||
.bind(null, await getAndUpdateModeHandler())(testObj)
|
||||
.catch((reason: Error) => {
|
||||
reason.stack = niceStack;
|
||||
throw reason;
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user