fix(examples): convert ALT-centered config to kdl and smoothify (#1910)

- Alt-hjkl for pane movements everywhere
- faster pane creation in pane mode with hjkl
- add space to exit mode, if it does not break workflow
- dense: only 127 LOC keybindings, 7 LOC general config
- comment-heavy (for potential useful things): 61 LOC comments
This commit is contained in:
matu3ba 2022-11-08 15:56:16 +01:00 committed by GitHub
parent 0477d93444
commit ec023197f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 195 additions and 230 deletions

View File

@ -0,0 +1,195 @@
// ############################################################
// ### ### Alt-centered configuration for Zellij ### ####
// ############################################################
// - 1 prefix key (Alt) for most common actions in normal mode
// - Less common actions require switching mode or are removed
// - Press escape, enter or space to switch back to normal mode
// - Press Alt-q for quitting and Alt-d for detaching
//
// To access other modes from normal mode press
// 1. Alt-r for resize, 2. Alt-p for pane,
// 3. .. move, 4. .. tab, 5. .. scroll,
// 6. in scroll mode s to type text, 7. enter to search.
//
// Run `zellij setup --check` for troubleshooting and inspecting
// current config locations and features that are enabled.
keybinds {
normal clear-defaults=true {
bind "Alt q" { Quit; }
bind "Alt d" { Detach; }
bind "Alt p" { SwitchToMode "pane"; }
bind "Alt r" { SwitchToMode "resize"; }
bind "Alt t" { SwitchToMode "tab"; }
bind "Alt s" { SwitchToMode "scroll"; }
bind "Alt m" { SwitchToMode "move"; }
bind "Alt n" { NewPane; }
bind "Alt h" { MoveFocusOrTab "Left"; }
bind "Alt l" { MoveFocusOrTab "Right"; }
bind "Alt j" { MoveFocus "Down"; }
bind "Alt k" { MoveFocus "Up"; }
bind "Alt +" { Resize "Increase"; }
bind "Alt -" { Resize "Decrease"; }
}
pane clear-defaults=true {
bind "Enter" "Esc" "Space" { SwitchToMode "normal"; }
bind "h" "Left" { NewPane "Left"; }
bind "l" "Right" { NewPane "Right"; }
bind "j" "Down" { NewPane "Down"; }
bind "k" "Up" { NewPane "Up"; }
bind "Alt h" "Left" { MoveFocus "Left"; }
bind "Alt l" "Right" { MoveFocus "Right"; }
bind "Alt j" "Down" { MoveFocus "Down"; }
bind "Alt k" "Up" { MoveFocus "Up"; }
bind "p" { SwitchFocus; }
bind "n" { NewPane; }
bind "x" { CloseFocus; }
bind "f" { ToggleFocusFullscreen; }
bind "z" { TogglePaneFrames; }
}
tab clear-defaults=true {
bind "Enter" "Esc" "Space" { SwitchToMode "normal"; }
bind "h" "Left" { GoToPreviousTab; }
bind "l" "Right" { GoToNextTab; }
bind "n" { NewTab; }
bind "x" { CloseTab; }
bind "s" { ToggleActiveSyncTab; }
bind "Alt h" { MoveFocus "Left"; }
bind "Alt l" { MoveFocus "Right"; }
bind "Alt j" { MoveFocus "Down"; }
bind "Alt k" { MoveFocus "Up"; }
bind "1" { GoToTab 1; }
bind "2" { GoToTab 2; }
bind "3" { GoToTab 3; }
bind "4" { GoToTab 4; }
bind "5" { GoToTab 5; }
bind "6" { GoToTab 6; }
bind "7" { GoToTab 7; }
bind "8" { GoToTab 8; }
bind "9" { GoToTab 9; }
bind "Tab" { ToggleTab; }
}
resize clear-defaults=true {
bind "Enter" "Esc" "Space" { SwitchToMode "normal"; }
bind "h" "Left" { Resize "Left"; }
bind "j" "Down" { Resize "Down"; }
bind "k" "Up" { Resize "Up"; }
bind "l" "Right" { Resize "Right"; }
bind "Alt =" { Resize "Increase"; }
bind "Alt +" { Resize "Increase"; }
bind "Alt -" { Resize "Decrease"; }
bind "Alt n" { NewPane; }
bind "Alt h" { MoveFocus "Left"; }
bind "Alt l" { MoveFocus "Right"; }
bind "Alt j" { MoveFocus "Down"; }
bind "Alt k" { MoveFocus "Up"; }
}
move clear-defaults=true {
bind "Enter" "Esc" "Space" { SwitchToMode "normal"; }
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" { MoveFocus "Left"; }
bind "Alt l" { MoveFocus "Right"; }
bind "Alt j" { MoveFocus "Down"; }
bind "Alt k" { MoveFocus "Up"; }
}
scroll clear-defaults=true {
bind "e" { EditScrollback; SwitchToMode "normal"; }
bind "Enter" "Esc" { SwitchToMode "normal"; }
bind "Alt c" { ScrollToBottom; SwitchToMode "normal"; }
bind "j" "Down" { ScrollDown; }
bind "k" "Up" { ScrollUp; }
bind "Alt f" "PageDown" "Right" "l" { PageScrollDown; }
bind "Alt b" "PageUp" "Left" "h" { PageScrollUp; }
bind "d" { HalfPageScrollDown; }
bind "u" { HalfPageScrollUp; }
bind "Alt h" { MoveFocus "Left"; }
bind "Alt l" { MoveFocus "Right"; }
bind "Alt j" { MoveFocus "Down"; }
bind "Alt k" { MoveFocus "Up"; }
bind "s" { SwitchToMode "entersearch"; SearchInput 0; }
}
search clear-defaults=true {
bind "Alt s" "Enter" "Esc" "Space" { SwitchToMode "normal"; }
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"; }
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"; }
}
entersearch clear-defaults=true {
bind "Enter" { SwitchToMode "search"; }
bind "Alt c" "Esc" { SearchInput 27; SwitchToMode "scroll"; }
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"; }
}
locked clear-defaults=true {}
renamepane clear-defaults=true {}
renametab clear-defaults=true {}
session clear-defaults=true {}
tmux clear-defaults=true {}
}
// 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"
// Request simplified ui (without arrow fonts) of plugins
simplified_ui true
// Choose the path to the default shell that zellij will use for opening new panes
// Default: $SHELL
//default_shell "fish"
// remove pane frame
pane_frames false
// 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"
// On certain configurations, or terminals mouse_mode can interfere with copying text.
mouse_mode true
// 100_000 should never exceed 6MB per shell pane, unless the lines are very long
scroll_buffer_size 100000
// Command to execute when copying text. Text will be piped to stdin of program
// to perform copy. Can be used with terminal emulators which do not support
// OSC 52 ANSI control sequence (used on default without this option).
//copy_command "xclip -selection clipboard" // x11
//copy_command "wl-copy" // wayland
//copy_command "pbcopy" // osx
// Choose the destination for copied text (x11/wayland only), if copy_command not set
// Options:
// - system (default)
// - primary
//copy_clipboard "primary"
// Is automatic copy (and clear) of selection when releasing mouse enabled?
// 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"

View File

@ -1,230 +0,0 @@
###########################################################
#### ### Alt-centered configuration for Zellij ### ####
###########################################################
# - 1 prefix key (Alt) for most common actions in normal mode
# - less common actions require switching mode or are removed
# - switching back to normal mode with escape and enter
# - Alt-q for quitting and Alt-d for detaching
# To access other modes from normal mode press
# 1. Alt-r for resize, 2. Alt-p for pane,
# 4. .. move, 5. .. tab, 6. .. scroll
# Press Enter or Escape to switch back to normal mode
# Run `zellij setup --check` for troubleshooting and inspecting
# current config locations and features that are enabled.
# NOTE: Modes must have a binding, if they are reachable.
keybinds:
normal:
# unbinds the current scope.
- unbind: true
- action: [Quit,]
key: [ Alt: 'q',]
- action: [Detach,]
key: [ Alt: 'd',]
- action: [SwitchToMode: Pane,]
key: [ Alt: 'p',]
- action: [SwitchToMode: Resize,]
key: [ Alt: 'r',]
- action: [SwitchToMode: Tab,]
key: [ Alt: 't',]
- action: [SwitchToMode: Scroll,]
key: [ Alt: 's',]
- action: [SwitchToMode: Session,]
key: [ Alt: 'e',]
- action: [SwitchToMode: Move,]
key: [ Alt: 'm',]
- action: [NewPane: ]
key: [ Alt: 'n',]
- action: [MoveFocusOrTab: Left,]
key: [ Alt: 'h',]
- action: [MoveFocusOrTab: Right,]
key: [ Alt: 'l',]
- action: [MoveFocus: Down,]
key: [ Alt: 'j',]
- action: [MoveFocus: Up,]
key: [ Alt: 'k',]
- action: [Resize: Increase,]
key: [ Alt: '+']
- action: [Resize: Decrease,]
key: [ Alt: '-']
resize:
- unbind: true
- action: [SwitchToMode: Normal,]
key: [ Char: "\n", Esc]
- 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: [ Alt: '+']
- action: [Resize: Decrease,]
key: [Char: '-']
- action: [NewPane: ,]
key: [ Alt: 'n',]
- action: [MoveFocus: Left,]
key: [ Alt: 'h',]
- action: [MoveFocus: Right,]
key: [ Alt: 'l',]
- action: [MoveFocus: Down,]
key: [ Alt: 'j',]
- action: [MoveFocus: Up,]
key: [ Alt: 'k',]
pane:
- unbind: true
- action: [SwitchToMode: Normal,]
key: [Char: "\n", Esc]
- 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: ,]
key: [Char: 'n', Alt: 'n',]
- action: [NewPane: Down,]
key: [Char: 'd',]
- action: [NewPane: Right,]
key: [Char: 'r',]
- action: [CloseFocus,]
key: [Char: 'x',]
- action: [ToggleFocusFullscreen,]
key: [Char: 'f',]
- action: [TogglePaneFrames,]
key: [Char: 'z',]
move:
- unbind: true
- action: [SwitchToMode: Normal,]
key: [Char: "\n", Esc]
- 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: [MoveFocus: Left,]
key: [ Alt: 'h',]
- action: [MoveFocus: Right,]
key: [ Alt: 'l',]
- action: [MoveFocus: Down,]
key: [ Alt: 'j',]
- action: [MoveFocus: Up,]
key: [ Alt: 'k',]
tab:
- unbind: true
- action: [SwitchToMode: Normal,]
key: [Char: "\n", Esc]
- action: [GoToPreviousTab,]
key: [ Char: 'h', Left, ]
- action: [GoToNextTab,]
key: [ Char: 'l', Right,]
- action: [NewTab: ,]
key: [ Char: 'n',]
- action: [CloseTab,]
key: [ Char: 'x',]
- action: [ToggleActiveSyncTab]
key: [Char: 's']
- action: [MoveFocus: Left,]
key: [ Alt: 'h',]
- action: [MoveFocus: Right,]
key: [ Alt: 'l',]
- action: [MoveFocus: Down,]
key: [ Alt: 'j',]
- action: [MoveFocus: Up,]
key: [ Alt: 'k',]
- action: [GoToTab: 1,]
key: [ Char: '1',]
- action: [GoToTab: 2,]
key: [ Char: '2',]
- action: [GoToTab: 3,]
key: [ Char: '3',]
- action: [GoToTab: 4,]
key: [ Char: '4',]
- action: [GoToTab: 5,]
key: [ Char: '5',]
- action: [GoToTab: 6,]
key: [ Char: '6',]
- action: [GoToTab: 7,]
key: [ Char: '7',]
- action: [GoToTab: 8,]
key: [ Char: '8',]
- action: [GoToTab: 9,]
key: [ Char: '9',]
- action: [ToggleTab]
key: [ Char: "\t" ]
scroll:
- unbind: true
- action: [SwitchToMode: Normal,]
key: [Char: "\n", Esc]
- action: [ScrollDown,]
key: [Char: 'j', Down,]
- action: [ScrollUp,]
key: [Char: 'k', Up,]
- action: [PageScrollDown,]
key: [ Alt: 'f', PageDown, Right, Char: 'l',]
- action: [PageScrollUp,]
key: [ Alt: 'b', PageUp, Left, Char: 'h',]
- action: [HalfPageScrollDown,]
key: [Char: 'd',]
- action: [HalfPageScrollUp,]
key: [Char: 'u',]
- action: [MoveFocus: Left,]
key: [ Alt: 'h',]
- action: [MoveFocus: Right,]
key: [ Alt: 'l',]
- action: [MoveFocus: Down,]
key: [ Alt: 'j',]
- action: [MoveFocus: Up,]
key: [ Alt: 'k',]
renametab:
- unbind: true
renamepane:
- unbind: true
session:
- unbind: true
locked:
- unbind: true
plugins:
- path: tab-bar
tag: tab-bar
- path: status-bar
tag: status-bar
- path: strider
tag: strider
# 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
# request simpler ui (without arrow fonts) of plugins
simplified_ui: true
# Choose the path to the default shell that zellij will use for opening new panes
# Default: $SHELL
#default_shell: fish
# remove pane frame (also removes space between panes and highlighting of current pane)
pane_frames: false
# Choose the mode that zellij uses when starting up.
# Default: normal
#default_mode: locked
theme: default
# Choose the theme that is specified in the themes section.
# Default: default
#theme: default
# Note: Mouse mode can interfere with copying text.
mouse_mode: true