Skip to content

Commit 6e4d530

Browse files
authored
Merge pull request #5 from VSCodeVim/master
update master
2 parents ce0c0e0 + 714071a commit 6e4d530

File tree

4 files changed

+63
-56
lines changed

4 files changed

+63
-56
lines changed

package-lock.json

Lines changed: 31 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,20 +1058,20 @@
10581058
"gulp-tag-version": "1.3.1",
10591059
"gulp-tslint": "8.1.4",
10601060
"gulp-typescript": "5.0.1",
1061-
"husky": "4.2.5",
1061+
"husky": "4.3.0",
10621062
"minimist": "1.2.5",
10631063
"mocha": "8.1.3",
10641064
"plugin-error": "1.0.1",
10651065
"prettier": "2.1.1",
1066-
"pretty-quick": "3.0.0",
1066+
"pretty-quick": "3.0.1",
10671067
"sinon": "9.0.3",
10681068
"ts-loader": "8.0.3",
10691069
"tslint": "6.1.3",
10701070
"typescript": "4.0.2",
10711071
"vscode-test": "1.4.0",
10721072
"webpack": "4.44.1",
10731073
"webpack-cli": "3.3.12",
1074-
"webpack-merge": "5.1.3",
1074+
"webpack-merge": "5.1.4",
10751075
"webpack-stream": "6.1.0"
10761076
}
10771077
}

src/actions/commands/actions.ts

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,9 +1171,11 @@ class CommandRepeatSubstitution extends BaseCommand {
11711171
}
11721172
}
11731173

1174+
type FoldDirection = 'up' | 'down' | undefined;
11741175
abstract class CommandFold extends BaseCommand {
11751176
modes = [Mode.Normal, Mode.Visual, Mode.VisualLine];
11761177
commandName: string;
1178+
direction: FoldDirection;
11771179

11781180
public doesActionApply(vimState: VimState, keysPressed: string[]): boolean {
11791181
// Don't run if there's an operator because the Sneak plugin uses <operator>z
@@ -1183,7 +1185,13 @@ abstract class CommandFold extends BaseCommand {
11831185
}
11841186

11851187
public async exec(position: Position, vimState: VimState): Promise<void> {
1186-
await vscode.commands.executeCommand(this.commandName);
1188+
const timesToRepeat = vimState.recordedState.count || 1;
1189+
const args =
1190+
this.direction !== undefined
1191+
? { levels: timesToRepeat, direction: this.direction }
1192+
: undefined;
1193+
await vscode.commands.executeCommand(this.commandName, args);
1194+
vimState.cursors = getCursorsAfterSync();
11871195
await vimState.setCurrentMode(Mode.Normal);
11881196
}
11891197
}
@@ -1192,24 +1200,13 @@ abstract class CommandFold extends BaseCommand {
11921200
class CommandToggleFold extends CommandFold {
11931201
keys = ['z', 'a'];
11941202
commandName = 'editor.toggleFold';
1195-
public async exec(position: Position, vimState: VimState): Promise<void> {
1196-
await vscode.commands.executeCommand(this.commandName);
1197-
vimState.cursors = getCursorsAfterSync();
1198-
await vimState.setCurrentMode(Mode.Normal);
1199-
}
12001203
}
12011204

12021205
@RegisterAction
12031206
class CommandCloseFold extends CommandFold {
12041207
keys = ['z', 'c'];
12051208
commandName = 'editor.fold';
1206-
runsOnceForEachCountPrefix = true;
1207-
1208-
public async exec(position: Position, vimState: VimState): Promise<void> {
1209-
let timesToRepeat = vimState.recordedState.count || 1;
1210-
await vscode.commands.executeCommand('editor.fold', { levels: timesToRepeat, direction: 'up' });
1211-
vimState.cursors = getCursorsAfterSync();
1212-
}
1209+
direction: FoldDirection = 'up';
12131210
}
12141211

12151212
@RegisterAction
@@ -1222,15 +1219,7 @@ class CommandCloseAllFolds extends CommandFold {
12221219
class CommandOpenFold extends CommandFold {
12231220
keys = ['z', 'o'];
12241221
commandName = 'editor.unfold';
1225-
runsOnceForEachCountPrefix = true;
1226-
1227-
public async exec(position: Position, vimState: VimState): Promise<void> {
1228-
let timesToRepeat = vimState.recordedState.count || 1;
1229-
await vscode.commands.executeCommand('editor.unfold', {
1230-
levels: timesToRepeat,
1231-
direction: 'down',
1232-
});
1233-
}
1222+
direction: FoldDirection = 'down';
12341223
}
12351224

12361225
@RegisterAction

syntaxes/vimrc.tmLanguage.json

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,39 @@
66
"patterns": [
77
{
88
"name": "comment.line",
9-
"match": "\".*$"
9+
"match": "(^| |\t)\".*$"
1010
},
1111
{
1212
"name": "entity.name.function",
13-
"match": "^(map|nmap|vmap|smap|xmap|omap|map!|imap|lmap|cmap)"
13+
"match": "^( |\t)*(map|nmap|vmap|smap|xmap|omap|map!|imap|lmap|cmap)"
1414
},
1515
{
1616
"name": "entity.name.function",
17-
"match": "^(noremap|nnoremap|vnoremap|snoremap|xnoremap|onoremap|noremap!|inoremap|lnoremap|cnoremap)"
17+
"match": "^( |\t)*(noremap|nnoremap|vnoremap|snoremap|xnoremap|onoremap|noremap!|inoremap|lnoremap|cnoremap)"
1818
},
1919
{
2020
"name": "entity.name.function",
21-
"match": "^(unmap|nunmap|vunmap|sunmap|xunmap|ounmap|unmap!|iunmap|lunmap|cunmap)"
21+
"match": "^( |\t)*(unmap|nunmap|vunmap|sunmap|xunmap|ounmap|unmap!|iunmap|lunmap|cunmap)"
2222
},
2323
{
2424
"name": "entity.name.function",
25-
"match": "^set"
25+
"match": "^( |\t)*set"
26+
},
27+
{
28+
"name": "constant",
29+
"match": "<([Ll][Ee][Aa][Dd][Ee][Rr])>"
30+
},
31+
{
32+
"name": "constant",
33+
"match": "<([Cc][Rr])>"
34+
},
35+
{
36+
"name": "constant",
37+
"match": "<[CcDd]-.>"
2638
},
2739
{
2840
"name": "string.unquoted",
29-
"match": ".*$"
41+
"match": "[A-Za-z]+(\\.[A-Za-z]+)+"
3042
}
3143
]
3244
}

0 commit comments

Comments
 (0)