Vimcraft Docs / CLI Commands

CLI Commands

Vimcraft provides a command-line interface (vimc) for editing files, running scripts, managing plugins, and testing.

Opening Files

Basic Usage

# Open a file
vimc myfile.ts

# Open multiple files
vimc file1.ts file2.ts

# Open at specific line
vimc +10 myfile.ts

# Open with debug mode
vimc --debug myfile.ts

vimc run

Execute TypeScript or JavaScript files with access to the Vimcraft API.

# Run a script
vimc run script.ts

# Run with performance metrics
vimc run --metrics script.ts

Use Cases

Quick automation scripts:

// format-all.ts
const files = ['src/main.ts', 'src/utils.ts'];
for (const file of files) {
  console.log(`Processing ${file}...`);
  // Process file
}
vimc run format-all.ts

Performance testing:

vimc run --metrics my-plugin.ts
# Outputs timing information and memory usage

vimc test

Run end-to-end tests for plugins and editor behavior.

# Run all tests in a directory
vimc test tests/

# Run a single test file
vimc test tests/motions.ts

# Run tests matching a pattern
vimc test tests/*-plugin.ts

Test File Example

// tests/basic.ts

vim.e2e.describe('Basic Navigation', function() {
  vim.e2e.test('j moves down', function() {
    vim.e2e.keys('j');
    vim.e2e.assert.cursorAt(1, 0);
  });

  vim.e2e.test('k moves up', function() {
    vim.e2e.keys('jk');
    vim.e2e.assert.cursorAt(0, 0);
  });
});

vim.e2e.runAll();

See vim.e2e for full testing documentation.

vimc install

Install plugins from the Vimcraft registry or GitHub.

# Install from registry (coming soon)
vimc install plugin-name

# Install from GitHub
vimc install github:username/repo

vimc remove

Uninstall plugins.

# Remove an installed plugin
vimc remove plugin-name

vimc list

List installed plugins.

# Show all installed plugins
vimc list

# Output example:
# Installed plugins:
#   - auto-save (local)
#   - word-count (local)

Options

Global Options

OptionDescription
--help, -hShow help information
--version, -vShow version number
--debugStart with Chrome DevTools debugging

File Opening Options

OptionDescription
+{num}Open file at line number
--debugEnable Chrome DevTools

vimc run Options

OptionDescription
--metricsShow performance metrics

Configuration

Vimcraft configuration is stored in ~/.config/vimcraft/:

~/.config/vimcraft/
├── index.ts         # Main configuration file
├── plugins/         # Local plugins
│   ├── my-plugin.ts
│   └── utils.ts
└── installed/       # Installed plugins from registry

Examples

Development Workflow

# Start editing
vimc src/main.ts

# Run tests while developing
vimc test tests/

# Run a quick script
vimc run scripts/generate-types.ts

Debug Mode

# Open with Chrome DevTools
vimc --debug src/main.ts

# DevTools opens automatically for:
# - Console logging
# - Inspecting plugin state
# - Debugging JavaScript execution

Plugin Development

# Create plugin directory if needed
mkdir -p ~/.config/vimcraft/plugins

# Edit your plugin
vimc ~/.config/vimcraft/plugins/my-plugin.ts

# Test your plugin
vimc test tests/my-plugin.ts

See Also