Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/cmd_line/commands/ascii.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { VimState } from '../../state/vimState';
import { ExCommand } from '../../vimscript/exCommand';

export class AsciiCommand extends ExCommand {
public override isRepeatableWithDot = false;

async execute(vimState: VimState): Promise<void> {
await new CommandUnicodeName().exec(vimState.cursorStopPosition, vimState);
}
Expand Down
2 changes: 2 additions & 0 deletions src/cmd_line/commands/bang.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export interface IBangCommandArguments {
}

export class BangCommand extends ExCommand {
public override isRepeatableWithDot = false;

public static readonly argParser: Parser<BangCommand> = all.map(
(command) =>
new BangCommand({
Expand Down
2 changes: 2 additions & 0 deletions src/cmd_line/commands/bufferDelete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ interface IBufferDeleteCommandArguments {
// http://vimdoc.sourceforge.net/htmldoc/windows.html#buffers
//
export class BufferDeleteCommand extends ExCommand {
public override isRepeatableWithDot = false;

public static readonly argParser: Parser<BufferDeleteCommand> = seq(
bangParser.skip(optWhitespace),
alt<string | number>(numberParser, fileNameParser).sepBy(whitespace),
Expand Down
2 changes: 2 additions & 0 deletions src/cmd_line/commands/change.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export interface IChangeCommandArguments {
}

export class ChangeCommand extends ExCommand {
public override isRepeatableWithDot = false;

public static readonly argParser: Parser<ChangeCommand> = optWhitespace.then(
alt(
numberParser.map((count) => {
Expand Down
2 changes: 2 additions & 0 deletions src/cmd_line/commands/close.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { bangParser } from '../../vimscript/parserUtils';
// http://vimdoc.sourceforge.net/htmldoc/windows.html#:close
//
export class CloseCommand extends ExCommand {
public override isRepeatableWithDot = false;

public static readonly argParser: Parser<CloseCommand> = bangParser.map(
(bang) => new CloseCommand(bang),
);
Expand Down
2 changes: 2 additions & 0 deletions src/cmd_line/commands/copy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { ExCommand } from '../../vimscript/exCommand';
import { Address, LineRange } from '../../vimscript/lineRange';

export class CopyCommand extends ExCommand {
public override isRepeatableWithDot = false;

public static readonly argParser: Parser<CopyCommand> = optWhitespace
.then(Address.parser.fallback(undefined))
.map((address) => new CopyCommand(address));
Expand Down
2 changes: 2 additions & 0 deletions src/cmd_line/commands/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export interface IDeleteCommandArguments {
}

export class DeleteCommand extends ExCommand {
public override isRepeatableWithDot = false;

// TODO: this is copy-pasted from `:y[ank]`
public static readonly argParser: Parser<DeleteCommand> = optWhitespace.then(
alt(
Expand Down
2 changes: 2 additions & 0 deletions src/cmd_line/commands/digraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ interface DigraphQuickPickItem extends vscode.QuickPickItem {
}

export class DigraphsCommand extends ExCommand {
public override isRepeatableWithDot = false;

public static readonly argParser: Parser<DigraphsCommand> = seq(
bangParser,
whitespace.then(seq(any, any, whitespace.then(numberParser).atLeast(1))).fallback(undefined),
Expand Down
2 changes: 2 additions & 0 deletions src/cmd_line/commands/echo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { displayValue } from '../../vimscript/expression/displayValue';
import { VimError } from '../../error';

export class EchoCommand extends ExCommand {
public override isRepeatableWithDot = false;

public static argParser(echoArgs: { sep: string; error: boolean }): Parser<EchoCommand> {
return optWhitespace
.then(seq(expressionParser.sepBy(whitespace), all))
Expand Down
4 changes: 4 additions & 0 deletions src/cmd_line/commands/eval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { EvaluationContext } from '../../vimscript/expression/evaluate';
import { VimError } from '../../error';

export class EvalCommand extends ExCommand {
public override isRepeatableWithDot = false;

public static argParser: Parser<EvalCommand> = optWhitespace
.then(seq(expressionParser.fallback(undefined), all))
.map(([expression, trailing]) => {
Expand All @@ -32,6 +34,8 @@ export class EvalCommand extends ExCommand {
}

export class CallCommand extends ExCommand {
public override isRepeatableWithDot = false;

public static argParser: Parser<CallCommand> = optWhitespace
.then(functionCallParser)
.map((call) => new CallCommand(call));
Expand Down
2 changes: 2 additions & 0 deletions src/cmd_line/commands/explore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { VimState } from '../../state/vimState';
import { ExCommand } from '../../vimscript/exCommand';

export class ExploreCommand extends ExCommand {
public override isRepeatableWithDot = false;

async execute(vimState: VimState): Promise<void> {
await commands.executeCommand('workbench.view.explorer');
}
Expand Down
2 changes: 2 additions & 0 deletions src/cmd_line/commands/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ function getLegacyArgs(args: IFileCommandArguments): LegacyArgs {
}

export class FileCommand extends ExCommand {
public override isRepeatableWithDot = false;

// TODO: There's a lot of duplication here
// TODO: These `optWhitespace` calls should be `whitespace`
public static readonly argParsers = {
Expand Down
2 changes: 2 additions & 0 deletions src/cmd_line/commands/fileInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { ExCommand } from '../../vimscript/exCommand';
import { bangParser } from '../../vimscript/parserUtils';

export class FileInfoCommand extends ExCommand {
public override isRepeatableWithDot = false;

public static readonly argParser: Parser<FileInfoCommand> = seq(
bangParser,
optWhitespace.then(all),
Expand Down
2 changes: 2 additions & 0 deletions src/cmd_line/commands/goto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { LineRange } from '../../vimscript/lineRange';
import { numberParser } from '../../vimscript/parserUtils';

export class GotoCommand extends ExCommand {
public override isRepeatableWithDot = false;

public static readonly argParser: Parser<GotoCommand> = optWhitespace
.then(numberParser.fallback(undefined))
.map((count) => new GotoCommand(count));
Expand Down
2 changes: 2 additions & 0 deletions src/cmd_line/commands/gotoLine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { ExCommand } from '../../vimscript/exCommand';
import { LineRange } from '../../vimscript/lineRange';

export class GotoLineCommand extends ExCommand {
public override isRepeatableWithDot = false;

public async execute(vimState: VimState): Promise<void> {
return;
}
Expand Down
2 changes: 2 additions & 0 deletions src/cmd_line/commands/grep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ interface IGrepCommandArguments {
// Implements :grep
// https://vimdoc.sourceforge.net/htmldoc/quickfix.html#:vimgrep
export class GrepCommand extends ExCommand {
public override isRepeatableWithDot = false;

// TODO: parse the pattern for flags to notify the user that they are not supported yet
public static readonly argParser: Parser<GrepCommand> = optWhitespace.then(
seq(
Expand Down
2 changes: 2 additions & 0 deletions src/cmd_line/commands/history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ export interface IHistoryCommandArguments {

// http://vimdoc.sourceforge.net/htmldoc/cmdline.html#:history
export class HistoryCommand extends ExCommand {
public override isRepeatableWithDot = false;

public static readonly argParser: Parser<HistoryCommand> = optWhitespace
.then(historyTypeParser.fallback(HistoryCommandType.Cmd))
.map((type) => new HistoryCommand({ type }));
Expand Down
4 changes: 4 additions & 0 deletions src/cmd_line/commands/jumps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class JumpPickItem implements QuickPickItem {
}

export class JumpsCommand extends ExCommand {
public override isRepeatableWithDot = false;

async execute(vimState: VimState): Promise<void> {
const jumpTracker = globalState.jumpTracker;
if (jumpTracker.hasJumps) {
Expand All @@ -46,6 +48,8 @@ export class JumpsCommand extends ExCommand {
}

export class ClearJumpsCommand extends ExCommand {
public override isRepeatableWithDot = false;

async execute(vimState: VimState): Promise<void> {
const jumpTracker = globalState.jumpTracker;
jumpTracker.clearJumps();
Expand Down
6 changes: 6 additions & 0 deletions src/cmd_line/commands/leftRightCenter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ type LeftArgs = {
};

export class LeftCommand extends ExCommand {
public override isRepeatableWithDot = false;

public static readonly argParser: Parser<LeftCommand> = optWhitespace
.then(numberParser.fallback(0))
.map((indent) => new LeftCommand({ indent }));
Expand Down Expand Up @@ -50,6 +52,8 @@ type RightArgs = {
};

export class RightCommand extends ExCommand {
public override isRepeatableWithDot = false;

public static readonly argParser: Parser<RightCommand> = optWhitespace
.then(numberParser.fallback(undefined))
.map((width) => new RightCommand({ width: width ?? configuration.textwidth }));
Expand Down Expand Up @@ -94,6 +98,8 @@ type CenterArgs = {
};

export class CenterCommand extends ExCommand {
public override isRepeatableWithDot = false;

public static readonly argParser: Parser<CenterCommand> = optWhitespace
.then(numberParser.fallback(undefined))
.map((width) => new CenterCommand({ width: width ?? configuration.textwidth }));
Expand Down
4 changes: 4 additions & 0 deletions src/cmd_line/commands/let.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ const sliceParser: Parser<Slice> = seq(
}));

export class LetCommand extends ExCommand {
public override isRepeatableWithDot = false;

public static readonly argParser = (lock: boolean) =>
alt<LetCommand>(
// `:let {var} = {expr}`
Expand Down Expand Up @@ -350,6 +352,8 @@ export class LetCommand extends ExCommand {
}

export class UnletCommand extends ExCommand {
public override isRepeatableWithDot = false;

public static readonly argParser = seqMap(
bangParser,
whitespace.then(variableParser.sepBy(whitespace)),
Expand Down
6 changes: 6 additions & 0 deletions src/cmd_line/commands/marks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class MarkQuickPickItem implements QuickPickItem {
}

export class MarksCommand extends ExCommand {
public override isRepeatableWithDot = false;

public static readonly argParser: Parser<MarksCommand> = optWhitespace
.then(noneOf('|'))
.many()
Expand Down Expand Up @@ -67,6 +69,8 @@ export class MarksCommand extends ExCommand {
type DeleteMarksArgs = Array<{ start: string; end: string } | string> | '!';

export class DeleteMarksCommand extends ExCommand {
public override isRepeatableWithDot = false;

public static readonly argParser: Parser<DeleteMarksCommand> = alt<DeleteMarksArgs>(
string('!'),
whitespace.then(
Expand Down Expand Up @@ -137,6 +141,8 @@ export class DeleteMarksCommand extends ExCommand {
}

export class MarkCommand extends ExCommand {
public override isRepeatableWithDot = false;

public static readonly argParser: Parser<MarkCommand> = seq(
optWhitespace,
regexp(/[a-zA-Z'`<>[\].]/).desc('mark name'),
Expand Down
2 changes: 2 additions & 0 deletions src/cmd_line/commands/move.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { ExCommand } from '../../vimscript/exCommand';
import { Address, LineRange } from '../../vimscript/lineRange';

export class MoveCommand extends ExCommand {
public override isRepeatableWithDot = false;

public static readonly argParser: Parser<MoveCommand> = optWhitespace
.then(Address.parser.fallback(undefined))
.map((address) => new MoveCommand(address));
Expand Down
2 changes: 2 additions & 0 deletions src/cmd_line/commands/nohl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { StatusBar } from '../../statusBar';
import { ExCommand } from '../../vimscript/exCommand';

export class NohlCommand extends ExCommand {
public override isRepeatableWithDot = false;

async execute(vimState: VimState): Promise<void> {
globalState.hl = false;

Expand Down
2 changes: 2 additions & 0 deletions src/cmd_line/commands/normal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { ExCommand } from '../../vimscript/exCommand';
import { LineRange } from '../../vimscript/lineRange';

export class NormalCommand extends ExCommand {
public override isRepeatableWithDot = false;

// TODO: support to parse `:normal!`
public static readonly argParser: Parser<NormalCommand> = whitespace
.then(all)
Expand Down
2 changes: 2 additions & 0 deletions src/cmd_line/commands/only.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { VimState } from '../../state/vimState';
import { ExCommand } from '../../vimscript/exCommand';

export class OnlyCommand extends ExCommand {
public override isRepeatableWithDot = false;

async execute(vimState: VimState): Promise<void> {
await Promise.allSettled([
vscode.commands.executeCommand('workbench.action.joinAllGroups'),
Expand Down
2 changes: 2 additions & 0 deletions src/cmd_line/commands/print.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ type PrintArgs = {
// TODO: `:l[ist]` is more than an alias
// TODO: `:z`
export class PrintCommand extends ExCommand {
public override isRepeatableWithDot = false;

// TODO: Print {count} and [flags]
public static readonly argParser = (args: {
printNumbers: boolean;
Expand Down
2 changes: 2 additions & 0 deletions src/cmd_line/commands/put.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ export interface IPutCommandArguments {
//

export class PutExCommand extends ExCommand {
public override isRepeatableWithDot = false;

public static readonly argParser: Parser<PutExCommand> = seq(
bangParser,
optWhitespace.then(
Expand Down
2 changes: 2 additions & 0 deletions src/cmd_line/commands/pwd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import * as vscode from 'vscode';
* Implements the :pwd command, which prints the current working directory.
*/
export class PwdCommand extends ExCommand {
public override isRepeatableWithDot = false;

async execute(vimState: VimState): Promise<void> {
const workspaceFolders = vscode.workspace.workspaceFolders;
if (workspaceFolders && workspaceFolders.length > 0) {
Expand Down
2 changes: 2 additions & 0 deletions src/cmd_line/commands/read.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export type IReadCommandArguments = {
// http://vimdoc.sourceforge.net/htmldoc/insert.html#:read!
//
export class ReadCommand extends ExCommand {
public override isRepeatableWithDot = false;

public static readonly argParser: Parser<ReadCommand> = seq(
whitespace.then(fileOptParser).fallback([]),
optWhitespace
Expand Down
2 changes: 2 additions & 0 deletions src/cmd_line/commands/redo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { numberParser } from '../../vimscript/parserUtils';
// http://vimdoc.sourceforge.net/htmldoc/undo.html#redo
//
export class RedoCommand extends ExCommand {
public override isRepeatableWithDot = false;

public static readonly argParser: Parser<RedoCommand> = optWhitespace
.then(numberParser)
.fallback(undefined)
Expand Down
2 changes: 2 additions & 0 deletions src/cmd_line/commands/retab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ interface UpdatedLineSegment {

// :[range]ret[ab][!] [new_tabstop]
export class RetabCommand extends ExCommand {
public override isRepeatableWithDot = false;

public static readonly argParser: Parser<RetabCommand> = seq(
bangParser,
optWhitespace.then(numberParser).fallback(undefined),
Expand Down
2 changes: 2 additions & 0 deletions src/cmd_line/commands/set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ const setOperationParser: Parser<SetOperation> = whitespace
.fallback({ type: 'show_or_set', option: undefined });

export class SetCommand extends ExCommand {
public override isRepeatableWithDot = false;

public static readonly argParser: Parser<SetCommand> = setOperationParser.map(
(operation) => new SetCommand(operation),
);
Expand Down
2 changes: 2 additions & 0 deletions src/cmd_line/commands/sh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { VimState } from '../../state/vimState';
import { ExCommand } from '../../vimscript/exCommand';

export class ShCommand extends ExCommand {
public override isRepeatableWithDot = false;

async execute(vimState: VimState): Promise<void> {
window.createTerminal().show();
}
Expand Down
2 changes: 2 additions & 0 deletions src/cmd_line/commands/shift.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export type ShiftArgs = {
};

export class ShiftCommand extends ExCommand {
public override isRepeatableWithDot = false;

public static readonly argParser = (dir: '>' | '<'): Parser<ShiftCommand> =>
optWhitespace
.then(
Expand Down
2 changes: 2 additions & 0 deletions src/cmd_line/commands/smile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { TextEditor } from '../../textEditor';
import { ExCommand } from '../../vimscript/exCommand';

export class SmileCommand extends ExCommand {
public override isRepeatableWithDot = false;

static readonly smileText: string = `
oooo$$$$$$$$$$$$oooo
oo$$$$$$$$$$$$$$$$$$$$$$$$o
Expand Down
2 changes: 2 additions & 0 deletions src/cmd_line/commands/sort.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export interface ISortCommandArguments {
}

export class SortCommand extends ExCommand {
public override isRepeatableWithDot = false;

public static readonly argParser: Parser<SortCommand> = seq(
bangParser,
optWhitespace.then(oneOf('bfilnorux').many()),
Expand Down
2 changes: 2 additions & 0 deletions src/cmd_line/commands/substitute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ const countParser: Parser<number | undefined> = optWhitespace
* - update search state too!
*/
export class SubstituteCommand extends ExCommand {
public override isRepeatableWithDot = false;

public static readonly argParser: Parser<SubstituteCommand> = optWhitespace.then(
alt(
// :s[ubstitute]/{pattern}/{string}/[flags] [count]
Expand Down
Loading