diff options
| author | Aram Drevekenin <aram@poor.dev> | 2022-10-05 07:44:00 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-05 07:44:00 +0200 |
| commit | 79bf6ab868cbdab1f9a3827c9b70198f54548b44 (patch) | |
| tree | 2d6fc4c1d8a79ebd727a1a5f8b6406617dd0de55 /zellij-client | |
| parent | docs(changelog): add darwin dependencies (diff) | |
| download | sl0ppij-79bf6ab868cbdab1f9a3827c9b70198f54548b44.tar.gz sl0ppij-79bf6ab868cbdab1f9a3827c9b70198f54548b44.tar.xz sl0ppij-79bf6ab868cbdab1f9a3827c9b70198f54548b44.zip | |
feat(config): switch to kdl (#1759)
* chore(config): default kdl keybindings config
* tests
* work
* refactor(config): move stuff around
* work
* tab merge layout
* work
* work
* layouts working
* work
* layout tests
* work
* work
* feat(parsing): kdl layouts without config
* refactor(kdl): move stuff around
* work
* tests(layout): add cases and fix bugs
* work
* fix(kdl): various bugs
* chore(layouts): move all layouts to kdl
* feat(kdl): shared keybidns
* fix(layout): do not count fixed panes toward percentile
* fix(keybinds): missing keybinds and actions
* fix(config): adjust default tips
* refactor(config): move stuff around
* fix(tests): make e2e tests pass
* fix(kdl): add verbose parsing errors
* fix(kdl): focused tab
* fix(layout): corret default_tab_template behavior
* style(code): fix compile warnings
* feat(cli): send actions through the cli
* fix(cli): exit only when action is done
* fix(cli): open embedded pane from floating pane
* fix(cli): send actions to other sessions
* feat(cli): command alias
* feat(converter): convert old config
* feat(converter): convert old layout and theme files
* feat(kdl): pretty errors
* feat(client): convert old YAML files on startup
* fix: various bugs and styling issues
* fix: e2e tests
* fix(screen): propagate errors after merge
* style(clippy): lower clippy level
* fix(tests): own session_name variable
* style(fmt): rustfmt
* fix(cli): various action fixes
* style(fmt): rustfmt
* fix(themes): loading of theme files
* style(fmt): rustfmt
* fix(tests): theme fixtures
* fix(layouts): better errors on unknown nodes
* fix(kdl): clarify valid node terminator error
* fix(e2e): adjust close tab test
* fix(e2e): adjust close tab test again
* style(code): cleanup some comments
Diffstat (limited to 'zellij-client')
46 files changed, 11642 insertions, 302 deletions
diff --git a/zellij-client/Cargo.toml b/zellij-client/Cargo.toml index 30370d47..5761b0e5 100644 --- a/zellij-client/Cargo.toml +++ b/zellij-client/Cargo.toml @@ -10,6 +10,9 @@ license = "MIT" [dependencies] mio = { version = "0.7.11", features = ['os-ext'] } +serde = { version = "1.0", features = ["derive"] } +url = { version = "2.2.2", features = ["serde"] } +serde_yaml = "0.8" zellij-utils = { path = "../zellij-utils/", version = "0.32.0" } log = "0.4.17" diff --git a/zellij-client/src/cli_client.rs b/zellij-client/src/cli_client.rs new file mode 100644 index 00000000..95cd9d13 --- /dev/null +++ b/zellij-client/src/cli_client.rs @@ -0,0 +1,34 @@ +//! The `[cli_client]` is used to attach to a running server session +//! and dispatch actions, that are specified through the command line. +use std::process; +use std::{fs, path::PathBuf}; + +use crate::os_input_output::ClientOsApi; +use zellij_utils::{ + input::actions::Action, + ipc::{ClientToServerMsg, ServerToClientMsg}, +}; + +pub fn start_cli_client(os_input: Box<dyn ClientOsApi>, session_name: &str, actions: Vec<Action>) { + let zellij_ipc_pipe: PathBuf = { + let mut sock_dir = zellij_utils::consts::ZELLIJ_SOCK_DIR.clone(); + fs::create_dir_all(&sock_dir).unwrap(); + zellij_utils::shared::set_permissions(&sock_dir, 0o700).unwrap(); + sock_dir.push(session_name); + sock_dir + }; + os_input.connect_to_server(&*zellij_ipc_pipe); + for action in actions { + let msg = ClientToServerMsg::Action(action, None); + os_input.send_to_server(msg); + } + loop { + match os_input.recv_from_server() { + Some((ServerToClientMsg::UnblockInputThread, _)) => { + os_input.send_to_server(ClientToServerMsg::ClientExited); + process::exit(0); + }, + _ => {}, + } + } +} diff --git a/zellij-client/src/fake_client.rs b/zellij-client/src/fake_client.rs deleted file mode 100644 index 475298e9..00000000 --- a/zellij-client/src/fake_client.rs +++ /dev/null @@ -1,184 +0,0 @@ -//! The `[fake_client]` is used to attach to a running server session -//! and dispatch actions, that are specified through the command line. -//! Multiple actions at the same time can be dispatched. -use log::debug; -use std::sync::{Arc, Mutex}; -use std::{fs, path::PathBuf, thread}; - -use crate::{ - command_is_executing::CommandIsExecuting, input_handler::input_actions, - os_input_output::ClientOsApi, stdin_ansi_parser::StdinAnsiParser, stdin_handler::stdin_loop, - ClientInfo, ClientInstruction, InputInstruction, -}; -use zellij_utils::{ - channels::{self, ChannelWithContext, SenderWithContext}, - cli::CliArgs, - data::{ClientId, Style}, - errors::ContextType, - input::{actions::Action, config::Config, layout::LayoutFromYaml, options::Options}, - ipc::{ClientAttributes, ClientToServerMsg, ServerToClientMsg}, -}; - -pub fn start_fake_client( - os_input: Box<dyn ClientOsApi>, - _opts: CliArgs, - config: Config, - config_options: Options, - info: ClientInfo, - _layout: Option<LayoutFromYaml>, - actions: Vec<Action>, -) { - debug!("Starting fake Zellij client!"); - let session_name = info.get_session_name(); - - // TODO: Ideally the `fake_client` would not need to specify these options, - // but the `[NewTab:]` action depends on this state being - // even in this client. - let palette = config.themes.clone().map_or_else( - || os_input.load_palette(), - |t| { - t.theme_config(&config_options) - .unwrap_or_else(|| os_input.load_palette()) - }, - ); - - let full_screen_ws = os_input.get_terminal_size_using_fd(0); - let client_attributes = ClientAttributes { - size: full_screen_ws, - style: Style { - colors: palette, - rounded_corners: config.ui.unwrap_or_default().pane_frames.rounded_corners, - }, - keybinds: config.keybinds.clone(), - }; - - let first_msg = ClientToServerMsg::AttachClient(client_attributes, config_options.clone()); - - let zellij_ipc_pipe: PathBuf = { - let mut sock_dir = zellij_utils::consts::ZELLIJ_SOCK_DIR.clone(); - fs::create_dir_all(&sock_dir).unwrap(); - zellij_utils::shared::set_permissions(&sock_dir, 0o700).unwrap(); - sock_dir.push(session_name); - sock_dir - }; - os_input.connect_to_server(&*zellij_ipc_pipe); - os_input.send_to_server(first_msg); - - let mut command_is_executing = CommandIsExecuting::new(); - - let (send_client_instructions, receive_client_instructions): ChannelWithContext< - ClientInstruction, - > = channels::bounded(50); - let send_client_instructions = SenderWithContext::new(send_client_instructions); - - let (send_input_instructions, receive_input_instructions): ChannelWithContext< - InputInstruction, - > = channels::bounded(50); - let send_input_instructions = SenderWithContext::new(send_input_instructions); - - std::panic::set_hook({ - use zellij_utils::errors::handle_panic; - let send_client_instructions = send_client_instructions.clone(); - Box::new(move |info| { - handle_panic(info, &send_client_instructions); - }) - }); - - let stdin_ansi_parser = Arc::new(Mutex::new(StdinAnsiParser::new())); - let _stdin_thread = thread::Builder::new() - .name("stdin_handler".to_string()) - .spawn({ - let os_input = os_input.clone(); - let send_input_instructions = send_input_instructions.clone(); - move || stdin_loop(os_input, send_input_instructions, stdin_ansi_parser) - }); - - let clients: Vec<ClientId>; - os_input.send_to_server(ClientToServerMsg::ListClients); - #[allow(clippy::collapsible_match)] - loop { - if let Some((msg, _)) = os_input.recv_from_server() { - if let ServerToClientMsg::ActiveClients(active_clients) = msg { - clients = active_clients; - break; - } - } - } - debug!("The connected client id's are: {:?}.", clients); - - let _input_thread = thread::Builder::new() - .name("input_handler".to_string()) - .spawn({ - let send_client_instructions = send_client_instructions.clone(); - let command_is_executing = command_is_executing.clone(); - let os_input = os_input.clone(); - let default_mode = config_options.default_mode.unwrap_or_default(); - let session_name = session_name.to_string(); - move || { - input_actions( - os_input, - config, - config_options, - command_is_executing, - clients, - send_client_instructions, - default_mode, - receive_input_instructions, - actions, - session_name, - ) - } - }); - - let router_thread = thread::Builder::new() - .name("router".to_string()) - .spawn({ - let os_input = os_input.clone(); - let mut should_break = false; - move || loop { - if let Some((instruction, err_ctx)) = os_input.recv_from_server() { - err_ctx.update_thread_ctx(); - if let ServerToClientMsg::Exit(_) = instruction { - should_break = true; - } - send_client_instructions.send(instruction.into()).unwrap(); - if should_break { - break; - } - } - } - }) - .unwrap(); - - loop { - let (client_instruction, mut err_ctx) = receive_client_instructions - .recv() - .expect("failed to receive app instruction on channel"); - - err_ctx.add_call(ContextType::Client((&client_instruction).into())); - match client_instruction { - ClientInstruction::Exit(_) => { - os_input.send_to_server(ClientToServerMsg::ClientExited); - break; - }, - ClientInstruction::Error(_) => { - let _ = os_input.send_to_server(ClientToServerMsg::Action(Action::Quit, None)); - // handle_error(backtrace); - }, - ClientInstruction::Render(_) => { - // This is a fake client, that doesn't render, but - // dispatches actions. - }, - ClientInstruction::UnblockInputThread => { - command_is_executing.unblock_input_thread(); - }, - ClientInstruction::SwitchToMode(input_mode) => { - send_input_instructions - .send(InputInstruction::SwitchToMode(input_mode)) - .unwrap(); - }, - _ => {}, - } - } - router_thread.join().unwrap(); -} diff --git a/zellij-client/src/input_handler.rs b/zellij-client/src/input_handler.rs index bebf1ee7..076ab35d 100644 --- a/zellij-client/src/input_handler.rs +++ b/zellij-client/src/input_handler.rs @@ -11,7 +11,6 @@ use zellij_utils::{ actions::Action, cast_termwiz_key, config::Config, - keybinds::Keybinds, mouse::{MouseButton, MouseEvent}, options::Options, }, @@ -133,7 +132,9 @@ impl InputHandler { } fn handle_key(&mut self, key: &Key, raw_bytes: Vec<u8>) { let keybinds = &self.config.keybinds; - for action in Keybinds::key_to_actions(key, raw_bytes, &self.mode, keybinds) { + for action in + keybinds.get_actions_for_key_in_mode_or_default_action(&self.mode, key, raw_bytes) + { let should_exit = self.dispatch_action(action, None); if should_exit { self.should_exit = true; @@ -230,65 +231,6 @@ impl InputHandler { }, } } - fn handle_actions(&mut self, actions: Vec<Action>, session_name: &str, clients: Vec<ClientId>) { - let mut detached = false; - for action in actions { - match action { - Action::Quit => { - crate::sessions::kill_session(session_name); - break; - }, - Action::Detach => { - let first = clients.first().unwrap(); - let last = clients.last().unwrap(); - self.os_input - .send_to_server(ClientToServerMsg::DetachSession(vec![*first, *last])); - detached = true; - break; - }, - // Actions, that are independent from the specific client - // and not session idempotent should be specified here - Action::NewTab(_) - | Action::Run(_) - | Action::NewPane(_) - | Action::WriteChars(_) - | Action::EditScrollback - | Action::DumpScreen(_) - | Action::ToggleActiveSyncTab - | Action::ToggleFloatingPanes - | Action::TogglePaneEmbedOrFloating - | Action::TogglePaneFrames - | Action::ToggleFocusFullscreen - | Action::Write(_) => { - let client_id = clients.first().unwrap(); - log::debug!("Sending action to client: {}", client_id); - self.dispatch_action(action, Some(*client_id)); - }, - Action::CloseFocus | Action::CloseTab => { - let client_id = clients.first().unwrap(); - log::debug!("Sending action to client: {}", client_id); - log::warn!("Running this action from the focused pane, can lead to unexpected behaviour."); - self.dispatch_action(action, Some(*client_id)); - }, - _ => { - // FIXME: If a specific `session_id` is specified, - // then only send the actions to that specific `client_id` - for client_id in &clients { - self.dispatch_action(action.clone(), Some(*client_id)); - } - }, - } - } - self.dispatch_action(Action::Detach, None); - self.should_exit = true; - log::error!("Quitting Now. Dispatched the actions"); - if detached { - self.exit(ExitReason::NormalDetached); - } else { - self.exit(ExitReason::Normal); - } - } - /// Dispatches an [`Action`]. /// /// This function's body dictates what each [`Action`] actually does when @@ -329,7 +271,7 @@ impl InputHandler { | Action::Run(_) | Action::ToggleFloatingPanes | Action::TogglePaneEmbedOrFloating - | Action::NewTab(_) + | Action::NewTab(..) | Action::GoToNextTab | Action::GoToPreviousTab | Action::CloseTab @@ -381,29 +323,3 @@ pub(crate) fn input_loop( ) .handle_input(); } -/// Entry point to the module. Instantiates an [`InputHandler`] and starts -/// its [`InputHandler::handle_input()`] loop. -#[allow(clippy::too_many_arguments)] -pub(crate) fn input_actions( - os_input: Box<dyn ClientOsApi>, - config: Config, - options: Options, - command_is_executing: CommandIsExecuting, - clients: Vec<ClientId>, - send_client_instructions: SenderWithContext<ClientInstruction>, - default_mode: InputMode, - receive_input_instructions: Receiver<(InputInstruction, ErrorContext)>, - actions: Vec<Action>, - session_name: String, -) { - let _handler = InputHandler::new( - os_input, - command_is_executing, - config, - options, - send_client_instructions, - default_mode, - receive_input_instructions, - ) - .handle_actions(actions, &session_name, clients); -} diff --git a/zellij-client/src/lib.rs b/zellij-client/src/lib.rs index 9c5169cc..bac08715 100644 --- a/zellij-client/src/lib.rs +++ b/zellij-client/src/lib.rs @@ -1,9 +1,9 @@ pub mod os_input_output; +pub mod cli_client; mod command_is_executing; -pub mod fake_client; mod input_handler; -mod sessions; +pub mod old_config_converter; mod stdin_ansi_parser; mod stdin_handler; @@ -30,7 +30,7 @@ use zellij_utils::{ ipc::{ClientAttributes, ClientToServerMsg, ExitReason, ServerToClientMsg}, termwiz::input::InputEvent, }; -use zellij_utils::{cli::CliArgs, input::layout::LayoutFromYaml}; +use zellij_utils::{cli::CliArgs, input::layout::Layout}; /// Instructions related to the client-side application #[derive(Debug, Clone)] @@ -124,7 +124,7 @@ pub fn start_client( config: Config, config_options: Options, info: ClientInfo, - layout: Option<LayoutFromYaml>, + layout: Option<Layout>, ) { info!("Starting Zellij client!"); let clear_client_terminal_attributes = "\u{1b}[?1l\u{1b}=\u{1b}[r\u{1b}[?1000l\u{1b}[?1002l\u{1b}[?1003l\u{1b}[?1005l\u{1b}[?1006l\u{1b}[?12l"; @@ -143,20 +143,16 @@ pub fn start_client( envs::set_zellij("0".to_string()); config.env.set_vars(); - let palette = config.themes.clone().map_or_else( - || os_input.load_palette(), - |t| { - t.theme_config(&config_options) - .unwrap_or_else(|| os_input.load_palette()) - }, - ); + let palette = config + .theme_config(&config_options) + .unwrap_or_else(|| os_input.load_palette()); let full_screen_ws = os_input.get_terminal_size_using_fd(0); let client_attributes = ClientAttributes { size: full_screen_ws, style: Style { colors: palette, - rounded_corners: config.ui.unwrap_or_default().pane_frames.rounded_corners, + rounded_corners: config.ui.pane_frames.rounded_corners, }, keybinds: config.keybinds.clone(), }; diff --git a/zellij-client/src/old_config_converter/convert_old_yaml_files.rs b/zellij-client/src/old_config_converter/convert_old_yaml_files.rs new file mode 100644 index 00000000..0d5bf2e5 --- /dev/null +++ b/zellij-client/src/old_config_converter/convert_old_yaml_files.rs @@ -0,0 +1,332 @@ +use super::{config_yaml_to_config_kdl, layout_yaml_to_layout_kdl}; +use std::path::PathBuf; +use zellij_utils::{ + cli::CliArgs, + setup::{find_default_config_dir, get_layout_dir, get_theme_dir}, +}; + +const OLD_CONFIG_NAME: &str = "config.yaml"; + +pub fn convert_old_yaml_files(opts: &CliArgs) { + let config_dir = opts.config_dir.clone().or_else(find_default_config_dir); + let layout_dir = get_layout_dir(config_dir.clone()); + let theme_dir = get_theme_dir(find_default_config_dir()); + let specified_config_location = opts.config.as_ref(); + + let mut layout_files_to_convert = vec![]; + let mut theme_files_to_convert = vec![]; + if let Some(layout) = opts.layout.as_ref() { + if layout.extension().map(|s| s.to_string_lossy().to_string()) == Some("yaml".into()) { + if layout.exists() { + layout_files_to_convert.push((layout.clone(), true)); + } + } + } + layout_files_to_convert.dedup(); + if let Some(layout_dir) = layout_dir { + if let Ok(files) = std::fs::read_dir(layout_dir) { + for file in files { + if let Ok(file) = file { + if file + .path() + .extension() + .map(|s| s.to_string_lossy().to_string()) + == Some("yaml".into()) + { + let mut new_file_path = file.path().clone(); + new_file_path.set_extension("kdl"); + if !new_file_path.exists() { + layout_files_to_convert.push((file.path().clone(), false)); + } + } + } + } + } + } + + if let Some(theme_dir) = theme_dir { + if theme_dir.is_dir() { + if let Ok(files) = std::fs::read_dir(theme_dir) { + for entry in files.flatten() { + if let Some(extension) = entry.path().extension() { + if extension == "yaml" { + let mut new_file_path = entry.path().clone(); + new_file_path.set_extension("kdl"); + if !new_file_path.exists() { + theme_files_to_convert.push(entry.path()) + } + } + } + } + } + } + } + + if let Some(config_dir) = config_dir { + let yaml_config_location = specified_config_location.cloned().filter(|c| { + c.extension().map(|s| s.to_string_lossy().to_string()) == Some("yaml".into()) + }); + let specified_yaml_config_location = yaml_config_location.is_some(); + let config_location = + yaml_config_location.unwrap_or_else(|| config_dir.join(OLD_CONFIG_NAME)); + match convert_yaml( + config_location, + layout_files_to_convert, + theme_files_to_convert, + specified_yaml_config_location, + ) { + Ok(should_exit) => { + if should_exit { + std::process::exit(0); + } + }, + Err(e) => { + eprintln!(""); + eprintln!("\u{1b}[1;31mFailed to convert yaml config\u{1b}[m: {}", e); + eprintln!(""); + std::process::exit(1); + }, + } + } +} + +fn print_conversion_title_message() { + println!(""); + println!("\u{1b}[1mZellij has moved to a new configuration format (KDL - https://kdl.dev) and has now been run with an old YAML configuration/layout/theme file.\u{1b}[m"); +} + +fn print_converting_config_message(old_file_name: String, new_file_name: String) { + println!( + "- Converting configuration file: \u{1b}[1;36m{}\u{1b}[m to the new configuration format at the same location: \u{1b}[1;36m{}\u{1b}[m", + old_file_name, + new_file_name + ); +} + +fn print_conversion_layouts_message(layout_files_to_convert: Vec<(PathBuf, bool)>) { + println!("- Converting the following layout YAML files to KDL files in the same location:"); + for (layout_file, _was_explicitly_set) in layout_files_to_convert.iter() { + let mut new_layout_file_name = layout_file.clone(); + new_layout_file_name.set_extension("kdl"); + println!( + "\u{1b}[1;36m{}\u{1b}[m => \u{1b}[1;36m{}\u{1b}[m", + layout_file.as_path().as_os_str().to_string_lossy(), + new_layout_file_name.as_path().as_os_str().to_string_lossy() + ); + } +} + +fn print_conversion_themes_message(theme_files_to_convert: Vec<PathBuf>) { + println!("- Converting the following theme YAML files to KDL files in the same location:"); + for theme_file in theme_files_to_convert.iter() { + let mut new_theme_file_name = theme_file.clone(); + new_theme_file_name.set_extension("kdl"); + println!( + "\u{1b}[1;36m{}\u{1b}[m => \u{1b}[1;36m{}\u{1b}[m", + theme_file.as_path().as_os_str().to_string_lossy(), + new_theme_file_name.as_path().as_os_str().to_string_lossy() + ); + } +} + +fn print_no_actions_and_wait_for_user_input() -> Result<(), String> { + println!("\u{1b}[1;32mNo actions are required of you. Press ENTER to continue.\u{1b}[m"); + std::io::stdin() + .read_line(&mut String::new()) + .map_err(|e| format!("Failed to read from STDIN: {:?}", e))?; + Ok(()) +} + +fn print_remain_unmodified_message(will_exit: bool) { + println!("The original file(s) will remain unmodified."); + if !will_exit { + println!("Will then use the new converted file(s) for this and the next runs."); + } + println!(""); +} + +fn print_flag_help_message( + layout_files_to_convert: Vec<(PathBuf, bool)>, + yaml_config_file: &PathBuf, + yaml_config_was_explicitly_set: bool, +) -> Result<(), String> { + println!("\u{1b}[1;32mWhat do you need to do?\u{1b}[m"); + match layout_files_to_convert + .iter() + .find(|(_f, explicit)| *explicit) + { + Some((explicitly_specified_layout, _)) => { + let mut kdl_config_file_path = yaml_config_file.clone(); + let mut kdl_explicitly_specified_layout = explicitly_specified_layout.clone(); + kdl_config_file_path.set_extension("kdl"); + kdl_explicitly_specified_layout.set_extension("kdl"); + if yaml_config_was_explicitly_set { + println!("Since both the YAML config and a YAML layout file were explicitly specified, you'll need to re-run Zellij and point it to the new files:"); + println!( + "\u{1b}[1;33mzellij --config {} --layout {}\u{1b}[m", + kdl_config_file_path + .as_path() + .as_os_str() + .to_string_lossy() + .to_string(), + kdl_explicitly_specified_layout + .as_path() + .as_os_str() + .to_string_lossy() + .to_string(), + ); + } else { + println!("Since a YAML layout was explicitly specified, you'll need to re-run Zellij and point it to the new layout:"); + println!( + "\u{1b}[1;33mzellij --layout {}\u{1b}[m", + kdl_explicitly_specified_layout + .as_path() + .as_os_str() + .to_string_lossy() + .to_string(), + ); + } + }, + None => { + if yaml_config_was_explicitly_set { + let mut kdl_config_file_path = yaml_config_file.clone(); + kdl_config_file_path.set_extension("kdl"); + println!("Since the YAML config was explicitly specified, you'll need to re-run Zellij and point it to the new config:"); + println!( + "\u{1b}[1;33mzellij --config {}\u{1b}[m", + kdl_config_file_path + .as_path() + .as_os_str() + .to_string_lossy() + .to_string(), + ); + } + }, + } + println!(""); + println!("\u{1b}[1;32mPress ENTER to continue.\u{1b}[m"); + std::io::stdin() + .read_line(&mut String::new()) + .map_err(|e| format!("Failed to read from STDIN: {:?}", e))?; + Ok(()) +} + +fn convert_layouts(layout_files_to_convert: Vec<(PathBuf, bool)>) -> Result<(), String> { + for (layout_file, _was_explicitly_set) in layout_files_to_convert { + let raw_layout_file = std::fs::read_to_string(&layout_file) + .map_err(|e| format!("Failed to read layout file {:?}: {:?}", layout_file, e))?; + let kdl_layout = layout_yaml_to_layout_kdl(&raw_layout_file)?; + let mut new_layout_file = layout_file.clone(); + new_layout_file.set_extension("kdl"); + std::fs::write(&new_layout_file, kdl_layout).map_err(|e| { + format!( + "Failed to write new layout file to {:?}: {:?}", + new_layout_file, e + ) + })?; + } + Ok(()) +} + +fn convert_themes(theme_files_to_convert: Vec<PathBuf>) -> Result<(), String> { + for theme_file in theme_files_to_convert { + let raw_theme_file = std::fs::read_to_string(&theme_file) + .map_err(|e| format!("Failed to read theme file {:?}: {:?}", theme_file, e))?; + let kdl_theme = config_yaml_to_config_kdl(&raw_theme_file, true)?; + let mut new_theme_file = theme_file.clone(); + new_theme_file.set_extension("kdl"); + std::fs::write(&new_theme_file, kdl_theme).map_err(|e| { + format!( + "Failed to write new theme file to {:?}: {:?}", + new_theme_file, e + ) + })?; + } + Ok(()) +} + +fn convert_config(yaml_config_file: PathBuf, new_config_file: PathBuf) -> Result<(), String> { + if yaml_config_file.exists() && !new_config_file.exists() { + let raw_config_file = std::fs::read_to_string(&yaml_config_file) + .map_err(|e| format!("Failed to read config file {:?}: {:?}", yaml_config_file, e))?; + let kdl_config = config_yaml_to_config_kdl(&raw_config_file, false)?; + std::fs::write(&new_config_file, kdl_config).map_err(|e| { + format!( + "Failed to write new config file to {:?}: {:?}", + new_config_file, e + ) + })?; + } + Ok(()) +} + +fn convert_yaml( + yaml_config_file: PathBuf, + layout_files_to_convert: Vec<(PathBuf, bool)>, + theme_files_to_convert: Vec<PathBuf>, + yaml_config_was_explicitly_set: bool, +) -> Result<bool, String> { + let mut should_exit = false; + let mut new_config_file = yaml_config_file.clone(); + new_config_file.set_extension("kdl"); + let yaml_config_file_exists = yaml_config_file.exists(); + let layout_was_explicitly_set = layout_files_to_convert + .iter() + .find(|(_l, was_explicitly_set)| *was_explicitly_set) + .is_some(); + let new_config_file_exists = new_config_file.exists(); + let no_need_to_convert_config = + (new_config_file_exists && !yaml_config_was_explicitly_set) || !yaml_config_file_exists; + if no_need_to_convert_config + && layout_files_to_convert.is_empty() + && theme_files_to_convert.is_empty() + && !layout_was_explicitly_set + { + // Nothing to do... + return Ok(should_exit); + } + print_conversion_title_message(); + if yaml_config_file_exists && !new_config_file_exists { + print_converting_config_message( + yaml_config_file + .as_path() + .as_os_str() + .to_string_lossy() + .to_string(), + new_config_file + .as_path() + .as_os_str() + .to_string_lossy() + .to_string(), + ); + } else if yaml_config_file_exists && new_config_file_exists && yaml_config_was_explicitly_set { + return Err( + format!( + "Specified old YAML format config (--config {}) but a new KDL file exists in that location. To fix, point to it the new file instead: zellij --config {}", + yaml_config_file.as_path().as_os_str().to_string_lossy().to_string(), + new_config_file.as_path().as_os_str().to_string_lossy().to_string() + ) + ); + } + if !layout_files_to_convert.is_empty() { + print_conversion_layouts_message(layout_files_to_convert.clone()); + } + if !theme_files_to_convert.is_empty() { + print_conversion_themes_message(theme_files_to_convert.clone()); + } + print_remain_unmodified_message(layout_was_explicitly_set || yaml_config_was_explicitly_set); + if layout_was_explicitly_set || yaml_config_was_explicitly_set { + print_flag_help_message( + layout_files_to_convert.clone(), + &yaml_config_file, + yaml_config_was_explicitly_set, + )?; + should_exit = true; + } else { + print_no_actions_and_wait_for_user_input()?; + } + convert_layouts(layout_files_to_convert)?; + convert_themes(theme_files_to_convert)?; + convert_config(yaml_config_file, new_config_file)?; + Ok(should_exit) +} diff --git a/zellij-client/src/old_config_converter/mod.rs b/zellij-client/src/old_config_converter/mod.rs new file mode 100644 index 00000000..ac6d7676 --- /dev/null +++ b/zellij-client/src/old_config_converter/mod.rs @@ -0,0 +1,6 @@ +mod convert_old_yaml_files; +mod old_config; +mod old_layout; +pub use convert_old_yaml_files::convert_old_yaml_files; +pub use old_config::config_yaml_to_config_kdl; +pub use old_layout::layout_yaml_to_layout_kdl; diff --git a/zellij-client/src/old_config_converter/old_config.rs b/zellij-client/src/old_config_converter/old_config.rs new file mode 100644 index 00000000..73e098b7 --- /dev/null +++ b/zellij-client/src/old_config_converter/old_config.rs @@ -0,0 +1,1292 @@ +// This is a converter from the old yaml config to the new KDL config. +// +// It is supposed to be mostly self containing - please refrain from adding to it, importing +// from it or changing it +use std::fmt; +use std::path::PathBuf; + +use serde::de::{Error, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use std::collections::{BTreeMap, HashMap}; +use url::Url; + +const ON_FORCE_CLOSE_DESCRIPTION: &'static str = " +// Choose what to do when zellij receives SIGTERM, SIGINT, SIGQUIT or SIGHUP +// eg. when terminal window with an active zellij session is closed +// Options: +// - detach (Default) +// - quit +// +"; + +const SIMPLIFIED_UI_DESCRIPTION: &'static str = " +// Send a request for a simplified ui (without arrow fonts) to plugins +// Options: +// - true +// - false (Default) +// +"; + +const DEFAULT_SHELL_DESCRIPTION: &'static str = " +// Choose the path to the default shell that zellij will use for opening new panes +// Default: $SHELL +// +"; + +const PANE_FRAMES_DESCRIPTION: &'static str = " +// Toggle between having pane frames around the panes +// Options: +// - true (default) +// - false +// +"; + +const DEFAULT_THEME_DESCRIPTION: &'static str = " +// Choose the theme that is specified in the themes section. +// Default: default +// +"; + +const DEFAULT_MODE_DESCRIPTION: &'static str = " +// Choose the mode that zellij uses when starting up. +// Default: normal +// +"; + +const MOUSE_MODE_DESCRIPTION: &'static str = " +// Toggle enabling the mouse mode. +// On certain configurations, or terminals this could +// potentially interfere with copying text. +// Options: +// - true (default) +// - false +// +"; + +const SCROLL_BUFFER_SIZE_DESCRIPTION: &'static str = " +// Configure the scroll back buffer size +// This is the number of lines zellij stores for each pane in the scroll back +// buffer. Excess number of lines are discarded in a FIFO fashion. +// Valid values: positive integers +// Default value: 10000 +// +"; + +const COPY_COMMAND_DESCRIPTION: &'static str = " +// Provide a command to execute when copying text. The text will be piped to +// the stdin of the program to perform the copy. This can be used with +// terminal emulators which do not support the OSC 52 ANSI control sequence +// that will be used by default if this option is not set. +// Examples: +// +// copy_command \"xclip -selection clipboard\" // x11 +// copy_command \"wl-copy\" // wayland +// copy_command \"pbcopy\" // osx +"; + +const COPY_CLIPBOARD_DESCRIPTION: &'static str = " +// Choose the destination for copied text +// Allows using the primary selection buffer (on x11/wayland) instead of the system clipboard. +// Does not apply when using copy_command. +// Options: +// - system (default) +// - primary +// +"; + +const COPY_ON_SELECT_DESCRIPTION: &'static str = " +// Enable or disable automatic copy (and clear) of selection when releasing mouse +// Default: true +// +"; + +const SCROLLBACK_EDITOR_DESCRIPTION: &'static str = " +// Path to the default editor to use to edit pane scrollbuffer +// Default: $EDITOR or $VISUAL +// +"; + +const MIRROR_SESSION_DESCRIPTION: &'static str = " +// When attaching to an existing session with other users, +// should the session be mirrored (true) +// or should each user have their own cursor (false) +// Default: false +// +"; + +const DEFAULT_LAYOUT_DESCRIPTION: &'static str = " +// The name of the default layout to load on startup +// Default: \"default\" +// +"; + +const LAYOUT_DIR_DESCRIPTION: &'static str = " +// The folder in which Zellij will look for layouts +// +"; + +const THEME_DIR_DESCRIPTION: &'static str = " +// The folder in which Zellij will look for themes +// +"; + +fn options_yaml_to_options_kdl(options_yaml: &OldOptions, no_comments: bool) -> String { + let mut options_kdl = String::new(); + + macro_rules! push_option { + ($attribute_name:ident, $description_text:ident, $present_pattern:expr) => { + if !no_comments { + options_kdl.push_str($description_text); + } + if let Some($attribute_name) = &options_yaml.$attribute_name { + options_kdl.push_str(&format!($present_pattern, $attribute_name)); + options_kdl.push('\n'); + }; + }; + ($attribute_name:ident, $description_text:ident, $present_pattern:expr, $absent_pattern:expr) => { + if !no_comments { + options_kdl.push_str($description_text); + } + match &options_yaml.$attribute_name { + Some($attribute_name) => { + options_kdl.push_str(&format!($present_pattern, $attribute_name)); + }, + None => { + if !no_comments { + options_kdl.push_str(&format!($absent_pattern)); + } + }, + }; + if !no_comments || options_yaml.$attribute_name.is_some() { + options_kdl.push('\n'); + } + }; + } + + push_option!( + on_force_close, + ON_FORCE_CLOSE_DESCRIPTION, + "on_force_close \"{}\"", + "// on_force_close \"quit\"" + ); + push_option!( + simplified_ui, + SIMPLIFIED_UI_DESCRIPTION, + "simplified_ui {}", + "// simplified_ui true" + ); + push_option!( + default_shell, + DEFAULT_SHELL_DESCRIPTION, + "default_shell {:?}", + "// default_shell \"fish\"" + ); + push_option!( + pane_frames, + PANE_FRAMES_DESCRIPTION, + "pane_frames {}", + "// pane_frames true" + ); + push_option!( + theme, + DEFAULT_THEME_DESCRIPTION, + "theme {:?} ", + "// theme \"default\"" + ); + push_option!( + default_layout, + DEFAULT_LAYOUT_DESCRIPTION, + "default_layout {:?}", + "// default_layout \"compact\"" + ); + push_option!( + default_mode, + DEFAULT_MODE_DESCRIPTION, + "default_mode \"{}\"", + "// default_mode \"locked\"" + ); + push_option!( + mouse_mode, + MOUSE_MODE_DESCRIPTION, + "mouse_mode {}", + "// mouse_mode false" + ); + push_option!( + scroll_buffer_size, + SCROLL_BUFFER_SIZE_DESCRIPTION, + "scroll_buffer_size {}", + "// scroll_buffer_size 10000" + ); + push_option!(copy_command, COPY_COMMAND_DESCRIPTION, "copy_command {:?}"); + push_option!( + copy_clipboard, + COPY_CLIPBOARD_DESCRIPTION, + "copy_clipboard \"{}\"", + "// copy_clipboard \"primary\"" + ); + push_option!( + copy_on_select, + COPY_ON_SELECT_DESCRIPTION, + "copy_on_select {}", + "// copy_on_select false" + ); + push_option!( + scrollback_editor, + SCROLLBACK_EDITOR_DESCRIPTION, + "scrollback_editor {:?}", + "// scrollback_editor \"/usr/bin/vim\"" + ); + push_option!( + mirror_session, + MIRROR_SESSION_DESCRIPTION, + "mirror_session {}", + "// mirror_session true" + ); + push_option!( + layout_dir, + LAYOUT_DIR_DESCRIPTION, + "layout_dir {:?}", + "// layout_dir /path/to/my/layout_dir" + ); + push_option!( + theme_dir, + THEME_DIR_DESCRIPTION, + "theme_dir {:?}", + "// theme_dir \"/path/to/my/theme_dir\"" + ); + + options_kdl +} + +fn env_yaml_to_env_kdl(env_yaml: &OldEnvironmentVariablesFromYaml) -> String { + let mut env_kdl = String::new(); + let mut env_vars: Vec<(String, String)> = env_yaml + .env + .iter() + .map(|(name, val)| (name.clone(), val.clone())) + .collect(); + env_vars.sort_unstable(); + env_kdl.push_str("env {\n"); + for (name, val) in env_vars { + env_kdl.push_str(&format!(" {} \"{}\"\n", name, val)); + } + env_kdl.push_str("}\n"); + env_kdl +} + +fn plugins_yaml_to_plugins_kdl(plugins_yaml_to_plugins_kdl: &OldPluginsConfigFromYaml) -> String { + let mut plugins_kdl = String::new(); + if !&plugins_yaml_to_plugins_kdl.0.is_empty() { + plugins_kdl.push_str("\n"); + plugins_kdl.push_str("plugins {\n") + } + for plugin_config in &plugins_yaml_to_plugins_kdl.0 { + if plugin_config._allow_exec_host_cmd { + plugins_kdl.push_str(&format!( + " {} {{ path {:?}; _allow_exec_host_cmd true; }}\n", + plugin_config.tag.0, plugin_config.path + )); + } else { + plugins_kdl.push_str(&format!( + " {} {{ path {:?}; }}\n", + plugin_config.tag.0, plugin_config.path + )); + } + } + if !&plugins_yaml_to_plugins_kdl.0.is_empty() { + plugins_kdl.push_str("}\n") + } + plugins_kdl +} + +fn ui_config_yaml_to_ui_config_kdl(ui_config_yaml: &OldUiConfigFromYaml) -> String { + let mut kdl_ui_config = String::new(); + if ui_config_yaml.pane_frames.rounded_corners { + kdl_ui_config.push_str("\n"); + kdl_ui_config.push_str("ui {\n"); + kdl_ui_config.push_str(" pane_frames {\n"); + kdl_ui_config.push_str(" rounded_corners true\n"); + kdl_ui_config.push_str(" }\n"); + kdl_ui_config.push_str("}\n"); + } else { + // I'm not sure this is a thing, but since it's possible, why not? + kdl_ui_config.push_str("\n"); + kdl_ui_config.push_str("ui {\n"); + kdl_ui_config.push_str(" pane_frames {\n"); + kdl_ui_config.push_str(" rounded_corners false\n"); + kdl_ui_config.push_str(" }\n"); + kdl_ui_config.push_str("}\n"); + } + kdl_ui_config +} + +fn theme_config_yaml_to_theme_config_kdl( + theme_config_yaml: &OldThemesFromYamlIntermediate, +) -> String { + macro_rules! theme_color { + ($theme:ident, $color:ident, $color_name:expr, $kdl_theme_config:expr) => { + match $theme.palette.$color { + OldPaletteColorFromYaml::Rgb((r, g, b)) => { + $kdl_theme_config + .push_str(&format!(" {} {} {} {}\n", $color_name, r, g, b)); + }, + OldPaletteColorFromYaml::EightBit(eight_bit_color) => { + $kdl_theme_config + .push_str(&format!(" {} {}\n", $color_name, eight_bit_color)); + }, + OldPaletteColorFromYaml::Hex(OldHexColor(r, g, b)) => { + $kdl_theme_config + .push_str(&format!(" {} {} {} {}\n", $color_name, r, g, b)); + }, + } + }; + } + + let mut kdl_theme_config = String::new(); + if !theme_config_yaml.0.is_empty() { + kdl_theme_config.push_str("themes {\n") + } + let mut themes: Vec<(String, OldTheme)> = theme_config_yaml + .0 + .iter() + .map(|(theme_name, theme)| (theme_name.clone(), theme.clone())) + .collect(); + themes.sort_by(|a, b| a.0.partial_cmp(&b.0).unwrap()); + for (theme_name, theme) in themes { + kdl_theme_config.push_str(&format!(" {} {{\n", theme_name)); + theme_color!(theme, fg, "fg", kdl_theme_config); + theme_color!(theme, bg, "bg", kdl_theme_config); + theme_color!(theme, black, "black", kdl_theme_config); + theme_color!(theme, red, "red", kdl_theme_config); + theme_color!(theme, green, "green", kdl_theme_config); + theme_color!(theme, yellow, "yellow", kdl_theme_config); + theme_color!(theme, blue, "blue", kdl_theme_config); + theme_color!(theme, magenta, "magenta", kdl_theme_config); + theme_color!(theme, cyan, "cyan", kdl_theme_config); + theme_color!(theme, white, "white", kdl_theme_config); + theme_color!(theme, orange, "orange", kdl_theme_config); + kdl_theme_config.push_str(" }\n"); + } + if !theme_config_yaml.0.is_empty() { + kdl_theme_config.push_str("}\n") + } + kdl_theme_config +} + +fn keybinds_yaml_to_keybinds_kdl(keybinds_yaml: &OldKeybindsFromYaml) -> String { + let mut kdl_keybinds = String::new(); + let modes = vec![ + // mode sort order + OldInputMode::Normal, + OldInputMode::Locked, + OldInputMode::Pane, + OldInputMode::Tab, + OldInputMode::Resize, + OldInputMode::Move, + OldInputMode::Scroll, + OldInputMode::Session, + OldInputMode::Search, + OldInputMode::EnterSearch, + OldInputMode::RenameTab, + OldInputMode::RenamePane, + OldInputMode::Prompt, + OldInputMode::Tmux, + ]; + + // title and global unbinds / clear-defaults + match &keybinds_yaml.unbind { + OldUnbind::Keys(keys_to_unbind) => { + kdl_keybinds.push_str("keybinds {\n"); + let key_string: String = keys_to_unbind + .iter() + .map(|k| format!("\"{}\"", k)) + .collect::<Vec<String>>() + .join(" "); + kdl_keybinds.push_str(&format!(" unbind {}\n", key_string)); + }, + OldUnbind::All(should_unbind_all_defaults) => { + if *should_unbind_all_defaults { + kdl_keybinds.push_str("keybinds clear-defaults=true {\n"); + } else { + kdl_keybinds.push_str("keybinds {\n"); + } + }, + } + + for mode in modes { + if let Some(mode_keybinds) = keybinds_yaml.keybinds.get(&mode) { + let mut should_clear_mode_defaults = false; + let mut kdl_mode_keybinds = String::new(); + for key_action_unbind in mode_keybinds { + match key_action_unbind { + OldKeyActionUnbind::KeyAction(key_action) => { + let keys = &key_action.key; + let actions = &key_action.action; + let key_string: String = keys + .iter() + .map(|k| format!("\"{}\"", k)) + .collect::<Vec<String>>() + .join(" "); + let actions_string: String = actions + .iter() + .map(|a| format!("{};", a)) + .collect::<Vec<String>>() + .join(" "); + kdl_mode_keybinds.push_str(&format!( + " bind {} {{ {} }}\n", + key_string, actions_string + )); + }, + OldKeyActionUnbind::Unbind(unbind) => match &unbind.unbind { + OldUnbind::Keys(keys_to_unbind) => { + let key_string: String = keys_to_unbind + .iter() + .map(|k| format!("\"{}\"", k)) + .collect::<Vec<String>>() + .join(" "); + kdl_mode_keybinds.push_str(&format!(" unbind {}\n", key_string)); + }, + OldUnbind::All(unbind_all) => { + if *unbind_all { + should_clear_mode_defaults = true; + } + }, + }, + } + } + if should_clear_mode_defaults { + kdl_keybinds.push_str(&format!(" {} clear-defaults=true {{\n", mode)); + } else { + kdl_keybinds.push_str(&format!(" {} {{\n", mode)); + } + kdl_keybinds.push_str(&kdl_mode_keybinds); + kdl_keybinds.push_str(" }\n"); + } + } + kdl_keybinds.push_str("}\n"); + kdl_keybinds +} + +pub fn config_yaml_to_config_kdl( + raw_yaml_config: &str, + no_comments: bool, +) -> Result<String, String> { + // returns the raw kdl config + let config_from_yaml: OldConfigFromYaml = serde_yaml::from_str(raw_yaml_config) + .map_err(|e| format!("Failed to parse yaml: {:?}", e))?; + let mut kdl_config = String::new(); + if let Some(old_config_keybinds) = config_from_yaml.keybinds.as_ref() { + kdl_config.push_str(&keybinds_yaml_to_keybinds_kdl(old_config_keybinds)); + } + if let Some(old_config_options) = config_from_yaml.options.as_ref() { + kdl_config.push_str(&options_yaml_to_options_kdl( + old_config_options, + no_comments, + )); + } + if let Some(old_config_env_variables) = config_from_yaml.env.as_ref() { + kdl_config.push_str(&env_yaml_to_env_kdl(old_config_env_variables)); + } + kdl_config.push_str(&plugins_yaml_to_plugins_kdl(&config_from_yaml.plugins)); + if let Some(old_ui_config) = config_from_yaml.ui.as_ref() { + kdl_config.push_str(&ui_config_yaml_to_ui_config_kdl(old_ui_config)); + } + if let Some(old_themes_config) = config_from_yaml.themes.as_ref() { + kdl_config.push_str(&theme_config_yaml_to_theme_config_kdl(old_themes_config)); + } + Ok(kdl_config) +} + +#[derive(Clone, Default, Debug, Deserialize, Serialize, PartialEq)] +pub struct OldConfigFromYaml { + #[serde(flatten)] + pub options: Option<OldOptions>, + pub keybinds: Option<OldKeybindsFromYaml>, + pub themes: Option<OldThemesFromYamlIntermediate>, + #[serde(flatten)] + pub env: Option<OldEnvironmentVariablesFromYaml>, + #[serde(default)] + pub plugins: OldPluginsConfigFromYaml, + pub ui: Option<OldUiConfigFromYaml>, +} + +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +pub struct OldKeybindsFromYaml { + #[serde(flatten)] + keybinds: HashMap<OldInputMode, Vec<OldKeyActionUnbind>>, + #[serde(default)] + unbind: OldUnbind, +} + +#[derive(Clone, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)] +#[serde(untagged)] +enum OldUnbind { + // This is the correct order, don't rearrange! + // Suspected Bug in the untagged macro. + // 1. Keys + Keys(Vec<OldKey>), + // 2. All + All(bool), +} + +impl Default for OldUnbind { + fn default() -> OldUnbind { + OldUnbind::All(false) + } +} + +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +#[serde(untagged)] +enum OldKeyActionUnbind { + KeyAction(OldKeyActionFromYaml), + Unbind(OldUnbindFromYaml), +} + +/// Intermediate struct used for deserialisation +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +struct OldKeyActionFromYaml { + action: Vec<OldAction>, + key: Vec<OldKey>, +} + +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +struct OldUnbindFromYaml { + unbind: OldUnbind, +} + +/// Main configuration. +#[derive(Debug, Clone, PartialEq, Deserialize)] +struct OldConfig { + pub keybinds: OldKeybinds, + pub options: OldOptions, + pub themes: Option<OldThemesFromYamlIntermediate>, + pub plugins: OldPluginsConfig, + pub ui: Option<OldUiConfigFromYaml>, + pub env: OldEnvironmentVariablesFromYaml, +} + +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +struct OldKeybinds(HashMap<OldInputMode, OldModeKeybinds>); + +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +struct OldModeKeybinds(BTreeMap<OldKey, Vec<OldAction>>); + +#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)] +pub struct OldThemesFromYamlIntermediate(HashMap<String, OldTheme>); + +#[derive(Clone, Copy, Debug, Serialize, Deserialize, PartialEq, Eq, Hash, Default)] +struct OldPaletteFromYaml { + pub fg: OldPaletteColorFromYaml, + pub bg: OldPaletteColorFromYaml, + pub black: OldPaletteColorFromYaml, + pub red: OldPaletteColorFromYaml, + pub green: OldPaletteColorFromYaml, + pub yellow: OldPaletteColorFromYaml, + pub blue: OldPaletteColorFromYaml, + pub magenta: OldPaletteColorFromYaml, + pub cyan: OldPaletteColorFromYaml, + pub white: OldPaletteColorFromYaml, + pub orange: OldPaletteColorFromYaml, +} + +/// Intermediate deserialization enum +// This is here in order to make the untagged enum work +#[derive(Clone, Copy, Debug, Serialize, Deserialize, PartialEq, Eq, Hash)] +#[serde(untagged)] +enum OldPaletteColorFromYaml { + Rgb((u8, u8, u8)), + EightBit(u8), + Hex(OldHexColor), +} + +impl From<OldHexColor> for (u8, u8, u8) { + fn from(e: OldHexColor) -> (u8, u8, u8) { + let OldHexColor(r, g, b) = e; + (r, g, b) + } +} + +struct OldHexColorVisitor(); + +impl<'de> Visitor<'de> for OldHexColorVisitor { + type Value = OldHexColor; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + write!(formatter, "a hex color in the format #RGB or #RRGGBB") + } + + fn visit_str<E>(self, s: &str) -> Result<Self::Value, E> + where + E: Error, + { + if let Some(stripped) = s.strip_prefix('#') { + return self.visit_str(stripped); + } + + if s.len() == 3 { + Ok(OldHexColor( + u8::from_str_radix(&s[0..1], 16).map_err(E::custom)? * 0x11, + u8::from_str_radix(&s[1..2], 16).map_err(E::custom)? * 0x11, + u8::from_str_radix(&s[2..3], 16).map_err(E::custom)? * 0x11, + )) + } else if s.len() == 6 { + Ok(OldHexColor( + u8::from_str_radix(&s[0..2], 16).map_err(E::custom)?, + u8::from_str_radix(&s[2..4], 16).map_err(E::custom)?, + u8::from_str_radix(&s[4..6], 16).map_err(E::custom)?, + )) + } else { + Err(Error::custom( + "Hex color must be of form \"#RGB\" or \"#RRGGBB\"", + )) + } + } +} + +impl<'de> Deserialize<'de> for OldHexColor { + fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> + where + D: Deserializer<'de>, + { + deserializer.deserialize_str(OldHexColorVisitor()) + } +} + +impl Default for OldPaletteColorFromYaml { + fn default() -> Self { + OldPaletteColorFromYaml::EightBit(0) + } +} + +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize)] +struct OldHexColor(u8, u8, u8); + +#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)] +struct OldTheme { + #[serde(flatten)] + palette: OldPaletteFromYaml, +} + +#[derive(Debug, Default, Clone, Copy, PartialEq, Deserialize, Serialize)] +pub struct OldUiConfigFromYaml { + pub pane_frames: OldFrameConfigFromYaml, +} + +#[derive(Debug, Default, Clone, Copy, PartialEq, Deserialize, Serialize)] +pub struct OldFrameConfigFromYaml { + pub rounded_corners: bool, +} + +#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] +pub struct OldEnvironmentVariablesFromYaml { + env: HashMap<String, String>, +} + +#[derive(Clone, Debug, Default, PartialEq, Deserialize, Serialize)] +pub struct OldPluginsConfigFromYaml(Vec<OldPluginConfigFromYaml>); + +#[derive(Clone, Debug, Default, PartialEq, Deserialize, Serialize)] +struct OldPluginConfigFromYaml { + pub path: PathBuf, + pub tag: OldPluginTag, + #[serde(default)] + pub run: OldPluginTypeFromYaml, + #[serde(default)] + pub config: serde_yaml::Value, + #[serde(default)] + pub _allow_exec_host_cmd: bool, +} + +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +#[serde(rename_all = "kebab-case")] +enum OldPluginTypeFromYaml { + Headless, + Pane, +} + +impl Default for OldPluginTypeFromYaml { + fn default() -> Self { + Self::Pane + } +} + +/// Tag used to identify the plugin in layout and config yaml files +#[derive(Debug, Default, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)] +struct OldPluginTag(String); + +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +struct OldPluginsConfig(HashMap<OldPluginTag, OldPluginConfig>); + +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +struct OldPluginConfig { + /// Path of the plugin, see resolve_wasm_bytes for resolution semantics + pub path: PathBuf, + /// Plugin type + pub run: OldPluginType, + /// Allow command execution from plugin + pub _allow_exec_host_cmd: bool, + /// Original location of the + pub location: OldRunPluginLocation, +} + +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)] +enum OldRunPluginLocation { + File(PathBuf), + Zellij(OldPluginTag), +} + +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +#[serde(rename_all = "kebab-case")] +enum OldPluginType { + /// Starts immediately when Zellij is started and runs without a visible pane + Headless, + /// Runs once per pane declared inside a layout file + Pane(Option<usize>), // tab_index +} + +#[derive(Copy, Clone, Debug, PartialEq, Deserialize, Serialize)] +pub enum OldOnForceClose { + #[serde(alias = "quit")] + Quit, + #[serde(alias = "detach")] + Detach, +} + +impl std::fmt::Display for OldOnForceClose { + fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> { + match self { + Self::Quit => write!(f, "quit"), + Self::Detach => write!(f, "detach"), + } + } +} + +impl Default for OldOnForceClose { + fn default() -> Self { + Self::Detach + } +} + +#[derive(Deserialize, Serialize, Debug, Clone, Copy, PartialEq)] +pub enum OldClipboard { + #[serde(alias = "system")] + System, + #[serde(alias = "primary")] + Primary, +} + +impl std::fmt::Display for OldClipboard { + fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> { + match self { + Self::System => write!(f, "system"), + Self::Primary => write!(f, "primary"), + } + } +} + +impl Default for OldClipboard { + fn default() -> Self { + Self::System + } +} + +#[derive(Clone, Default, Debug, PartialEq, Deserialize, Serialize)] +pub struct OldOptions { + #[serde(default)] + pub simplified_ui: Option<bool>, + pub theme: Option<String>, + pub default_mode: Option<OldInputMode>, + pub default_shell: Option<PathBuf>, + pub default_layout: Option<PathBuf>, + pub layout_dir: Option<PathBuf>, + pub theme_dir: Option<PathBuf>, + #[serde(default)] + pub mouse_mode: Option<bool>, + #[serde(default)] + pub pane_frames: Option<bool>, + #[serde(default)] + pub mirror_session: Option<bool>, + pub on_force_close: Option<OldOnForceClose>, + pub scroll_buffer_size: Option<usize>, + #[serde(default)] + pub copy_command: Option<String>, + #[serde(default)] + pub copy_clipboard: Option<OldClipboard>, + #[serde(default)] + pub copy_on_select: Option<bool>, + pub scrollback_editor: Option<PathBuf>, +} + +/// Describes the different input modes, which change the way that keystrokes will be interpreted. +#[derive(Debug, PartialEq, Eq, Hash, Copy, Clone, Serialize, Deserialize)] +pub enum OldInputMode { + /// In `Normal` mode, input is always written to the terminal, except for the shortcuts leading + /// to other modes + #[serde(alias = "normal")] + Normal, + /// In `Locked` mode, input is always written to the terminal and all shortcuts are disabled + /// except the one leading back to normal mode + #[serde(alias = "locked")] + Locked, + /// `Resize` mode allows resizing the different existing panes. + #[serde(alias = "resize")] + Resize, + /// `Pane` mode allows creating and closing panes, as well as moving between them. + #[serde(alias = "pane")] + Pane, + /// `Tab` mode allows creating and closing tabs, as well as moving between them. + #[serde(alias = "tab")] + Tab, + /// `Scroll` mode allows scrolling up and down within a pane. + #[serde(alias = "scroll")] + Scroll, + /// `EnterSearch` mode allows for typing in the needle for a search in the scroll buffer of a pane. + #[serde(alias = "entersearch")] + EnterSearch, + /// `Search` mode allows for searching a term in a pane (superset of `Scroll`). + #[serde(alias = "search")] + Search, + /// `RenameTab` mode allows assigning a new name to a tab. + #[serde(alias = "renametab")] + RenameTab, + /// `RenamePane` mode allows assigning a new name to a pane. + #[serde(alias = "renamepane")] + RenamePane, + /// `Session` mode allows detaching sessions + #[serde(alias = "session")] + Session, + /// `Move` mode allows moving the different existing panes within a tab + #[serde(alias = "move")] + Move, + /// `Prompt` mode allows interacting with active prompts. + #[serde(alias = "prompt")] + Prompt, + /// `Tmux` mode allows for basic tmux keybindings functionality + #[serde(alias = "tmux")] + Tmux, +} + +impl std::fmt::Display for OldInputMode { + fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> { + match self { + Self::Normal => write!(f, "normal"), + Self::Locked => write!(f, "locked"), + Self::Resize => write!(f, "resize"), + Self::Pane => write!(f, "pane"), + Self::Tab => write!(f, "tab"), + Self::Scroll => write!(f, "scroll"), + Self::EnterSearch => write!(f, "entersearch"), + Self::Search => write!(f, "search"), + Self::RenameTab => write!(f, "RenameTab"), + Self::RenamePane => write!(f, "RenamePane"), + Self::Session => write!(f, "session"), + Self::Move => write!(f, "move"), + Self::Prompt => write!(f, "prompt"), + Self::Tmux => write!(f, "tmux"), + } + } +} + +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, PartialOrd, Ord)] +enum OldKey { + PageDown, + PageUp, + Left, + Down, + Up, + Right, + Home, + End, + Backspace, + Delete, + Insert, + F(u8), + Char(char), + Alt(OldCharOrArrow), + Ctrl(char), + BackTab, + Null, + Esc, +} + +impl std::fmt::Display for OldKey { + fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> { + match self { + Self::PageDown => write!(f, "PageDown"), + Self::PageUp => write!(f, "PageUp"), + Self::Left => write!(f, "Left"), + Self::Down => write!(f, "Down"), + Self::Up => write!(f, "Up"), + Self::Right => write!(f, "Right"), + Self::Home => write!(f, "Home"), + Self::End => write!(f, "End"), + Self::Backspace => write!(f, "Backspace"), + Self::Delete => write!(f, "Delete"), + Self::Insert => write!(f, "Insert"), + Self::F(index) => write!(f, "F{}", index), + Self::Char(c) => match c { + '\n' => write!(f, "Enter"), + '\t' => write!(f, "Tab"), + '\"' => write!(f, "\\\""), // make sure it is escaped because otherwise it will be + // seen as a KDL string starter/terminator + ' ' => write!(f, "Space"), + _ => write!(f, "{}", c), + }, + Self::Alt(char_or_arrow) => match char_or_arrow { + OldCharOrArrow::Char(c) => write!(f, "Alt {}", c), + OldCharOrArrow::Direction(direction) => match direction { + OldDirection::Left => write!(f, "Alt Left"), + OldDirection::Right => write!(f, "Alt Right"), + OldDirection::Up => write!(f, "Alt Up"), + OldDirection::Down => write!(f, "Alt Down"), + }, + }, + Self::Ctrl(c) => write!(f, "Ctrl {}", c), + Self::BackTab => write!(f, "Tab"), + Self::Null => write!(f, "Null"), + Self::Esc => write!(f, "Esc"), + } + } +} + +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, PartialOrd, Ord)] +#[serde(untagged)] +enum OldCharOrArrow { + Char(char), + Direction(OldDirection), +} + +/// The four directions (left, right, up, down). +#[derive(Eq, Clone, Copy, Debug, PartialEq, Hash, Deserialize, Serialize, PartialOrd, Ord)] +enum OldDirection { + Left, + Right, + Up, + Down, +} + +impl std::fmt::Display for OldDirection { + fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> { + match self { + Self::Left => write!(f, "Left"), + Self::Right => write!(f, "Right"), + Self::Up => write!(f, "Up"), + Self::Down => write!(f, "Down"), + } + } +} + +impl Default for OldDirection { + fn default() -> Self { + OldDirection::Left + } +} + +#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] +enum OldAction { + Quit, + Write(Vec<u8>), + WriteChars(String), + SwitchToMode(OldInputMode), + Resize(OldResizeDirection), + FocusNextPane, + FocusPreviousPane, + SwitchFocus, + MoveFocus(OldDirection), + MoveFocusOrTab(OldDirection), + MovePane(Option<OldDirection>), + DumpScreen(String), + EditScrollback, + ScrollUp, + ScrollUpAt(OldPosition), + ScrollDown, + ScrollDownAt(OldPosition), + ScrollToBottom, + PageScrollUp, + PageScrollDown, + HalfPageScrollUp, + HalfPageScrollDown, + ToggleFocusFullscreen, + TogglePaneFrames, + ToggleActiveSyncTab, + NewPane(Option<OldDirection>), + TogglePaneEmbedOrFloating, + ToggleFloatingPanes, + CloseFocus, + PaneNameInput(Vec<u8>), + UndoRenamePane, + NewTab(Option<OldTabLayout>), + NoOp, + GoToNextTab, + GoToPreviousTab, + CloseTab, + GoToTab(u32), + ToggleTab, + TabNameInput(Vec<u8>), + UndoRenameTab, + Run(OldRunCommandAction), + Detach, + LeftClick(OldPosition), + RightClick(OldPosition), + MiddleClick(OldPosition), + LeftMouseRelease(OldPosition), + RightMouseRelease(OldPosition), + MiddleMouseRelease(OldPosition), + MouseHoldLeft(OldPosition), + MouseHoldRight(OldPosition), + MouseHoldMiddle(OldPosition), + Copy, + Confirm, + Deny, + SkipConfirm(Box<OldAction>), + SearchInput(Vec<u8>), + Search(OldSearchDirection), + SearchToggleOption(OldSearchOption), +} + +impl std::fmt::Display for OldAction { + fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> { + match self { + Self::Quit => write!(f, "Quit"), + Self::Write(bytes) => write!( + f, + "Write {}", + bytes + .iter() + .map(|c| format!("{}", *c)) + .collect::<Vec<String>>() + .join(" ") + ), + Self::WriteChars(chars) => write!(f, "WriteChars \"{}\"", chars), + Self::SwitchToMode(input_mode) => write!(f, "SwitchToMode \"{}\"", input_mode), + Self::Resize(resize_direction) => write!(f, "Resize \"{}\"", resize_direction), + Self::FocusNextPane => write!(f, "FocusNextPane"), + Self::FocusPreviousPane => write!(f, "FocusPreviousPane"), + Self::SwitchFocus => write!(f, "SwitchFocus"), + Self::MoveFocus(direction) => write!(f, "MoveFocus \"{}\"", direction), + Self::MoveFocusOrTab(direction) => write!(f, "MoveFocusOrTab \"{}\"", direction), + Self::MovePane(direction) => match direction { + Some(direction) => write!(f, "MovePane \"{}\"", direction), + None => write!(f, "MovePane"), + }, + Self::DumpScreen(file) => write!(f, "DumpScreen \"{}\"", file), + Self::EditScrollback => write!(f, "EditScrollback"), + Self::ScrollUp => write!(f, "ScrollUp"), + Self::ScrollDown => write!(f, "ScrollDown"), + Self::ScrollToBottom => write!(f, "ScrollToBottom"), + Self::PageScrollUp => write!(f, "PageScrollUp"), + Self::PageScrollDown => write!(f, "PageScrollDown"), + Self::HalfPageScrollUp => write!(f, "HalfPageScrollUp"), + Self::HalfPageScrollDown => write!(f, "HalfPageScrollDown"), + Self::ToggleFocusFullscreen => write!(f, "ToggleFocusFullscreen"), + Self::TogglePaneFrames => write!(f, "TogglePaneFrames"), + Self::ToggleActiveSyncTab => write!(f, "ToggleActiveSyncTab"), + Self::NewPane(direction) => match direction { + Some(direction) => write!(f, "NewPane \"{}\"", direction), + None => write!(f, "NewPane"), + }, + Self::TogglePaneEmbedOrFloating => write!(f, "TogglePaneEmbedOrFloating"), + Self::ToggleFloatingPanes => write!(f, "ToggleFloatingPanes"), + Self::CloseFocus => write!(f, "CloseFocus"), + Self::PaneNameInput(bytes) => write!( + f, + "PaneNameInput {}", + bytes + .iter() + .map(|c| format!("{}", *c)) + .collect::<Vec<String>>() + .join(" ") + ), + Self::UndoRenamePane => write!(f, "UndoRenamePane"), + Self::NewTab(_) => write!(f, "NewTab"), + Self::NoOp => write!(f, "NoOp"), + Self::GoToNextTab => write!(f, "GoToNextTab"), + Self::GoToPreviousTab => write!(f, "GoToPreviousTab"), + Self::CloseTab => write!(f, "CloseTab"), + Self::GoToTab(index) => write!(f, "GoToTab {}", index), + Self::ToggleTab => write!(f, "ToggleTab"), + // Self::TabNameInput(bytes) => write!(f, "TabNameInput {}", format!("{}", bytes.iter().map(|c| format!("{}", *c)).collect::<Vec<String>>().join(" "))), + Self::TabNameInput(bytes) => write!( + f, + "TabNameInput {}", + bytes + .iter() + .map(|c| format!("{}", *c)) + .collect::<Vec<String>>() + .join(" ") + ), + Self::UndoRenameTab => write!(f, "UndoRenameTab"), + Self::Run(run_command_action) => { + let mut run_block_serialized = format!("Run {:?}", run_command_action.command); + for arg in &run_command_action.args { + run_block_serialized.push_str(&format!(" \"{}\"", arg)); + } + match (&run_command_action.cwd, run_command_action.direction) { + (Some(cwd), Some(direction)) => { + run_block_serialized.push_str(&format!( + "{{ cwd {:?}; direction \"{}\"; }}", + cwd, direction + )); + }, + (None, Some(direction)) => { + run_block_serialized + .push_str(&format!("{{ direction \"{}\"; }}", direction)); + }, + (Some(cwd), None) => { + run_block_serialized.push_str(&format!("{{ cwd {:?}; }}", cwd)); + }, + (None, None) => {}, + } + write!(f, "{}", run_block_serialized) + }, + Self::Detach => write!(f, "Detach"), + Self::Copy => write!(f, "Copy"), + Self::Confirm => write!(f, "Confirm"), + Self::Deny => write!(f, "Deny"), + Self::SearchInput(bytes) => write!( + f, + "SearchInput {}", + bytes + .iter() + .map(|c| format!("{}", *c)) + .collect::<Vec<String>>() + .join(" ") + ), + Self::Search(direction) => write!(f, "Search \"{}\"", direction), + Self::SearchToggleOption(option) => write!(f, "SearchToggleOption \"{}\"", option), + _ => Err(std::fmt::Error), + } + } +} + +#[derive(Clone, Copy, Debug, PartialEq, Eq, Deserialize, Serialize)] +enum OldSearchDirection { + Down, + Up, +} + +impl std::fmt::Display for OldSearchDirection { + fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> { + match self { + Self::Down => write!(f, "Down"), + Self::Up => write!(f, "Up"), + } + } +} + +#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] +enum OldSearchOption { + CaseSensitivity, + WholeWord, + Wrap, +} + +impl std::fmt::Display for OldSearchOption { + fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> { + match self { + Self::CaseSensitivity => write!(f, "CaseSensitivity"), + Self::WholeWord => write!(f, "WholeWord"), + Self::Wrap => write!(f, "Wrap"), + } + } +} + +#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] +enum OldResizeDirection { + Left, + Right, + Up, + Down, + Increase, + Decrease, +} + +impl std::fmt::Display for OldResizeDirection { + fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> { + match self { + Self::Left => write!(f, "Left"), + Self::Right => write!(f, "Right"), + Self::Up => write!(f, "Up"), + Self::Down => write!(f, "Down"), + Self::Increase => write!(f, "Increase"), + Self::Decrease => write!(f, "Decrease"), + } + } +} + +#[derive(Debug, Hash, Copy, Clone, PartialEq, Eq, PartialOrd, Deserialize, Serialize)] +struct OldPosition { + pub line: OldLine, + pub column: OldColumn, +} + +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Deserialize, Serialize, PartialOrd)] +struct OldLine(pub isize); +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Deserialize, Serialize, PartialOrd)] +struct OldColumn(pub usize); + +#[derive(Clone, Debug, Deserialize, Default, Serialize, PartialEq, Eq)] +struct OldRunCommandAction { + #[serde(rename = "cmd")] + pub command: PathBuf, + #[serde(default)] + pub args: Vec<String>, + #[serde(default)] + pub cwd: Option<PathBuf>, + #[serde(default)] + pub direction: Option<OldDirection>, +} + +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)] +struct OldTabLayout { + #[serde(default)] + pub direction: OldDirection, + pub pane_name: Option<String>, + #[serde(default)] + pub borderless: bool, + #[serde(default)] + pub parts: Vec<OldTabLayout>, + pub split_size: Option<OldSplitSize>, + #[serde(default)] + pub name: String, + pub focus: Option<bool>, + pub run: Option<OldRunFromYaml>, +} + +#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq)] +enum OldSplitSize { + #[serde(alias = "percent")] + Percent(u64), // 1 to 100 + #[serde(alias = "fixed")] + Fixed(usize), // An absolute number of columns or rows +} + +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)] +enum OldRunFromYaml { + #[serde(rename = "plugin")] + Plugin(OldRunPluginFromYaml), + #[serde(rename = "command")] + Command(OldRunCommand), +} + +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)] +struct OldRunPluginFromYaml { + #[serde(default)] + pub _allow_exec_host_cmd: bool, + pub location: Url, +} + +#[derive(Clone, Debug, Deserialize, Default, Serialize, PartialEq, Eq)] +pub struct OldRunCommand { + #[serde(alias = "cmd")] + pub command: PathBuf, + #[serde(default)] + pub args: Vec<String>, + #[serde(default)] + pub cwd: Option<PathBuf>, +} + +// The unit test location. +#[path = "./unit/convert_config_tests.rs"] +#[cfg(test)] +mod convert_config_test; diff --git a/zellij-client/src/old_config_converter/old_layout.rs b/zellij-client/src/old_config_converter/old_layout.rs new file mode 100644 index 00000000..cd1aa66f --- /dev/null +++ b/zellij-client/src/old_config_converter/old_layout.rs @@ -0,0 +1,557 @@ +// This is a converter from the old yaml layout to the new KDL layout. +// +// It is supposed to be mostly self containing - please refrain from adding to it, importing +// from it or changing it +use super::old_config::{config_yaml_to_config_kdl, OldConfigFromYaml, OldRunCommand}; +use serde::{Deserialize, Serialize}; +use std::vec::Vec; +use std::{fmt, path::PathBuf}; +use url::Url; + +fn pane_line( + pane_name: Option<&String>, + split_size: Option<OldSplitSize>, + focus: Option<bool>, + borderless: bool, +) -> String { + let mut pane_line = format!("pane"); + if let Some(pane_name) = pane_name { + pane_line.push_str(&format!(" name=\"{}\"", pane_name)); + } + if let Some(split_size) = split_size { + pane_line.push_str(&format!(" size={}", split_size)); + } + if let Some(focus) = focus { + pane_line.push_str(&format!(" focus={}", focus)); + } + if borderless { + pane_line.push_str(" borderless=true"); + } + pane_line +} + +fn tab_line( + pane_name: Option<&String>, + split_size: Option<OldSplitSize>, + focus: Option<bool>, + borderless: bool, +) -> String { + let mut pane_line = format!("tab"); + if let Some(pane_name) = pane_name { + pane_line.push_str(&format!(" name=\"{}\"", pane_name)); + } + if let Some(split_size) = split_size { + pane_line.push_str(&format!(" size={}", split_size)); + } + if let Some(focus) = focus { + pane_line.push_str(&format!(" focus={}", focus)); + } + if borderless { + pane_line.push_str(" borderless=true"); + } + pane_line +} + +fn pane_line_with_children( + pane_name: Option<&String>, + split_size: Option<OldSplitSize>, + focus: Option<bool>, + borderless: bool, + split_direction: OldDirection, +) -> String { + let mut pane_line = format!("pane"); + if let Some(pane_name) = pane_name { + pane_line.push_str(&format!(" name=\"{}\"", pane_name)); + } + if let Some(split_size) = split_size { + pane_line.push_str(&format!(" size={}", split_size)); + } + if let Some(focus) = focus { + pane_line.push_str(&format!(" focus={}", focus)); + } + pane_line.push_str(&format!(" split_direction=\"{}\"", split_direction)); + if borderless { + pane_line.push_str(" borderless=true"); + } + pane_line +} + +fn pane_command_line( + pane_name: Option<&String>, + split_size: Option<OldSplitSize>, + focus: Option<bool>, + borderless: bool, + command: &PathBuf, +) -> String { + let mut pane_line = format!("pane command={:?}", command); + if let Some(pane_name) = pane_name { + pane_line.push_str(&format!(" name=\"{}\"", pane_name)); + } + if let Some(split_size) = split_size { + pane_line.push_str(&format!(" size={}", split_size)); + } + if let Some(focus) = focus { + pane_line.push_str(&format!(" focus={}", focus)); + } + if borderless { + pane_line.push_str(" borderless=true"); + } + pane_line +} + +fn tab_line_with_children( + pane_name: Option<&String>, + split_size: Option<OldSplitSize>, + focus: Option<bool>, + borderless: bool, + split_direction: OldDirection, +) -> String { + let mut pane_line = format!("tab"); + if let Some(pane_name) = pane_name { + pane_line.push_str(&format!(" name=\"{}\"", pane_name)); + } + if let Some(split_size) = split_size { + pane_line.push_str(&format!(" size={}", split_size)); + } + if let Some(focus) = focus { + pane_line.push_str(&format!(" focus={}", focus)); + } + pane_line.push_str(&format!(" split_direction=\"{}\"", split_direction)); + if borderless { + pane_line.push_str(" borderless=true"); + } + pane_line +} + +fn stringify_template( + template: &OldLayoutTemplate, + indentation: String, + has_no_tabs: bool, + is_base: bool, +) -> String { + let mut stringified = if is_base { + String::new() + } else { + String::from("\n") + }; + if is_base && !template.parts.is_empty() && template.direction == OldDirection::Vertical { + // we don't support specifying the split direction in the layout node + // eg. layout split_direction="Vertical" { .. } <== this is not supported!! + // so we need to add a child wrapper with the split direction instead: + // layout { + // pane split_direction="Vertical" { .. } + // } + let child_indentation = format!("{} ", &indentation); + stringified.push_str(&stringify_template( + template, + child_indentation, + has_no_tabs, + false, + )); + } else if !template.parts.is_empty() { + if !is_base { + stringified.push_str(&format!( + "{}{} {{", + indentation, + pane_line_with_children( + template.pane_name.as_ref(), + template.split_size, + template.focus, + template.borderless, + template.direction + ) + )); + } + for part in &template.parts { + let child_indentation = format!("{} ", &indentation); + stringified.push_str(&stringify_template( + &part, + child_indentation, + has_no_tabs, + false, + )); + } + if !is_base { + stringified.push_str(&format!("\n{}}}", indentation)); + } + } else if template.body && !has_no_tabs { + stringified.push_str(&format!("{}children", indentation)); + } else { + match template.run.as_ref() { + Some(OldRunFromYaml::Plugin(plugin_from_yaml)) => { + stringified.push_str(&format!( + "{}{} {{\n", + &indentation, + pane_line( + template.pane_name.as_ref(), + template.split_size, + template.focus, + template.borderless + ) + )); + stringified.push_str(&format!( + "{} plugin location=\"{}\"\n", + &indentation, plugin_from_yaml.location + )); + stringified.push_str(&format!("{}}}", &indentation)); + }, + Some(OldRunFromYaml::Command(command_from_yaml)) => { + stringified.push_str(&format!( + "{}{}", + &indentation, + &pane_command_line( + template.pane_name.as_ref(), + template.split_size, + template.focus, + template.borderless, + &command_from_yaml.command + ) + )); + if let Some(cwd) = command_from_yaml.cwd.as_ref() { + stringified.push_str(&format!(" cwd={:?}", cwd)); + } + if !command_from_yaml.args.is_empty() { + stringified.push_str(" {\n"); + stringified.push_str(&format!( + "{} args {}\n", + &indentation, + command_from_yaml + .args + .iter() + .map(|s| format!("\"{}\"", s)) + .collect::<Vec<String>>() + .join(" ") + )); + stringified.push_str(&format!("{}}}", &indentation)); + } + }, + None => { + stringified.push_str(&format!( + "{}{}", + &indentation, + pane_line( + template.pane_name.as_ref(), + template.split_size, + template.focus, + template.borderless + ) + )); + }, + }; + } + stringified +} + +fn stringify_tabs(tabs: Vec<OldTabLayout>) -> String { + let mut stringified = String::new(); + for tab in tabs { + let child_indentation = String::from(" "); + if !tab.parts.is_empty() { + stringified.push_str(&format!( + "\n{}{} {{", + child_indentation, + tab_line_with_children( + tab.pane_name.as_ref(), + tab.split_size, + tab.focus, + tab.borderless, + tab.direction + ) + )); + let tab_template = OldLayoutTemplate::from(tab); + stringified.push_str(&stringify_template( + &tab_template, + child_indentation.clone(), + true, + true, + )); + stringified.push_str(&format!("\n{}}}", child_indentation)); + } else { + stringified.push_str(&format!( + "\n{}{}", + child_indentation, + tab_line( + tab.pane_name.as_ref(), + tab.split_size, + tab.focus, + tab.borderless + ) + )); + } + } + stringified +} + +pub fn layout_yaml_to_layout_kdl(raw_yaml_layout: &str) -> Result<String, String> { + // returns the raw kdl config + let layout_from_yaml: OldLayoutFromYamlIntermediate = serde_yaml::from_str(raw_yaml_layout) + .map_err(|e| format!("Failed to parse yaml: {:?}", e))?; + let mut kdl_layout = String::new(); + kdl_layout.push_str("layout {"); + let template = layout_from_yaml.template; + let tabs = layout_from_yaml.tabs; + let has_no_tabs = tabs.is_empty() + || tabs.len() == 1 && tabs.get(0).map(|t| t.parts.is_empty()).unwrap_or(false); + if has_no_tabs { + let indentation = String::from(""); + kdl_layout.push_str(&stringify_template( + &template, + indentation, + has_no_tabs, + true, + )); + } else { + kdl_layout.push_str("\n default_tab_template {"); + let indentation = String::from(" "); + kdl_layout.push_str(&stringify_template( + &template, + indentation, + has_no_tabs, + true, + )); + kdl_layout.push_str("\n }"); + kdl_layout.push_str(&stringify_tabs(tabs)); + } + kdl_layout.push_str("\n}"); + let layout_config = config_yaml_to_config_kdl(raw_yaml_layout, true)?; + if let Some(session_name) = layout_from_yaml.session.name { + kdl_layout.push_str(&format!("\nsession_name \"{}\"", session_name)); + if let Some(attach_to_session) = layout_from_yaml.session.attach { + kdl_layout.push_str(&format!("\nattach_to_session {}", attach_to_session)); + } + } + if !layout_config.is_empty() { + kdl_layout.push('\n'); + } + kdl_layout.push_str(&layout_config); + Ok(kdl_layout) +} + +#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone, Copy)] +pub enum OldDirection { + #[serde(alias = "horizontal")] + Horizontal, + #[serde(alias = "vertical")] + Vertical, +} + +impl fmt::Display for OldDirection { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { + match self { + Self::Horizontal => write!(f, "Horizontal"), + Self::Vertical => write!(f, "Vertical"), + } + } +} + +#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq)] +pub enum OldSplitSize { + #[serde(alias = "percent")] + Percent(u64), // 1 to 100 + #[serde(alias = "fixed")] + Fixed(usize), // An absolute number of columns or rows +} + +impl fmt::Display for OldSplitSize { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { + match self { + Self::Percent(percent) => write!(f, "\"{}%\"", percent), + Self::Fixed(fixed_size) => write!(f, "{}", fixed_size), + } + } +} + +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)] +pub enum OldRunFromYaml { + #[serde(rename = "plugin")] + Plugin(OldRunPluginFromYaml), + #[serde(rename = "command")] + Command(OldRunCommand), +} + +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)] +pub struct OldRunPluginFromYaml { + #[serde(default)] + pub _allow_exec_host_cmd: bool, + pub location: Url, +} + +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] +#[serde(default)] +pub struct OldLayoutFromYamlIntermediate { + #[serde(default)] + pub template: OldLayoutTemplate, + #[serde(default)] + pub borderless: bool, + #[serde(default)] + pub tabs: Vec<OldTabLayout>, + #[serde(default)] + pub session: OldSessionFromYaml, + #[serde(flatten)] + pub config: Option<OldConfigFromYaml>, +} + +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)] +#[serde(default)] +pub struct OldLayoutFromYaml { + #[serde(default)] + pub session: OldSessionFromYaml, + #[serde(default)] + pub template: OldLayoutTemplate, + #[serde(default)] + pub borderless: bool, + #[serde(default)] + pub tabs: Vec<OldTabLayout>, +} + +#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)] +pub struct OldSessionFromYaml { + pub name: Option<String>, + #[serde(default = "default_as_some_true")] + pub attach: Option<bool>, +} + +fn default_as_some_true() -> Option<bool> { + Some(true) +} + +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] +pub struct OldLayoutTemplate { + pub direction: OldDirection, + #[serde(default)] + pub pane_name: Option<String>, + #[serde(default)] + pub borderless: bool, + #[serde(default)] + pub parts: Vec<OldLayoutTemplate>, + #[serde(default)] + pub body: bool, + pub split_size: Option<OldSplitSize>, + pub focus: Option<bool>, + pub run: Option<OldRunFromYaml>, +} + +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)] +pub struct OldTabLayout { + #[serde(default)] + pub direction: OldDirection, + pub pane_name: Option<String>, + #[serde(default)] + pub borderless: bool, + #[serde(default)] + pub parts: Vec<OldTabLayout>, + pub split_size: Option<OldSplitSize>, + #[serde(default)] + pub name: String, + pub focus: Option<bool>, + pub run: Option<OldRunFromYaml>, +} + +impl From<OldTabLayout> for OldLayoutTemplate { + fn from(old_tab_layout: OldTabLayout) -> Self { + OldLayoutTemplate { + direction: old_tab_layout.direction, + pane_name: old_tab_layout.pane_name.clone(), + borderless: old_tab_layout.borderless, + parts: old_tab_layout.parts.iter().map(|o| o.into()).collect(), + split_size: old_tab_layout.split_size, + focus: old_tab_layout.focus, + run: old_tab_layout.run.clone(), + body: false, + } + } +} + +impl From<&OldTabLayout> for OldLayoutTemplate { + fn from(old_tab_layout: &OldTabLayout) -> Self { + OldLayoutTemplate { + direction: old_tab_layout.direction, + pane_name: old_tab_layout.pane_name.clone(), + borderless: old_tab_layout.borderless, + parts: old_tab_layout.parts.iter().map(|o| o.into()).collect(), + split_size: old_tab_layout.split_size, + focus: old_tab_layout.focus, + run: old_tab_layout.run.clone(), + body: false, + } + } +} + +impl From<&mut OldTabLayout> for OldLayoutTemplate { + fn from(old_tab_layout: &mut OldTabLayout) -> Self { + OldLayoutTemplate { + direction: old_tab_layout.direction, + pane_name: old_tab_layout.pane_name.clone(), + borderless: old_tab_layout.borderless, + parts: old_tab_layout.parts.iter().map(|o| o.into()).collect(), + split_size: old_tab_layout.split_size, + focus: old_tab_layout.focus, + run: old_tab_layout.run.clone(), + body: false, + } + } +} + +impl From<OldLayoutFromYamlIntermediate> for OldLayoutFromYaml { + fn from(layout_from_yaml_intermediate: OldLayoutFromYamlIntermediate) -> Self { + Self { + template: layout_from_yaml_intermediate.template, + borderless: layout_from_yaml_intermediate.borderless, + tabs: layout_from_yaml_intermediate.tabs, + session: layout_from_yaml_intermediate.session, + } + } +} + +impl From<OldLayoutFromYaml> for OldLayoutFromYamlIntermediate { + fn from(layout_from_yaml: OldLayoutFromYaml) -> Self { + Self { + template: layout_from_yaml.template, + borderless: layout_from_yaml.borderless, + tabs: layout_from_yaml.tabs, + config: None, + session: layout_from_yaml.session, + } + } +} + +impl Default for OldLayoutFromYamlIntermediate { + fn default() -> Self { + OldLayoutFromYaml::default().into() + } +} + +impl Default for OldLayoutTemplate { + fn default() -> Self { + Self { + direction: OldDirection::Horizontal, + pane_name: None, + body: false, + borderless: false, + parts: vec![OldLayoutTemplate { + direction: OldDirection::Horizontal, + pane_name: None, + body: true, + borderless: false, + split_size: None, + focus: None, + run: None, + parts: vec![], + }], + split_size: None, + focus: None, + run: None, + } + } +} + +impl Default for OldDirection { + fn default() -> Self { + OldDirection::Horizontal + } +} + +// The unit test location. +#[path = "./unit/convert_layout_tests.rs"] +#[cfg(test)] +mod convert_layout_test; diff --git a/zellij-client/src/old_config_converter/unit/convert_config_tests.rs b/zellij-client/src/old_config_converter/unit/convert_config_tests.rs new file mode 100644 index 00000000..444d8775 --- /dev/null +++ b/zellij-client/src/old_config_converter/unit/convert_config_tests.rs @@ -0,0 +1,126 @@ +use crate::old_config_converter::config_yaml_to_config_kdl; +use insta::assert_snapshot; +use std::path::PathBuf; +use std::{fs::File, io::prelude::*}; + +#[test] +fn properly_convert_default_config() -> Result<(), String> { + let fixture = PathBuf::from(format!( + "{}/src/old_config_converter/unit/fixtures/old_default_yaml_config.yaml", + env!("CARGO_MANIFEST_DIR") + )); + let mut handle = File::open(&fixture).map_err(|e| format!("{}", e))?; + let mut raw_config_file = String::new(); + handle + .read_to_string(&mut raw_config_file) + .map_err(|e| format!("{}", e))?; + let kdl_config = config_yaml_to_config_kdl(&raw_config_file, false)?; + assert_snapshot!(format!("{}", kdl_config)); + Ok(()) +} + +#[test] +fn convert_config_with_custom_options() -> Result<(), String> { + let fixture = PathBuf::from(format!( + "{}/src/old_config_converter/unit/fixtures/old_yaml_config_with_custom_options.yaml", + env!("CARGO_MANIFEST_DIR") + )); + let mut handle = File::open(&fixture).map_err(|e| format!("{}", e))?; + let mut raw_config_file = String::new(); + handle + .read_to_string(&mut raw_config_file) + .map_err(|e| format!("{}", e))?; + let kdl_config = config_yaml_to_config_kdl(&raw_config_file, false)?; + assert_snapshot!(format!("{}", kdl_config)); + Ok(()) +} + +#[test] +fn convert_config_with_keybind_unbinds_in_mode() -> Result<(), String> { + let fixture = PathBuf::from(format!( + "{}/src/old_config_converter/unit/fixtures/old_yaml_config_with_unbinds_in_mode.yaml", + env!("CARGO_MANIFEST_DIR") + )); + let mut handle = File::open(&fixture).map_err(|e| format!("{}", e))?; + let mut raw_config_file = String::new(); + handle + .read_to_string(&mut raw_config_file) + .map_err(|e| format!("{}", e))?; + let kdl_config = config_yaml_to_config_kdl(&raw_config_file, false)?; + assert_snapshot!(format!("{}", kdl_config)); + Ok(()) +} + +#[test] +fn convert_config_with_global_keybind_unbinds() -> Result<(), String> { + let fixture = PathBuf::from(format!("{}/src/old_config_converter/unit/fixtures/old_yaml_config_with_global_keybind_unbinds.yaml", env!("CARGO_MANIFEST_DIR"))); + let mut handle = File::open(&fixture).map_err(|e| format!("{}", e))?; + let mut raw_config_file = String::new(); + handle + .read_to_string(&mut raw_config_file) + .map_err(|e| format!("{}", e))?; + let kdl_config = config_yaml_to_config_kdl(&raw_config_file, false)?; + assert_snapshot!(format!("{}", kdl_config)); + Ok(()) +} + +#[test] +fn convert_config_with_unbind_all_keys_per_mode() -> Result<(), String> { + let fixture = PathBuf::from(format!("{}/src/old_config_converter/unit/fixtures/old_yaml_config_with_unbind_all_keys_per_mode.yaml", env!("CARGO_MANIFEST_DIR"))); + let mut handle = File::open(&fixture).map_err(|e| format!("{}", e))?; + let mut raw_config_file = String::new(); + handle + .read_to_string(&mut raw_config_file) + .map_err(|e| format!("{}", e))?; + let kdl_config = config_yaml_to_config_kdl(&raw_config_file, false)?; + assert_snapshot!(format!("{}", kdl_config)); + Ok(()) +} + +#[test] +fn convert_config_with_env_variables() -> Result<(), String> { + let fixture = PathBuf::from(format!( + "{}/src/old_config_converter/unit/fixtures/old_yaml_config_with_env_variables.yaml", + env!("CARGO_MANIFEST_DIR") + )); + let mut handle = File::open(&fixture).map_err(|e| format!("{}", e))?; + let mut raw_config_file = String::new(); + handle + .read_to_string(&mut raw_config_file) + .map_err(|e| format!("{}", e))?; + let kdl_config = config_yaml_to_config_kdl(&raw_config_file, false)?; + assert_snapshot!(format!("{}", kdl_config)); + Ok(()) +} + +#[test] +fn convert_config_with_ui_config() -> Result<(), String> { + let fixture = PathBuf::from(format!( + "{}/src/old_config_converter/unit/fixtures/old_yaml_config_with_ui.yaml", + env!("CARGO_MANIFEST_DIR") + )); + let mut handle = File::open(&fixture).map_err(|e| format!("{}", e))?; + let mut raw_config_file = String::new(); + handle + .read_to_string(&mut raw_config_file) + .map_err(|e| format!("{}", e))?; + let kdl_config = config_yaml_to_config_kdl(&raw_config_file, false)?; + assert_snapshot!(format!("{}", kdl_config)); + Ok(()) +} + +#[test] +fn convert_config_with_themes_config() -> Result<(), String> { + let fixture = PathBuf::from(format!( + "{}/src/old_config_converter/unit/fixtures/old_yaml_config_with_themes.yaml", + env!("CARGO_MANIFEST_DIR") + )); + let mut handle = File::open(&fixture).map_err(|e| format!("{}", e))?; + let mut raw_config_file = String::new(); + handle + .read_to_string(&mut raw_config_file) + .map_err(|e| format!("{}", e))?; + let kdl_config = config_yaml_to_config_kdl(&raw_config_file, false)?; + assert_snapshot!(format!("{}", kdl_config)); + Ok(()) +} diff --git a/zellij-client/src/old_config_converter/unit/convert_layout_tests.rs b/zellij-client/src/old_config_converter/unit/convert_layout_tests.rs new file mode 100644 index 00000000..30e689bb --- /dev/null +++ b/zellij-client/src/old_config_converter/unit/convert_layout_tests.rs @@ -0,0 +1,142 @@ +use crate::old_config_converter::layout_yaml_to_layout_kdl; +use insta::assert_snapshot; +use std::path::PathBuf; +use std::{fs::File, io::prelude::*}; + +#[test] +fn properly_convert_default_layout() -> Result<(), String> { + let fixture = PathBuf::from(format!( + "{}/src/old_config_converter/unit/fixtures/old_default_yaml_layout.yaml", + env!("CARGO_MANIFEST_DIR") + )); + let mut handle = File::open(&fixture).map_err(|e| format!("{}", e))?; + let mut raw_config_file = String::new(); + handle + .read_to_string(&mut raw_config_file) + .map_err(|e| format!("{}", e))?; + let kdl_config = layout_yaml_to_layout_kdl(&raw_config_file)?; + assert_snapshot!(format!("{}", kdl_config)); + Ok(()) +} + +#[test] +fn properly_convert_layout_with_session_name() -> Result<(), String> { + let fixture = PathBuf::from(format!( + "{}/src/old_config_converter/unit/fixtures/old_yaml_layout_with_session_name.yaml", + env!("CARGO_MANIFEST_DIR") + )); + let mut handle = File::open(&fixture).map_err(|e| format!("{}", e))?; + let mut raw_config_file = String::new(); + handle + .read_to_string(&mut raw_config_file) + .map_err(|e| format!("{}", e))?; + let kdl_config = layout_yaml_to_layout_kdl(&raw_config_file)?; + assert_snapshot!(format!("{}", kdl_config)); + Ok(()) +} + +#[test] +fn properly_convert_layout_with_session_name_and_attach_false() -> Result<(), String> { + let fixture = PathBuf::from(format!("{}/src/old_config_converter/unit/fixtures/old_yaml_layout_with_session_name_and_attach_false.yaml", env!("CARGO_MANIFEST_DIR"))); + let mut handle = File::open(&fixture).map_err(|e| format!("{}", e))?; + let mut raw_config_file = String::new(); + handle + .read_to_string(&mut raw_config_file) + .map_err(|e| format!("{}", e))?; + let kdl_config = layout_yaml_to_layout_kdl(&raw_config_file)?; + assert_snapshot!(format!("{}", kdl_config)); + Ok(()) +} + +#[test] +fn properly_convert_layout_with_config() -> Result<(), String> { + let fixture = PathBuf::from(format!( + "{}/src/old_config_converter/unit/fixtures/old_yaml_layout_with_config.yaml", + env!("CARGO_MANIFEST_DIR") + )); + let mut handle = File::open(&fixture).map_err(|e| format!("{}", e))?; + let mut raw_config_file = String::new(); + handle + .read_to_string(&mut raw_config_file) + .map_err(|e| format!("{}", e))?; + let kdl_config = layout_yaml_to_layout_kdl(&raw_config_file)?; + assert_snapshot!(format!("{}", kdl_config)); + Ok(()) +} + +#[test] +fn properly_convert_layout_with_config_and_session_name() -> Result<(), String> { + let fixture = PathBuf::from(format!("{}/src/old_config_converter/unit/fixtures/old_yaml_layout_with_config_and_session_name.yaml", env!("CARGO_MANIFEST_DIR"))); + let mut handle = File::open(&fixture).map_err(|e| format!("{}", e))?; + let mut raw_config_file = String::new(); + handle + .read_to_string(&mut raw_config_file) + .map_err(|e| format!("{}", e))?; + let kdl_config = layout_yaml_to_layout_kdl(&raw_config_file)?; + assert_snapshot!(format!("{}", kdl_config)); + Ok(()) +} + +#[test] +fn properly_convert_layout_example_1() -> Result<(), String> { + let fixture = PathBuf::from(format!( + "{}/src/old_config_converter/unit/fixtures/multiple_tabs_layout.yaml", + env!("CARGO_MANIFEST_DIR") + )); + let mut handle = File::open(&fixture).map_err(|e| format!("{}", e))?; + let mut raw_config_file = String::new(); + handle + .read_to_string(&mut raw_config_file) + .map_err(|e| format!("{}", e))?; + let kdl_config = layout_yaml_to_layout_kdl(&raw_config_file)?; + assert_snapshot!(format!("{}", kdl_config)); + Ok(()) +} + +#[test] +fn properly_convert_layout_example_2() -> Result<(), String> { + let fixture = PathBuf::from(format!( + "{}/src/old_config_converter/unit/fixtures/multiple_tabs_layout_htop_command.yaml", + env!("CARGO_MANIFEST_DIR") + )); + let mut handle = File::open(&fixture).map_err(|e| format!("{}", e))?; + let mut raw_config_file = String::new(); + handle + .read_to_string(&mut raw_config_file) + .map_err(|e| format!("{}", e))?; + let kdl_config = layout_yaml_to_layout_kdl(&raw_config_file)?; + assert_snapshot!(format!("{}", kdl_config)); + Ok(()) +} + +#[test] +fn properly_convert_layout_example_3() -> Result<(), String> { + let fixture = PathBuf::from(format!( + "{}/src/old_config_converter/unit/fixtures/run_htop_layout.yaml", + env!("CARGO_MANIFEST_DIR") + )); + let mut handle = File::open(&fixture).map_err(|e| format!("{}", e))?; + let mut raw_config_file = String::new(); + handle + .read_to_string(&mut raw_config_file) + .map_err(|e| format!("{}", e))?; + let kdl_config = layout_yaml_to_layout_kdl(&raw_config_file)?; + assert_snapshot!(format!("{}", kdl_config)); + Ok(()) +} + +#[test] +fn properly_convert_layout_example_4() -> Result<(), String> { + let fixture = PathBuf::from(format!( + "{}/src/old_config_converter/unit/fixtures/run_htop_layout_with_plugins.yaml", + env!("CARGO_MANIFEST_DIR") + )); + let mut handle = File::open(&fixture).map_err(|e| format!("{}", e))?; + let mut raw_config_file = String::new(); + handle + .read_to_string(&mut raw_config_file) + .map_err(|e| format!("{}", e))?; + let kdl_config = layout_yaml_to_layout_kdl(&raw_config_file)?; + assert_snapshot!(format!("{}", kdl_config)); + Ok(()) +} diff --git a/zellij-client/src/old_config_converter/unit/fixtures/multiple_tabs_layout.yaml b/zellij-client/src/old_config_converter/unit/fixtures/multiple_tabs_layout.yaml new file mode 100644 index 00000000..04fca4a5 --- /dev/null +++ b/zellij-client/src/old_config_converter/unit/fixtures/multiple_tabs_layout.yaml @@ -0,0 +1,90 @@ +--- +template: + direction: Horizontal + parts: + - direction: Vertical + split_size: + Fixed: 1 + run: + plugin: + location: "zellij:tab-bar" + borderless: true + - direction: Vertical + body: true + - direction: Vertical + split_size: + Fixed: 2 + run: + plugin: + location: "zellij:status-bar" + borderless: true + +tabs: +- direction: Vertical + parts: + - direction: Vertical + split_size: + Percent: 50 + - direction: Vertical + split_size: + Percent: 50 +- direction: Vertical +- direction: Vertical + parts: + - direction: Vertical + split_size: + Percent: 50 + - direction: Vertical + split_size: + Percent: 50 +- direction: Vertical + parts: + - direction: Vertical + split_size: + Percent: 50 + - direction: Horizontal + split_size: + Percent: 50 + parts: + - direction: Vertical + split_size: + Percent: 50 + - direction: Vertical + split_size: + Percent: 50 +- direction: Vertical +- direction: Vertical +- direction: Vertical +- direction: Vertical + parts: + - direction: Vertical + split_size: + Percent: 20 + run: + plugin: + location: "zellij:strider" + - direction: Horizontal + split_size: + Percent: 80 + parts: + - direction: Vertical + split_size: + Percent: 50 + - direction: Vertical + split_size: + Percent: 50 +- direction: Vertical + parts: + - direction: Vertical + split_size: + Percent: 40 + - direction: Horizontal + split_size: + Percent: 60 + parts: + - direction: Vertical + split_size: + Percent: 50 + - direction: Vertical + split_size: + Percent: 50 diff --git a/zellij-client/src/old_config_converter/unit/fixtures/multiple_tabs_layout_htop_command.yaml b/zellij-client/src/old_config_converter/unit/fixtures/multiple_tabs_layout_htop_command.yaml new file mode 100644 index 00000000..1449aa71 --- /dev/null +++ b/zellij-client/src/old_config_converter/unit/fixtures/multiple_tabs_layout_htop_command.yaml @@ -0,0 +1,93 @@ +--- +template: + direction: Horizontal + parts: + - direction: Vertical + split_size: + Fixed: 1 + run: + plugin: + location: "zellij:tab-bar" + borderless: true + - direction: Vertical + body: true + - direction: Vertical + split_size: + Fixed: 2 + run: + plugin: + location: "zellij:status-bar" + borderless: true + +tabs: +- direction: Vertical + parts: + - direction: Vertical + split_size: + Percent: 50 + run: + command: {cmd: htop} + - direction: Vertical + split_size: + Percent: 50 +- direction: Vertical + parts: + - direction: Vertical + split_size: + Percent: 50 + - direction: Vertical + split_size: + Percent: 50 +- direction: Vertical + parts: + - direction: Vertical + split_size: + Percent: 50 + - direction: Horizontal + split_size: + Percent: 50 + parts: + - direction: Vertical + split_size: + Percent: 50 + - direction: Vertical + split_size: + Percent: 50 +- direction: Vertical +- direction: Vertical + run: + command: {cmd: htop, args: ["-C"]} +- direction: Vertical +- direction: Vertical + parts: + - direction: Vertical + split_size: + Percent: 20 + run: + plugin: + location: "zellij:strider" + - direction: Horizontal + split_size: + Percent: 80 + parts: + - direction: Vertical + split_size: + Percent: 50 + - direction: Vertical + split_size: + Percent: 50 +- direction: Vertical + parts: + - direction: Vertical + split_size: + Percent: 40 + - direction: Horizontal + split_size: + Percent: 60 + parts: + - direction: Vertical + split_size: + Percent: 50 + - direction: Vertical + split_size: + Percent: 50 diff --git a/zellij-client/src/old_config_converter/unit/fixtures/old_default_yaml_config.yaml b/zellij-client/src/old_config_converter/unit/fixtures/old_default_yaml_config.yaml new file mode 100644 index 00000000..cf0e5150 --- /dev/null +++ b/zellij-client/src/old_config_converter/unit/fixtures/old_default_yaml_config.yaml @@ -0,0 +1,639 @@ +--- +# Configuration for zellij. + +# In order to troubleshoot your configuration try using the following command: +# `zellij setup --check` +# It should show current config locations and features that are enabled. + +keybinds: + unbind: true + normal: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's',] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [NewPane: ] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right ] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up, ] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + # uncomment this and adjust key if using copy_on_select=false + # - action: [Copy: ] + # key: [ Alt: 'c'] + locked: + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'g',] + resize: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'n', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [Quit] + key: [Ctrl: 'q'] + - action: [Resize: Left,] + key: [Char: 'h', Left,] + - action: [Resize: Down,] + key: [Char: 'j', Down,] + - action: [Resize: Up,] + key: [Char: 'k', Up, ] + - action: [Resize: Right,] + key: [Char: 'l', Right,] + - action: [Resize: Increase,] + key: [Char: '='] + - action: [Resize: Increase,] + key: [ Char: '+'] + - action: [Resize: Decrease,] + key: [Char: '-'] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + pane: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'p', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [MoveFocus: Left,] + key: [ Char: 'h', Left,] + - action: [MoveFocus: Right,] + key: [ Char: 'l', Right,] + - action: [MoveFocus: Down,] + key: [ Char: 'j', Down,] + - action: [MoveFocus: Up,] + key: [ Char: 'k', Up,] + - action: [SwitchFocus,] + key: [Char: 'p'] + - action: [NewPane: , SwitchToMode: Normal,] + key: [Char: 'n',] + - action: [NewPane: Down, SwitchToMode: Normal,] + key: [Char: 'd',] + - action: [NewPane: Right, SwitchToMode: Normal,] + key: [Char: 'r',] + - action: [CloseFocus, SwitchToMode: Normal,] + key: [Char: 'x',] + - action: [ToggleFocusFullscreen, SwitchToMode: Normal,] + key: [Char: 'f',] + - action: [TogglePaneFrames, SwitchToMode: Normal,] + key: [Char: 'z',] + - action: [ToggleFloatingPanes, SwitchToMode: Normal,] + key: [Char: 'w'] + - action: [TogglePaneEmbedOrFloating, SwitchToMode: Normal,] + key: [Char: 'e'] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + - action: [SwitchToMode: RenamePane, PaneNameInput: [0],] + key: [Char: 'c'] + move: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'h', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [Quit] + key: [Ctrl: 'q'] + - action: [MovePane: ,] + key: [Char: 'n', Char: "\t",] + - action: [MovePane: Left,] + key: [Char: 'h', Left,] + - action: [MovePane: Down,] + key: [Char: 'j', Down,] + - action: [MovePane: Up,] + key: [Char: 'k', Up, ] + - action: [MovePane: Right,] + key: [Char: 'l', Right,] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + tab: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 't', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: RenameTab, TabNameInput: [0],] + key: [Char: 'r'] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [GoToPreviousTab,] + key: [ Char: 'h', Left, Up, Char: 'k',] + - action: [GoToNextTab,] + key: [ Char: 'l', Right,Down, Char: 'j'] + - action: [NewTab: , SwitchToMode: Normal,] + key: [ Char: 'n',] + - action: [CloseTab, SwitchToMode: Normal,] + key: [ Char: 'x',] + - action: [ToggleActiveSyncTab, SwitchToMode: Normal,] + key: [Char: 's'] + - action: [GoToTab: 1, SwitchToMode: Normal,] + key: [ Char: '1',] + - action: [GoToTab: 2, SwitchToMode: Normal,] + key: [ Char: '2',] + - action: [GoToTab: 3, SwitchToMode: Normal,] + key: [ Char: '3',] + - action: [GoToTab: 4, SwitchToMode: Normal,] + key: [ Char: '4',] + - action: [GoToTab: 5, SwitchToMode: Normal,] + key: [ Char: '5',] + - action: [GoToTab: 6, SwitchToMode: Normal,] + key: [ Char: '6',] + - action: [GoToTab: 7, SwitchToMode: Normal,] + key: [ Char: '7',] + - action: [GoToTab: 8, SwitchToMode: Normal,] + key: [ Char: '8',] + - action: [GoToTab: 9, SwitchToMode: Normal,] + key: [ Char: '9',] + - action: [ToggleTab] + key: [ Char: "\t" ] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + scroll: + - action: [EditScrollback, SwitchToMode: Normal] + key: [Char: 'e'] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 's', Char: ' ', Char: "\n", Esc] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [ScrollToBottom, SwitchToMode: Normal,] + key: [Ctrl: 'c',] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [ScrollDown,] + key: [Char: 'j', Down,] + - action: [ScrollUp,] + key: [Char: 'k', Up,] + - action: [PageScrollDown,] + key: [Ctrl: 'f', PageDown, Right, Char: 'l',] + - action: [PageScrollUp,] + key: [Ctrl: 'b', PageUp, Left, Char: 'h',] + - action: [HalfPageScrollDown,] + key: [Char: 'd',] + - action: [HalfPageScrollUp,] + key: [Char: 'u',] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + # uncomment this and adjust key if using copy_on_select=false + # - action: [Copy: ] + # key: [ Alt: 'c'] + - action: [SwitchToMode: EnterSearch, SearchInput: [0],] + key: [Char: 's'] + entersearch: + - action: [SwitchToMode: Search,] + key: [Char: "\n"] + - action: [SearchInput: [27], SwitchToMode: Scroll,] + key: [Ctrl: 'c', Esc] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + search: + - action: [SwitchToMode: Normal,] + key: [Ctrl: 's', Char: ' ', Char: "\n", Esc] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [ScrollToBottom, SwitchToMode: Normal,] + key: [Ctrl: 'c',] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [ScrollDown,] + key: [Char: 'j', Down,] + - action: [ScrollUp,] + key: [Char: 'k', Up,] + - action: [PageScrollDown,] + key: [Ctrl: 'f', PageDown, Right, Char: 'l',] + - action: [PageScrollUp,] + key: [Ctrl: 'b', PageUp, Left, Char: 'h',] + - action: [HalfPageScrollDown,] + key: [Char: 'd',] + - action: [HalfPageScrollUp,] + key: [Char: 'u',] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + - action: [SwitchToMode: EnterSearch, SearchInput: [0],] + key: [Char: 's'] + - action: [Search: Down] + key: [Char: 'n'] + - action: [Search: Up] + key: [Char: 'p'] + - action: [SearchToggleOption: CaseSensitivity] + key: [Char: 'c'] + - action: [SearchToggleOption: Wrap] + key: [Char: 'w'] + - action: [SearchToggleOption: WholeWord] + key: [Char: 'o'] + renametab: + - action: [SwitchToMode: Normal,] + key: [Char: "\n", Ctrl: 'c', Esc] + - action: [UndoRenameTab , SwitchToMode: Tab,] + key: [Esc,] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + renamepane: + - action: [SwitchToMode: Normal,] + key: [Char: "\n", Ctrl: 'c', Esc] + - action: [UndoRenamePane , SwitchToMode: Pane,] + key: [Esc,] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + session: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'o', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [Detach,] + key: [Char: 'd',] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + tmux: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'o', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Scroll,] + key: [ Char: '['] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [Write: [2,], SwitchToMode: Normal] + key: [Ctrl: 'b'] + - action: [NewPane: Down, SwitchToMode: Normal,] + key: [Char: "\"",] + - action: [NewPane: Right, SwitchToMode: Normal,] + key: [Char: '%',] + - action: [ToggleFocusFullscreen, SwitchToMode: Normal,] + key: [Char: 'z',] + - action: [NewTab: , SwitchToMode: Normal,] + key: [ Char: 'c',] + - action: [SwitchToMode: RenameTab, TabNameInput: [0],] + key: [Char: ','] + - action: [GoToPreviousTab, SwitchToMode: Normal,] + key: [ Char: 'p'] + - action: [GoToNextTab, SwitchToMode: Normal,] + key: [ Char: 'n'] + - action: [MoveFocus: Left, SwitchToMode: Normal,] + key: [ Left,] + - action: [MoveFocus: Right, SwitchToMode: Normal,] + key: [ Right,] + - action: [MoveFocus: Down, SwitchToMode: Normal,] + key: [ Down,] + - action: [MoveFocus: Up, SwitchToMode: Normal,] + key: [ Up,] + - action: [MoveFocus: Left, SwitchToMode: Normal,] + key: [ Char: 'h'] + - action: [MoveFocus: Right, SwitchToMode: Normal,] + key: [ Char: 'l'] + - action: [MoveFocus: Down, SwitchToMode: Normal,] + key: [ Char: 'j'] + - action: [MoveFocus: Up, SwitchToMode: Normal,] + key: [ Char: 'k'] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [FocusNextPane,] + key: [ Char: 'o'] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + - action: [Detach,] + key: [Char: 'd',] +plugins: + - path: tab-bar + tag: tab-bar + - path: status-bar + tag: status-bar + - path: strider + tag: strider + - path: compact-bar + tag: compact-bar + +# Choose what to do when zellij receives SIGTERM, SIGINT, SIGQUIT or SIGHUP +# eg. when terminal window with an active zellij session is closed +# Options: +# - detach (Default) +# - quit +# on_force_close: quit + +# Send a request for a simplified ui (without arrow fonts) to plugins +# Options: +# - true +# - false (Default) +# simplified_ui: true + +# Choose the path to the default shell that zellij will use for opening new panes +# Default: $SHELL +# default_shell: fish + +# Toggle between having pane frames around the panes +# Options: +# - true (default) +# - false +#pane_frames: true + +# Choose the theme that is specified in the themes section. +# For some examples, see: https://github.com/zellij-org/zellij/tree/main/example/themes +# Default: default +#theme: default + +# Choose the mode that zellij uses when starting up. +# Default: normal +#default_mode: locked + +# Toggle enabling the mouse mode. +# On certain configurations, or terminals this could +# potentially interfere with copying text. +# Options: +# - true (default) +# - false +#mouse_mode: false + +# Configure the scroll back buffer size +# This is the number of lines zellij stores for each pane in the scroll back +# buffer. Excess number of lines are discarded in a FIFO fashion. +# Valid values: positive integers +# Default value: 10000 +#scroll_buffer_size: 10000 + +# Provide a command to execute when copying text. The text will be piped to +# the stdin of the program to perform the copy. This can be used with +# terminal emulators which do not support the OSC 52 ANSI control sequence +# that will be used by default if this option is not set. +# Examples: +#copy_command: "xclip -selection clipboard" # x11 +#copy_command: "wl-copy" # wayland +#copy_command: "pbcopy" # osx + +# Choose the destination for copied text +# Allows using the primary selection buffer (on x11/wayland) instead of the system clipboard. +# Does not apply when using copy_command. +# Options: +# - system (default) +# - primary +#copy_clipboard: primary + +# Enable or disable automatic copy (and clear) of selection when releasing mouse +#copy_on_select: true + +# Path to the default editor to use to edit pane scrollbuffer +# scrollback_editor: /usr/bin/nano diff --git a/zellij-client/src/old_config_converter/unit/fixtures/old_default_yaml_layout.yaml b/zellij-client/src/old_config_converter/unit/fixtures/old_default_yaml_layout.yaml new file mode 100644 index 00000000..0688e54b --- /dev/null +++ b/zellij-client/src/old_config_converter/unit/fixtures/old_default_yaml_layout.yaml @@ -0,0 +1,22 @@ +--- +template: + direction: Horizontal + parts: + - direction: Vertical + borderless: true + split_size: + Fixed: 1 + run: + plugin: + location: "zellij:tab-bar" + - direction: Vertical + body: true + - direction: Vertical + borderless: true + split_size: + Fixed: 2 + run: + plugin: + location: "zellij:status-bar" +tabs: + - direction: Vertical diff --git a/zellij-client/src/old_config_converter/unit/fixtures/old_yaml_config_with_custom_options.yaml b/zellij-client/src/old_config_converter/unit/fixtures/old_yaml_config_with_custom_options.yaml new file mode 100644 index 00000000..797a3f22 --- /dev/null +++ b/zellij-client/src/old_config_converter/unit/fixtures/old_yaml_config_with_custom_options.yaml @@ -0,0 +1,639 @@ +--- +# Configuration for zellij. + +# In order to troubleshoot your configuration try using the following command: +# `zellij setup --check` +# It should show current config locations and features that are enabled. + +keybinds: + unbind: true + normal: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's',] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [NewPane: ] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right ] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up, ] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + # uncomment this and adjust key if using copy_on_select=false + # - action: [Copy: ] + # key: [ Alt: 'c'] + locked: + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'g',] + resize: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'n', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [Quit] + key: [Ctrl: 'q'] + - action: [Resize: Left,] + key: [Char: 'h', Left,] + - action: [Resize: Down,] + key: [Char: 'j', Down,] + - action: [Resize: Up,] + key: [Char: 'k', Up, ] + - action: [Resize: Right,] + key: [Char: 'l', Right,] + - action: [Resize: Increase,] + key: [Char: '='] + - action: [Resize: Increase,] + key: [ Char: '+'] + - action: [Resize: Decrease,] + key: [Char: '-'] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + pane: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'p', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [MoveFocus: Left,] + key: [ Char: 'h', Left,] + - action: [MoveFocus: Right,] + key: [ Char: 'l', Right,] + - action: [MoveFocus: Down,] + key: [ Char: 'j', Down,] + - action: [MoveFocus: Up,] + key: [ Char: 'k', Up,] + - action: [SwitchFocus,] + key: [Char: 'p'] + - action: [NewPane: , SwitchToMode: Normal,] + key: [Char: 'n',] + - action: [NewPane: Down, SwitchToMode: Normal,] + key: [Char: 'd',] + - action: [NewPane: Right, SwitchToMode: Normal,] + key: [Char: 'r',] + - action: [CloseFocus, SwitchToMode: Normal,] + key: [Char: 'x',] + - action: [ToggleFocusFullscreen, SwitchToMode: Normal,] + key: [Char: 'f',] + - action: [TogglePaneFrames, SwitchToMode: Normal,] + key: [Char: 'z',] + - action: [ToggleFloatingPanes, SwitchToMode: Normal,] + key: [Char: 'w'] + - action: [TogglePaneEmbedOrFloating, SwitchToMode: Normal,] + key: [Char: 'e'] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + - action: [SwitchToMode: RenamePane, PaneNameInput: [0],] + key: [Char: 'c'] + move: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'h', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [Quit] + key: [Ctrl: 'q'] + - action: [MovePane: ,] + key: [Char: 'n', Char: "\t",] + - action: [MovePane: Left,] + key: [Char: 'h', Left,] + - action: [MovePane: Down,] + key: [Char: 'j', Down,] + - action: [MovePane: Up,] + key: [Char: 'k', Up, ] + - action: [MovePane: Right,] + key: [Char: 'l', Right,] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + tab: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 't', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: RenameTab, TabNameInput: [0],] + key: [Char: 'r'] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [GoToPreviousTab,] + key: [ Char: 'h', Left, Up, Char: 'k',] + - action: [GoToNextTab,] + key: [ Char: 'l', Right,Down, Char: 'j'] + - action: [NewTab: , SwitchToMode: Normal,] + key: [ Char: 'n',] + - action: [CloseTab, SwitchToMode: Normal,] + key: [ Char: 'x',] + - action: [ToggleActiveSyncTab, SwitchToMode: Normal,] + key: [Char: 's'] + - action: [GoToTab: 1, SwitchToMode: Normal,] + key: [ Char: '1',] + - action: [GoToTab: 2, SwitchToMode: Normal,] + key: [ Char: '2',] + - action: [GoToTab: 3, SwitchToMode: Normal,] + key: [ Char: '3',] + - action: [GoToTab: 4, SwitchToMode: Normal,] + key: [ Char: '4',] + - action: [GoToTab: 5, SwitchToMode: Normal,] + key: [ Char: '5',] + - action: [GoToTab: 6, SwitchToMode: Normal,] + key: [ Char: '6',] + - action: [GoToTab: 7, SwitchToMode: Normal,] + key: [ Char: '7',] + - action: [GoToTab: 8, SwitchToMode: Normal,] + key: [ Char: '8',] + - action: [GoToTab: 9, SwitchToMode: Normal,] + key: [ Char: '9',] + - action: [ToggleTab] + key: [ Char: "\t" ] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + scroll: + - action: [EditScrollback, SwitchToMode: Normal] + key: [Char: 'e'] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 's', Char: ' ', Char: "\n", Esc] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [ScrollToBottom, SwitchToMode: Normal,] + key: [Ctrl: 'c',] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [ScrollDown,] + key: [Char: 'j', Down,] + - action: [ScrollUp,] + key: [Char: 'k', Up,] + - action: [PageScrollDown,] + key: [Ctrl: 'f', PageDown, Right, Char: 'l',] + - action: [PageScrollUp,] + key: [Ctrl: 'b', PageUp, Left, Char: 'h',] + - action: [HalfPageScrollDown,] + key: [Char: 'd',] + - action: [HalfPageScrollUp,] + key: [Char: 'u',] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + # uncomment this and adjust key if using copy_on_select=false + # - action: [Copy: ] + # key: [ Alt: 'c'] + - action: [SwitchToMode: EnterSearch, SearchInput: [0],] + key: [Char: 's'] + entersearch: + - action: [SwitchToMode: Search,] + key: [Char: "\n"] + - action: [SearchInput: [27], SwitchToMode: Scroll,] + key: [Ctrl: 'c', Esc] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + search: + - action: [SwitchToMode: Normal,] + key: [Ctrl: 's', Char: ' ', Char: "\n", Esc] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [ScrollToBottom, SwitchToMode: Normal,] + key: [Ctrl: 'c',] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [ScrollDown,] + key: [Char: 'j', Down,] + - action: [ScrollUp,] + key: [Char: 'k', Up,] + - action: [PageScrollDown,] + key: [Ctrl: 'f', PageDown, Right, Char: 'l',] + - action: [PageScrollUp,] + key: [Ctrl: 'b', PageUp, Left, Char: 'h',] + - action: [HalfPageScrollDown,] + key: [Char: 'd',] + - action: [HalfPageScrollUp,] + key: [Char: 'u',] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + - action: [SwitchToMode: EnterSearch, SearchInput: [0],] + key: [Char: 's'] + - action: [Search: Down] + key: [Char: 'n'] + - action: [Search: Up] + key: [Char: 'p'] + - action: [SearchToggleOption: CaseSensitivity] + key: [Char: 'c'] + - action: [SearchToggleOption: Wrap] + key: [Char: 'w'] + - action: [SearchToggleOption: WholeWord] + key: [Char: 'o'] + renametab: + - action: [SwitchToMode: Normal,] + key: [Char: "\n", Ctrl: 'c', Esc] + - action: [UndoRenameTab , SwitchToMode: Tab,] + key: [Esc,] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + renamepane: + - action: [SwitchToMode: Normal,] + key: [Char: "\n", Ctrl: 'c', Esc] + - action: [UndoRenamePane , SwitchToMode: Pane,] + key: [Esc,] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + session: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'o', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [Detach,] + key: [Char: 'd',] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + tmux: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'o', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Scroll,] + key: [ Char: '['] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [Write: [2,], SwitchToMode: Normal] + key: [Ctrl: 'b'] + - action: [NewPane: Down, SwitchToMode: Normal,] + key: [Char: "\"",] + - action: [NewPane: Right, SwitchToMode: Normal,] + key: [Char: '%',] + - action: [ToggleFocusFullscreen, SwitchToMode: Normal,] + key: [Char: 'z',] + - action: [NewTab: , SwitchToMode: Normal,] + key: [ Char: 'c',] + - action: [SwitchToMode: RenameTab, TabNameInput: [0],] + key: [Char: ','] + - action: [GoToPreviousTab, SwitchToMode: Normal,] + key: [ Char: 'p'] + - action: [GoToNextTab, SwitchToMode: Normal,] + key: [ Char: 'n'] + - action: [MoveFocus: Left, SwitchToMode: Normal,] + key: [ Left,] + - action: [MoveFocus: Right, SwitchToMode: Normal,] + key: [ Right,] + - action: [MoveFocus: Down, SwitchToMode: Normal,] + key: [ Down,] + - action: [MoveFocus: Up, SwitchToMode: Normal,] + key: [ Up,] + - action: [MoveFocus: Left, SwitchToMode: Normal,] + key: [ Char: 'h'] + - action: [MoveFocus: Right, SwitchToMode: Normal,] + key: [ Char: 'l'] + - action: [MoveFocus: Down, SwitchToMode: Normal,] + key: [ Char: 'j'] + - action: [MoveFocus: Up, SwitchToMode: Normal,] + key: [ Char: 'k'] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [FocusNextPane,] + key: [ Char: 'o'] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + - action: [Detach,] + key: [Char: 'd',] +plugins: + - path: tab-bar + tag: tab-bar + - path: status-bar + tag: status-bar + - path: strider + tag: strider + - path: compact-bar + tag: compact-bar + +# Choose what to do when zellij receives SIGTERM, SIGINT, SIGQUIT or SIGHUP +# eg. when terminal window with an active zellij session is closed +# Options: +# - detach (Default) +# - quit +on_force_close: quit + +# Send a request for a simplified ui (without arrow fonts) to plugins +# Options: +# - true +# - false (Default) +simplified_ui: true + +# Choose the path to the default shell that zellij will use for opening new panes +# Default: $SHELL +default_shell: fish + +# Toggle between having pane frames around the panes +# Options: +# - true (default) +# - false +pane_frames: true + +# Choose the theme that is specified in the themes section. +# For some examples, see: https://github.com/zellij-org/zellij/tree/main/example/themes +# Default: default +theme: default + +# Choose the mode that zellij uses when starting up. +# Default: normal +default_mode: locked + +# Toggle enabling the mouse mode. +# On certain configurations, or terminals this could +# potentially interfere with copying text. +# Options: +# - true (default) +# - false +mouse_mode: false + +# Configure the scroll back buffer size +# This is the number of lines zellij stores for each pane in the scroll back +# buffer. Excess number of lines are discarded in a FIFO fashion. +# Valid values: positive integers +# Default value: 10000 +scroll_buffer_size: 10000 + +# Provide a command to execute when copying text. The text will be piped to +# the stdin of the program to perform the copy. This can be used with +# terminal emulators which do not support the OSC 52 ANSI control sequence +# that will be used by default if this option is not set. +# Examples: +#copy_command: "xclip -selection clipboard" # x11 +#copy_command: "wl-copy" # wayland +copy_command: "pbcopy" # osx + +# Choose the destination for copied text +# Allows using the primary selection buffer (on x11/wayland) instead of the system clipboard. +# Does not apply when using copy_command. +# Options: +# - system (default) +# - primary +copy_clipboard: primary + +# Enable or disable automatic copy (and clear) of selection when releasing mouse +copy_on_select: true + +# Path to the default editor to use to edit pane scrollbuffer +scrollback_editor: /usr/bin/nano diff --git a/zellij-client/src/old_config_converter/unit/fixtures/old_yaml_config_with_env_variables.yaml b/zellij-client/src/old_config_converter/unit/fixtures/old_yaml_config_with_env_variables.yaml new file mode 100644 index 00000000..26006ba3 --- /dev/null +++ b/zellij-client/src/old_config_converter/unit/fixtures/old_yaml_config_with_env_variables.yaml @@ -0,0 +1,644 @@ +--- +# Configuration for zellij. + +# In order to troubleshoot your configuration try using the following command: +# `zellij setup --check` +# It should show current config locations and features that are enabled. + +keybinds: + unbind: true + normal: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's',] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [NewPane: ] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right ] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up, ] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + # uncomment this and adjust key if using copy_on_select=false + # - action: [Copy: ] + # key: [ Alt: 'c'] + locked: + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'g',] + resize: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'n', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [Quit] + key: [Ctrl: 'q'] + - action: [Resize: Left,] + key: [Char: 'h', Left,] + - action: [Resize: Down,] + key: [Char: 'j', Down,] + - action: [Resize: Up,] + key: [Char: 'k', Up, ] + - action: [Resize: Right,] + key: [Char: 'l', Right,] + - action: [Resize: Increase,] + key: [Char: '='] + - action: [Resize: Increase,] + key: [ Char: '+'] + - action: [Resize: Decrease,] + key: [Char: '-'] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + pane: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'p', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [MoveFocus: Left,] + key: [ Char: 'h', Left,] + - action: [MoveFocus: Right,] + key: [ Char: 'l', Right,] + - action: [MoveFocus: Down,] + key: [ Char: 'j', Down,] + - action: [MoveFocus: Up,] + key: [ Char: 'k', Up,] + - action: [SwitchFocus,] + key: [Char: 'p'] + - action: [NewPane: , SwitchToMode: Normal,] + key: [Char: 'n',] + - action: [NewPane: Down, SwitchToMode: Normal,] + key: [Char: 'd',] + - action: [NewPane: Right, SwitchToMode: Normal,] + key: [Char: 'r',] + - action: [CloseFocus, SwitchToMode: Normal,] + key: [Char: 'x',] + - action: [ToggleFocusFullscreen, SwitchToMode: Normal,] + key: [Char: 'f',] + - action: [TogglePaneFrames, SwitchToMode: Normal,] + key: [Char: 'z',] + - action: [ToggleFloatingPanes, SwitchToMode: Normal,] + key: [Char: 'w'] + - action: [TogglePaneEmbedOrFloating, SwitchToMode: Normal,] + key: [Char: 'e'] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + - action: [SwitchToMode: RenamePane, PaneNameInput: [0],] + key: [Char: 'c'] + move: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'h', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [Quit] + key: [Ctrl: 'q'] + - action: [MovePane: ,] + key: [Char: 'n', Char: "\t",] + - action: [MovePane: Left,] + key: [Char: 'h', Left,] + - action: [MovePane: Down,] + key: [Char: 'j', Down,] + - action: [MovePane: Up,] + key: [Char: 'k', Up, ] + - action: [MovePane: Right,] + key: [Char: 'l', Right,] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + tab: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 't', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: RenameTab, TabNameInput: [0],] + key: [Char: 'r'] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [GoToPreviousTab,] + key: [ Char: 'h', Left, Up, Char: 'k',] + - action: [GoToNextTab,] + key: [ Char: 'l', Right,Down, Char: 'j'] + - action: [NewTab: , SwitchToMode: Normal,] + key: [ Char: 'n',] + - action: [CloseTab, SwitchToMode: Normal,] + key: [ Char: 'x',] + - action: [ToggleActiveSyncTab, SwitchToMode: Normal,] + key: [Char: 's'] + - action: [GoToTab: 1, SwitchToMode: Normal,] + key: [ Char: '1',] + - action: [GoToTab: 2, SwitchToMode: Normal,] + key: [ Char: '2',] + - action: [GoToTab: 3, SwitchToMode: Normal,] + key: [ Char: '3',] + - action: [GoToTab: 4, SwitchToMode: Normal,] + key: [ Char: '4',] + - action: [GoToTab: 5, SwitchToMode: Normal,] + key: [ Char: '5',] + - action: [GoToTab: 6, SwitchToMode: Normal,] + key: [ Char: '6',] + - action: [GoToTab: 7, SwitchToMode: Normal,] + key: [ Char: '7',] + - action: [GoToTab: 8, SwitchToMode: Normal,] + key: [ Char: '8',] + - action: [GoToTab: 9, SwitchToMode: Normal,] + key: [ Char: '9',] + - action: [ToggleTab] + key: [ Char: "\t" ] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + scroll: + - action: [EditScrollback, SwitchToMode: Normal] + key: [Char: 'e'] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 's', Char: ' ', Char: "\n", Esc] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [ScrollToBottom, SwitchToMode: Normal,] + key: [Ctrl: 'c',] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [ScrollDown,] + key: [Char: 'j', Down,] + - action: [ScrollUp,] + key: [Char: 'k', Up,] + - action: [PageScrollDown,] + key: [Ctrl: 'f', PageDown, Right, Char: 'l',] + - action: [PageScrollUp,] + key: [Ctrl: 'b', PageUp, Left, Char: 'h',] + - action: [HalfPageScrollDown,] + key: [Char: 'd',] + - action: [HalfPageScrollUp,] + key: [Char: 'u',] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + # uncomment this and adjust key if using copy_on_select=false + # - action: [Copy: ] + # key: [ Alt: 'c'] + - action: [SwitchToMode: EnterSearch, SearchInput: [0],] + key: [Char: 's'] + entersearch: + - action: [SwitchToMode: Search,] + key: [Char: "\n"] + - action: [SearchInput: [27], SwitchToMode: Scroll,] + key: [Ctrl: 'c', Esc] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + search: + - action: [SwitchToMode: Normal,] + key: [Ctrl: 's', Char: ' ', Char: "\n", Esc] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [ScrollToBottom, SwitchToMode: Normal,] + key: [Ctrl: 'c',] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [ScrollDown,] + key: [Char: 'j', Down,] + - action: [ScrollUp,] + key: [Char: 'k', Up,] + - action: [PageScrollDown,] + key: [Ctrl: 'f', PageDown, Right, Char: 'l',] + - action: [PageScrollUp,] + key: [Ctrl: 'b', PageUp, Left, Char: 'h',] + - action: [HalfPageScrollDown,] + key: [Char: 'd',] + - action: [HalfPageScrollUp,] + key: [Char: 'u',] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + - action: [SwitchToMode: EnterSearch, SearchInput: [0],] + key: [Char: 's'] + - action: [Search: Down] + key: [Char: 'n'] + - action: [Search: Up] + key: [Char: 'p'] + - action: [SearchToggleOption: CaseSensitivity] + key: [Char: 'c'] + - action: [SearchToggleOption: Wrap] + key: [Char: 'w'] + - action: [SearchToggleOption: WholeWord] + key: [Char: 'o'] + renametab: + - action: [SwitchToMode: Normal,] + key: [Char: "\n", Ctrl: 'c', Esc] + - action: [UndoRenameTab , SwitchToMode: Tab,] + key: [Esc,] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + renamepane: + - action: [SwitchToMode: Normal,] + key: [Char: "\n", Ctrl: 'c', Esc] + - action: [UndoRenamePane , SwitchToMode: Pane,] + key: [Esc,] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + session: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'o', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [Detach,] + key: [Char: 'd',] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + tmux: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'o', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Scroll,] + key: [ Char: '['] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [Write: [2,], SwitchToMode: Normal] + key: [Ctrl: 'b'] + - action: [NewPane: Down, SwitchToMode: Normal,] + key: [Char: "\"",] + - action: [NewPane: Right, SwitchToMode: Normal,] + key: [Char: '%',] + - action: [ToggleFocusFullscreen, SwitchToMode: Normal,] + key: [Char: 'z',] + - action: [NewTab: , SwitchToMode: Normal,] + key: [ Char: 'c',] + - action: [SwitchToMode: RenameTab, TabNameInput: [0],] + key: [Char: ','] + - action: [GoToPreviousTab, SwitchToMode: Normal,] + key: [ Char: 'p'] + - action: [GoToNextTab, SwitchToMode: Normal,] + key: [ Char: 'n'] + - action: [MoveFocus: Left, SwitchToMode: Normal,] + key: [ Left,] + - action: [MoveFocus: Right, SwitchToMode: Normal,] + key: [ Right,] + - action: [MoveFocus: Down, SwitchToMode: Normal,] + key: [ Down,] + - action: [MoveFocus: Up, SwitchToMode: Normal,] + key: [ Up,] + - action: [MoveFocus: Left, SwitchToMode: Normal,] + key: [ Char: 'h'] + - action: [MoveFocus: Right, SwitchToMode: Normal,] + key: [ Char: 'l'] + - action: [MoveFocus: Down, SwitchToMode: Normal,] + key: [ Char: 'j'] + - action: [MoveFocus: Up, SwitchToMode: Normal,] + key: [ Char: 'k'] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [FocusNextPane,] + key: [ Char: 'o'] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + - action: [Detach,] + key: [Char: 'd',] +plugins: + - path: tab-bar + tag: tab-bar + - path: status-bar + tag: status-bar + - path: strider + tag: strider + - path: compact-bar + tag: compact-bar + +env: + foo: bar + bar: baz + RUST_BACKTRACE: "1" + +# Choose what to do when zellij receives SIGTERM, SIGINT, SIGQUIT or SIGHUP +# eg. when terminal window with an active zellij session is closed +# Options: +# - detach (Default) +# - quit +# on_force_close: quit + +# Send a request for a simplified ui (without arrow fonts) to plugins +# Options: +# - true +# - false (Default) +# simplified_ui: true + +# Choose the path to the default shell that zellij will use for opening new panes +# Default: $SHELL +# default_shell: fish + +# Toggle between having pane frames around the panes +# Options: +# - true (default) +# - false +#pane_frames: true + +# Choose the theme that is specified in the themes section. +# For some examples, see: https://github.com/zellij-org/zellij/tree/main/example/themes +# Default: default +#theme: default + +# Choose the mode that zellij uses when starting up. +# Default: normal +#default_mode: locked + +# Toggle enabling the mouse mode. +# On certain configurations, or terminals this could +# potentially interfere with copying text. +# Options: +# - true (default) +# - false +#mouse_mode: false + +# Configure the scroll back buffer size +# This is the number of lines zellij stores for each pane in the scroll back +# buffer. Excess number of lines are discarded in a FIFO fashion. +# Valid values: positive integers +# Default value: 10000 +#scroll_buffer_size: 10000 + +# Provide a command to execute when copying text. The text will be piped to +# the stdin of the program to perform the copy. This can be used with +# terminal emulators which do not support the OSC 52 ANSI control sequence +# that will be used by default if this option is not set. +# Examples: +#copy_command: "xclip -selection clipboard" # x11 +#copy_command: "wl-copy" # wayland +#copy_command: "pbcopy" # osx + +# Choose the destination for copied text +# Allows using the primary selection buffer (on x11/wayland) instead of the system clipboard. +# Does not apply when using copy_command. +# Options: +# - system (default) +# - primary +#copy_clipboard: primary + +# Enable or disable automatic copy (and clear) of selection when releasing mouse +#copy_on_select: true + +# Path to the default editor to use to edit pane scrollbuffer +# scrollback_editor: /usr/bin/nano diff --git a/zellij-client/src/old_config_converter/unit/fixtures/old_yaml_config_with_global_keybind_unbinds.yaml b/zellij-client/src/old_config_converter/unit/fixtures/old_yaml_config_with_global_keybind_unbinds.yaml new file mode 100644 index 00000000..819764cb --- /dev/null +++ b/zellij-client/src/old_config_converter/unit/fixtures/old_yaml_config_with_global_keybind_unbinds.yaml @@ -0,0 +1,639 @@ +--- +# Configuration for zellij. + +# In order to troubleshoot your configuration try using the following command: +# `zellij setup --check` +# It should show current config locations and features that are enabled. + +keybinds: + unbind: [Ctrl: 'g', Char: ' '] + normal: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's',] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [NewPane: ] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right ] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up, ] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + # uncomment this and adjust key if using copy_on_select=false + # - action: [Copy: ] + # key: [ Alt: 'c'] + locked: + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'g',] + resize: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'n', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [Quit] + key: [Ctrl: 'q'] + - action: [Resize: Left,] + key: [Char: 'h', Left,] + - action: [Resize: Down,] + key: [Char: 'j', Down,] + - action: [Resize: Up,] + key: [Char: 'k', Up, ] + - action: [Resize: Right,] + key: [Char: 'l', Right,] + - action: [Resize: Increase,] + key: [Char: '='] + - action: [Resize: Increase,] + key: [ Char: '+'] + - action: [Resize: Decrease,] + key: [Char: '-'] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + pane: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'p', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [MoveFocus: Left,] + key: [ Char: 'h', Left,] + - action: [MoveFocus: Right,] + key: [ Char: 'l', Right,] + - action: [MoveFocus: Down,] + key: [ Char: 'j', Down,] + - action: [MoveFocus: Up,] + key: [ Char: 'k', Up,] + - action: [SwitchFocus,] + key: [Char: 'p'] + - action: [NewPane: , SwitchToMode: Normal,] + key: [Char: 'n',] + - action: [NewPane: Down, SwitchToMode: Normal,] + key: [Char: 'd',] + - action: [NewPane: Right, SwitchToMode: Normal,] + key: [Char: 'r',] + - action: [CloseFocus, SwitchToMode: Normal,] + key: [Char: 'x',] + - action: [ToggleFocusFullscreen, SwitchToMode: Normal,] + key: [Char: 'f',] + - action: [TogglePaneFrames, SwitchToMode: Normal,] + key: [Char: 'z',] + - action: [ToggleFloatingPanes, SwitchToMode: Normal,] + key: [Char: 'w'] + - action: [TogglePaneEmbedOrFloating, SwitchToMode: Normal,] + key: [Char: 'e'] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + - action: [SwitchToMode: RenamePane, PaneNameInput: [0],] + key: [Char: 'c'] + move: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'h', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [Quit] + key: [Ctrl: 'q'] + - action: [MovePane: ,] + key: [Char: 'n', Char: "\t",] + - action: [MovePane: Left,] + key: [Char: 'h', Left,] + - action: [MovePane: Down,] + key: [Char: 'j', Down,] + - action: [MovePane: Up,] + key: [Char: 'k', Up, ] + - action: [MovePane: Right,] + key: [Char: 'l', Right,] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + tab: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 't', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: RenameTab, TabNameInput: [0],] + key: [Char: 'r'] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [GoToPreviousTab,] + key: [ Char: 'h', Left, Up, Char: 'k',] + - action: [GoToNextTab,] + key: [ Char: 'l', Right,Down, Char: 'j'] + - action: [NewTab: , SwitchToMode: Normal,] + key: [ Char: 'n',] + - action: [CloseTab, SwitchToMode: Normal,] + key: [ Char: 'x',] + - action: [ToggleActiveSyncTab, SwitchToMode: Normal,] + key: [Char: 's'] + - action: [GoToTab: 1, SwitchToMode: Normal,] + key: [ Char: '1',] + - action: [GoToTab: 2, SwitchToMode: Normal,] + key: [ Char: '2',] + - action: [GoToTab: 3, SwitchToMode: Normal,] + key: [ Char: '3',] + - action: [GoToTab: 4, SwitchToMode: Normal,] + key: [ Char: '4',] + - action: [GoToTab: 5, SwitchToMode: Normal,] + key: [ Char: '5',] + - action: [GoToTab: 6, SwitchToMode: Normal,] + key: [ Char: '6',] + - action: [GoToTab: 7, SwitchToMode: Normal,] + key: [ Char: '7',] + - action: [GoToTab: 8, SwitchToMode: Normal,] + key: [ Char: '8',] + - action: [GoToTab: 9, SwitchToMode: Normal,] + key: [ Char: '9',] + - action: [ToggleTab] + key: [ Char: "\t" ] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + scroll: + - action: [EditScrollback, SwitchToMode: Normal] + key: [Char: 'e'] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 's', Char: ' ', Char: "\n", Esc] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [ScrollToBottom, SwitchToMode: Normal,] + key: [Ctrl: 'c',] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [ScrollDown,] + key: [Char: 'j', Down,] + - action: [ScrollUp,] + key: [Char: 'k', Up,] + - action: [PageScrollDown,] + key: [Ctrl: 'f', PageDown, Right, Char: 'l',] + - action: [PageScrollUp,] + key: [Ctrl: 'b', PageUp, Left, Char: 'h',] + - action: [HalfPageScrollDown,] + key: [Char: 'd',] + - action: [HalfPageScrollUp,] + key: [Char: 'u',] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + # uncomment this and adjust key if using copy_on_select=false + # - action: [Copy: ] + # key: [ Alt: 'c'] + - action: [SwitchToMode: EnterSearch, SearchInput: [0],] + key: [Char: 's'] + entersearch: + - action: [SwitchToMode: Search,] + key: [Char: "\n"] + - action: [SearchInput: [27], SwitchToMode: Scroll,] + key: [Ctrl: 'c', Esc] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + search: + - action: [SwitchToMode: Normal,] + key: [Ctrl: 's', Char: ' ', Char: "\n", Esc] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [ScrollToBottom, SwitchToMode: Normal,] + key: [Ctrl: 'c',] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [ScrollDown,] + key: [Char: 'j', Down,] + - action: [ScrollUp,] + key: [Char: 'k', Up,] + - action: [PageScrollDown,] + key: [Ctrl: 'f', PageDown, Right, Char: 'l',] + - action: [PageScrollUp,] + key: [Ctrl: 'b', PageUp, Left, Char: 'h',] + - action: [HalfPageScrollDown,] + key: [Char: 'd',] + - action: [HalfPageScrollUp,] + key: [Char: 'u',] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + - action: [SwitchToMode: EnterSearch, SearchInput: [0],] + key: [Char: 's'] + - action: [Search: Down] + key: [Char: 'n'] + - action: [Search: Up] + key: [Char: 'p'] + - action: [SearchToggleOption: CaseSensitivity] + key: [Char: 'c'] + - action: [SearchToggleOption: Wrap] + key: [Char: 'w'] + - action: [SearchToggleOption: WholeWord] + key: [Char: 'o'] + renametab: + - action: [SwitchToMode: Normal,] + key: [Char: "\n", Ctrl: 'c', Esc] + - action: [UndoRenameTab , SwitchToMode: Tab,] + key: [Esc,] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + renamepane: + - action: [SwitchToMode: Normal,] + key: [Char: "\n", Ctrl: 'c', Esc] + - action: [UndoRenamePane , SwitchToMode: Pane,] + key: [Esc,] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + session: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'o', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [Detach,] + key: [Char: 'd',] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + tmux: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'o', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Scroll,] + key: [ Char: '['] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [Write: [2,], SwitchToMode: Normal] + key: [Ctrl: 'b'] + - action: [NewPane: Down, SwitchToMode: Normal,] + key: [Char: "\"",] + - action: [NewPane: Right, SwitchToMode: Normal,] + key: [Char: '%',] + - action: [ToggleFocusFullscreen, SwitchToMode: Normal,] + key: [Char: 'z',] + - action: [NewTab: , SwitchToMode: Normal,] + key: [ Char: 'c',] + - action: [SwitchToMode: RenameTab, TabNameInput: [0],] + key: [Char: ','] + - action: [GoToPreviousTab, SwitchToMode: Normal,] + key: [ Char: 'p'] + - action: [GoToNextTab, SwitchToMode: Normal,] + key: [ Char: 'n'] + - action: [MoveFocus: Left, SwitchToMode: Normal,] + key: [ Left,] + - action: [MoveFocus: Right, SwitchToMode: Normal,] + key: [ Right,] + - action: [MoveFocus: Down, SwitchToMode: Normal,] + key: [ Down,] + - action: [MoveFocus: Up, SwitchToMode: Normal,] + key: [ Up,] + - action: [MoveFocus: Left, SwitchToMode: Normal,] + key: [ Char: 'h'] + - action: [MoveFocus: Right, SwitchToMode: Normal,] + key: [ Char: 'l'] + - action: [MoveFocus: Down, SwitchToMode: Normal,] + key: [ Char: 'j'] + - action: [MoveFocus: Up, SwitchToMode: Normal,] + key: [ Char: 'k'] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [FocusNextPane,] + key: [ Char: 'o'] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + - action: [Detach,] + key: [Char: 'd',] +plugins: + - path: tab-bar + tag: tab-bar + - path: status-bar + tag: status-bar + - path: strider + tag: strider + - path: compact-bar + tag: compact-bar + +# Choose what to do when zellij receives SIGTERM, SIGINT, SIGQUIT or SIGHUP +# eg. when terminal window with an active zellij session is closed +# Options: +# - detach (Default) +# - quit +# on_force_close: quit + +# Send a request for a simplified ui (without arrow fonts) to plugins +# Options: +# - true +# - false (Default) +# simplified_ui: true + +# Choose the path to the default shell that zellij will use for opening new panes +# Default: $SHELL +# default_shell: fish + +# Toggle between having pane frames around the panes +# Options: +# - true (default) +# - false +#pane_frames: true + +# Choose the theme that is specified in the themes section. +# For some examples, see: https://github.com/zellij-org/zellij/tree/main/example/themes +# Default: default +#theme: default + +# Choose the mode that zellij uses when starting up. +# Default: normal +#default_mode: locked + +# Toggle enabling the mouse mode. +# On certain configurations, or terminals this could +# potentially interfere with copying text. +# Options: +# - true (default) +# - false +#mouse_mode: false + +# Configure the scroll back buffer size +# This is the number of lines zellij stores for each pane in the scroll back +# buffer. Excess number of lines are discarded in a FIFO fashion. +# Valid values: positive integers +# Default value: 10000 +#scroll_buffer_size: 10000 + +# Provide a command to execute when copying text. The text will be piped to +# the stdin of the program to perform the copy. This can be used with +# terminal emulators which do not support the OSC 52 ANSI control sequence +# that will be used by default if this option is not set. +# Examples: +#copy_command: "xclip -selection clipboard" # x11 +#copy_command: "wl-copy" # wayland +#copy_command: "pbcopy" # osx + +# Choose the destination for copied text +# Allows using the primary selection buffer (on x11/wayland) instead of the system clipboard. +# Does not apply when using copy_command. +# Options: +# - system (default) +# - primary +#copy_clipboard: primary + +# Enable or disable automatic copy (and clear) of selection when releasing mouse +#copy_on_select: true + +# Path to the default editor to use to edit pane scrollbuffer +# scrollback_editor: /usr/bin/nano diff --git a/zellij-client/src/old_config_converter/unit/fixtures/old_yaml_config_with_themes.yaml b/zellij-client/src/old_config_converter/unit/fixtures/old_yaml_config_with_themes.yaml new file mode 100644 index 00000000..d2839a64 --- /dev/null +++ b/zellij-client/src/old_config_converter/unit/fixtures/old_yaml_config_with_themes.yaml @@ -0,0 +1,677 @@ +--- +# Configuration for zellij. + +# In order to troubleshoot your configuration try using the following command: +# `zellij setup --check` +# It should show current config locations and features that are enabled. + +keybinds: + unbind: true + normal: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's',] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [NewPane: ] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right ] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up, ] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + # uncomment this and adjust key if using copy_on_select=false + # - action: [Copy: ] + # key: [ Alt: 'c'] + locked: + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'g',] + resize: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'n', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [Quit] + key: [Ctrl: 'q'] + - action: [Resize: Left,] + key: [Char: 'h', Left,] + - action: [Resize: Down,] + key: [Char: 'j', Down,] + - action: [Resize: Up,] + key: [Char: 'k', Up, ] + - action: [Resize: Right,] + key: [Char: 'l', Right,] + - action: [Resize: Increase,] + key: [Char: '='] + - action: [Resize: Increase,] + key: [ Char: '+'] + - action: [Resize: Decrease,] + key: [Char: '-'] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + pane: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'p', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [MoveFocus: Left,] + key: [ Char: 'h', Left,] + - action: [MoveFocus: Right,] + key: [ Char: 'l', Right,] + - action: [MoveFocus: Down,] + key: [ Char: 'j', Down,] + - action: [MoveFocus: Up,] + key: [ Char: 'k', Up,] + - action: [SwitchFocus,] + key: [Char: 'p'] + - action: [NewPane: , SwitchToMode: Normal,] + key: [Char: 'n',] + - action: [NewPane: Down, SwitchToMode: Normal,] + key: [Char: 'd',] + - action: [NewPane: Right, SwitchToMode: Normal,] + key: [Char: 'r',] + - action: [CloseFocus, SwitchToMode: Normal,] + key: [Char: 'x',] + - action: [ToggleFocusFullscreen, SwitchToMode: Normal,] + key: [Char: 'f',] + - action: [TogglePaneFrames, SwitchToMode: Normal,] + key: [Char: 'z',] + - action: [ToggleFloatingPanes, SwitchToMode: Normal,] + key: [Char: 'w'] + - action: [TogglePaneEmbedOrFloating, SwitchToMode: Normal,] + key: [Char: 'e'] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + - action: [SwitchToMode: RenamePane, PaneNameInput: [0],] + key: [Char: 'c'] + move: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'h', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [Quit] + key: [Ctrl: 'q'] + - action: [MovePane: ,] + key: [Char: 'n', Char: "\t",] + - action: [MovePane: Left,] + key: [Char: 'h', Left,] + - action: [MovePane: Down,] + key: [Char: 'j', Down,] + - action: [MovePane: Up,] + key: [Char: 'k', Up, ] + - action: [MovePane: Right,] + key: [Char: 'l', Right,] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + tab: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 't', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: RenameTab, TabNameInput: [0],] + key: [Char: 'r'] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [GoToPreviousTab,] + key: [ Char: 'h', Left, Up, Char: 'k',] + - action: [GoToNextTab,] + key: [ Char: 'l', Right,Down, Char: 'j'] + - action: [NewTab: , SwitchToMode: Normal,] + key: [ Char: 'n',] + - action: [CloseTab, SwitchToMode: Normal,] + key: [ Char: 'x',] + - action: [ToggleActiveSyncTab, SwitchToMode: Normal,] + key: [Char: 's'] + - action: [GoToTab: 1, SwitchToMode: Normal,] + key: [ Char: '1',] + - action: [GoToTab: 2, SwitchToMode: Normal,] + key: [ Char: '2',] + - action: [GoToTab: 3, SwitchToMode: Normal,] + key: [ Char: '3',] + - action: [GoToTab: 4, SwitchToMode: Normal,] + key: [ Char: '4',] + - action: [GoToTab: 5, SwitchToMode: Normal,] + key: [ Char: '5',] + - action: [GoToTab: 6, SwitchToMode: Normal,] + key: [ Char: '6',] + - action: [GoToTab: 7, SwitchToMode: Normal,] + key: [ Char: '7',] + - action: [GoToTab: 8, SwitchToMode: Normal,] + key: [ Char: '8',] + - action: [GoToTab: 9, SwitchToMode: Normal,] + key: [ Char: '9',] + - action: [ToggleTab] + key: [ Char: "\t" ] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + scroll: + - action: [EditScrollback, SwitchToMode: Normal] + key: [Char: 'e'] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 's', Char: ' ', Char: "\n", Esc] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [ScrollToBottom, SwitchToMode: Normal,] + key: [Ctrl: 'c',] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [ScrollDown,] + key: [Char: 'j', Down,] + - action: [ScrollUp,] + key: [Char: 'k', Up,] + - action: [PageScrollDown,] + key: [Ctrl: 'f', PageDown, Right, Char: 'l',] + - action: [PageScrollUp,] + key: [Ctrl: 'b', PageUp, Left, Char: 'h',] + - action: [HalfPageScrollDown,] + key: [Char: 'd',] + - action: [HalfPageScrollUp,] + key: [Char: 'u',] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + # uncomment this and adjust key if using copy_on_select=false + # - action: [Copy: ] + # key: [ Alt: 'c'] + - action: [SwitchToMode: EnterSearch, SearchInput: [0],] + key: [Char: 's'] + entersearch: + - action: [SwitchToMode: Search,] + key: [Char: "\n"] + - action: [SearchInput: [27], SwitchToMode: Scroll,] + key: [Ctrl: 'c', Esc] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + search: + - action: [SwitchToMode: Normal,] + key: [Ctrl: 's', Char: ' ', Char: "\n", Esc] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [ScrollToBottom, SwitchToMode: Normal,] + key: [Ctrl: 'c',] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [ScrollDown,] + key: [Char: 'j', Down,] + - action: [ScrollUp,] + key: [Char: 'k', Up,] + - action: [PageScrollDown,] + key: [Ctrl: 'f', PageDown, Right, Char: 'l',] + - action: [PageScrollUp,] + key: [Ctrl: 'b', PageUp, Left, Char: 'h',] + - action: [HalfPageScrollDown,] + key: [Char: 'd',] + - action: [HalfPageScrollUp,] + key: [Char: 'u',] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + - action: [SwitchToMode: EnterSearch, SearchInput: [0],] + key: [Char: 's'] + - action: [Search: Down] + key: [Char: 'n'] + - action: [Search: Up] + key: [Char: 'p'] + - action: [SearchToggleOption: CaseSensitivity] + key: [Char: 'c'] + - action: [SearchToggleOption: Wrap] + key: [Char: 'w'] + - action: [SearchToggleOption: WholeWord] + key: [Char: 'o'] + renametab: + - action: [SwitchToMode: Normal,] + key: [Char: "\n", Ctrl: 'c', Esc] + - action: [UndoRenameTab , SwitchToMode: Tab,] + key: [Esc,] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + renamepane: + - action: [SwitchToMode: Normal,] + key: [Char: "\n", Ctrl: 'c', Esc] + - action: [UndoRenamePane , SwitchToMode: Pane,] + key: [Esc,] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + session: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'o', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [Detach,] + key: [Char: 'd',] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + tmux: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'o', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Scroll,] + key: [ Char: '['] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [Write: [2,], SwitchToMode: Normal] + key: [Ctrl: 'b'] + - action: [NewPane: Down, SwitchToMode: Normal,] + key: [Char: "\"",] + - action: [NewPane: Right, SwitchToMode: Normal,] + key: [Char: '%',] + - action: [ToggleFocusFullscreen, SwitchToMode: Normal,] + key: [Char: 'z',] + - action: [NewTab: , SwitchToMode: Normal,] + key: [ Char: 'c',] + - action: [SwitchToMode: RenameTab, TabNameInput: [0],] + key: [Char: ','] + - action: [GoToPreviousTab, SwitchToMode: Normal,] + key: [ Char: 'p'] + - action: [GoToNextTab, SwitchToMode: Normal,] + key: [ Char: 'n'] + - action: [MoveFocus: Left, SwitchToMode: Normal,] + key: [ Left,] + - action: [MoveFocus: Right, SwitchToMode: Normal,] + key: [ Right,] + - action: [MoveFocus: Down, SwitchToMode: Normal,] + key: [ Down,] + - action: [MoveFocus: Up, SwitchToMode: Normal,] + key: [ Up,] + - action: [MoveFocus: Left, SwitchToMode: Normal,] + key: [ Char: 'h'] + - action: [MoveFocus: Right, SwitchToMode: Normal,] + key: [ Char: 'l'] + - action: [MoveFocus: Down, SwitchToMode: Normal,] + key: [ Char: 'j'] + - action: [MoveFocus: Up, SwitchToMode: Normal,] + key: [ Char: 'k'] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [FocusNextPane,] + key: [ Char: 'o'] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + - action: [Detach,] + key: [Char: 'd',] +plugins: + - path: tab-bar + tag: tab-bar + - path: status-bar + tag: status-bar + - path: strider + tag: strider + - path: compact-bar + tag: compact-bar + +# Choose what to do when zellij receives SIGTERM, SIGINT, SIGQUIT or SIGHUP +# eg. when terminal window with an active zellij session is closed +# Options: +# - detach (Default) +# - quit +# on_force_close: quit + +# Send a request for a simplified ui (without arrow fonts) to plugins +# Options: +# - true +# - false (Default) +# simplified_ui: true + +# Choose the path to the default shell that zellij will use for opening new panes +# Default: $SHELL +# default_shell: fish + +# Toggle between having pane frames around the panes +# Options: +# - true (default) +# - false +#pane_frames: true + +# Choose the theme that is specified in the themes section. +# For some examples, see: https://github.com/zellij-org/zellij/tree/main/example/themes +# Default: default +#theme: default + +# Choose the mode that zellij uses when starting up. +# Default: normal +#default_mode: locked + +# Toggle enabling the mouse mode. +# On certain configurations, or terminals this could +# potentially interfere with copying text. +# Options: +# - true (default) +# - false +#mouse_mode: false + +# Configure the scroll back buffer size +# This is the number of lines zellij stores for each pane in the scroll back +# buffer. Excess number of lines are discarded in a FIFO fashion. +# Valid values: positive integers +# Default value: 10000 +#scroll_buffer_size: 10000 + +# Provide a command to execute when copying text. The text will be piped to +# the stdin of the program to perform the copy. This can be used with +# terminal emulators which do not support the OSC 52 ANSI control sequence +# that will be used by default if this option is not set. +# Examples: +#copy_command: "xclip -selection clipboard" # x11 +#copy_command: "wl-copy" # wayland +#copy_command: "pbcopy" # osx + +# Choose the destination for copied text +# Allows using the primary selection buffer (on x11/wayland) instead of the system clipboard. +# Does not apply when using copy_command. +# Options: +# - system (default) +# - primary +#copy_clipboard: primary + +# Enable or disable automatic copy (and clear) of selection when releasing mouse +#copy_on_select: true + +# Path to the default editor to use to edit pane scrollbuffer +# scrollback_editor: /usr/bin/nano +# +themes: + nord: + fg: "D8DEE9" + bg: "#2E3440" + black: "#3B4252" + red: "#BF616A" + green: "#A3BE8C" + yellow: "#EBCB8B" + blue: "#81A1C1" + magenta: "#B48EAD" + cyan: "#88C0D0" + white: "#E5E9F0" + orange: "#D08770" + molokai-dark: + bg: [27, 29, 30] + red: [255, 0, 0] + green: [0, 140, 0] + yellow: [255, 255, 0] + blue: [102, 217, 239] + magenta: [174, 129, 255] + orange: [253, 151, 31] + fg: [248, 248, 240] + cyan: [0, 255, 255] + black: [0, 0, 0] + white: [255, 255, 255] + some-eightbit-theme: + bg: 0 + red: 2 + green: 3 + yellow: 4 + blue: 5 + magenta: 6 + orange: 7 + fg: 8 + cyan: 9 + black: 10 + white: 255 diff --git a/zellij-client/src/old_config_converter/unit/fixtures/old_yaml_config_with_ui.yaml b/zellij-client/src/old_config_converter/unit/fixtures/old_yaml_config_with_ui.yaml new file mode 100644 index 00000000..edf4af81 --- /dev/null +++ b/zellij-client/src/old_config_converter/unit/fixtures/old_yaml_config_with_ui.yaml @@ -0,0 +1,643 @@ +--- +# Configuration for zellij. + +# In order to troubleshoot your configuration try using the following command: +# `zellij setup --check` +# It should show current config locations and features that are enabled. + +keybinds: + unbind: true + normal: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's',] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [NewPane: ] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right ] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up, ] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + # uncomment this and adjust key if using copy_on_select=false + # - action: [Copy: ] + # key: [ Alt: 'c'] + locked: + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'g',] + resize: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'n', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [Quit] + key: [Ctrl: 'q'] + - action: [Resize: Left,] + key: [Char: 'h', Left,] + - action: [Resize: Down,] + key: [Char: 'j', Down,] + - action: [Resize: Up,] + key: [Char: 'k', Up, ] + - action: [Resize: Right,] + key: [Char: 'l', Right,] + - action: [Resize: Increase,] + key: [Char: '='] + - action: [Resize: Increase,] + key: [ Char: '+'] + - action: [Resize: Decrease,] + key: [Char: '-'] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + pane: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'p', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [MoveFocus: Left,] + key: [ Char: 'h', Left,] + - action: [MoveFocus: Right,] + key: [ Char: 'l', Right,] + - action: [MoveFocus: Down,] + key: [ Char: 'j', Down,] + - action: [MoveFocus: Up,] + key: [ Char: 'k', Up,] + - action: [SwitchFocus,] + key: [Char: 'p'] + - action: [NewPane: , SwitchToMode: Normal,] + key: [Char: 'n',] + - action: [NewPane: Down, SwitchToMode: Normal,] + key: [Char: 'd',] + - action: [NewPane: Right, SwitchToMode: Normal,] + key: [Char: 'r',] + - action: [CloseFocus, SwitchToMode: Normal,] + key: [Char: 'x',] + - action: [ToggleFocusFullscreen, SwitchToMode: Normal,] + key: [Char: 'f',] + - action: [TogglePaneFrames, SwitchToMode: Normal,] + key: [Char: 'z',] + - action: [ToggleFloatingPanes, SwitchToMode: Normal,] + key: [Char: 'w'] + - action: [TogglePaneEmbedOrFloating, SwitchToMode: Normal,] + key: [Char: 'e'] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + - action: [SwitchToMode: RenamePane, PaneNameInput: [0],] + key: [Char: 'c'] + move: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'h', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [Quit] + key: [Ctrl: 'q'] + - action: [MovePane: ,] + key: [Char: 'n', Char: "\t",] + - action: [MovePane: Left,] + key: [Char: 'h', Left,] + - action: [MovePane: Down,] + key: [Char: 'j', Down,] + - action: [MovePane: Up,] + key: [Char: 'k', Up, ] + - action: [MovePane: Right,] + key: [Char: 'l', Right,] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + tab: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 't', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: RenameTab, TabNameInput: [0],] + key: [Char: 'r'] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [GoToPreviousTab,] + key: [ Char: 'h', Left, Up, Char: 'k',] + - action: [GoToNextTab,] + key: [ Char: 'l', Right,Down, Char: 'j'] + - action: [NewTab: , SwitchToMode: Normal,] + key: [ Char: 'n',] + - action: [CloseTab, SwitchToMode: Normal,] + key: [ Char: 'x',] + - action: [ToggleActiveSyncTab, SwitchToMode: Normal,] + key: [Char: 's'] + - action: [GoToTab: 1, SwitchToMode: Normal,] + key: [ Char: '1',] + - action: [GoToTab: 2, SwitchToMode: Normal,] + key: [ Char: '2',] + - action: [GoToTab: 3, SwitchToMode: Normal,] + key: [ Char: '3',] + - action: [GoToTab: 4, SwitchToMode: Normal,] + key: [ Char: '4',] + - action: [GoToTab: 5, SwitchToMode: Normal,] + key: [ Char: '5',] + - action: [GoToTab: 6, SwitchToMode: Normal,] + key: [ Char: '6',] + - action: [GoToTab: 7, SwitchToMode: Normal,] + key: [ Char: '7',] + - action: [GoToTab: 8, SwitchToMode: Normal,] + key: [ Char: '8',] + - action: [GoToTab: 9, SwitchToMode: Normal,] + key: [ Char: '9',] + - action: [ToggleTab] + key: [ Char: "\t" ] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + scroll: + - action: [EditScrollback, SwitchToMode: Normal] + key: [Char: 'e'] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 's', Char: ' ', Char: "\n", Esc] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [ScrollToBottom, SwitchToMode: Normal,] + key: [Ctrl: 'c',] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [ScrollDown,] + key: [Char: 'j', Down,] + - action: [ScrollUp,] + key: [Char: 'k', Up,] + - action: [PageScrollDown,] + key: [Ctrl: 'f', PageDown, Right, Char: 'l',] + - action: [PageScrollUp,] + key: [Ctrl: 'b', PageUp, Left, Char: 'h',] + - action: [HalfPageScrollDown,] + key: [Char: 'd',] + - action: [HalfPageScrollUp,] + key: [Char: 'u',] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + # uncomment this and adjust key if using copy_on_select=false + # - action: [Copy: ] + # key: [ Alt: 'c'] + - action: [SwitchToMode: EnterSearch, SearchInput: [0],] + key: [Char: 's'] + entersearch: + - action: [SwitchToMode: Search,] + key: [Char: "\n"] + - action: [SearchInput: [27], SwitchToMode: Scroll,] + key: [Ctrl: 'c', Esc] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + search: + - action: [SwitchToMode: Normal,] + key: [Ctrl: 's', Char: ' ', Char: "\n", Esc] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [ScrollToBottom, SwitchToMode: Normal,] + key: [Ctrl: 'c',] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [ScrollDown,] + key: [Char: 'j', Down,] + - action: [ScrollUp,] + key: [Char: 'k', Up,] + - action: [PageScrollDown,] + key: [Ctrl: 'f', PageDown, Right, Char: 'l',] + - action: [PageScrollUp,] + key: [Ctrl: 'b', PageUp, Left, Char: 'h',] + - action: [HalfPageScrollDown,] + key: [Char: 'd',] + - action: [HalfPageScrollUp,] + key: [Char: 'u',] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + - action: [SwitchToMode: EnterSearch, SearchInput: [0],] + key: [Char: 's'] + - action: [Search: Down] + key: [Char: 'n'] + - action: [Search: Up] + key: [Char: 'p'] + - action: [SearchToggleOption: CaseSensitivity] + key: [Char: 'c'] + - action: [SearchToggleOption: Wrap] + key: [Char: 'w'] + - action: [SearchToggleOption: WholeWord] + key: [Char: 'o'] + renametab: + - action: [SwitchToMode: Normal,] + key: [Char: "\n", Ctrl: 'c', Esc] + - action: [UndoRenameTab , SwitchToMode: Tab,] + key: [Esc,] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + renamepane: + - action: [SwitchToMode: Normal,] + key: [Char: "\n", Ctrl: 'c', Esc] + - action: [UndoRenamePane , SwitchToMode: Pane,] + key: [Esc,] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + session: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'o', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [Detach,] + key: [Char: 'd',] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + tmux: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'o', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Scroll,] + key: [ Char: '['] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [Write: [2,], SwitchToMode: Normal] + key: [Ctrl: 'b'] + - action: [NewPane: Down, SwitchToMode: Normal,] + key: [Char: "\"",] + - action: [NewPane: Right, SwitchToMode: Normal,] + key: [Char: '%',] + - action: [ToggleFocusFullscreen, SwitchToMode: Normal,] + key: [Char: 'z',] + - action: [NewTab: , SwitchToMode: Normal,] + key: [ Char: 'c',] + - action: [SwitchToMode: RenameTab, TabNameInput: [0],] + key: [Char: ','] + - action: [GoToPreviousTab, SwitchToMode: Normal,] + key: [ Char: 'p'] + - action: [GoToNextTab, SwitchToMode: Normal,] + key: [ Char: 'n'] + - action: [MoveFocus: Left, SwitchToMode: Normal,] + key: [ Left,] + - action: [MoveFocus: Right, SwitchToMode: Normal,] + key: [ Right,] + - action: [MoveFocus: Down, SwitchToMode: Normal,] + key: [ Down,] + - action: [MoveFocus: Up, SwitchToMode: Normal,] + key: [ Up,] + - action: [MoveFocus: Left, SwitchToMode: Normal,] + key: [ Char: 'h'] + - action: [MoveFocus: Right, SwitchToMode: Normal,] + key: [ Char: 'l'] + - action: [MoveFocus: Down, SwitchToMode: Normal,] + key: [ Char: 'j'] + - action: [MoveFocus: Up, SwitchToMode: Normal,] + key: [ Char: 'k'] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [FocusNextPane,] + key: [ Char: 'o'] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + - action: [Detach,] + key: [Char: 'd',] +plugins: + - path: tab-bar + tag: tab-bar + - path: status-bar + tag: status-bar + - path: strider + tag: strider + - path: compact-bar + tag: compact-bar + +ui: + pane_frames: + rounded_corners: true +# Choose what to do when zellij receives SIGTERM, SIGINT, SIGQUIT or SIGHUP +# Choose what to do when zellij receives SIGTERM, SIGINT, SIGQUIT or SIGHUP +# eg. when terminal window with an active zellij session is closed +# Options: +# - detach (Default) +# - quit +# on_force_close: quit + +# Send a request for a simplified ui (without arrow fonts) to plugins +# Options: +# - true +# - false (Default) +# simplified_ui: true + +# Choose the path to the default shell that zellij will use for opening new panes +# Default: $SHELL +# default_shell: fish + +# Toggle between having pane frames around the panes +# Options: +# - true (default) +# - false +#pane_frames: true + +# Choose the theme that is specified in the themes section. +# For some examples, see: https://github.com/zellij-org/zellij/tree/main/example/themes +# Default: default +#theme: default + +# Choose the mode that zellij uses when starting up. +# Default: normal +#default_mode: locked + +# Toggle enabling the mouse mode. +# On certain configurations, or terminals this could +# potentially interfere with copying text. +# Options: +# - true (default) +# - false +#mouse_mode: false + +# Configure the scroll back buffer size +# This is the number of lines zellij stores for each pane in the scroll back +# buffer. Excess number of lines are discarded in a FIFO fashion. +# Valid values: positive integers +# Default value: 10000 +#scroll_buffer_size: 10000 + +# Provide a command to execute when copying text. The text will be piped to +# the stdin of the program to perform the copy. This can be used with +# terminal emulators which do not support the OSC 52 ANSI control sequence +# that will be used by default if this option is not set. +# Examples: +#copy_command: "xclip -selection clipboard" # x11 +#copy_command: "wl-copy" # wayland +#copy_command: "pbcopy" # osx + +# Choose the destination for copied text +# Allows using the primary selection buffer (on x11/wayland) instead of the system clipboard. +# Does not apply when using copy_command. +# Options: +# - system (default) +# - primary +#copy_clipboard: primary + +# Enable or disable automatic copy (and clear) of selection when releasing mouse +#copy_on_select: true + +# Path to the default editor to use to edit pane scrollbuffer +# scrollback_editor: /usr/bin/nano diff --git a/zellij-client/src/old_config_converter/unit/fixtures/old_yaml_config_with_unbind_all_keys_per_mode.yaml b/zellij-client/src/old_config_converter/unit/fixtures/old_yaml_config_with_unbind_all_keys_per_mode.yaml new file mode 100644 index 00000000..5cf962b8 --- /dev/null +++ b/zellij-client/src/old_config_converter/unit/fixtures/old_yaml_config_with_unbind_all_keys_per_mode.yaml @@ -0,0 +1,639 @@ +--- +# Configuration for zellij. + +# In order to troubleshoot your configuration try using the following command: +# `zellij setup --check` +# It should show current config locations and features that are enabled. + +keybinds: + normal: + - unbind: true + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's',] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [NewPane: ] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right ] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up, ] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + # uncomment this and adjust key if using copy_on_select=false + # - action: [Copy: ] + # key: [ Alt: 'c'] + locked: + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'g',] + resize: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'n', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [Quit] + key: [Ctrl: 'q'] + - action: [Resize: Left,] + key: [Char: 'h', Left,] + - action: [Resize: Down,] + key: [Char: 'j', Down,] + - action: [Resize: Up,] + key: [Char: 'k', Up, ] + - action: [Resize: Right,] + key: [Char: 'l', Right,] + - action: [Resize: Increase,] + key: [Char: '='] + - action: [Resize: Increase,] + key: [ Char: '+'] + - action: [Resize: Decrease,] + key: [Char: '-'] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + pane: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'p', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [MoveFocus: Left,] + key: [ Char: 'h', Left,] + - action: [MoveFocus: Right,] + key: [ Char: 'l', Right,] + - action: [MoveFocus: Down,] + key: [ Char: 'j', Down,] + - action: [MoveFocus: Up,] + key: [ Char: 'k', Up,] + - action: [SwitchFocus,] + key: [Char: 'p'] + - action: [NewPane: , SwitchToMode: Normal,] + key: [Char: 'n',] + - action: [NewPane: Down, SwitchToMode: Normal,] + key: [Char: 'd',] + - action: [NewPane: Right, SwitchToMode: Normal,] + key: [Char: 'r',] + - action: [CloseFocus, SwitchToMode: Normal,] + key: [Char: 'x',] + - action: [ToggleFocusFullscreen, SwitchToMode: Normal,] + key: [Char: 'f',] + - action: [TogglePaneFrames, SwitchToMode: Normal,] + key: [Char: 'z',] + - action: [ToggleFloatingPanes, SwitchToMode: Normal,] + key: [Char: 'w'] + - action: [TogglePaneEmbedOrFloating, SwitchToMode: Normal,] + key: [Char: 'e'] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + - action: [SwitchToMode: RenamePane, PaneNameInput: [0],] + key: [Char: 'c'] + move: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'h', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [Quit] + key: [Ctrl: 'q'] + - action: [MovePane: ,] + key: [Char: 'n', Char: "\t",] + - action: [MovePane: Left,] + key: [Char: 'h', Left,] + - action: [MovePane: Down,] + key: [Char: 'j', Down,] + - action: [MovePane: Up,] + key: [Char: 'k', Up, ] + - action: [MovePane: Right,] + key: [Char: 'l', Right,] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + tab: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 't', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: RenameTab, TabNameInput: [0],] + key: [Char: 'r'] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [GoToPreviousTab,] + key: [ Char: 'h', Left, Up, Char: 'k',] + - action: [GoToNextTab,] + key: [ Char: 'l', Right,Down, Char: 'j'] + - action: [NewTab: , SwitchToMode: Normal,] + key: [ Char: 'n',] + - action: [CloseTab, SwitchToMode: Normal,] + key: [ Char: 'x',] + - action: [ToggleActiveSyncTab, SwitchToMode: Normal,] + key: [Char: 's'] + - action: [GoToTab: 1, SwitchToMode: Normal,] + key: [ Char: '1',] + - action: [GoToTab: 2, SwitchToMode: Normal,] + key: [ Char: '2',] + - action: [GoToTab: 3, SwitchToMode: Normal,] + key: [ Char: '3',] + - action: [GoToTab: 4, SwitchToMode: Normal,] + key: [ Char: '4',] + - action: [GoToTab: 5, SwitchToMode: Normal,] + key: [ Char: '5',] + - action: [GoToTab: 6, SwitchToMode: Normal,] + key: [ Char: '6',] + - action: [GoToTab: 7, SwitchToMode: Normal,] + key: [ Char: '7',] + - action: [GoToTab: 8, SwitchToMode: Normal,] + key: [ Char: '8',] + - action: [GoToTab: 9, SwitchToMode: Normal,] + key: [ Char: '9',] + - action: [ToggleTab] + key: [ Char: "\t" ] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + scroll: + - action: [EditScrollback, SwitchToMode: Normal] + key: [Char: 'e'] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 's', Char: ' ', Char: "\n", Esc] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [ScrollToBottom, SwitchToMode: Normal,] + key: [Ctrl: 'c',] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [ScrollDown,] + key: [Char: 'j', Down,] + - action: [ScrollUp,] + key: [Char: 'k', Up,] + - action: [PageScrollDown,] + key: [Ctrl: 'f', PageDown, Right, Char: 'l',] + - action: [PageScrollUp,] + key: [Ctrl: 'b', PageUp, Left, Char: 'h',] + - action: [HalfPageScrollDown,] + key: [Char: 'd',] + - action: [HalfPageScrollUp,] + key: [Char: 'u',] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + # uncomment this and adjust key if using copy_on_select=false + # - action: [Copy: ] + # key: [ Alt: 'c'] + - action: [SwitchToMode: EnterSearch, SearchInput: [0],] + key: [Char: 's'] + entersearch: + - action: [SwitchToMode: Search,] + key: [Char: "\n"] + - action: [SearchInput: [27], SwitchToMode: Scroll,] + key: [Ctrl: 'c', Esc] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + search: + - action: [SwitchToMode: Normal,] + key: [Ctrl: 's', Char: ' ', Char: "\n", Esc] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [ScrollToBottom, SwitchToMode: Normal,] + key: [Ctrl: 'c',] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [ScrollDown,] + key: [Char: 'j', Down,] + - action: [ScrollUp,] + key: [Char: 'k', Up,] + - action: [PageScrollDown,] + key: [Ctrl: 'f', PageDown, Right, Char: 'l',] + - action: [PageScrollUp,] + key: [Ctrl: 'b', PageUp, Left, Char: 'h',] + - action: [HalfPageScrollDown,] + key: [Char: 'd',] + - action: [HalfPageScrollUp,] + key: [Char: 'u',] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + - action: [SwitchToMode: EnterSearch, SearchInput: [0],] + key: [Char: 's'] + - action: [Search: Down] + key: [Char: 'n'] + - action: [Search: Up] + key: [Char: 'p'] + - action: [SearchToggleOption: CaseSensitivity] + key: [Char: 'c'] + - action: [SearchToggleOption: Wrap] + key: [Char: 'w'] + - action: [SearchToggleOption: WholeWord] + key: [Char: 'o'] + renametab: + - action: [SwitchToMode: Normal,] + key: [Char: "\n", Ctrl: 'c', Esc] + - action: [UndoRenameTab , SwitchToMode: Tab,] + key: [Esc,] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + renamepane: + - action: [SwitchToMode: Normal,] + key: [Char: "\n", Ctrl: 'c', Esc] + - action: [UndoRenamePane , SwitchToMode: Pane,] + key: [Esc,] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + session: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'o', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [Detach,] + key: [Char: 'd',] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + tmux: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'o', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Scroll,] + key: [ Char: '['] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [Write: [2,], SwitchToMode: Normal] + key: [Ctrl: 'b'] + - action: [NewPane: Down, SwitchToMode: Normal,] + key: [Char: "\"",] + - action: [NewPane: Right, SwitchToMode: Normal,] + key: [Char: '%',] + - action: [ToggleFocusFullscreen, SwitchToMode: Normal,] + key: [Char: 'z',] + - action: [NewTab: , SwitchToMode: Normal,] + key: [ Char: 'c',] + - action: [SwitchToMode: RenameTab, TabNameInput: [0],] + key: [Char: ','] + - action: [GoToPreviousTab, SwitchToMode: Normal,] + key: [ Char: 'p'] + - action: [GoToNextTab, SwitchToMode: Normal,] + key: [ Char: 'n'] + - action: [MoveFocus: Left, SwitchToMode: Normal,] + key: [ Left,] + - action: [MoveFocus: Right, SwitchToMode: Normal,] + key: [ Right,] + - action: [MoveFocus: Down, SwitchToMode: Normal,] + key: [ Down,] + - action: [MoveFocus: Up, SwitchToMode: Normal,] + key: [ Up,] + - action: [MoveFocus: Left, SwitchToMode: Normal,] + key: [ Char: 'h'] + - action: [MoveFocus: Right, SwitchToMode: Normal,] + key: [ Char: 'l'] + - action: [MoveFocus: Down, SwitchToMode: Normal,] + key: [ Char: 'j'] + - action: [MoveFocus: Up, SwitchToMode: Normal,] + key: [ Char: 'k'] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [FocusNextPane,] + key: [ Char: 'o'] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + - action: [Detach,] + key: [Char: 'd',] +plugins: + - path: tab-bar + tag: tab-bar + - path: status-bar + tag: status-bar + - path: strider + tag: strider + - path: compact-bar + tag: compact-bar + +# Choose what to do when zellij receives SIGTERM, SIGINT, SIGQUIT or SIGHUP +# eg. when terminal window with an active zellij session is closed +# Options: +# - detach (Default) +# - quit +# on_force_close: quit + +# Send a request for a simplified ui (without arrow fonts) to plugins +# Options: +# - true +# - false (Default) +# simplified_ui: true + +# Choose the path to the default shell that zellij will use for opening new panes +# Default: $SHELL +# default_shell: fish + +# Toggle between having pane frames around the panes +# Options: +# - true (default) +# - false +#pane_frames: true + +# Choose the theme that is specified in the themes section. +# For some examples, see: https://github.com/zellij-org/zellij/tree/main/example/themes +# Default: default +#theme: default + +# Choose the mode that zellij uses when starting up. +# Default: normal +#default_mode: locked + +# Toggle enabling the mouse mode. +# On certain configurations, or terminals this could +# potentially interfere with copying text. +# Options: +# - true (default) +# - false +#mouse_mode: false + +# Configure the scroll back buffer size +# This is the number of lines zellij stores for each pane in the scroll back +# buffer. Excess number of lines are discarded in a FIFO fashion. +# Valid values: positive integers +# Default value: 10000 +#scroll_buffer_size: 10000 + +# Provide a command to execute when copying text. The text will be piped to +# the stdin of the program to perform the copy. This can be used with +# terminal emulators which do not support the OSC 52 ANSI control sequence +# that will be used by default if this option is not set. +# Examples: +#copy_command: "xclip -selection clipboard" # x11 +#copy_command: "wl-copy" # wayland +#copy_command: "pbcopy" # osx + +# Choose the destination for copied text +# Allows using the primary selection buffer (on x11/wayland) instead of the system clipboard. +# Does not apply when using copy_command. +# Options: +# - system (default) +# - primary +#copy_clipboard: primary + +# Enable or disable automatic copy (and clear) of selection when releasing mouse +#copy_on_select: true + +# Path to the default editor to use to edit pane scrollbuffer +# scrollback_editor: /usr/bin/nano diff --git a/zellij-client/src/old_config_converter/unit/fixtures/old_yaml_config_with_unbinds_in_mode.yaml b/zellij-client/src/old_config_converter/unit/fixtures/old_yaml_config_with_unbinds_in_mode.yaml new file mode 100644 index 00000000..fff9a528 --- /dev/null +++ b/zellij-client/src/old_config_converter/unit/fixtures/old_yaml_config_with_unbinds_in_mode.yaml @@ -0,0 +1,640 @@ +--- +# Configuration for zellij. + +# In order to troubleshoot your configuration try using the following command: +# `zellij setup --check` +# It should show current config locations and features that are enabled. + +keybinds: + unbind: true + normal: + - unbind: [Ctrl: 'a', Char: "\n"] + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's',] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [NewPane: ] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right ] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up, ] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + # uncomment this and adjust key if using copy_on_select=false + # - action: [Copy: ] + # key: [ Alt: 'c'] + locked: + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'g',] + resize: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'n', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [Quit] + key: [Ctrl: 'q'] + - action: [Resize: Left,] + key: [Char: 'h', Left,] + - action: [Resize: Down,] + key: [Char: 'j', Down,] + - action: [Resize: Up,] + key: [Char: 'k', Up, ] + - action: [Resize: Right,] + key: [Char: 'l', Right,] + - action: [Resize: Increase,] + key: [Char: '='] + - action: [Resize: Increase,] + key: [ Char: '+'] + - action: [Resize: Decrease,] + key: [Char: '-'] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + pane: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'p', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [MoveFocus: Left,] + key: [ Char: 'h', Left,] + - action: [MoveFocus: Right,] + key: [ Char: 'l', Right,] + - action: [MoveFocus: Down,] + key: [ Char: 'j', Down,] + - action: [MoveFocus: Up,] + key: [ Char: 'k', Up,] + - action: [SwitchFocus,] + key: [Char: 'p'] + - action: [NewPane: , SwitchToMode: Normal,] + key: [Char: 'n',] + - action: [NewPane: Down, SwitchToMode: Normal,] + key: [Char: 'd',] + - action: [NewPane: Right, SwitchToMode: Normal,] + key: [Char: 'r',] + - action: [CloseFocus, SwitchToMode: Normal,] + key: [Char: 'x',] + - action: [ToggleFocusFullscreen, SwitchToMode: Normal,] + key: [Char: 'f',] + - action: [TogglePaneFrames, SwitchToMode: Normal,] + key: [Char: 'z',] + - action: [ToggleFloatingPanes, SwitchToMode: Normal,] + key: [Char: 'w'] + - action: [TogglePaneEmbedOrFloating, SwitchToMode: Normal,] + key: [Char: 'e'] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + - action: [SwitchToMode: RenamePane, PaneNameInput: [0],] + key: [Char: 'c'] + move: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'h', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [Quit] + key: [Ctrl: 'q'] + - action: [MovePane: ,] + key: [Char: 'n', Char: "\t",] + - action: [MovePane: Left,] + key: [Char: 'h', Left,] + - action: [MovePane: Down,] + key: [Char: 'j', Down,] + - action: [MovePane: Up,] + key: [Char: 'k', Up, ] + - action: [MovePane: Right,] + key: [Char: 'l', Right,] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + tab: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 't', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: RenameTab, TabNameInput: [0],] + key: [Char: 'r'] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [GoToPreviousTab,] + key: [ Char: 'h', Left, Up, Char: 'k',] + - action: [GoToNextTab,] + key: [ Char: 'l', Right,Down, Char: 'j'] + - action: [NewTab: , SwitchToMode: Normal,] + key: [ Char: 'n',] + - action: [CloseTab, SwitchToMode: Normal,] + key: [ Char: 'x',] + - action: [ToggleActiveSyncTab, SwitchToMode: Normal,] + key: [Char: 's'] + - action: [GoToTab: 1, SwitchToMode: Normal,] + key: [ Char: '1',] + - action: [GoToTab: 2, SwitchToMode: Normal,] + key: [ Char: '2',] + - action: [GoToTab: 3, SwitchToMode: Normal,] + key: [ Char: '3',] + - action: [GoToTab: 4, SwitchToMode: Normal,] + key: [ Char: '4',] + - action: [GoToTab: 5, SwitchToMode: Normal,] + key: [ Char: '5',] + - action: [GoToTab: 6, SwitchToMode: Normal,] + key: [ Char: '6',] + - action: [GoToTab: 7, SwitchToMode: Normal,] + key: [ Char: '7',] + - action: [GoToTab: 8, SwitchToMode: Normal,] + key: [ Char: '8',] + - action: [GoToTab: 9, SwitchToMode: Normal,] + key: [ Char: '9',] + - action: [ToggleTab] + key: [ Char: "\t" ] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + scroll: + - action: [EditScrollback, SwitchToMode: Normal] + key: [Char: 'e'] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 's', Char: ' ', Char: "\n", Esc] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [ScrollToBottom, SwitchToMode: Normal,] + key: [Ctrl: 'c',] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [ScrollDown,] + key: [Char: 'j', Down,] + - action: [ScrollUp,] + key: [Char: 'k', Up,] + - action: [PageScrollDown,] + key: [Ctrl: 'f', PageDown, Right, Char: 'l',] + - action: [PageScrollUp,] + key: [Ctrl: 'b', PageUp, Left, Char: 'h',] + - action: [HalfPageScrollDown,] + key: [Char: 'd',] + - action: [HalfPageScrollUp,] + key: [Char: 'u',] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + # uncomment this and adjust key if using copy_on_select=false + # - action: [Copy: ] + # key: [ Alt: 'c'] + - action: [SwitchToMode: EnterSearch, SearchInput: [0],] + key: [Char: 's'] + entersearch: + - action: [SwitchToMode: Search,] + key: [Char: "\n"] + - action: [SearchInput: [27], SwitchToMode: Scroll,] + key: [Ctrl: 'c', Esc] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + search: + - action: [SwitchToMode: Normal,] + key: [Ctrl: 's', Char: ' ', Char: "\n", Esc] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [SwitchToMode: Session,] + key: [Ctrl: 'o',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [ScrollToBottom, SwitchToMode: Normal,] + key: [Ctrl: 'c',] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [ScrollDown,] + key: [Char: 'j', Down,] + - action: [ScrollUp,] + key: [Char: 'k', Up,] + - action: [PageScrollDown,] + key: [Ctrl: 'f', PageDown, Right, Char: 'l',] + - action: [PageScrollUp,] + key: [Ctrl: 'b', PageUp, Left, Char: 'h',] + - action: [HalfPageScrollDown,] + key: [Char: 'd',] + - action: [HalfPageScrollUp,] + key: [Char: 'u',] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] # The Alt: Left etc. variants are temporary hacks and will be removed in the future - please do not rely on them! + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + - action: [SwitchToMode: EnterSearch, SearchInput: [0],] + key: [Char: 's'] + - action: [Search: Down] + key: [Char: 'n'] + - action: [Search: Up] + key: [Char: 'p'] + - action: [SearchToggleOption: CaseSensitivity] + key: [Char: 'c'] + - action: [SearchToggleOption: Wrap] + key: [Char: 'w'] + - action: [SearchToggleOption: WholeWord] + key: [Char: 'o'] + renametab: + - action: [SwitchToMode: Normal,] + key: [Char: "\n", Ctrl: 'c', Esc] + - action: [UndoRenameTab , SwitchToMode: Tab,] + key: [Esc,] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + renamepane: + - action: [SwitchToMode: Normal,] + key: [Char: "\n", Ctrl: 'c', Esc] + - action: [UndoRenamePane , SwitchToMode: Pane,] + key: [Esc,] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + session: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tmux,] + key: [Ctrl: 'b',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'o', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [Detach,] + key: [Char: 'd',] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + tmux: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g'] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Move,] + key: [Ctrl: 'h',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] + - action: [SwitchToMode: Normal,] + key: [Ctrl: 'o', Char: "\n", Char: ' ', Esc] + - action: [SwitchToMode: Scroll,] + key: [Ctrl: 's'] + - action: [SwitchToMode: Scroll,] + key: [ Char: '['] + - action: [Quit,] + key: [Ctrl: 'q',] + - action: [Write: [2,], SwitchToMode: Normal] + key: [Ctrl: 'b'] + - action: [NewPane: Down, SwitchToMode: Normal,] + key: [Char: "\"",] + - action: [NewPane: Right, SwitchToMode: Normal,] + key: [Char: '%',] + - action: [ToggleFocusFullscreen, SwitchToMode: Normal,] + key: [Char: 'z',] + - action: [NewTab: , SwitchToMode: Normal,] + key: [ Char: 'c',] + - action: [SwitchToMode: RenameTab, TabNameInput: [0],] + key: [Char: ','] + - action: [GoToPreviousTab, SwitchToMode: Normal,] + key: [ Char: 'p'] + - action: [GoToNextTab, SwitchToMode: Normal,] + key: [ Char: 'n'] + - action: [MoveFocus: Left, SwitchToMode: Normal,] + key: [ Left,] + - action: [MoveFocus: Right, SwitchToMode: Normal,] + key: [ Right,] + - action: [MoveFocus: Down, SwitchToMode: Normal,] + key: [ Down,] + - action: [MoveFocus: Up, SwitchToMode: Normal,] + key: [ Up,] + - action: [MoveFocus: Left, SwitchToMode: Normal,] + key: [ Char: 'h'] + - action: [MoveFocus: Right, SwitchToMode: Normal,] + key: [ Char: 'l'] + - action: [MoveFocus: Down, SwitchToMode: Normal,] + key: [ Char: 'j'] + - action: [MoveFocus: Up, SwitchToMode: Normal,] + key: [ Char: 'k'] + - action: [NewPane: ,] + key: [ Alt: 'n',] + - action: [MoveFocusOrTab: Left,] + key: [ Alt: 'h', Alt: Left] + - action: [MoveFocusOrTab: Right,] + key: [ Alt: 'l', Alt: Right] + - action: [MoveFocus: Down,] + key: [ Alt: 'j', Alt: Down] + - action: [MoveFocus: Up,] + key: [ Alt: 'k', Alt: Up] + - action: [FocusNextPane,] + key: [ Char: 'o'] + - action: [Resize: Increase,] + key: [ Alt: '='] + - action: [Resize: Increase,] + key: [ Alt: '+'] + - action: [Resize: Decrease,] + key: [ Alt: '-'] + - action: [Detach,] + key: [Char: 'd',] +plugins: + - path: tab-bar + tag: tab-bar + - path: status-bar + tag: status-bar + - path: strider + tag: strider + - path: compact-bar + tag: compact-bar + +# Choose what to do when zellij receives SIGTERM, SIGINT, SIGQUIT or SIGHUP +# eg. when terminal window with an active zellij session is closed +# Options: +# - detach (Default) +# - quit +# on_force_close: quit + +# Send a request for a simplified ui (without arrow fonts) to plugins +# Options: +# - true +# - false (Default) +# simplified_ui: true + +# Choose the path to the default shell that zellij will use for opening new panes +# Default: $SHELL +# default_shell: fish + +# Toggle between having pane frames around the panes +# Options: +# - true (default) +# - false +#pane_frames: true + +# Choose the theme that is specified in the themes section. +# For some examples, see: https://github.com/zellij-org/zellij/tree/main/example/themes +# Default: default +#theme: default + +# Choose the mode that zellij uses when starting up. +# Default: normal +#default_mode: locked + +# Toggle enabling the mouse mode. +# On certain configurations, or terminals this could +# potentially interfere with copying text. +# Options: +# - true (default) +# - false +#mouse_mode: false + +# Configure the scroll back buffer size +# This is the number of lines zellij stores for each pane in the scroll back +# buffer. Excess number of lines are discarded in a FIFO fashion. +# Valid values: positive integers +# Default value: 10000 +#scroll_buffer_size: 10000 + +# Provide a command to execute when copying text. The text will be piped to +# the stdin of the program to perform the copy. This can be used with +# terminal emulators which do not support the OSC 52 ANSI control sequence +# that will be used by default if this option is not set. +# Examples: +#copy_command: "xclip -selection clipboard" # x11 +#copy_command: "wl-copy" # wayland +#copy_command: "pbcopy" # osx + +# Choose the destination for copied text +# Allows using the primary selection buffer (on x11/wayland) instead of the system clipboard. +# Does not apply when using copy_command. +# Options: +# - system (default) +# - primary +#copy_clipboard: primary + +# Enable or disable automatic copy (and clear) of selection when releasing mouse +#copy_on_select: true + +# Path to the default editor to use to edit pane scrollbuffer +# scrollback_editor: /usr/bin/nano diff --git a/zellij-client/src/old_config_converter/unit/fixtures/old_yaml_layout_with_config.yaml b/zellij-client/src/old_config_converter/unit/fixtures/old_yaml_layout_with_config.yaml new file mode 100644 index 00000000..0d5f40b9 --- /dev/null +++ b/zellij-client/src/old_config_converter/unit/fixtures/old_yaml_layout_with_config.yaml @@ -0,0 +1,34 @@ +--- +template: + direction: Horizontal + parts: + - direction: Vertical + borderless: true + split_size: + Fixed: 1 + run: + plugin: + location: "zellij:tab-bar" + - direction: Vertical + body: true + - direction: Vertical + borderless: true + split_size: + Fixed: 2 + run: + plugin: + location: "zellij:status-bar" +tabs: + - direction: Vertical +default_shell: fish +keybinds: + unbind: true + normal: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] diff --git a/zellij-client/src/old_config_converter/unit/fixtures/old_yaml_layout_with_config_and_session_name.yaml b/zellij-client/src/old_config_converter/unit/fixtures/old_yaml_layout_with_config_and_session_name.yaml new file mode 100644 index 00000000..7e6fa2cb --- /dev/null +++ b/zellij-client/src/old_config_converter/unit/fixtures/old_yaml_layout_with_config_and_session_name.yaml @@ -0,0 +1,36 @@ +--- +template: + direction: Horizontal + parts: + - direction: Vertical + borderless: true + split_size: + Fixed: 1 + run: + plugin: + location: "zellij:tab-bar" + - direction: Vertical + body: true + - direction: Vertical + borderless: true + split_size: + Fixed: 2 + run: + plugin: + location: "zellij:status-bar" +tabs: + - direction: Vertical +session: + name: foo +default_shell: fish +keybinds: + unbind: true + normal: + - action: [SwitchToMode: Locked,] + key: [Ctrl: 'g',] + - action: [SwitchToMode: Pane,] + key: [Ctrl: 'p',] + - action: [SwitchToMode: Resize,] + key: [Ctrl: 'n',] + - action: [SwitchToMode: Tab,] + key: [Ctrl: 't',] diff --git a/zellij-client/src/old_config_converter/unit/fixtures/old_yaml_layout_with_session_name.yaml b/zellij-client/src/old_config_converter/unit/fixtures/old_yaml_layout_with_session_name.yaml new file mode 100644 index 00000000..9e452574 --- /dev/null +++ b/zellij-client/src/old_config_converter/unit/fixtures/old_yaml_layout_with_session_name.yaml @@ -0,0 +1,24 @@ +--- +template: + direction: Horizontal + parts: + - direction: Vertical + borderless: true + split_size: + Fixed: 1 + run: + plugin: + location: "zellij:tab-bar" + - direction: Vertical + body: true + - direction: Vertical + borderless: true + split_size: + Fixed: 2 + run: + plugin: + location: "zellij:status-bar" +tabs: + - direction: Vertical +session: + name: foo diff --git a/zellij-client/src/old_config_converter/unit/fixtures/old_yaml_layout_with_session_name_and_attach_false.yaml b/zellij-client/src/old_config_converter/unit/fixtures/old_yaml_layout_with_session_name_and_attach_false.yaml new file mode 100644 index 00000000..1f33f1c3 --- /dev/null +++ b/zellij-client/src/old_config_converter/unit/fixtures/old_yaml_layout_with_session_name_and_attach_false.yaml @@ -0,0 +1,25 @@ +--- +template: + direction: Horizontal + parts: + - direction: Vertical + borderless: true + split_size: + Fixed: 1 + run: + plugin: + location: "zellij:tab-bar" + - direction: Vertical + body: true + - direction: Vertical + borderless: true + split_size: + Fixed: 2 + run: + plugin: + location: "zellij:status-bar" +tabs: + - direction: Vertical +session: + name: foo + attach: false diff --git a/zellij-client/src/old_config_converter/unit/fixtures/run_htop_layout.yaml b/zellij-client/src/old_config_converter/unit/fixtures/run_htop_layout.yaml new file mode 100644 index 00000000..91f4f63c --- /dev/null +++ b/zellij-client/src/old_config_converter/unit/fixtures/run_htop_layout.yaml @@ -0,0 +1,21 @@ +--- +tabs: + - direction: Vertical + parts: + - direction: Horizontal + split_size: + Percent: 50 + parts: + - direction: Vertical + split_size: + Percent: 50 + - direction: Vertical + split_size: + Percent: 50 + run: + command: {cmd: htop} + - direction: Horizontal + split_size: + Percent: 50 + run: + command: {cmd: htop} diff --git a/zellij-client/src/old_config_converter/unit/fixtures/run_htop_layout_with_plugins.yaml b/zellij-client/src/old_config_converter/unit/fixtures/run_htop_layout_with_plugins.yaml new file mode 100644 index 00000000..05d2798f --- /dev/null +++ b/zellij-client/src/old_config_converter/unit/fixtures/run_htop_layout_with_plugins.yaml @@ -0,0 +1,35 @@ +--- +tabs: + - direction: Horizontal + parts: + - direction: Vertical + split_size: + Fixed: 1 + run: + plugin: + location: "zellij:tab-bar" + borderless: true + - direction: Vertical + parts: + - direction: Vertical + parts: + - direction: Vertical + split_size: + Percent: 50 + run: + command: {cmd: htop} + - direction: Vertical + split_size: + Percent: 50 + run: + command: {cmd: htop, args: ["-C", "--tree"]} + - direction: Vertical + split_size: + Fixed: 5 + - direction: Vertical + split_size: + Fixed: 2 + run: + plugin: + location: "zellij:status-bar" + borderless: true diff --git a/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_config__convert_config_test__convert_config_with_custom_options.snap b/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_config__convert_config_test__convert_config_with_custom_options.snap new file mode 100644 index 00000000..34539e60 --- /dev/null +++ b/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_config__convert_config_test__convert_config_with_custom_options.snap @@ -0,0 +1,411 @@ +--- +source: zellij-client/src/old_config_converter/./unit/convert_config_tests.rs +assertion_line: 24 +expression: "format!(\"{}\", kdl_config)" +--- +keybinds clear-defaults=true { + normal { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl q" { Quit; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + locked { + bind "Ctrl g" { SwitchToMode "normal"; } + } + pane { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl p" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl q" { Quit; } + bind "h" "Left" { MoveFocus "Left"; } + bind "l" "Right" { MoveFocus "Right"; } + bind "j" "Down" { MoveFocus "Down"; } + bind "k" "Up" { MoveFocus "Up"; } + bind "p" { SwitchFocus; } + bind "n" { NewPane; SwitchToMode "normal"; } + bind "d" { NewPane "Down"; SwitchToMode "normal"; } + bind "r" { NewPane "Right"; SwitchToMode "normal"; } + bind "x" { CloseFocus; SwitchToMode "normal"; } + bind "f" { ToggleFocusFullscreen; SwitchToMode "normal"; } + bind "z" { TogglePaneFrames; SwitchToMode "normal"; } + bind "w" { ToggleFloatingPanes; SwitchToMode "normal"; } + bind "e" { TogglePaneEmbedOrFloating; SwitchToMode "normal"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + bind "c" { SwitchToMode "RenamePane"; PaneNameInput 0; } + } + tab { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl t" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "r" { SwitchToMode "RenameTab"; TabNameInput 0; } + bind "Ctrl q" { Quit; } + bind "h" "Left" "Up" "k" { GoToPreviousTab; } + bind "l" "Right" "Down" "j" { GoToNextTab; } + bind "n" { NewTab; SwitchToMode "normal"; } + bind "x" { CloseTab; SwitchToMode "normal"; } + bind "s" { ToggleActiveSyncTab; SwitchToMode "normal"; } + bind "1" { GoToTab 1; SwitchToMode "normal"; } + bind "2" { GoToTab 2; SwitchToMode "normal"; } + bind "3" { GoToTab 3; SwitchToMode "normal"; } + bind "4" { GoToTab 4; SwitchToMode "normal"; } + bind "5" { GoToTab 5; SwitchToMode "normal"; } + bind "6" { GoToTab 6; SwitchToMode "normal"; } + bind "7" { GoToTab 7; SwitchToMode "normal"; } + bind "8" { GoToTab 8; SwitchToMode "normal"; } + bind "9" { GoToTab 9; SwitchToMode "normal"; } + bind "Tab" { ToggleTab; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + resize { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl n" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl q" { Quit; } + bind "h" "Left" { Resize "Left"; } + bind "j" "Down" { Resize "Down"; } + bind "k" "Up" { Resize "Up"; } + bind "l" "Right" { Resize "Right"; } + bind "=" { Resize "Increase"; } + bind "+" { Resize "Increase"; } + bind "-" { Resize "Decrease"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + move { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl h" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl q" { Quit; } + bind "n" "Tab" { MovePane; } + bind "h" "Left" { MovePane "Left"; } + bind "j" "Down" { MovePane "Down"; } + bind "k" "Up" { MovePane "Up"; } + bind "l" "Right" { MovePane "Right"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + scroll { + bind "e" { EditScrollback; SwitchToMode "normal"; } + bind "Ctrl s" "Space" "Enter" "Esc" { SwitchToMode "normal"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl c" { ScrollToBottom; SwitchToMode "normal"; } + bind "Ctrl q" { Quit; } + bind "j" "Down" { ScrollDown; } + bind "k" "Up" { ScrollUp; } + bind "Ctrl f" "PageDown" "Right" "l" { PageScrollDown; } + bind "Ctrl b" "PageUp" "Left" "h" { PageScrollUp; } + bind "d" { HalfPageScrollDown; } + bind "u" { HalfPageScrollUp; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + bind "s" { SwitchToMode "entersearch"; SearchInput 0; } + } + session { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl o" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl q" { Quit; } + bind "d" { Detach; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + search { + bind "Ctrl s" "Space" "Enter" "Esc" { SwitchToMode "normal"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl c" { ScrollToBottom; SwitchToMode "normal"; } + bind "Ctrl q" { Quit; } + bind "j" "Down" { ScrollDown; } + bind "k" "Up" { ScrollUp; } + bind "Ctrl f" "PageDown" "Right" "l" { PageScrollDown; } + bind "Ctrl b" "PageUp" "Left" "h" { PageScrollUp; } + bind "d" { HalfPageScrollDown; } + bind "u" { HalfPageScrollUp; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + bind "s" { SwitchToMode "entersearch"; SearchInput 0; } + bind "n" { Search "Down"; } + bind "p" { Search "Up"; } + bind "c" { SearchToggleOption "CaseSensitivity"; } + bind "w" { SearchToggleOption "Wrap"; } + bind "o" { SearchToggleOption "WholeWord"; } + } + entersearch { + bind "Enter" { SwitchToMode "search"; } + bind "Ctrl c" "Esc" { SearchInput 27; SwitchToMode "scroll"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + RenameTab { + bind "Enter" "Ctrl c" "Esc" { SwitchToMode "normal"; } + bind "Esc" { UndoRenameTab; SwitchToMode "tab"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + RenamePane { + bind "Enter" "Ctrl c" "Esc" { SwitchToMode "normal"; } + bind "Esc" { UndoRenamePane; SwitchToMode "pane"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + tmux { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl o" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "[" { SwitchToMode "scroll"; } + bind "Ctrl q" { Quit; } + bind "Ctrl b" { Write 2; SwitchToMode "normal"; } + bind "\"" { NewPane "Down"; SwitchToMode "normal"; } + bind "%" { NewPane "Right"; SwitchToMode "normal"; } + bind "z" { ToggleFocusFullscreen; SwitchToMode "normal"; } + bind "c" { NewTab; SwitchToMode "normal"; } + bind "," { SwitchToMode "RenameTab"; TabNameInput 0; } + bind "p" { GoToPreviousTab; SwitchToMode "normal"; } + bind "n" { GoToNextTab; SwitchToMode "normal"; } + bind "Left" { MoveFocus "Left"; SwitchToMode "normal"; } + bind "Right" { MoveFocus "Right"; SwitchToMode "normal"; } + bind "Down" { MoveFocus "Down"; SwitchToMode "normal"; } + bind "Up" { MoveFocus "Up"; SwitchToMode "normal"; } + bind "h" { MoveFocus "Left"; SwitchToMode "normal"; } + bind "l" { MoveFocus "Right"; SwitchToMode "normal"; } + bind "j" { MoveFocus "Down"; SwitchToMode "normal"; } + bind "k" { MoveFocus "Up"; SwitchToMode "normal"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "o" { FocusNextPane; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + bind "d" { Detach; } + } +} + +// Choose what to do when zellij receives SIGTERM, SIGINT, SIGQUIT or SIGHUP +// eg. when terminal window with an active zellij session is closed +// Options: +// - detach (Default) +// - quit +// +on_force_close "quit" + +// Send a request for a simplified ui (without arrow fonts) to plugins +// Options: +// - true +// - false (Default) +// +simplified_ui true + +// Choose the path to the default shell that zellij will use for opening new panes +// Default: $SHELL +// +default_shell "fish" + +// Toggle between having pane frames around the panes +// Options: +// - true (default) +// - false +// +pane_frames true + +// Choose the theme that is specified in the themes section. +// Default: default +// +theme "default" + +// The name of the default layout to load on startup +// Default: "default" +// +// default_layout "compact" + +// Choose the mode that zellij uses when starting up. +// Default: normal +// +default_mode "locked" + +// Toggle enabling the mouse mode. +// On certain configurations, or terminals this could +// potentially interfere with copying text. +// Options: +// - true (default) +// - false +// +mouse_mode false + +// Configure the scroll back buffer size +// This is the number of lines zellij stores for each pane in the scroll back +// buffer. Excess number of lines are discarded in a FIFO fashion. +// Valid values: positive integers +// Default value: 10000 +// +scroll_buffer_size 10000 + +// Provide a command to execute when copying text. The text will be piped to +// the stdin of the program to perform the copy. This can be used with +// terminal emulators which do not support the OSC 52 ANSI control sequence +// that will be used by default if this option is not set. +// Examples: +// +// copy_command "xclip -selection clipboard" // x11 +// copy_command "wl-copy" // wayland +// copy_command "pbcopy" // osx +copy_command "pbcopy" + +// Choose the destination for copied text +// Allows using the primary selection buffer (on x11/wayland) instead of the system clipboard. +// Does not apply when using copy_command. +// Options: +// - system (default) +// - primary +// +copy_clipboard "primary" + +// Enable or disable automatic copy (and clear) of selection when releasing mouse +// Default: true +// +copy_on_select true + +// Path to the default editor to use to edit pane scrollbuffer +// Default: $EDITOR or $VISUAL +// +scrollback_editor "/usr/bin/nano" + +// When attaching to an existing session with other users, +// should the session be mirrored (true) +// or should each user have their own cursor (false) +// Default: false +// +// mirror_session true + +// The folder in which Zellij will look for layouts +// +// layout_dir /path/to/my/layout_dir + +// The folder in which Zellij will look for themes +// +// theme_dir "/path/to/my/theme_dir" + +plugins { + tab-bar { path "tab-bar"; } + status-bar { path "status-bar"; } + strider { path "strider"; } + compact-bar { path "compact-bar"; } +} + diff --git a/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_config__convert_config_test__convert_config_with_env_variables.snap b/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_config__convert_config_test__convert_config_with_env_variables.snap new file mode 100644 index 00000000..c28f4afa --- /dev/null +++ b/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_config__convert_config_test__convert_config_with_env_variables.snap @@ -0,0 +1,415 @@ +--- +source: zellij-client/src/old_config_converter/./unit/convert_config_tests.rs +assertion_line: 68 +expression: "format!(\"{}\", kdl_config)" +--- +keybinds clear-defaults=true { + normal { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl q" { Quit; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + locked { + bind "Ctrl g" { SwitchToMode "normal"; } + } + pane { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl p" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl q" { Quit; } + bind "h" "Left" { MoveFocus "Left"; } + bind "l" "Right" { MoveFocus "Right"; } + bind "j" "Down" { MoveFocus "Down"; } + bind "k" "Up" { MoveFocus "Up"; } + bind "p" { SwitchFocus; } + bind "n" { NewPane; SwitchToMode "normal"; } + bind "d" { NewPane "Down"; SwitchToMode "normal"; } + bind "r" { NewPane "Right"; SwitchToMode "normal"; } + bind "x" { CloseFocus; SwitchToMode "normal"; } + bind "f" { ToggleFocusFullscreen; SwitchToMode "normal"; } + bind "z" { TogglePaneFrames; SwitchToMode "normal"; } + bind "w" { ToggleFloatingPanes; SwitchToMode "normal"; } + bind "e" { TogglePaneEmbedOrFloating; SwitchToMode "normal"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + bind "c" { SwitchToMode "RenamePane"; PaneNameInput 0; } + } + tab { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl t" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "r" { SwitchToMode "RenameTab"; TabNameInput 0; } + bind "Ctrl q" { Quit; } + bind "h" "Left" "Up" "k" { GoToPreviousTab; } + bind "l" "Right" "Down" "j" { GoToNextTab; } + bind "n" { NewTab; SwitchToMode "normal"; } + bind "x" { CloseTab; SwitchToMode "normal"; } + bind "s" { ToggleActiveSyncTab; SwitchToMode "normal"; } + bind "1" { GoToTab 1; SwitchToMode "normal"; } + bind "2" { GoToTab 2; SwitchToMode "normal"; } + bind "3" { GoToTab 3; SwitchToMode "normal"; } + bind "4" { GoToTab 4; SwitchToMode "normal"; } + bind "5" { GoToTab 5; SwitchToMode "normal"; } + bind "6" { GoToTab 6; SwitchToMode "normal"; } + bind "7" { GoToTab 7; SwitchToMode "normal"; } + bind "8" { GoToTab 8; SwitchToMode "normal"; } + bind "9" { GoToTab 9; SwitchToMode "normal"; } + bind "Tab" { ToggleTab; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + resize { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl n" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl q" { Quit; } + bind "h" "Left" { Resize "Left"; } + bind "j" "Down" { Resize "Down"; } + bind "k" "Up" { Resize "Up"; } + bind "l" "Right" { Resize "Right"; } + bind "=" { Resize "Increase"; } + bind "+" { Resize "Increase"; } + bind "-" { Resize "Decrease"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + move { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl h" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl q" { Quit; } + bind "n" "Tab" { MovePane; } + bind "h" "Left" { MovePane "Left"; } + bind "j" "Down" { MovePane "Down"; } + bind "k" "Up" { MovePane "Up"; } + bind "l" "Right" { MovePane "Right"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + scroll { + bind "e" { EditScrollback; SwitchToMode "normal"; } + bind "Ctrl s" "Space" "Enter" "Esc" { SwitchToMode "normal"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl c" { ScrollToBottom; SwitchToMode "normal"; } + bind "Ctrl q" { Quit; } + bind "j" "Down" { ScrollDown; } + bind "k" "Up" { ScrollUp; } + bind "Ctrl f" "PageDown" "Right" "l" { PageScrollDown; } + bind "Ctrl b" "PageUp" "Left" "h" { PageScrollUp; } + bind "d" { HalfPageScrollDown; } + bind "u" { HalfPageScrollUp; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + bind "s" { SwitchToMode "entersearch"; SearchInput 0; } + } + session { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl o" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl q" { Quit; } + bind "d" { Detach; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + search { + bind "Ctrl s" "Space" "Enter" "Esc" { SwitchToMode "normal"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl c" { ScrollToBottom; SwitchToMode "normal"; } + bind "Ctrl q" { Quit; } + bind "j" "Down" { ScrollDown; } + bind "k" "Up" { ScrollUp; } + bind "Ctrl f" "PageDown" "Right" "l" { PageScrollDown; } + bind "Ctrl b" "PageUp" "Left" "h" { PageScrollUp; } + bind "d" { HalfPageScrollDown; } + bind "u" { HalfPageScrollUp; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + bind "s" { SwitchToMode "entersearch"; SearchInput 0; } + bind "n" { Search "Down"; } + bind "p" { Search "Up"; } + bind "c" { SearchToggleOption "CaseSensitivity"; } + bind "w" { SearchToggleOption "Wrap"; } + bind "o" { SearchToggleOption "WholeWord"; } + } + entersearch { + bind "Enter" { SwitchToMode "search"; } + bind "Ctrl c" "Esc" { SearchInput 27; SwitchToMode "scroll"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + RenameTab { + bind "Enter" "Ctrl c" "Esc" { SwitchToMode "normal"; } + bind "Esc" { UndoRenameTab; SwitchToMode "tab"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + RenamePane { + bind "Enter" "Ctrl c" "Esc" { SwitchToMode "normal"; } + bind "Esc" { UndoRenamePane; SwitchToMode "pane"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + tmux { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl o" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "[" { SwitchToMode "scroll"; } + bind "Ctrl q" { Quit; } + bind "Ctrl b" { Write 2; SwitchToMode "normal"; } + bind "\"" { NewPane "Down"; SwitchToMode "normal"; } + bind "%" { NewPane "Right"; SwitchToMode "normal"; } + bind "z" { ToggleFocusFullscreen; SwitchToMode "normal"; } + bind "c" { NewTab; SwitchToMode "normal"; } + bind "," { SwitchToMode "RenameTab"; TabNameInput 0; } + bind "p" { GoToPreviousTab; SwitchToMode "normal"; } + bind "n" { GoToNextTab; SwitchToMode "normal"; } + bind "Left" { MoveFocus "Left"; SwitchToMode "normal"; } + bind "Right" { MoveFocus "Right"; SwitchToMode "normal"; } + bind "Down" { MoveFocus "Down"; SwitchToMode "normal"; } + bind "Up" { MoveFocus "Up"; SwitchToMode "normal"; } + bind "h" { MoveFocus "Left"; SwitchToMode "normal"; } + bind "l" { MoveFocus "Right"; SwitchToMode "normal"; } + bind "j" { MoveFocus "Down"; SwitchToMode "normal"; } + bind "k" { MoveFocus "Up"; SwitchToMode "normal"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "o" { FocusNextPane; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + bind "d" { Detach; } + } +} + +// Choose what to do when zellij receives SIGTERM, SIGINT, SIGQUIT or SIGHUP +// eg. when terminal window with an active zellij session is closed +// Options: +// - detach (Default) +// - quit +// +// on_force_close "quit" + +// Send a request for a simplified ui (without arrow fonts) to plugins +// Options: +// - true +// - false (Default) +// +// simplified_ui true + +// Choose the path to the default shell that zellij will use for opening new panes +// Default: $SHELL +// +// default_shell "fish" + +// Toggle between having pane frames around the panes +// Options: +// - true (default) +// - false +// +// pane_frames true + +// Choose the theme that is specified in the themes section. +// Default: default +// +// theme "default" + +// The name of the default layout to load on startup +// Default: "default" +// +// default_layout "compact" + +// Choose the mode that zellij uses when starting up. +// Default: normal +// +// default_mode "locked" + +// Toggle enabling the mouse mode. +// On certain configurations, or terminals this could +// potentially interfere with copying text. +// Options: +// - true (default) +// - false +// +// mouse_mode false + +// Configure the scroll back buffer size +// This is the number of lines zellij stores for each pane in the scroll back +// buffer. Excess number of lines are discarded in a FIFO fashion. +// Valid values: positive integers +// Default value: 10000 +// +// scroll_buffer_size 10000 + +// Provide a command to execute when copying text. The text will be piped to +// the stdin of the program to perform the copy. This can be used with +// terminal emulators which do not support the OSC 52 ANSI control sequence +// that will be used by default if this option is not set. +// Examples: +// +// copy_command "xclip -selection clipboard" // x11 +// copy_command "wl-copy" // wayland +// copy_command "pbcopy" // osx + +// Choose the destination for copied text +// Allows using the primary selection buffer (on x11/wayland) instead of the system clipboard. +// Does not apply when using copy_command. +// Options: +// - system (default) +// - primary +// +// copy_clipboard "primary" + +// Enable or disable automatic copy (and clear) of selection when releasing mouse +// Default: true +// +// copy_on_select false + +// Path to the default editor to use to edit pane scrollbuffer +// Default: $EDITOR or $VISUAL +// +// scrollback_editor "/usr/bin/vim" + +// When attaching to an existing session with other users, +// should the session be mirrored (true) +// or should each user have their own cursor (false) +// Default: false +// +// mirror_session true + +// The folder in which Zellij will look for layouts +// +// layout_dir /path/to/my/layout_dir + +// The folder in which Zellij will look for themes +// +// theme_dir "/path/to/my/theme_dir" +env { + RUST_BACKTRACE "1" + bar "baz" + foo "bar" +} + +plugins { + tab-bar { path "tab-bar"; } + status-bar { path "status-bar"; } + strider { path "strider"; } + compact-bar { path "compact-bar"; } +} + diff --git a/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_config__convert_config_test__convert_config_with_global_keybind_unbinds.snap b/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_config__convert_config_test__convert_config_with_global_keybind_unbinds.snap new file mode 100644 index 00000000..5ce03e24 --- /dev/null +++ b/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_config__convert_config_test__convert_config_with_global_keybind_unbinds.snap @@ -0,0 +1,411 @@ +--- +source: zellij-client/src/old_config_converter/./unit/convert_config_tests.rs +assertion_line: 46 +expression: "format!(\"{}\", kdl_config)" +--- +keybinds { + unbind "Ctrl g" "Space" + normal { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl q" { Quit; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + locked { + bind "Ctrl g" { SwitchToMode "normal"; } + } + pane { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl p" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl q" { Quit; } + bind "h" "Left" { MoveFocus "Left"; } + bind "l" "Right" { MoveFocus "Right"; } + bind "j" "Down" { MoveFocus "Down"; } + bind "k" "Up" { MoveFocus "Up"; } + bind "p" { SwitchFocus; } + bind "n" { NewPane; SwitchToMode "normal"; } + bind "d" { NewPane "Down"; SwitchToMode "normal"; } + bind "r" { NewPane "Right"; SwitchToMode "normal"; } + bind "x" { CloseFocus; SwitchToMode "normal"; } + bind "f" { ToggleFocusFullscreen; SwitchToMode "normal"; } + bind "z" { TogglePaneFrames; SwitchToMode "normal"; } + bind "w" { ToggleFloatingPanes; SwitchToMode "normal"; } + bind "e" { TogglePaneEmbedOrFloating; SwitchToMode "normal"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + bind "c" { SwitchToMode "RenamePane"; PaneNameInput 0; } + } + tab { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl t" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "r" { SwitchToMode "RenameTab"; TabNameInput 0; } + bind "Ctrl q" { Quit; } + bind "h" "Left" "Up" "k" { GoToPreviousTab; } + bind "l" "Right" "Down" "j" { GoToNextTab; } + bind "n" { NewTab; SwitchToMode "normal"; } + bind "x" { CloseTab; SwitchToMode "normal"; } + bind "s" { ToggleActiveSyncTab; SwitchToMode "normal"; } + bind "1" { GoToTab 1; SwitchToMode "normal"; } + bind "2" { GoToTab 2; SwitchToMode "normal"; } + bind "3" { GoToTab 3; SwitchToMode "normal"; } + bind "4" { GoToTab 4; SwitchToMode "normal"; } + bind "5" { GoToTab 5; SwitchToMode "normal"; } + bind "6" { GoToTab 6; SwitchToMode "normal"; } + bind "7" { GoToTab 7; SwitchToMode "normal"; } + bind "8" { GoToTab 8; SwitchToMode "normal"; } + bind "9" { GoToTab 9; SwitchToMode "normal"; } + bind "Tab" { ToggleTab; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + resize { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl n" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl q" { Quit; } + bind "h" "Left" { Resize "Left"; } + bind "j" "Down" { Resize "Down"; } + bind "k" "Up" { Resize "Up"; } + bind "l" "Right" { Resize "Right"; } + bind "=" { Resize "Increase"; } + bind "+" { Resize "Increase"; } + bind "-" { Resize "Decrease"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + move { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl h" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl q" { Quit; } + bind "n" "Tab" { MovePane; } + bind "h" "Left" { MovePane "Left"; } + bind "j" "Down" { MovePane "Down"; } + bind "k" "Up" { MovePane "Up"; } + bind "l" "Right" { MovePane "Right"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + scroll { + bind "e" { EditScrollback; SwitchToMode "normal"; } + bind "Ctrl s" "Space" "Enter" "Esc" { SwitchToMode "normal"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl c" { ScrollToBottom; SwitchToMode "normal"; } + bind "Ctrl q" { Quit; } + bind "j" "Down" { ScrollDown; } + bind "k" "Up" { ScrollUp; } + bind "Ctrl f" "PageDown" "Right" "l" { PageScrollDown; } + bind "Ctrl b" "PageUp" "Left" "h" { PageScrollUp; } + bind "d" { HalfPageScrollDown; } + bind "u" { HalfPageScrollUp; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + bind "s" { SwitchToMode "entersearch"; SearchInput 0; } + } + session { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl o" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl q" { Quit; } + bind "d" { Detach; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + search { + bind "Ctrl s" "Space" "Enter" "Esc" { SwitchToMode "normal"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl c" { ScrollToBottom; SwitchToMode "normal"; } + bind "Ctrl q" { Quit; } + bind "j" "Down" { ScrollDown; } + bind "k" "Up" { ScrollUp; } + bind "Ctrl f" "PageDown" "Right" "l" { PageScrollDown; } + bind "Ctrl b" "PageUp" "Left" "h" { PageScrollUp; } + bind "d" { HalfPageScrollDown; } + bind "u" { HalfPageScrollUp; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + bind "s" { SwitchToMode "entersearch"; SearchInput 0; } + bind "n" { Search "Down"; } + bind "p" { Search "Up"; } + bind "c" { SearchToggleOption "CaseSensitivity"; } + bind "w" { SearchToggleOption "Wrap"; } + bind "o" { SearchToggleOption "WholeWord"; } + } + entersearch { + bind "Enter" { SwitchToMode "search"; } + bind "Ctrl c" "Esc" { SearchInput 27; SwitchToMode "scroll"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + RenameTab { + bind "Enter" "Ctrl c" "Esc" { SwitchToMode "normal"; } + bind "Esc" { UndoRenameTab; SwitchToMode "tab"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + RenamePane { + bind "Enter" "Ctrl c" "Esc" { SwitchToMode "normal"; } + bind "Esc" { UndoRenamePane; SwitchToMode "pane"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + tmux { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl o" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "[" { SwitchToMode "scroll"; } + bind "Ctrl q" { Quit; } + bind "Ctrl b" { Write 2; SwitchToMode "normal"; } + bind "\"" { NewPane "Down"; SwitchToMode "normal"; } + bind "%" { NewPane "Right"; SwitchToMode "normal"; } + bind "z" { ToggleFocusFullscreen; SwitchToMode "normal"; } + bind "c" { NewTab; SwitchToMode "normal"; } + bind "," { SwitchToMode "RenameTab"; TabNameInput 0; } + bind "p" { GoToPreviousTab; SwitchToMode "normal"; } + bind "n" { GoToNextTab; SwitchToMode "normal"; } + bind "Left" { MoveFocus "Left"; SwitchToMode "normal"; } + bind "Right" { MoveFocus "Right"; SwitchToMode "normal"; } + bind "Down" { MoveFocus "Down"; SwitchToMode "normal"; } + bind "Up" { MoveFocus "Up"; SwitchToMode "normal"; } + bind "h" { MoveFocus "Left"; SwitchToMode "normal"; } + bind "l" { MoveFocus "Right"; SwitchToMode "normal"; } + bind "j" { MoveFocus "Down"; SwitchToMode "normal"; } + bind "k" { MoveFocus "Up"; SwitchToMode "normal"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "o" { FocusNextPane; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + bind "d" { Detach; } + } +} + +// Choose what to do when zellij receives SIGTERM, SIGINT, SIGQUIT or SIGHUP +// eg. when terminal window with an active zellij session is closed +// Options: +// - detach (Default) +// - quit +// +// on_force_close "quit" + +// Send a request for a simplified ui (without arrow fonts) to plugins +// Options: +// - true +// - false (Default) +// +// simplified_ui true + +// Choose the path to the default shell that zellij will use for opening new panes +// Default: $SHELL +// +// default_shell "fish" + +// Toggle between having pane frames around the panes +// Options: +// - true (default) +// - false +// +// pane_frames true + +// Choose the theme that is specified in the themes section. +// Default: default +// +// theme "default" + +// The name of the default layout to load on startup +// Default: "default" +// +// default_layout "compact" + +// Choose the mode that zellij uses when starting up. +// Default: normal +// +// default_mode "locked" + +// Toggle enabling the mouse mode. +// On certain configurations, or terminals this could +// potentially interfere with copying text. +// Options: +// - true (default) +// - false +// +// mouse_mode false + +// Configure the scroll back buffer size +// This is the number of lines zellij stores for each pane in the scroll back +// buffer. Excess number of lines are discarded in a FIFO fashion. +// Valid values: positive integers +// Default value: 10000 +// +// scroll_buffer_size 10000 + +// Provide a command to execute when copying text. The text will be piped to +// the stdin of the program to perform the copy. This can be used with +// terminal emulators which do not support the OSC 52 ANSI control sequence +// that will be used by default if this option is not set. +// Examples: +// +// copy_command "xclip -selection clipboard" // x11 +// copy_command "wl-copy" // wayland +// copy_command "pbcopy" // osx + +// Choose the destination for copied text +// Allows using the primary selection buffer (on x11/wayland) instead of the system clipboard. +// Does not apply when using copy_command. +// Options: +// - system (default) +// - primary +// +// copy_clipboard "primary" + +// Enable or disable automatic copy (and clear) of selection when releasing mouse +// Default: true +// +// copy_on_select false + +// Path to the default editor to use to edit pane scrollbuffer +// Default: $EDITOR or $VISUAL +// +// scrollback_editor "/usr/bin/vim" + +// When attaching to an existing session with other users, +// should the session be mirrored (true) +// or should each user have their own cursor (false) +// Default: false +// +// mirror_session true + +// The folder in which Zellij will look for layouts +// +// layout_dir /path/to/my/layout_dir + +// The folder in which Zellij will look for themes +// +// theme_dir "/path/to/my/theme_dir" + +plugins { + tab-bar { path "tab-bar"; } + status-bar { path "status-bar"; } + strider { path "strider"; } + compact-bar { path "compact-bar"; } +} + diff --git a/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_config__convert_config_test__convert_config_with_keybind_unbinds_in_mode.snap b/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_config__convert_config_test__convert_config_with_keybind_unbinds_in_mode.snap new file mode 100644 index 00000000..d7ac6474 --- /dev/null +++ b/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_config__convert_config_test__convert_config_with_keybind_unbinds_in_mode.snap @@ -0,0 +1,411 @@ +--- +source: zellij-client/src/old_config_converter/./unit/convert_config_tests.rs +assertion_line: 35 +expression: "format!(\"{}\", kdl_config)" +--- +keybinds clear-defaults=true { + normal { + unbind "Ctrl a" "Enter" + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl q" { Quit; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + locked { + bind "Ctrl g" { SwitchToMode "normal"; } + } + pane { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl p" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl q" { Quit; } + bind "h" "Left" { MoveFocus "Left"; } + bind "l" "Right" { MoveFocus "Right"; } + bind "j" "Down" { MoveFocus "Down"; } + bind "k" "Up" { MoveFocus "Up"; } + bind "p" { SwitchFocus; } + bind "n" { NewPane; SwitchToMode "normal"; } + bind "d" { NewPane "Down"; SwitchToMode "normal"; } + bind "r" { NewPane "Right"; SwitchToMode "normal"; } + bind "x" { CloseFocus; SwitchToMode "normal"; } + bind "f" { ToggleFocusFullscreen; SwitchToMode "normal"; } + bind "z" { TogglePaneFrames; SwitchToMode "normal"; } + bind "w" { ToggleFloatingPanes; SwitchToMode "normal"; } + bind "e" { TogglePaneEmbedOrFloating; SwitchToMode "normal"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + bind "c" { SwitchToMode "RenamePane"; PaneNameInput 0; } + } + tab { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl t" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "r" { SwitchToMode "RenameTab"; TabNameInput 0; } + bind "Ctrl q" { Quit; } + bind "h" "Left" "Up" "k" { GoToPreviousTab; } + bind "l" "Right" "Down" "j" { GoToNextTab; } + bind "n" { NewTab; SwitchToMode "normal"; } + bind "x" { CloseTab; SwitchToMode "normal"; } + bind "s" { ToggleActiveSyncTab; SwitchToMode "normal"; } + bind "1" { GoToTab 1; SwitchToMode "normal"; } + bind "2" { GoToTab 2; SwitchToMode "normal"; } + bind "3" { GoToTab 3; SwitchToMode "normal"; } + bind "4" { GoToTab 4; SwitchToMode "normal"; } + bind "5" { GoToTab 5; SwitchToMode "normal"; } + bind "6" { GoToTab 6; SwitchToMode "normal"; } + bind "7" { GoToTab 7; SwitchToMode "normal"; } + bind "8" { GoToTab 8; SwitchToMode "normal"; } + bind "9" { GoToTab 9; SwitchToMode "normal"; } + bind "Tab" { ToggleTab; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + resize { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl n" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl q" { Quit; } + bind "h" "Left" { Resize "Left"; } + bind "j" "Down" { Resize "Down"; } + bind "k" "Up" { Resize "Up"; } + bind "l" "Right" { Resize "Right"; } + bind "=" { Resize "Increase"; } + bind "+" { Resize "Increase"; } + bind "-" { Resize "Decrease"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + move { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl h" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl q" { Quit; } + bind "n" "Tab" { MovePane; } + bind "h" "Left" { MovePane "Left"; } + bind "j" "Down" { MovePane "Down"; } + bind "k" "Up" { MovePane "Up"; } + bind "l" "Right" { MovePane "Right"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + scroll { + bind "e" { EditScrollback; SwitchToMode "normal"; } + bind "Ctrl s" "Space" "Enter" "Esc" { SwitchToMode "normal"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl c" { ScrollToBottom; SwitchToMode "normal"; } + bind "Ctrl q" { Quit; } + bind "j" "Down" { ScrollDown; } + bind "k" "Up" { ScrollUp; } + bind "Ctrl f" "PageDown" "Right" "l" { PageScrollDown; } + bind "Ctrl b" "PageUp" "Left" "h" { PageScrollUp; } + bind "d" { HalfPageScrollDown; } + bind "u" { HalfPageScrollUp; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + bind "s" { SwitchToMode "entersearch"; SearchInput 0; } + } + session { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl o" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl q" { Quit; } + bind "d" { Detach; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + search { + bind "Ctrl s" "Space" "Enter" "Esc" { SwitchToMode "normal"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl c" { ScrollToBottom; SwitchToMode "normal"; } + bind "Ctrl q" { Quit; } + bind "j" "Down" { ScrollDown; } + bind "k" "Up" { ScrollUp; } + bind "Ctrl f" "PageDown" "Right" "l" { PageScrollDown; } + bind "Ctrl b" "PageUp" "Left" "h" { PageScrollUp; } + bind "d" { HalfPageScrollDown; } + bind "u" { HalfPageScrollUp; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + bind "s" { SwitchToMode "entersearch"; SearchInput 0; } + bind "n" { Search "Down"; } + bind "p" { Search "Up"; } + bind "c" { SearchToggleOption "CaseSensitivity"; } + bind "w" { SearchToggleOption "Wrap"; } + bind "o" { SearchToggleOption "WholeWord"; } + } + entersearch { + bind "Enter" { SwitchToMode "search"; } + bind "Ctrl c" "Esc" { SearchInput 27; SwitchToMode "scroll"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + RenameTab { + bind "Enter" "Ctrl c" "Esc" { SwitchToMode "normal"; } + bind "Esc" { UndoRenameTab; SwitchToMode "tab"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + RenamePane { + bind "Enter" "Ctrl c" "Esc" { SwitchToMode "normal"; } + bind "Esc" { UndoRenamePane; SwitchToMode "pane"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + tmux { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl o" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "[" { SwitchToMode "scroll"; } + bind "Ctrl q" { Quit; } + bind "Ctrl b" { Write 2; SwitchToMode "normal"; } + bind "\"" { NewPane "Down"; SwitchToMode "normal"; } + bind "%" { NewPane "Right"; SwitchToMode "normal"; } + bind "z" { ToggleFocusFullscreen; SwitchToMode "normal"; } + bind "c" { NewTab; SwitchToMode "normal"; } + bind "," { SwitchToMode "RenameTab"; TabNameInput 0; } + bind "p" { GoToPreviousTab; SwitchToMode "normal"; } + bind "n" { GoToNextTab; SwitchToMode "normal"; } + bind "Left" { MoveFocus "Left"; SwitchToMode "normal"; } + bind "Right" { MoveFocus "Right"; SwitchToMode "normal"; } + bind "Down" { MoveFocus "Down"; SwitchToMode "normal"; } + bind "Up" { MoveFocus "Up"; SwitchToMode "normal"; } + bind "h" { MoveFocus "Left"; SwitchToMode "normal"; } + bind "l" { MoveFocus "Right"; SwitchToMode "normal"; } + bind "j" { MoveFocus "Down"; SwitchToMode "normal"; } + bind "k" { MoveFocus "Up"; SwitchToMode "normal"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "o" { FocusNextPane; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + bind "d" { Detach; } + } +} + +// Choose what to do when zellij receives SIGTERM, SIGINT, SIGQUIT or SIGHUP +// eg. when terminal window with an active zellij session is closed +// Options: +// - detach (Default) +// - quit +// +// on_force_close "quit" + +// Send a request for a simplified ui (without arrow fonts) to plugins +// Options: +// - true +// - false (Default) +// +// simplified_ui true + +// Choose the path to the default shell that zellij will use for opening new panes +// Default: $SHELL +// +// default_shell "fish" + +// Toggle between having pane frames around the panes +// Options: +// - true (default) +// - false +// +// pane_frames true + +// Choose the theme that is specified in the themes section. +// Default: default +// +// theme "default" + +// The name of the default layout to load on startup +// Default: "default" +// +// default_layout "compact" + +// Choose the mode that zellij uses when starting up. +// Default: normal +// +// default_mode "locked" + +// Toggle enabling the mouse mode. +// On certain configurations, or terminals this could +// potentially interfere with copying text. +// Options: +// - true (default) +// - false +// +// mouse_mode false + +// Configure the scroll back buffer size +// This is the number of lines zellij stores for each pane in the scroll back +// buffer. Excess number of lines are discarded in a FIFO fashion. +// Valid values: positive integers +// Default value: 10000 +// +// scroll_buffer_size 10000 + +// Provide a command to execute when copying text. The text will be piped to +// the stdin of the program to perform the copy. This can be used with +// terminal emulators which do not support the OSC 52 ANSI control sequence +// that will be used by default if this option is not set. +// Examples: +// +// copy_command "xclip -selection clipboard" // x11 +// copy_command "wl-copy" // wayland +// copy_command "pbcopy" // osx + +// Choose the destination for copied text +// Allows using the primary selection buffer (on x11/wayland) instead of the system clipboard. +// Does not apply when using copy_command. +// Options: +// - system (default) +// - primary +// +// copy_clipboard "primary" + +// Enable or disable automatic copy (and clear) of selection when releasing mouse +// Default: true +// +// copy_on_select false + +// Path to the default editor to use to edit pane scrollbuffer +// Default: $EDITOR or $VISUAL +// +// scrollback_editor "/usr/bin/vim" + +// When attaching to an existing session with other users, +// should the session be mirrored (true) +// or should each user have their own cursor (false) +// Default: false +// +// mirror_session true + +// The folder in which Zellij will look for layouts +// +// layout_dir /path/to/my/layout_dir + +// The folder in which Zellij will look for themes +// +// theme_dir "/path/to/my/theme_dir" + +plugins { + tab-bar { path "tab-bar"; } + status-bar { path "status-bar"; } + strider { path "strider"; } + compact-bar { path "compact-bar"; } +} + diff --git a/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_config__convert_config_test__convert_config_with_themes_config.snap b/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_config__convert_config_test__convert_config_with_themes_config.snap new file mode 100644 index 00000000..f8a65133 --- /dev/null +++ b/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_config__convert_config_test__convert_config_with_themes_config.snap @@ -0,0 +1,451 @@ +--- +source: zellij-client/src/old_config_converter/./unit/convert_config_tests.rs +assertion_line: 90 +expression: "format!(\"{}\", kdl_config)" +--- +keybinds clear-defaults=true { + normal { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl q" { Quit; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + locked { + bind "Ctrl g" { SwitchToMode "normal"; } + } + pane { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl p" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl q" { Quit; } + bind "h" "Left" { MoveFocus "Left"; } + bind "l" "Right" { MoveFocus "Right"; } + bind "j" "Down" { MoveFocus "Down"; } + bind "k" "Up" { MoveFocus "Up"; } + bind "p" { SwitchFocus; } + bind "n" { NewPane; SwitchToMode "normal"; } + bind "d" { NewPane "Down"; SwitchToMode "normal"; } + bind "r" { NewPane "Right"; SwitchToMode "normal"; } + bind "x" { CloseFocus; SwitchToMode "normal"; } + bind "f" { ToggleFocusFullscreen; SwitchToMode "normal"; } + bind "z" { TogglePaneFrames; SwitchToMode "normal"; } + bind "w" { ToggleFloatingPanes; SwitchToMode "normal"; } + bind "e" { TogglePaneEmbedOrFloating; SwitchToMode "normal"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + bind "c" { SwitchToMode "RenamePane"; PaneNameInput 0; } + } + tab { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl t" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "r" { SwitchToMode "RenameTab"; TabNameInput 0; } + bind "Ctrl q" { Quit; } + bind "h" "Left" "Up" "k" { GoToPreviousTab; } + bind "l" "Right" "Down" "j" { GoToNextTab; } + bind "n" { NewTab; SwitchToMode "normal"; } + bind "x" { CloseTab; SwitchToMode "normal"; } + bind "s" { ToggleActiveSyncTab; SwitchToMode "normal"; } + bind "1" { GoToTab 1; SwitchToMode "normal"; } + bind "2" { GoToTab 2; SwitchToMode "normal"; } + bind "3" { GoToTab 3; SwitchToMode "normal"; } + bind "4" { GoToTab 4; SwitchToMode "normal"; } + bind "5" { GoToTab 5; SwitchToMode "normal"; } + bind "6" { GoToTab 6; SwitchToMode "normal"; } + bind "7" { GoToTab 7; SwitchToMode "normal"; } + bind "8" { GoToTab 8; SwitchToMode "normal"; } + bind "9" { GoToTab 9; SwitchToMode "normal"; } + bind "Tab" { ToggleTab; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + resize { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl n" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl q" { Quit; } + bind "h" "Left" { Resize "Left"; } + bind "j" "Down" { Resize "Down"; } + bind "k" "Up" { Resize "Up"; } + bind "l" "Right" { Resize "Right"; } + bind "=" { Resize "Increase"; } + bind "+" { Resize "Increase"; } + bind "-" { Resize "Decrease"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + move { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl h" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl q" { Quit; } + bind "n" "Tab" { MovePane; } + bind "h" "Left" { MovePane "Left"; } + bind "j" "Down" { MovePane "Down"; } + bind "k" "Up" { MovePane "Up"; } + bind "l" "Right" { MovePane "Right"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + scroll { + bind "e" { EditScrollback; SwitchToMode "normal"; } + bind "Ctrl s" "Space" "Enter" "Esc" { SwitchToMode "normal"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl c" { ScrollToBottom; SwitchToMode "normal"; } + bind "Ctrl q" { Quit; } + bind "j" "Down" { ScrollDown; } + bind "k" "Up" { ScrollUp; } + bind "Ctrl f" "PageDown" "Right" "l" { PageScrollDown; } + bind "Ctrl b" "PageUp" "Left" "h" { PageScrollUp; } + bind "d" { HalfPageScrollDown; } + bind "u" { HalfPageScrollUp; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + bind "s" { SwitchToMode "entersearch"; SearchInput 0; } + } + session { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl o" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl q" { Quit; } + bind "d" { Detach; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + search { + bind "Ctrl s" "Space" "Enter" "Esc" { SwitchToMode "normal"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl c" { ScrollToBottom; SwitchToMode "normal"; } + bind "Ctrl q" { Quit; } + bind "j" "Down" { ScrollDown; } + bind "k" "Up" { ScrollUp; } + bind "Ctrl f" "PageDown" "Right" "l" { PageScrollDown; } + bind "Ctrl b" "PageUp" "Left" "h" { PageScrollUp; } + bind "d" { HalfPageScrollDown; } + bind "u" { HalfPageScrollUp; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + bind "s" { SwitchToMode "entersearch"; SearchInput 0; } + bind "n" { Search "Down"; } + bind "p" { Search "Up"; } + bind "c" { SearchToggleOption "CaseSensitivity"; } + bind "w" { SearchToggleOption "Wrap"; } + bind "o" { SearchToggleOption "WholeWord"; } + } + entersearch { + bind "Enter" { SwitchToMode "search"; } + bind "Ctrl c" "Esc" { SearchInput 27; SwitchToMode "scroll"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + RenameTab { + bind "Enter" "Ctrl c" "Esc" { SwitchToMode "normal"; } + bind "Esc" { UndoRenameTab; SwitchToMode "tab"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + RenamePane { + bind "Enter" "Ctrl c" "Esc" { SwitchToMode "normal"; } + bind "Esc" { UndoRenamePane; SwitchToMode "pane"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + tmux { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl o" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "[" { SwitchToMode "scroll"; } + bind "Ctrl q" { Quit; } + bind "Ctrl b" { Write 2; SwitchToMode "normal"; } + bind "\"" { NewPane "Down"; SwitchToMode "normal"; } + bind "%" { NewPane "Right"; SwitchToMode "normal"; } + bind "z" { ToggleFocusFullscreen; SwitchToMode "normal"; } + bind "c" { NewTab; SwitchToMode "normal"; } + bind "," { SwitchToMode "RenameTab"; TabNameInput 0; } + bind "p" { GoToPreviousTab; SwitchToMode "normal"; } + bind "n" { GoToNextTab; SwitchToMode "normal"; } + bind "Left" { MoveFocus "Left"; SwitchToMode "normal"; } + bind "Right" { MoveFocus "Right"; SwitchToMode "normal"; } + bind "Down" { MoveFocus "Down"; SwitchToMode "normal"; } + bind "Up" { MoveFocus "Up"; SwitchToMode "normal"; } + bind "h" { MoveFocus "Left"; SwitchToMode "normal"; } + bind "l" { MoveFocus "Right"; SwitchToMode "normal"; } + bind "j" { MoveFocus "Down"; SwitchToMode "normal"; } + bind "k" { MoveFocus "Up"; SwitchToMode "normal"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "o" { FocusNextPane; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + bind "d" { Detach; } + } +} + +// Choose what to do when zellij receives SIGTERM, SIGINT, SIGQUIT or SIGHUP +// eg. when terminal window with an active zellij session is closed +// Options: +// - detach (Default) +// - quit +// +// on_force_close "quit" + +// Send a request for a simplified ui (without arrow fonts) to plugins +// Options: +// - true +// - false (Default) +// +// simplified_ui true + +// Choose the path to the default shell that zellij will use for opening new panes +// Default: $SHELL +// +// default_shell "fish" + +// Toggle between having pane frames around the panes +// Options: +// - true (default) +// - false +// +// pane_frames true + +// Choose the theme that is specified in the themes section. +// Default: default +// +// theme "default" + +// The name of the default layout to load on startup +// Default: "default" +// +// default_layout "compact" + +// Choose the mode that zellij uses when starting up. +// Default: normal +// +// default_mode "locked" + +// Toggle enabling the mouse mode. +// On certain configurations, or terminals this could +// potentially interfere with copying text. +// Options: +// - true (default) +// - false +// +// mouse_mode false + +// Configure the scroll back buffer size +// This is the number of lines zellij stores for each pane in the scroll back +// buffer. Excess number of lines are discarded in a FIFO fashion. +// Valid values: positive integers +// Default value: 10000 +// +// scroll_buffer_size 10000 + +// Provide a command to execute when copying text. The text will be piped to +// the stdin of the program to perform the copy. This can be used with +// terminal emulators which do not support the OSC 52 ANSI control sequence +// that will be used by default if this option is not set. +// Examples: +// +// copy_command "xclip -selection clipboard" // x11 +// copy_command "wl-copy" // wayland +// copy_command "pbcopy" // osx + +// Choose the destination for copied text +// Allows using the primary selection buffer (on x11/wayland) instead of the system clipboard. +// Does not apply when using copy_command. +// Options: +// - system (default) +// - primary +// +// copy_clipboard "primary" + +// Enable or disable automatic copy (and clear) of selection when releasing mouse +// Default: true +// +// copy_on_select false + +// Path to the default editor to use to edit pane scrollbuffer +// Default: $EDITOR or $VISUAL +// +// scrollback_editor "/usr/bin/vim" + +// When attaching to an existing session with other users, +// should the session be mirrored (true) +// or should each user have their own cursor (false) +// Default: false +// +// mirror_session true + +// The folder in which Zellij will look for layouts +// +// layout_dir /path/to/my/layout_dir + +// The folder in which Zellij will look for themes +// +// theme_dir "/path/to/my/theme_dir" + +plugins { + tab-bar { path "tab-bar"; } + status-bar { path "status-bar"; } + strider { path "strider"; } + compact-bar { path "compact-bar"; } +} +themes { + molokai-dark { + fg 248 248 240 + bg 27 29 30 + black 0 0 0 + red 255 0 0 + green 0 140 0 + yellow 255 255 0 + blue 102 217 239 + magenta 174 129 255 + cyan 0 255 255 + white 255 255 255 + orange 253 151 31 + } + nord { + fg 216 222 233 + bg 46 52 64 + black 59 66 82 + red 191 97 106 + green 163 190 140 + yellow 235 203 139 + blue 129 161 193 + magenta 180 142 173 + cyan 136 192 208 + white 229 233 240 + orange 208 135 112 + } + some-eightbit-theme { + fg 8 + bg 0 + black 10 + red 2 + green 3 + yellow 4 + blue 5 + magenta 6 + cyan 9 + white 255 + orange 7 + } +} + diff --git a/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_config__convert_config_test__convert_config_with_ui_config.snap b/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_config__convert_config_test__convert_config_with_ui_config.snap new file mode 100644 index 00000000..e805563a --- /dev/null +++ b/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_config__convert_config_test__convert_config_with_ui_config.snap @@ -0,0 +1,416 @@ +--- +source: zellij-client/src/old_config_converter/./unit/convert_config_tests.rs +assertion_line: 79 +expression: "format!(\"{}\", kdl_config)" +--- +keybinds clear-defaults=true { + normal { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl q" { Quit; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + locked { + bind "Ctrl g" { SwitchToMode "normal"; } + } + pane { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl p" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl q" { Quit; } + bind "h" "Left" { MoveFocus "Left"; } + bind "l" "Right" { MoveFocus "Right"; } + bind "j" "Down" { MoveFocus "Down"; } + bind "k" "Up" { MoveFocus "Up"; } + bind "p" { SwitchFocus; } + bind "n" { NewPane; SwitchToMode "normal"; } + bind "d" { NewPane "Down"; SwitchToMode "normal"; } + bind "r" { NewPane "Right"; SwitchToMode "normal"; } + bind "x" { CloseFocus; SwitchToMode "normal"; } + bind "f" { ToggleFocusFullscreen; SwitchToMode "normal"; } + bind "z" { TogglePaneFrames; SwitchToMode "normal"; } + bind "w" { ToggleFloatingPanes; SwitchToMode "normal"; } + bind "e" { TogglePaneEmbedOrFloating; SwitchToMode "normal"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + bind "c" { SwitchToMode "RenamePane"; PaneNameInput 0; } + } + tab { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl t" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "r" { SwitchToMode "RenameTab"; TabNameInput 0; } + bind "Ctrl q" { Quit; } + bind "h" "Left" "Up" "k" { GoToPreviousTab; } + bind "l" "Right" "Down" "j" { GoToNextTab; } + bind "n" { NewTab; SwitchToMode "normal"; } + bind "x" { CloseTab; SwitchToMode "normal"; } + bind "s" { ToggleActiveSyncTab; SwitchToMode "normal"; } + bind "1" { GoToTab 1; SwitchToMode "normal"; } + bind "2" { GoToTab 2; SwitchToMode "normal"; } + bind "3" { GoToTab 3; SwitchToMode "normal"; } + bind "4" { GoToTab 4; SwitchToMode "normal"; } + bind "5" { GoToTab 5; SwitchToMode "normal"; } + bind "6" { GoToTab 6; SwitchToMode "normal"; } + bind "7" { GoToTab 7; SwitchToMode "normal"; } + bind "8" { GoToTab 8; SwitchToMode "normal"; } + bind "9" { GoToTab 9; SwitchToMode "normal"; } + bind "Tab" { ToggleTab; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + resize { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl n" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl q" { Quit; } + bind "h" "Left" { Resize "Left"; } + bind "j" "Down" { Resize "Down"; } + bind "k" "Up" { Resize "Up"; } + bind "l" "Right" { Resize "Right"; } + bind "=" { Resize "Increase"; } + bind "+" { Resize "Increase"; } + bind "-" { Resize "Decrease"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + move { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl h" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl q" { Quit; } + bind "n" "Tab" { MovePane; } + bind "h" "Left" { MovePane "Left"; } + bind "j" "Down" { MovePane "Down"; } + bind "k" "Up" { MovePane "Up"; } + bind "l" "Right" { MovePane "Right"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + scroll { + bind "e" { EditScrollback; SwitchToMode "normal"; } + bind "Ctrl s" "Space" "Enter" "Esc" { SwitchToMode "normal"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl c" { ScrollToBottom; SwitchToMode "normal"; } + bind "Ctrl q" { Quit; } + bind "j" "Down" { ScrollDown; } + bind "k" "Up" { ScrollUp; } + bind "Ctrl f" "PageDown" "Right" "l" { PageScrollDown; } + bind "Ctrl b" "PageUp" "Left" "h" { PageScrollUp; } + bind "d" { HalfPageScrollDown; } + bind "u" { HalfPageScrollUp; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + bind "s" { SwitchToMode "entersearch"; SearchInput 0; } + } + session { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl o" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl q" { Quit; } + bind "d" { Detach; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + search { + bind "Ctrl s" "Space" "Enter" "Esc" { SwitchToMode "normal"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl c" { ScrollToBottom; SwitchToMode "normal"; } + bind "Ctrl q" { Quit; } + bind "j" "Down" { ScrollDown; } + bind "k" "Up" { ScrollUp; } + bind "Ctrl f" "PageDown" "Right" "l" { PageScrollDown; } + bind "Ctrl b" "PageUp" "Left" "h" { PageScrollUp; } + bind "d" { HalfPageScrollDown; } + bind "u" { HalfPageScrollUp; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + bind "s" { SwitchToMode "entersearch"; SearchInput 0; } + bind "n" { Search "Down"; } + bind "p" { Search "Up"; } + bind "c" { SearchToggleOption "CaseSensitivity"; } + bind "w" { SearchToggleOption "Wrap"; } + bind "o" { SearchToggleOption "WholeWord"; } + } + entersearch { + bind "Enter" { SwitchToMode "search"; } + bind "Ctrl c" "Esc" { SearchInput 27; SwitchToMode "scroll"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + RenameTab { + bind "Enter" "Ctrl c" "Esc" { SwitchToMode "normal"; } + bind "Esc" { UndoRenameTab; SwitchToMode "tab"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + RenamePane { + bind "Enter" "Ctrl c" "Esc" { SwitchToMode "normal"; } + bind "Esc" { UndoRenamePane; SwitchToMode "pane"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + tmux { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl o" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "[" { SwitchToMode "scroll"; } + bind "Ctrl q" { Quit; } + bind "Ctrl b" { Write 2; SwitchToMode "normal"; } + bind "\"" { NewPane "Down"; SwitchToMode "normal"; } + bind "%" { NewPane "Right"; SwitchToMode "normal"; } + bind "z" { ToggleFocusFullscreen; SwitchToMode "normal"; } + bind "c" { NewTab; SwitchToMode "normal"; } + bind "," { SwitchToMode "RenameTab"; TabNameInput 0; } + bind "p" { GoToPreviousTab; SwitchToMode "normal"; } + bind "n" { GoToNextTab; SwitchToMode "normal"; } + bind "Left" { MoveFocus "Left"; SwitchToMode "normal"; } + bind "Right" { MoveFocus "Right"; SwitchToMode "normal"; } + bind "Down" { MoveFocus "Down"; SwitchToMode "normal"; } + bind "Up" { MoveFocus "Up"; SwitchToMode "normal"; } + bind "h" { MoveFocus "Left"; SwitchToMode "normal"; } + bind "l" { MoveFocus "Right"; SwitchToMode "normal"; } + bind "j" { MoveFocus "Down"; SwitchToMode "normal"; } + bind "k" { MoveFocus "Up"; SwitchToMode "normal"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "o" { FocusNextPane; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + bind "d" { Detach; } + } +} + +// Choose what to do when zellij receives SIGTERM, SIGINT, SIGQUIT or SIGHUP +// eg. when terminal window with an active zellij session is closed +// Options: +// - detach (Default) +// - quit +// +// on_force_close "quit" + +// Send a request for a simplified ui (without arrow fonts) to plugins +// Options: +// - true +// - false (Default) +// +// simplified_ui true + +// Choose the path to the default shell that zellij will use for opening new panes +// Default: $SHELL +// +// default_shell "fish" + +// Toggle between having pane frames around the panes +// Options: +// - true (default) +// - false +// +// pane_frames true + +// Choose the theme that is specified in the themes section. +// Default: default +// +// theme "default" + +// The name of the default layout to load on startup +// Default: "default" +// +// default_layout "compact" + +// Choose the mode that zellij uses when starting up. +// Default: normal +// +// default_mode "locked" + +// Toggle enabling the mouse mode. +// On certain configurations, or terminals this could +// potentially interfere with copying text. +// Options: +// - true (default) +// - false +// +// mouse_mode false + +// Configure the scroll back buffer size +// This is the number of lines zellij stores for each pane in the scroll back +// buffer. Excess number of lines are discarded in a FIFO fashion. +// Valid values: positive integers +// Default value: 10000 +// +// scroll_buffer_size 10000 + +// Provide a command to execute when copying text. The text will be piped to +// the stdin of the program to perform the copy. This can be used with +// terminal emulators which do not support the OSC 52 ANSI control sequence +// that will be used by default if this option is not set. +// Examples: +// +// copy_command "xclip -selection clipboard" // x11 +// copy_command "wl-copy" // wayland +// copy_command "pbcopy" // osx + +// Choose the destination for copied text +// Allows using the primary selection buffer (on x11/wayland) instead of the system clipboard. +// Does not apply when using copy_command. +// Options: +// - system (default) +// - primary +// +// copy_clipboard "primary" + +// Enable or disable automatic copy (and clear) of selection when releasing mouse +// Default: true +// +// copy_on_select false + +// Path to the default editor to use to edit pane scrollbuffer +// Default: $EDITOR or $VISUAL +// +// scrollback_editor "/usr/bin/vim" + +// When attaching to an existing session with other users, +// should the session be mirrored (true) +// or should each user have their own cursor (false) +// Default: false +// +// mirror_session true + +// The folder in which Zellij will look for layouts +// +// layout_dir /path/to/my/layout_dir + +// The folder in which Zellij will look for themes +// +// theme_dir "/path/to/my/theme_dir" + +plugins { + tab-bar { path "tab-bar"; } + status-bar { path "status-bar"; } + strider { path "strider"; } + compact-bar { path "compact-bar"; } +} + +ui { + pane_frames { + rounded_corners true + } +} + diff --git a/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_config__convert_config_test__convert_config_with_unbind_all_keys_per_mode.snap b/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_config__convert_config_test__convert_config_with_unbind_all_keys_per_mode.snap new file mode 100644 index 00000000..2b35143e --- /dev/null +++ b/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_config__convert_config_test__convert_config_with_unbind_all_keys_per_mode.snap @@ -0,0 +1,410 @@ +--- +source: zellij-client/src/old_config_converter/./unit/convert_config_tests.rs +assertion_line: 57 +expression: "format!(\"{}\", kdl_config)" +--- +keybinds { + normal clear-defaults=true { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl q" { Quit; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + locked { + bind "Ctrl g" { SwitchToMode "normal"; } + } + pane { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl p" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl q" { Quit; } + bind "h" "Left" { MoveFocus "Left"; } + bind "l" "Right" { MoveFocus "Right"; } + bind "j" "Down" { MoveFocus "Down"; } + bind "k" "Up" { MoveFocus "Up"; } + bind "p" { SwitchFocus; } + bind "n" { NewPane; SwitchToMode "normal"; } + bind "d" { NewPane "Down"; SwitchToMode "normal"; } + bind "r" { NewPane "Right"; SwitchToMode "normal"; } + bind "x" { CloseFocus; SwitchToMode "normal"; } + bind "f" { ToggleFocusFullscreen; SwitchToMode "normal"; } + bind "z" { TogglePaneFrames; SwitchToMode "normal"; } + bind "w" { ToggleFloatingPanes; SwitchToMode "normal"; } + bind "e" { TogglePaneEmbedOrFloating; SwitchToMode "normal"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + bind "c" { SwitchToMode "RenamePane"; PaneNameInput 0; } + } + tab { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl t" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "r" { SwitchToMode "RenameTab"; TabNameInput 0; } + bind "Ctrl q" { Quit; } + bind "h" "Left" "Up" "k" { GoToPreviousTab; } + bind "l" "Right" "Down" "j" { GoToNextTab; } + bind "n" { NewTab; SwitchToMode "normal"; } + bind "x" { CloseTab; SwitchToMode "normal"; } + bind "s" { ToggleActiveSyncTab; SwitchToMode "normal"; } + bind "1" { GoToTab 1; SwitchToMode "normal"; } + bind "2" { GoToTab 2; SwitchToMode "normal"; } + bind "3" { GoToTab 3; SwitchToMode "normal"; } + bind "4" { GoToTab 4; SwitchToMode "normal"; } + bind "5" { GoToTab 5; SwitchToMode "normal"; } + bind "6" { GoToTab 6; SwitchToMode "normal"; } + bind "7" { GoToTab 7; SwitchToMode "normal"; } + bind "8" { GoToTab 8; SwitchToMode "normal"; } + bind "9" { GoToTab 9; SwitchToMode "normal"; } + bind "Tab" { ToggleTab; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + resize { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl n" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl q" { Quit; } + bind "h" "Left" { Resize "Left"; } + bind "j" "Down" { Resize "Down"; } + bind "k" "Up" { Resize "Up"; } + bind "l" "Right" { Resize "Right"; } + bind "=" { Resize "Increase"; } + bind "+" { Resize "Increase"; } + bind "-" { Resize "Decrease"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + move { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl h" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl q" { Quit; } + bind "n" "Tab" { MovePane; } + bind "h" "Left" { MovePane "Left"; } + bind "j" "Down" { MovePane "Down"; } + bind "k" "Up" { MovePane "Up"; } + bind "l" "Right" { MovePane "Right"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + scroll { + bind "e" { EditScrollback; SwitchToMode "normal"; } + bind "Ctrl s" "Space" "Enter" "Esc" { SwitchToMode "normal"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl c" { ScrollToBottom; SwitchToMode "normal"; } + bind "Ctrl q" { Quit; } + bind "j" "Down" { ScrollDown; } + bind "k" "Up" { ScrollUp; } + bind "Ctrl f" "PageDown" "Right" "l" { PageScrollDown; } + bind "Ctrl b" "PageUp" "Left" "h" { PageScrollUp; } + bind "d" { HalfPageScrollDown; } + bind "u" { HalfPageScrollUp; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + bind "s" { SwitchToMode "entersearch"; SearchInput 0; } + } + session { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl o" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl q" { Quit; } + bind "d" { Detach; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + search { + bind "Ctrl s" "Space" "Enter" "Esc" { SwitchToMode "normal"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl c" { ScrollToBottom; SwitchToMode "normal"; } + bind "Ctrl q" { Quit; } + bind "j" "Down" { ScrollDown; } + bind "k" "Up" { ScrollUp; } + bind "Ctrl f" "PageDown" "Right" "l" { PageScrollDown; } + bind "Ctrl b" "PageUp" "Left" "h" { PageScrollUp; } + bind "d" { HalfPageScrollDown; } + bind "u" { HalfPageScrollUp; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + bind "s" { SwitchToMode "entersearch"; SearchInput 0; } + bind "n" { Search "Down"; } + bind "p" { Search "Up"; } + bind "c" { SearchToggleOption "CaseSensitivity"; } + bind "w" { SearchToggleOption "Wrap"; } + bind "o" { SearchToggleOption "WholeWord"; } + } + entersearch { + bind "Enter" { SwitchToMode "search"; } + bind "Ctrl c" "Esc" { SearchInput 27; SwitchToMode "scroll"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + RenameTab { + bind "Enter" "Ctrl c" "Esc" { SwitchToMode "normal"; } + bind "Esc" { UndoRenameTab; SwitchToMode "tab"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + RenamePane { + bind "Enter" "Ctrl c" "Esc" { SwitchToMode "normal"; } + bind "Esc" { UndoRenamePane; SwitchToMode "pane"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + tmux { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl o" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "[" { SwitchToMode "scroll"; } + bind "Ctrl q" { Quit; } + bind "Ctrl b" { Write 2; SwitchToMode "normal"; } + bind "\"" { NewPane "Down"; SwitchToMode "normal"; } + bind "%" { NewPane "Right"; SwitchToMode "normal"; } + bind "z" { ToggleFocusFullscreen; SwitchToMode "normal"; } + bind "c" { NewTab; SwitchToMode "normal"; } + bind "," { SwitchToMode "RenameTab"; TabNameInput 0; } + bind "p" { GoToPreviousTab; SwitchToMode "normal"; } + bind "n" { GoToNextTab; SwitchToMode "normal"; } + bind "Left" { MoveFocus "Left"; SwitchToMode "normal"; } + bind "Right" { MoveFocus "Right"; SwitchToMode "normal"; } + bind "Down" { MoveFocus "Down"; SwitchToMode "normal"; } + bind "Up" { MoveFocus "Up"; SwitchToMode "normal"; } + bind "h" { MoveFocus "Left"; SwitchToMode "normal"; } + bind "l" { MoveFocus "Right"; SwitchToMode "normal"; } + bind "j" { MoveFocus "Down"; SwitchToMode "normal"; } + bind "k" { MoveFocus "Up"; SwitchToMode "normal"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "o" { FocusNextPane; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + bind "d" { Detach; } + } +} + +// Choose what to do when zellij receives SIGTERM, SIGINT, SIGQUIT or SIGHUP +// eg. when terminal window with an active zellij session is closed +// Options: +// - detach (Default) +// - quit +// +// on_force_close "quit" + +// Send a request for a simplified ui (without arrow fonts) to plugins +// Options: +// - true +// - false (Default) +// +// simplified_ui true + +// Choose the path to the default shell that zellij will use for opening new panes +// Default: $SHELL +// +// default_shell "fish" + +// Toggle between having pane frames around the panes +// Options: +// - true (default) +// - false +// +// pane_frames true + +// Choose the theme that is specified in the themes section. +// Default: default +// +// theme "default" + +// The name of the default layout to load on startup +// Default: "default" +// +// default_layout "compact" + +// Choose the mode that zellij uses when starting up. +// Default: normal +// +// default_mode "locked" + +// Toggle enabling the mouse mode. +// On certain configurations, or terminals this could +// potentially interfere with copying text. +// Options: +// - true (default) +// - false +// +// mouse_mode false + +// Configure the scroll back buffer size +// This is the number of lines zellij stores for each pane in the scroll back +// buffer. Excess number of lines are discarded in a FIFO fashion. +// Valid values: positive integers +// Default value: 10000 +// +// scroll_buffer_size 10000 + +// Provide a command to execute when copying text. The text will be piped to +// the stdin of the program to perform the copy. This can be used with +// terminal emulators which do not support the OSC 52 ANSI control sequence +// that will be used by default if this option is not set. +// Examples: +// +// copy_command "xclip -selection clipboard" // x11 +// copy_command "wl-copy" // wayland +// copy_command "pbcopy" // osx + +// Choose the destination for copied text +// Allows using the primary selection buffer (on x11/wayland) instead of the system clipboard. +// Does not apply when using copy_command. +// Options: +// - system (default) +// - primary +// +// copy_clipboard "primary" + +// Enable or disable automatic copy (and clear) of selection when releasing mouse +// Default: true +// +// copy_on_select false + +// Path to the default editor to use to edit pane scrollbuffer +// Default: $EDITOR or $VISUAL +// +// scrollback_editor "/usr/bin/vim" + +// When attaching to an existing session with other users, +// should the session be mirrored (true) +// or should each user have their own cursor (false) +// Default: false +// +// mirror_session true + +// The folder in which Zellij will look for layouts +// +// layout_dir /path/to/my/layout_dir + +// The folder in which Zellij will look for themes +// +// theme_dir "/path/to/my/theme_dir" + +plugins { + tab-bar { path "tab-bar"; } + status-bar { path "status-bar"; } + strider { path "strider"; } + compact-bar { path "compact-bar"; } +} + diff --git a/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_config__convert_config_test__properly_convert_default_config.snap b/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_config__convert_config_test__properly_convert_default_config.snap new file mode 100644 index 00000000..461258e4 --- /dev/null +++ b/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_config__convert_config_test__properly_convert_default_config.snap @@ -0,0 +1,410 @@ +--- +source: zellij-client/src/old_config_converter/./unit/convert_config_tests.rs +assertion_line: 13 +expression: "format!(\"{}\", kdl_config)" +--- +keybinds clear-defaults=true { + normal { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl q" { Quit; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + locked { + bind "Ctrl g" { SwitchToMode "normal"; } + } + pane { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl p" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl q" { Quit; } + bind "h" "Left" { MoveFocus "Left"; } + bind "l" "Right" { MoveFocus "Right"; } + bind "j" "Down" { MoveFocus "Down"; } + bind "k" "Up" { MoveFocus "Up"; } + bind "p" { SwitchFocus; } + bind "n" { NewPane; SwitchToMode "normal"; } + bind "d" { NewPane "Down"; SwitchToMode "normal"; } + bind "r" { NewPane "Right"; SwitchToMode "normal"; } + bind "x" { CloseFocus; SwitchToMode "normal"; } + bind "f" { ToggleFocusFullscreen; SwitchToMode "normal"; } + bind "z" { TogglePaneFrames; SwitchToMode "normal"; } + bind "w" { ToggleFloatingPanes; SwitchToMode "normal"; } + bind "e" { TogglePaneEmbedOrFloating; SwitchToMode "normal"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + bind "c" { SwitchToMode "RenamePane"; PaneNameInput 0; } + } + tab { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl t" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "r" { SwitchToMode "RenameTab"; TabNameInput 0; } + bind "Ctrl q" { Quit; } + bind "h" "Left" "Up" "k" { GoToPreviousTab; } + bind "l" "Right" "Down" "j" { GoToNextTab; } + bind "n" { NewTab; SwitchToMode "normal"; } + bind "x" { CloseTab; SwitchToMode "normal"; } + bind "s" { ToggleActiveSyncTab; SwitchToMode "normal"; } + bind "1" { GoToTab 1; SwitchToMode "normal"; } + bind "2" { GoToTab 2; SwitchToMode "normal"; } + bind "3" { GoToTab 3; SwitchToMode "normal"; } + bind "4" { GoToTab 4; SwitchToMode "normal"; } + bind "5" { GoToTab 5; SwitchToMode "normal"; } + bind "6" { GoToTab 6; SwitchToMode "normal"; } + bind "7" { GoToTab 7; SwitchToMode "normal"; } + bind "8" { GoToTab 8; SwitchToMode "normal"; } + bind "9" { GoToTab 9; SwitchToMode "normal"; } + bind "Tab" { ToggleTab; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + resize { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl n" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl q" { Quit; } + bind "h" "Left" { Resize "Left"; } + bind "j" "Down" { Resize "Down"; } + bind "k" "Up" { Resize "Up"; } + bind "l" "Right" { Resize "Right"; } + bind "=" { Resize "Increase"; } + bind "+" { Resize "Increase"; } + bind "-" { Resize "Decrease"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + move { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl h" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl q" { Quit; } + bind "n" "Tab" { MovePane; } + bind "h" "Left" { MovePane "Left"; } + bind "j" "Down" { MovePane "Down"; } + bind "k" "Up" { MovePane "Up"; } + bind "l" "Right" { MovePane "Right"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + scroll { + bind "e" { EditScrollback; SwitchToMode "normal"; } + bind "Ctrl s" "Space" "Enter" "Esc" { SwitchToMode "normal"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl c" { ScrollToBottom; SwitchToMode "normal"; } + bind "Ctrl q" { Quit; } + bind "j" "Down" { ScrollDown; } + bind "k" "Up" { ScrollUp; } + bind "Ctrl f" "PageDown" "Right" "l" { PageScrollDown; } + bind "Ctrl b" "PageUp" "Left" "h" { PageScrollUp; } + bind "d" { HalfPageScrollDown; } + bind "u" { HalfPageScrollUp; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + bind "s" { SwitchToMode "entersearch"; SearchInput 0; } + } + session { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl o" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl q" { Quit; } + bind "d" { Detach; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + search { + bind "Ctrl s" "Space" "Enter" "Esc" { SwitchToMode "normal"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl b" { SwitchToMode "tmux"; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl c" { ScrollToBottom; SwitchToMode "normal"; } + bind "Ctrl q" { Quit; } + bind "j" "Down" { ScrollDown; } + bind "k" "Up" { ScrollUp; } + bind "Ctrl f" "PageDown" "Right" "l" { PageScrollDown; } + bind "Ctrl b" "PageUp" "Left" "h" { PageScrollUp; } + bind "d" { HalfPageScrollDown; } + bind "u" { HalfPageScrollUp; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + bind "s" { SwitchToMode "entersearch"; SearchInput 0; } + bind "n" { Search "Down"; } + bind "p" { Search "Up"; } + bind "c" { SearchToggleOption "CaseSensitivity"; } + bind "w" { SearchToggleOption "Wrap"; } + bind "o" { SearchToggleOption "WholeWord"; } + } + entersearch { + bind "Enter" { SwitchToMode "search"; } + bind "Ctrl c" "Esc" { SearchInput 27; SwitchToMode "scroll"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + RenameTab { + bind "Enter" "Ctrl c" "Esc" { SwitchToMode "normal"; } + bind "Esc" { UndoRenameTab; SwitchToMode "tab"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + RenamePane { + bind "Enter" "Ctrl c" "Esc" { SwitchToMode "normal"; } + bind "Esc" { UndoRenamePane; SwitchToMode "pane"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + } + tmux { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Ctrl t" { SwitchToMode "tab"; } + bind "Ctrl o" "Enter" "Space" "Esc" { SwitchToMode "normal"; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "[" { SwitchToMode "scroll"; } + bind "Ctrl q" { Quit; } + bind "Ctrl b" { Write 2; SwitchToMode "normal"; } + bind "\"" { NewPane "Down"; SwitchToMode "normal"; } + bind "%" { NewPane "Right"; SwitchToMode "normal"; } + bind "z" { ToggleFocusFullscreen; SwitchToMode "normal"; } + bind "c" { NewTab; SwitchToMode "normal"; } + bind "," { SwitchToMode "RenameTab"; TabNameInput 0; } + bind "p" { GoToPreviousTab; SwitchToMode "normal"; } + bind "n" { GoToNextTab; SwitchToMode "normal"; } + bind "Left" { MoveFocus "Left"; SwitchToMode "normal"; } + bind "Right" { MoveFocus "Right"; SwitchToMode "normal"; } + bind "Down" { MoveFocus "Down"; SwitchToMode "normal"; } + bind "Up" { MoveFocus "Up"; SwitchToMode "normal"; } + bind "h" { MoveFocus "Left"; SwitchToMode "normal"; } + bind "l" { MoveFocus "Right"; SwitchToMode "normal"; } + bind "j" { MoveFocus "Down"; SwitchToMode "normal"; } + bind "k" { MoveFocus "Up"; SwitchToMode "normal"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "o" { FocusNextPane; } + bind "Alt =" { Resize "Increase"; } + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + bind "d" { Detach; } + } +} + +// Choose what to do when zellij receives SIGTERM, SIGINT, SIGQUIT or SIGHUP +// eg. when terminal window with an active zellij session is closed +// Options: +// - detach (Default) +// - quit +// +// on_force_close "quit" + +// Send a request for a simplified ui (without arrow fonts) to plugins +// Options: +// - true +// - false (Default) +// +// simplified_ui true + +// Choose the path to the default shell that zellij will use for opening new panes +// Default: $SHELL +// +// default_shell "fish" + +// Toggle between having pane frames around the panes +// Options: +// - true (default) +// - false +// +// pane_frames true + +// Choose the theme that is specified in the themes section. +// Default: default +// +// theme "default" + +// The name of the default layout to load on startup +// Default: "default" +// +// default_layout "compact" + +// Choose the mode that zellij uses when starting up. +// Default: normal +// +// default_mode "locked" + +// Toggle enabling the mouse mode. +// On certain configurations, or terminals this could +// potentially interfere with copying text. +// Options: +// - true (default) +// - false +// +// mouse_mode false + +// Configure the scroll back buffer size +// This is the number of lines zellij stores for each pane in the scroll back +// buffer. Excess number of lines are discarded in a FIFO fashion. +// Valid values: positive integers +// Default value: 10000 +// +// scroll_buffer_size 10000 + +// Provide a command to execute when copying text. The text will be piped to +// the stdin of the program to perform the copy. This can be used with +// terminal emulators which do not support the OSC 52 ANSI control sequence +// that will be used by default if this option is not set. +// Examples: +// +// copy_command "xclip -selection clipboard" // x11 +// copy_command "wl-copy" // wayland +// copy_command "pbcopy" // osx + +// Choose the destination for copied text +// Allows using the primary selection buffer (on x11/wayland) instead of the system clipboard. +// Does not apply when using copy_command. +// Options: +// - system (default) +// - primary +// +// copy_clipboard "primary" + +// Enable or disable automatic copy (and clear) of selection when releasing mouse +// Default: true +// +// copy_on_select false + +// Path to the default editor to use to edit pane scrollbuffer +// Default: $EDITOR or $VISUAL +// +// scrollback_editor "/usr/bin/vim" + +// When attaching to an existing session with other users, +// should the session be mirrored (true) +// or should each user have their own cursor (false) +// Default: false +// +// mirror_session true + +// The folder in which Zellij will look for layouts +// +// layout_dir /path/to/my/layout_dir + +// The folder in which Zellij will look for themes +// +// theme_dir "/path/to/my/theme_dir" + +plugins { + tab-bar { path "tab-bar"; } + status-bar { path "status-bar"; } + strider { path "strider"; } + compact-bar { path "compact-bar"; } +} + diff --git a/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_layout__convert_layout_test__properly_convert_default_layout.snap b/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_layout__convert_layout_test__properly_convert_default_layout.snap new file mode 100644 index 00000000..94a9a4f3 --- /dev/null +++ b/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_layout__convert_layout_test__properly_convert_default_layout.snap @@ -0,0 +1,14 @@ +--- +source: zellij-client/src/old_config_converter/./unit/convert_layout_tests.rs +assertion_line: 13 +expression: "format!(\"{}\", kdl_config)" +--- +layout { + pane size=1 borderless=true { + plugin location="zellij:tab-bar" + } + pane + pane size=2 borderless=true { + plugin location="zellij:status-bar" + } +} diff --git a/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_layout__convert_layout_test__properly_convert_layout_example_1.snap b/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_layout__convert_layout_test__properly_convert_layout_example_1.snap new file mode 100644 index 00000000..67cb8a60 --- /dev/null +++ b/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_layout__convert_layout_test__properly_convert_layout_example_1.snap @@ -0,0 +1,61 @@ +--- +source: zellij-client/src/old_config_converter/./unit/convert_layout_tests.rs +assertion_line: 68 +expression: "format!(\"{}\", kdl_config)" +--- +layout { + default_tab_template { + pane size=1 borderless=true { + plugin location="zellij:tab-bar" + } + children + pane size=2 borderless=true { + plugin location="zellij:status-bar" + } + } + tab split_direction="Vertical" { + pane split_direction="Vertical" { + pane size="50%" + pane size="50%" + } + } + tab + tab split_direction="Vertical" { + pane split_direction="Vertical" { + pane size="50%" + pane size="50%" + } + } + tab split_direction="Vertical" { + pane split_direction="Vertical" { + pane size="50%" + pane size="50%" split_direction="Horizontal" { + pane size="50%" + pane size="50%" + } + } + } + tab + tab + tab + tab split_direction="Vertical" { + pane split_direction="Vertical" { + pane size="20%" { + plugin location="zellij:strider" + } + pane size="80%" split_direction="Horizontal" { + pane size="50%" + pane size="50%" + } + } + } + tab split_direction="Vertical" { + pane split_direction="Vertical" { + pane size="40%" + pane size="60%" split_direction="Horizontal" { + pane size="50%" + pane size="50%" + } + } + } +} diff --git a/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_layout__convert_layout_test__properly_convert_layout_example_2.snap b/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_layout__convert_layout_test__properly_convert_layout_example_2.snap new file mode 100644 index 00000000..0c5145a1 --- /dev/null +++ b/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_layout__convert_layout_test__properly_convert_layout_example_2.snap @@ -0,0 +1,60 @@ +--- +source: zellij-client/src/old_config_converter/./unit/convert_layout_tests.rs +assertion_line: 79 +expression: "format!(\"{}\", kdl_config)" +--- +layout { + default_tab_template { + pane size=1 borderless=true { + plugin location="zellij:tab-bar" + } + children + pane size=2 borderless=true { + plugin location="zellij:status-bar" + } + } + tab split_direction="Vertical" { + pane split_direction="Vertical" { + pane command="htop" size="50%" + pane size="50%" + } + } + tab split_direction="Vertical" { + pane split_direction="Vertical" { + pane size="50%" + pane size="50%" + } + } + tab split_direction="Vertical" { + pane split_direction="Vertical" { + pane size="50%" + pane size="50%" split_direction="Horizontal" { + pane size="50%" + pane size="50%" + } + } + } + tab + tab + tab + tab split_direction="Vertical" { + pane split_direction="Vertical" { + pane size="20%" { + plugin location="zellij:strider" + } + pane size="80%" split_direction="Horizontal" { + pane size="50%" + pane size="50%" + } + } + } + tab split_direction="Vertical" { + pane split_direction="Vertical" { + pane size="40%" + pane size="60%" split_direction="Horizontal" { + pane size="50%" + pane size="50%" + } + } + } +} diff --git a/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_layout__convert_layout_test__properly_convert_layout_example_3.snap b/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_layout__convert_layout_test__properly_convert_layout_example_3.snap new file mode 100644 index 00000000..733e2aff --- /dev/null +++ b/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_layout__convert_layout_test__properly_convert_layout_example_3.snap @@ -0,0 +1,19 @@ +--- +source: zellij-client/src/old_config_converter/./unit/convert_layout_tests.rs +assertion_line: 90 +expression: "format!(\"{}\", kdl_config)" +--- +layout { + default_tab_template { + children + } + tab split_direction="Vertical" { + pane split_direction="Vertical" { + pane size="50%" split_direction="Horizontal" { + pane size="50%" + pane command="htop" size="50%" + } + pane command="htop" size="50%" + } + } +} diff --git a/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_layout__convert_layout_test__properly_convert_layout_example_4.snap b/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_layout__convert_layout_test__properly_convert_layout_example_4.snap new file mode 100644 index 00000000..ed6d2d6d --- /dev/null +++ b/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_layout__convert_layout_test__properly_convert_layout_example_4.snap @@ -0,0 +1,27 @@ +--- +source: zellij-client/src/old_config_converter/./unit/convert_layout_tests.rs +assertion_line: 101 +expression: "format!(\"{}\", kdl_config)" +--- +layout { + default_tab_template { + children + } + tab split_direction="Horizontal" { + pane size=1 borderless=true { + plugin location="zellij:tab-bar" + } + pane split_direction="Vertical" { + pane split_direction="Vertical" { + pane command="htop" size="50%" + pane command="htop" size="50%" { + args "-C" "--tree" + } + } + } + pane size=5 + pane size=2 borderless=true { + plugin location="zellij:status-bar" + } + } +} diff --git a/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_layout__convert_layout_test__properly_convert_layout_with_config.snap b/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_layout__convert_layout_test__properly_convert_layout_with_config.snap new file mode 100644 index 00000000..a063d917 --- /dev/null +++ b/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_layout__convert_layout_test__properly_convert_layout_with_config.snap @@ -0,0 +1,24 @@ +--- +source: zellij-client/src/old_config_converter/./unit/convert_layout_tests.rs +assertion_line: 46 +expression: "format!(\"{}\", kdl_config)" +--- +layout { + pane size=1 borderless=true { + plugin location="zellij:tab-bar" + } + pane + pane size=2 borderless=true { + plugin location="zellij:status-bar" + } +} +keybinds clear-defaults=true { + normal { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl t" { SwitchToMode "tab"; } + } +} +default_shell "fish" + diff --git a/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_layout__convert_layout_test__properly_convert_layout_with_config_and_session_name.snap b/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_layout__convert_layout_test__properly_convert_layout_with_config_and_session_name.snap new file mode 100644 index 00000000..a77bc525 --- /dev/null +++ b/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_layout__convert_layout_test__properly_convert_layout_with_config_and_session_name.snap @@ -0,0 +1,26 @@ +--- +source: zellij-client/src/old_config_converter/./unit/convert_layout_tests.rs +assertion_line: 57 +expression: "format!(\"{}\", kdl_config)" +--- +layout { + pane size=1 borderless=true { + plugin location="zellij:tab-bar" + } + pane + pane size=2 borderless=true { + plugin location="zellij:status-bar" + } +} +session_name "foo" +attach_to_session true +keybinds clear-defaults=true { + normal { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Ctrl t" { SwitchToMode "tab"; } + } +} +default_shell "fish" + diff --git a/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_layout__convert_layout_test__properly_convert_layout_with_session_name.snap b/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_layout__convert_layout_test__properly_convert_layout_with_session_name.snap new file mode 100644 index 00000000..7b607256 --- /dev/null +++ b/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_layout__convert_layout_test__properly_convert_layout_with_session_name.snap @@ -0,0 +1,16 @@ +--- +source: zellij-client/src/old_config_converter/./unit/convert_layout_tests.rs +assertion_line: 24 +expression: "format!(\"{}\", kdl_config)" +--- +layout { + pane size=1 borderless=true { + plugin location="zellij:tab-bar" + } + pane + pane size=2 borderless=true { + plugin location="zellij:status-bar" + } +} +session_name "foo" +attach_to_session true diff --git a/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_layout__convert_layout_test__properly_convert_layout_with_session_name_and_attach_false.snap b/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_layout__convert_layout_test__properly_convert_layout_with_session_name_and_attach_false.snap new file mode 100644 index 00000000..4a09faea --- /dev/null +++ b/zellij-client/src/old_config_converter/unit/snapshots/zellij_client__old_config_converter__old_layout__convert_layout_test__properly_convert_layout_with_session_name_and_attach_false.snap @@ -0,0 +1,16 @@ +--- +source: zellij-client/src/old_config_converter/./unit/convert_layout_tests.rs +assertion_line: 35 +expression: "format!(\"{}\", kdl_config)" +--- +layout { + pane size=1 borderless=true { + plugin location="zellij:tab-bar" + } + pane + pane size=2 borderless=true { + plugin location="zellij:status-bar" + } +} +session_name "foo" +attach_to_session false diff --git a/zellij-client/src/sessions.rs b/zellij-client/src/sessions.rs deleted file mode 100644 index 6a3c0799..00000000 --- a/zellij-client/src/sessions.rs +++ /dev/null @@ -1,18 +0,0 @@ -use std::process; - -use zellij_utils::consts::ZELLIJ_SOCK_DIR; -use zellij_utils::interprocess::local_socket::LocalSocketStream; -use zellij_utils::ipc::{ClientToServerMsg, IpcSenderWithContext}; - -pub(crate) fn kill_session(name: &str) { - let path = &*ZELLIJ_SOCK_DIR.join(name); - match LocalSocketStream::connect(path) { - Ok(stream) => { - let _ = IpcSenderWithContext::new(stream).send(ClientToServerMsg::KillSession); - }, - Err(e) => { - eprintln!("Error occurred: {:?}", e); - process::exit(1); - }, - }; -} |
