Skip to main content

par_term_config/config/config_struct/
copy_mode_config.rs

1//! `CopyModeConfig` — vi-style copy mode settings.
2
3use serde::{Deserialize, Serialize};
4
5/// Settings for the vi-style keyboard-driven copy mode.
6#[derive(Debug, Clone, Serialize, Deserialize)]
7pub struct CopyModeConfig {
8    /// Enable copy mode (vi-style keyboard-driven text selection and navigation).
9    /// When enabled, users can enter copy mode via the `toggle_copy_mode` keybinding
10    /// action to navigate the terminal buffer with vi keys and yank text.
11    #[serde(default = "crate::defaults::bool_true")]
12    pub copy_mode_enabled: bool,
13
14    /// Automatically exit copy mode after yanking (copying) selected text.
15    /// When true (default), pressing `y` in visual mode copies text and exits copy mode.
16    /// When false, copy mode stays active after yanking so you can continue selecting.
17    #[serde(default = "crate::defaults::bool_true")]
18    pub copy_mode_auto_exit_on_yank: bool,
19
20    /// Show a status bar at the bottom of the terminal when copy mode is active.
21    /// The status bar displays the current mode (COPY/VISUAL/V-LINE/V-BLOCK/SEARCH)
22    /// and cursor position information.
23    #[serde(default = "crate::defaults::bool_true")]
24    pub copy_mode_show_status: bool,
25}
26
27impl Default for CopyModeConfig {
28    fn default() -> Self {
29        Self {
30            copy_mode_enabled: crate::defaults::bool_true(),
31            copy_mode_auto_exit_on_yank: crate::defaults::bool_true(),
32            copy_mode_show_status: crate::defaults::bool_true(),
33        }
34    }
35}