Skip to main content
The Command Palette provides quick access to all of Rode’s features through a searchable overlay, inspired by VS Code’s command palette.

Opening the Command Palette

Press Cmd+Shift+P to open the command palette overlay. The palette appears as a centered overlay with:
  • Search input at the top
  • Filtered commands listed below with descriptions
  • Keyboard navigation support

Available Commands

Rode’s command palette includes all major editor operations:
let commands = vec![
    Command {
        name: "Theme".to_string(),
        description: "Open theme settings".to_string(),
    },
    Command {
        name: "Settings".to_string(),
        description: "Open editor settings".to_string(),
    },
    Command {
        name: "Open File".to_string(),
        description: "Open an existing file".to_string(),
    },
    Command {
        name: "Open Folder".to_string(),
        description: "Open a folder in file tree".to_string(),
    },
    Command {
        name: "Save File".to_string(),
        description: "Save the current file".to_string(),
    },
    Command {
        name: "Quit".to_string(),
        description: "Exit the editor".to_string(),
    },
    Command {
        name: "New File".to_string(),
        description: "Create a new file".to_string(),
    },
    Command {
        name: "Save As".to_string(),
        description: "Save the current file with a new name".to_string(),
    },
    Command {
        name: "Toggle Terminal".to_string(),
        description: "Open system terminal".to_string(),
    },
    Command {
        name: "Find and Replace".to_string(),
        description: "Search and replace text in editor".to_string(),
    },
];

Command Categories

  • New File: Create a new untitled file
  • Open File: Browse and open an existing file
  • Open Folder: Open a folder in the file tree
  • Save File: Save the current file
  • Save As: Save with a new name/location

Using the Command Palette

1

Open Palette

Press Cmd+Shift+P to activate the command palette.
2

Search Commands

Start typing to filter commands by name (case-insensitive).
3

Navigate Results

Use and arrow keys to select a command.
4

Execute Command

Press Enter to run the selected command, or click it with the mouse.

Search Filtering

The command palette filters in real-time as you type:
pub fn filter_commands(&mut self) {
    let input_lower = self.input.to_lowercase();

    if input_lower.is_empty() {
        self.filtered_commands = self.commands.clone();
    } else {
        self.filtered_commands = self
            .commands
            .iter()
            .filter(|cmd| cmd.name.to_lowercase().contains(&input_lower))
            .cloned()
            .collect();
    }
}
Search behavior:
  • Case-insensitive matching
  • Substring matching (“file” matches “Open File”, “Save File”, “New File”)
  • Shows all commands when input is empty
  • Instant filtering as you type

Examples

Returns:
  • Save File
  • Save As
Returns:
  • Open File
  • Open Folder
  • (Also matches “Open theme settings” via description)
Returns:
  • Toggle Terminal
Returns:
  • Settings
  • (Also matches “Open theme settings”)

Keyboard Shortcuts

ShortcutAction
Cmd+Shift+POpen command palette
Select previous command
Select next command
EnterExecute selected command
EscapeClose palette
The command palette automatically focuses the search input when opened, so you can start typing immediately.

Command Structure

Each command has two properties:
name
string
The command’s display name (shown in bold)
description
string
A brief explanation of what the command does
#[derive(Clone, Debug)]
pub struct Command {
    pub name: String,
    pub description: String,
}

Integration with Other Features

The command palette integrates seamlessly with other Rode features:

Vim Command Mode

Vim-style commands (:w, :q, etc.) are translated to command palette commands:
:w"Save File"execute_palette_command("Save File")

Keyboard Shortcuts

Most keyboard shortcuts trigger the same commands as the palette:
  • Cmd+S = “Save File” command
  • Cmd+O = “Open Folder” command
  • Cmd+N = “New File” command
  • Cmd+J = “Toggle Terminal” command
Command names match exactly with menu item labels for consistency.

Implementation Details

State Management

pub struct CommandPalette {
    pub open: bool,
    pub input: String,
    commands: Vec<Command>,
    pub filtered_commands: Vec<Command>,
}

impl Default for CommandPalette {
    fn default() -> Self {
        let commands = vec![/* ... */];
        let filtered = commands.clone();

        Self {
            open: false,
            input: String::new(),
            commands,
            filtered_commands: filtered,
        }
    }
}
State fields:
  • open: Controls palette visibility
  • input: Current search query
  • commands: Master list of all commands (immutable)
  • filtered_commands: Subset matching current search

Toggle Behavior

pub fn toggle(&mut self) {
    self.open = !self.open;
    if self.open {
        self.input.clear();
        self.filtered_commands = self.commands.clone();
    }
}

pub fn close(&mut self) {
    self.open = false;
    self.input.clear();
    self.filtered_commands.clear();
}
When opening:
  • Clears previous search input
  • Resets filtered list to show all commands
  • Focuses the search input field
When closing:
  • Hides the overlay
  • Clears search state
  • Empties filtered list

Extending the Command Palette

To add new commands to the palette:
  1. Define the command in the commands vector (src/command_palette.rs:19-60)
  2. Handle execution in execute_palette_command (src/app.rs)
  3. Map keyboard shortcuts if desired (src/app.rs:1022-1051)
Command {
    name: "Format Document".to_string(),
    description: "Auto-format the current file".to_string(),
},

Design Philosophy

Rode’s command palette follows these principles:

Discoverability

All features accessible in one place with descriptions

Speed

Instant filtering and keyboard-driven navigation

Consistency

Command names match throughout the UI (menus, shortcuts, Vim mode)

Simplicity

Clear, concise command names and descriptions
The command palette is the fastest way to discover and access features you don’t have memorized. Press Cmd+Shift+P and explore!

Future Enhancements

Planned improvements:
1

Fuzzy Matching

Implement intelligent fuzzy matching like the file finder (e.g., “sf” matches “Save File”)
2

Recent Commands

Show recently used commands at the top of the list
3

Command History

Remember and suggest previously executed commands
4

Contextual Commands

Show different commands based on current editor state (e.g., Markdown-specific commands when editing .md files)