diff --git a/README.md b/README.md index 253bcda2505..98f7a82b4ed 100644 --- a/README.md +++ b/README.md @@ -117,18 +117,19 @@ Below is an example of a [settings.json](https://code.visualstudio.com/Docs/cust These settings are specific to VSCodeVim. -| Setting | Description | Type | Default Value | -| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------- | ------------------------ | -| vim.cursorStylePerMode._{Mode}_ | Configure a specific cursor style for _{Mode}_. Omitted modes will use [default cursor type](https://github.com/VSCodeVim/Vim/blob/4a6fde6dbd4d1fac1f204c0dc27c32883651ef1a/src/mode/mode.ts#L34) Supported cursors: line, block, underline, line-thin, block-outline, and underline-thin. | String | None | -| vim.debug.loggingLevel | Maximum level of messages to log. Logs are visible in the [developer tools](https://code.visualstudio.com/docs/extensions/developing-extensions#_developer-tools-console). Supported values: 'error', 'warn', 'info', 'verbose', 'debug'). | String | error | -| vim.disableExtension | Disable VSCodeVim extension. This setting can also be toggled using `toggleVim` command in the Command Palette | Boolean | false | -| vim.handleKeys | Delegate configured keys to be handled by VSCode instead of by the VSCodeVim extension. Any key in `keybindings` section of the [package.json](https://github.com/VSCodeVim/Vim/blob/master/package.json) that has a `vim.use` in the when argument can be delegated back to VSCode by setting `"": false`. Example: to use `ctrl+f` for find (native VSCode behaviour): `"vim.handleKeys": { "": false }`. | String | `"": true` | -| vim.overrideCopy | Override VSCode's copy command with our own, which works correctly with VSCodeVim. If cmd-c/ctrl-c is giving you issues, set this to false and complain [here](https://github.com/Microsoft/vscode/issues/217). | Boolean | false | -| vim.searchHighlightColor | Set the color of search highlights | String | rgba(150, 150, 255, 0.3) | -| vim.startInInsertMode | Start in Insert mode instead of Normal Mode | Boolean | false | -| vim.substituteGlobalFlag | Similar to Vim's `gdefault` setting. `/g` flag in a substitute command replaces all occurrences in the line. Without this flag, replacement occurs only for the first occurrence in each line. With this setting enabled, the `g` is on by default. | Boolean | false | -| vim.useCtrlKeys | Enable Vim ctrl keys overriding common VSCode operations such as copy, paste, find, etc. | Boolean | true | -| vim.visualstar | In visual mode, start a search with `*` or `#` using the current selection | Boolean | false | +| Setting | Description | Type | Default Value | +| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------- | ------------------------ | +| vim.changeWordIncludesWhitespace | Include trailing whitespace when changing word. This configures the cw action to act consistently as its siblings (yw and dw) instead of acting as ce. | Boolean | false | +| vim.cursorStylePerMode._{Mode}_ | Configure a specific cursor style for _{Mode}_. Omitted modes will use [default cursor type](https://github.com/VSCodeVim/Vim/blob/4a6fde6dbd4d1fac1f204c0dc27c32883651ef1a/src/mode/mode.ts#L34) Supported cursors: line, block, underline, line-thin, block-outline, and underline-thin. | String | None | +| vim.debug.loggingLevel | Maximum level of messages to log. Logs are visible in the [developer tools](https://code.visualstudio.com/docs/extensions/developing-extensions#_developer-tools-console). Supported values: 'error', 'warn', 'info', 'verbose', 'debug'). | String | error | +| vim.disableExtension | Disable VSCodeVim extension. This setting can also be toggled using `toggleVim` command in the Command Palette | Boolean | false | +| vim.handleKeys | Delegate configured keys to be handled by VSCode instead of by the VSCodeVim extension. Any key in `keybindings` section of the [package.json](https://github.com/VSCodeVim/Vim/blob/master/package.json) that has a `vim.use` in the when argument can be delegated back to VSCode by setting `"": false`. Example: to use `ctrl+f` for find (native VSCode behaviour): `"vim.handleKeys": { "": false }`. | String | `"": true` | +| vim.overrideCopy | Override VSCode's copy command with our own, which works correctly with VSCodeVim. If cmd-c/ctrl-c is giving you issues, set this to false and complain [here](https://github.com/Microsoft/vscode/issues/217). | Boolean | false | +| vim.searchHighlightColor | Set the color of search highlights | String | rgba(150, 150, 255, 0.3) | +| vim.startInInsertMode | Start in Insert mode instead of Normal Mode | Boolean | false | +| vim.substituteGlobalFlag | Similar to Vim's `gdefault` setting. `/g` flag in a substitute command replaces all occurrences in the line. Without this flag, replacement occurs only for the first occurrence in each line. With this setting enabled, the `g` is on by default. | Boolean | false | +| vim.useCtrlKeys | Enable Vim ctrl keys overriding common VSCode operations such as copy, paste, find, etc. | Boolean | true | +| vim.visualstar | In visual mode, start a search with `*` or `#` using the current selection | Boolean | false | ### Neovim Integration diff --git a/package.json b/package.json index a8a399bd6bd..5603c6c1273 100644 --- a/package.json +++ b/package.json @@ -578,6 +578,11 @@ "description": "In visual mode, start a search with * or # using the current selection", "default": false }, + "vim.changeWordIncludesWhitespace": { + "type": "boolean", + "description": "Includes trailing whitespace when changing word", + "default": false + }, "vim.foldfix": { "type": "boolean", "description": "Uses a hack to move around folds properly", diff --git a/src/actions/motion.ts b/src/actions/motion.ts index 6eeaf788fd2..a6e376bfb76 100644 --- a/src/actions/motion.ts +++ b/src/actions/motion.ts @@ -1150,7 +1150,11 @@ export class MoveWordBegin extends BaseMovement { vimState: VimState, isLastIteration: boolean = false ): Promise { - if (isLastIteration && vimState.recordedState.operator instanceof ChangeOperator) { + if ( + isLastIteration && + !configuration.changeWordIncludesWhitespace && + vimState.recordedState.operator instanceof ChangeOperator + ) { if (TextEditor.getLineAt(position).text.length < 1) { return position; } @@ -1208,7 +1212,10 @@ class MoveFullWordBegin extends BaseMovement { keys = ['W']; public async execAction(position: Position, vimState: VimState): Promise { - if (vimState.recordedState.operator instanceof ChangeOperator) { + if ( + !configuration.changeWordIncludesWhitespace && + vimState.recordedState.operator instanceof ChangeOperator + ) { // TODO use execForOperator? Or maybe dont? // See note for w diff --git a/src/configuration/configuration.ts b/src/configuration/configuration.ts index 0c36daa5f1f..9ebc52e16be 100644 --- a/src/configuration/configuration.ts +++ b/src/configuration/configuration.ts @@ -316,6 +316,8 @@ class Configuration implements IConfiguration { mouseSelectionGoesIntoVisualMode = true; + changeWordIncludesWhitespace = false; + foldfix = false; private disableExtension: boolean = false; diff --git a/src/configuration/iconfiguration.ts b/src/configuration/iconfiguration.ts index 5512cd142e4..bc345463376 100644 --- a/src/configuration/iconfiguration.ts +++ b/src/configuration/iconfiguration.ts @@ -197,6 +197,11 @@ export interface IConfiguration { */ mouseSelectionGoesIntoVisualMode: boolean; + /** + * Includes trailing whitespace when changing word. + */ + changeWordIncludesWhitespace: boolean; + /** * Uses a hack to fix moving around folds. */ diff --git a/test/testConfiguration.ts b/test/testConfiguration.ts index 19d25735fa4..cb15962fc1a 100644 --- a/test/testConfiguration.ts +++ b/test/testConfiguration.ts @@ -63,6 +63,7 @@ export class Configuration implements IConfiguration { iskeyword = '/\\()"\':,.;<>~!@#$%^&*|+=[]{}`?-'; visualstar = false; mouseSelectionGoesIntoVisualMode = true; + changeWordIncludesWhitespace = false; foldfix = false; disableExt = false; enableNeovim = false;