Skip to main content
Rode includes a Vim-inspired command mode that allows you to execute common editor operations using familiar colon commands.

Command Input Bar

The command input bar appears at the bottom of the editor, similar to Vim’s command line.

Opening Command Mode

Press : to open the command input bar.

How It Works

/// Vim-style `:` command input bar
/// Ported from rode's hotkey/command_input.rs, adapted for iced.

pub struct CommandInput {
    pub open: bool,
    pub input: String,
}

impl CommandInput {
    pub fn open(&mut self) {
        self.open = true;
        self.input.clear();
    }

    pub fn close(&mut self) {
        self.open = false;
    }

    /// Process a vim-style command string and return the command name
    pub fn process_command(&self) -> Option<String> {
        let cmd = self.input.trim();
        if cmd.is_empty() {
            return None;
        }

        match cmd {
            "w" | "write" => Some("Save File".to_string()),
            "q" | "quit" => Some("Quit".to_string()),
            "wq" => Some("Save and Quit".to_string()),
            "e" | "edit" => Some("Open File".to_string()),
            "new" => Some("New File".to_string()),
            _ => None,
        }
    }
}

Supported Commands

Rode implements the most commonly used Vim commands:
Saves the current file to disk.Aliases: :w, :writeEquivalent: Cmd+S
Closes the current tab.Aliases: :q, :quitEquivalent: Cmd+W
Saves the current file and closes the tab.Alias: :wqEquivalent: Cmd+S followed by Cmd+W
Opens the file picker dialog.Aliases: :e, :editEquivalent: Cmd+O
Creates a new empty file in a new tab.Alias: :newEquivalent: Cmd+N

Command Workflow

1

Activate Command Mode

Press : to open the command input bar at the bottom of the editor.
2

Type Command

Enter your Vim command (e.g., w, q, wq).
3

Execute

Press Enter to execute the command.
4

Cancel

Press Escape to close the command bar without executing.

Command Processing

When you submit a command, Rode:
  1. Trims whitespace from your input
  2. Matches against known commands (both short form and long form)
  3. Translates to internal command (e.g., “Save File”)
  4. Executes the command through the command palette system
  5. Closes the command bar automatically
Message::ToggleCommandInput => {
    if self.command_input.open {
        self.command_input.close();
    } else {
        self.command_input.open();
        return iced::widget::operation::focus(self.command_input_id.clone());
    }
    iced::Task::none()
}
Message::CommandInputChanged(input) => {
    self.command_input.input = input;
    iced::Task::none()
}
Message::CommandInputSubmit => {
    if let Some(cmd) = self.command_input.process_command() {
        self.command_input.close();
        return self.execute_palette_command(&cmd);
    }
    self.command_input.close();
    iced::Task::none()
}

Keyboard Shortcuts

ShortcutAction
:Open command input bar
EnterExecute command
EscapeCancel and close
The : key automatically opens the command bar and is ready for input. You don’t need to type the colon manually.

Differences from Vim

Rode’s Vim mode is inspired by Vim but is not a complete implementation:

What's Included

  • Colon command syntax
  • Common file operations (:w, :q, :wq)
  • Command aliases
  • Command bar UI

What's Not Included

  • Modal editing (Normal/Insert/Visual modes)
  • Movement commands (hjkl, w, b, etc.)
  • Text objects and motions
  • Macros and registers
Rode focuses on providing familiar Vim commands for file operations, not full Vim emulation. For complete Vim functionality, consider using Neovim or Vim directly.

Command Extensions

The command system is designed to be extensible. Commands are processed through the same system that powers the Command Palette, meaning:
  • Commands trigger the same actions as menu items
  • New commands can be added by extending the process_command function
  • All command palette features are accessible via Vim commands
Want to see more Vim commands? The command processing function in src/command_input.rs:29-43 shows exactly where to add new command mappings.

Integration with Command Palette

Vim commands and the Command Palette work together seamlessly:
Vim Command (:w) → Translates to"Save File"Execute viaCommand Palette System
This architecture means:
  • Consistency between command interfaces
  • Easy addition of new commands
  • Shared command execution logic
  • Unified keyboard shortcut handling

Future Enhancements

Planned improvements to Vim mode:
1

Additional Commands

  • :sp / :split for split views
  • :set for runtime configuration
  • :help for command reference
2

Command Arguments

Support for commands with arguments like :e filename or :w filepath
3

Command History

Arrow keys to navigate through previously executed commands
The Vim command mode provides a familiar interface for developers transitioning from Vim or looking for quick keyboard-driven operations.