Skip to content

Commit

Permalink
Merge branch 'master' into relative-command-ranges
Browse files Browse the repository at this point in the history
  • Loading branch information
captaincaius committed Oct 11, 2018
2 parents 74f13b5 + de9dfb1 commit 340452a
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 14 deletions.
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<C-...>` in the when argument can be delegated back to VSCode by setting `"<C-...>": false`. Example: to use `ctrl+f` for find (native VSCode behaviour): `"vim.handleKeys": { "<C-f>": false }`. | String | `"<C-d>": 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 <kbd>cw</kbd> action to act consistently as its siblings (<kbd>yw</kbd> and <kbd>dw</kbd>) instead of acting as <kbd>ce</kbd>. | 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<C-...>` in the when argument can be delegated back to VSCode by setting `"<C-...>": false`. Example: to use `ctrl+f` for find (native VSCode behaviour): `"vim.handleKeys": { "<C-f>": false }`. | String | `"<C-d>": 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

Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
11 changes: 9 additions & 2 deletions src/actions/motion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,11 @@ export class MoveWordBegin extends BaseMovement {
vimState: VimState,
isLastIteration: boolean = false
): Promise<Position> {
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;
}
Expand Down Expand Up @@ -1208,7 +1212,10 @@ class MoveFullWordBegin extends BaseMovement {
keys = ['W'];

public async execAction(position: Position, vimState: VimState): Promise<Position> {
if (vimState.recordedState.operator instanceof ChangeOperator) {
if (
!configuration.changeWordIncludesWhitespace &&
vimState.recordedState.operator instanceof ChangeOperator
) {
// TODO use execForOperator? Or maybe dont?

// See note for w
Expand Down
2 changes: 2 additions & 0 deletions src/configuration/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,8 @@ class Configuration implements IConfiguration {

mouseSelectionGoesIntoVisualMode = true;

changeWordIncludesWhitespace = false;

foldfix = false;

private disableExtension: boolean = false;
Expand Down
5 changes: 5 additions & 0 deletions src/configuration/iconfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
1 change: 1 addition & 0 deletions test/testConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export class Configuration implements IConfiguration {
iskeyword = '/\\()"\':,.;<>~!@#$%^&*|+=[]{}`?-';
visualstar = false;
mouseSelectionGoesIntoVisualMode = true;
changeWordIncludesWhitespace = false;
foldfix = false;
disableExt = false;
enableNeovim = false;
Expand Down

0 comments on commit 340452a

Please sign in to comment.