diff options
49 files changed, 2414 insertions, 548 deletions
diff --git a/Cargo.lock b/Cargo.lock index 792a355e3..471408e23 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -132,7 +132,7 @@ dependencies = [ "event-listener", "futures-lite", "once_cell", - "signal-hook 0.3.8", + "signal-hook", "winapi", ] @@ -1408,16 +1408,6 @@ dependencies = [ [[package]] name = "signal-hook" -version = "0.1.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e31d442c16f047a671b5a71e2161d6e68814012b7f5379d269ebd915fac2729" -dependencies = [ - "libc", - "signal-hook-registry", -] - -[[package]] -name = "signal-hook" version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef33d6d0cd06e0840fba9985aab098c147e67e05cee14d412d3345ed14ff30ac" @@ -2221,7 +2211,7 @@ dependencies = [ "serde", "serde_json", "serde_yaml", - "signal-hook 0.1.17", + "signal-hook", "strip-ansi-escapes", "structopt", "strum", diff --git a/Cargo.toml b/Cargo.toml index 06fb0c25c..a581dda67 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,7 +21,7 @@ nom = "6.0.1" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" serde_yaml = "0.8" -signal-hook = "0.1.10" +signal-hook = "0.3" strip-ansi-escapes = "0.1.0" structopt = "0.3" termion = "1.5.0" diff --git a/GOVERNANCE.md b/GOVERNANCE.md index 2928cd601..b405d29db 100644 --- a/GOVERNANCE.md +++ b/GOVERNANCE.md @@ -26,3 +26,6 @@ Once the organization reaches 10 members, a reasonable and achievable process mu * Denis Maximov <denis_maxim0v@protonmail.com> * Kunal Mohan <kunalmohan99@gmail.com> * Henil Dedania <dedaniahenil@gmail.com> +* Roee Shapira <ro33.sha@gmail.com> +* Alex Kenji Berthold <aks.kenji@protonmail.com> +* Kyle Sutherland-Cash <kyle.sutherlandcash@gmail.com> @@ -40,6 +40,44 @@ The status bar on the bottom should guide you through the possible keyboard shor For more build commands, take a look at [`Contributing.md`](CONTRIBUTING.md). +# Configuration +It is possible to configure keyboard shortcuts and their actions in a yaml file. +An example file can be found under `example/config.yaml`. + +Zellij will look for a file `/zellij/config.yaml` in the default configuration location of your os. + +To pass a config file directly to zellij run it either with: +`cargo run -- config [FILE]` or `zellij config [FILE]`. + +The structure is as follows: +``` +keybinds: + normal: + - action: [] + key: [] +``` +`normal` is one of the `modes` zellij can be in. +It is possible to bind a sequence of actions to numerous keys at the same time. +Here a reference to the [Key](https://docs.rs/termion/1.5.6/termion/event/enum.Key.html) format that is used. + +For example: +``` +keybinds: + normal: + - action: [ NewTab, GoToTab: 1,] + key: [ Char: 'c',] +``` +Will create a new tab and then switch to tab number 1 on pressing the +`c` key. +Whereas: +``` +keybinds: + normal: + - action: [ NewTab,] + key: [ Char: 'c', Char: 'd',] +``` +Will create a new tab on pressing either the `c` or the `d` key. + # What is the current status of the project? Zellij is in the last stages of being VT compatible. As much as modern terminals are. diff --git a/assets/completions/_zellij b/assets/completions/_zellij index 64bd538cd..fc1cd00f2 100644 --- a/assets/completions/_zellij +++ b/assets/completions/_zellij @@ -30,16 +30,93 @@ _zellij() { '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ +":: :_zellij_commands" \ +"*::: :->zellij" \ && ret=0 - + case $state in + (zellij) + words=($line[1] "${words[@]}") + (( CURRENT += 1 )) + curcontext="${curcontext%:*:*}:zellij-command-$line[1]:" + case $line[1] in + (c) +_arguments "${_arguments_options[@]}" \ +'--clean[Disables loading of configuration file at default location]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'::path:_files' \ +&& ret=0 +;; +(c) +_arguments "${_arguments_options[@]}" \ +'--clean[Disables loading of configuration file at default location]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'::path:_files' \ +&& ret=0 +;; +(config) +_arguments "${_arguments_options[@]}" \ +'--clean[Disables loading of configuration file at default location]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'::path:_files' \ +&& ret=0 +;; +(help) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; + esac + ;; +esac } (( $+functions[_zellij_commands] )) || _zellij_commands() { local commands; commands=( - + "config:Path to the configuration yaml file" \ +"help:Prints this message or the help of the given subcommand(s)" \ ) _describe -t commands 'zellij commands' commands "$@" } +(( $+functions[_c_commands] )) || +_c_commands() { + local commands; commands=( + + ) + _describe -t commands 'c commands' commands "$@" +} +(( $+functions[_zellij__c_commands] )) || +_zellij__c_commands() { + local commands; commands=( + + ) + _describe -t commands 'zellij c commands' commands "$@" +} +(( $+functions[_zellij__config_commands] )) || +_zellij__config_commands() { + local commands; commands=( + + ) + _describe -t commands 'zellij config commands' commands "$@" +} +(( $+functions[_zellij__help_commands] )) || +_zellij__help_commands() { + local commands; commands=( + + ) + _describe -t commands 'zellij help commands' commands "$@" +} _zellij "$@"
\ No newline at end of file diff --git a/assets/completions/zellij.bash b/assets/completions/zellij.bash index a921e7c99..10c18d532 100644 --- a/assets/completions/zellij.bash +++ b/assets/completions/zellij.bash @@ -13,6 +13,15 @@ _zellij() { cmd="zellij" ;; + c) + cmd+="__c" + ;; + config) + cmd+="__config" + ;; + help) + cmd+="__help" + ;; *) ;; esac @@ -20,7 +29,7 @@ _zellij() { case "${cmd}" in zellij) - opts=" -m -d -h -V -s -o -l --move-focus --debug --help --version --split --open-file --max-panes --layout " + opts=" -m -d -h -V -s -o -l --move-focus --debug --help --version --split --open-file --max-panes --layout config help c c" if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -63,6 +72,51 @@ _zellij() { return 0 ;; + zellij__c) + opts=" -h -V --clean --help --version <path> " + if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + zellij__config) + opts=" -h -V --clean --help --version <path> " + if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + zellij__help) + opts=" -h -V --help --version " + if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; esac } diff --git a/assets/completions/zellij.fish b/assets/completions/zellij.fish index e902823fc..36bab1924 100644 --- a/assets/completions/zellij.fish +++ b/assets/completions/zellij.fish @@ -6,3 +6,10 @@ complete -c zellij -n "__fish_use_subcommand" -s m -l move-focus -d 'Send "move complete -c zellij -n "__fish_use_subcommand" -s d -l debug complete -c zellij -n "__fish_use_subcommand" -s h -l help -d 'Prints help information' complete -c zellij -n "__fish_use_subcommand" -s V -l version -d 'Prints version information' +complete -c zellij -n "__fish_use_subcommand" -f -a "config" -d 'Path to the configuration yaml file' +complete -c zellij -n "__fish_use_subcommand" -f -a "help" -d 'Prints this message or the help of the given subcommand(s)' +complete -c zellij -n "__fish_seen_subcommand_from config" -l clean -d 'Disables loading of configuration file at default location' +complete -c zellij -n "__fish_seen_subcommand_from config" -s h -l help -d 'Prints help information' +complete -c zellij -n "__fish_seen_subcommand_from config" -s V -l version -d 'Prints version information' +complete -c zellij -n "__fish_seen_subcommand_from help" -s h -l help -d 'Prints help information' +complete -c zellij -n "__fish_seen_subcommand_from help" -s V -l version -d 'Prints version information' diff --git a/assets/plugins/status-bar.wasm b/assets/plugins/status-bar.wasm Binary files differindex 7650d577c..5dba9a50f 100644 --- a/assets/plugins/status-bar.wasm +++ b/assets/plugins/status-bar.wasm diff --git a/assets/plugins/strider.wasm b/assets/plugins/strider.wasm Binary files differindex 085e11f1a..e9024abba 100644 --- a/assets/plugins/strider.wasm +++ b/assets/plugins/strider.wasm diff --git a/assets/plugins/tab-bar.wasm b/assets/plugins/tab-bar.wasm Binary files differindex 141e47ba4..cc2f9eefb 100644 --- a/assets/plugins/tab-bar.wasm +++ b/assets/plugins/tab-bar.wasm diff --git a/default-tiles/status-bar/src/first_line.rs b/default-tiles/status-bar/src/first_line.rs index 0e4ec53b4..ea48cb1b8 100644 --- a/default-tiles/status-bar/src/first_line.rs +++ b/default-tiles/status-bar/src/first_line.rs @@ -99,7 +99,7 @@ fn unselected_mode_shortcut(letter: char, text: &str) -> LinePart { suffix_separator, ]) .to_string(), - len: text.chars().count() + 6, // 2 for the arrows, 3 for the char separators, 1 for the character + len: text.chars().count() + 7, // 2 for the arrows, 3 for the char separators, 1 for the character, 1 for the text padding } } @@ -129,7 +129,7 @@ fn selected_mode_shortcut(letter: char, text: &str) -> LinePart { suffix_separator, ]) .to_string(), - len: text.chars().count() + 6, // 2 for the arrows, 3 for the char separators, 1 for the character + len: text.chars().count() + 7, // 2 for the arrows, 3 for the char separators, 1 for the character, 1 for the text padding } } diff --git a/default-tiles/status-bar/src/main.rs b/default-tiles/status-bar/src/main.rs index 8daa158ed..ee4d17635 100644 --- a/default-tiles/status-bar/src/main.rs +++ b/default-tiles/status-bar/src/main.rs @@ -63,8 +63,8 @@ impl ZellijTile for State { let second_line = keybinds(&self.mode_info, cols); // [48;5;238m is gray background, [0K is so that it fills the rest of the line - // [48;5;16m is black background, [0K is so that it fills the rest of the line + // [m is background reset, [0K is so that it clears the rest of the line println!("{}\u{1b}[48;5;238m\u{1b}[0K", first_line); - println!("{}\u{1b}[48;5;16m\u{1b}[0K", second_line); + println!("\u{1b}[m{}\u{1b}[0K", second_line); } } diff --git a/default-tiles/status-bar/src/second_line.rs b/default-tiles/status-bar/src/second_line.rs index ebcb93dd4..48a82c6c3 100644 --- a/default-tiles/status-bar/src/second_line.rs +++ b/default-tiles/status-bar/src/second_line.rs @@ -59,6 +59,122 @@ fn first_word_shortcut(is_first_shortcut: bool, letter: &str, description: &str) len, } } +fn quicknav_full() -> LinePart { + let text_first_part = " Tip: "; + let alt = "Alt"; + let text_second_part = " + "; + let new_pane_shortcut = "n"; + let text_third_part = " => open new pane. "; + let second_alt = "Alt"; + let text_fourth_part = " + "; + let brackets_navigation = "[]"; + let text_fifth_part = " or "; + let hjkl_navigation = "hjkl"; + let text_sixths_part = " => navigate between panes."; + let len = text_first_part.chars().count() + + alt.chars().count() + + text_second_part.chars().count() + + new_pane_shortcut.chars().count() + + text_third_part.chars().count() + + second_alt.chars().count() + + text_fourth_part.chars().count() + + brackets_navigation.chars().count() + + text_fifth_part.chars().count() + + hjkl_navigation.chars().count() |