Examples

Zellij's keybindings can be configured to behave in multiple ways. Here are example configurations to possibly inspire you.

Prefix Example

This certain example works as if it had a prefix key.

Zellij starts in locked mode and only the prefix key switches to normal mode, from then on it is possible to have a layer of shortcuts, or more special modes to switch to.

Eg:

  • Open a pane: ^b - n
  • Open a pane to the right: ^b - p - r
  • Open a tab: ^b - N
  • Open multiple tabs: ^b - t - N - n
  • Switch to a specific pane or tab: ^b - h/j/k/l
  • Switch to a specific tab: ^b - 1
  • Resize: ^b - r - h/j/k/l
  • Fullscreen: ^b - p - f
  • Send the prefix key (^b): ^b - b
  • Detach the session: ^b - o - d
  • Quit zellij: ^b - ^q

Here is one possible example of that:

default_mode: locked
keybinds:
    unbind: true
    # the prefix key ^b
    locked:
        - action: [SwitchToMode: Normal,]
          key: [Ctrl: 'b',]
    normal:
        # send the prefix-key ^b on pressing b in normal mode
        # then switch back to locked mode
        - action: [Write: [2,], SwitchToMode: Locked]
          key: [Char: 'b']
        - action: [SwitchToMode: Locked,]
          key: [Ctrl: 'b', Char: ' ', Char: "\n"]
        - action: [SwitchToMode: Pane,]
          key: [Char: 'p',]
        - action: [SwitchToMode: Resize,]
          key: [Char: 'r',]
        - action: [SwitchToMode: Tab,]
          key: [Char: 't',]
        - action: [SwitchToMode: Scroll,]
          key: [Char: 's',]
        - action: [Quit,]
          key: [Ctrl: 'q',]
        - action: [NewPane: , SwitchToMode: Locked, ]
          key: [ Alt: 'n',]
        - action: [NewTab: , SwitchToMode: Locked, ]
          key: [ Char: 'N',]
        - action: [NewPane: , SwitchToMode: Locked,]
          key: [ Char: 'n',]
        - action: [MoveFocusOrTab: Left,]
          key: [ Char: 'h', Alt: 'h' ]
        - action: [MoveFocusOrTab: Right,]
          key: [ Char: 'l', Alt: 'l',]
        - action: [MoveFocus: Down,]
          key: [ Char: 'j', Alt: 'j',]
        - action: [MoveFocus: Up,]
          key: [ Char: 'k', Alt: 'k',]
        - action: [FocusPreviousPane,]
          key: [ Char: '[', Alt: '[']
        - action: [FocusNextPane,]
          key: [ Char: ']', Alt: '[']
        - action: [NewPane: Down, SwitchToMode: Locked,]
          key: [Char: '-',]
        - action: [NewPane: Right, SwitchToMode: Locked,]
          key: [Char: '\',]
        - 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',]
    resize:
        - action: [SwitchToMode: Locked,]
          key: [Ctrl: 'b']
        - action: [SwitchToMode: Pane,]
          key: [Ctrl: 'p',]
        - action: [SwitchToMode: Tab,]
          key: [Ctrl: 't',]
        - action: [SwitchToMode: Locked,]
          key: [Ctrl: 'r', Char: "\n", Char: ' ',]
        - action: [SwitchToMode: Scroll,]
          key: [Ctrl: 's']
        - 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: [NewPane: ,]
          key: [ Alt: 'n',]
        - action: [MoveFocus: Left,]
          key: [ Alt: 'h', Left,]
        - action: [MoveFocus: Right,]
          key: [ Alt: 'l', Right,]
        - action: [MoveFocus: Down,]
          key: [ Alt: 'j', Down,]
        - action: [MoveFocus: Up,]
          key: [ Alt: 'k', Up,]
        - action: [FocusPreviousPane,]
          key: [ Alt: '[',]
        - action: [FocusNextPane,]
          key: [ Alt: ']',]
    pane:
        - action: [SwitchToMode: Locked,]
          key: [Ctrl: 'b']
        - action: [SwitchToMode: Normal,]
          key: [Ctrl: 'p',]
        - action: [SwitchToMode: Tab,]
          key: [Ctrl: 't',]
        - action: [SwitchToMode: Locked,]
          key: [Ctrl: 'r', Char: "\n", Char: ' ',]
        - action: [SwitchToMode: Scroll,]
          key: [Ctrl: 's']
        - action: [Quit,]
          key: [Ctrl: 'q',]
        - action: [MoveFocus: Left,]
          key: [ Alt: 'h', Left,]
        - action: [MoveFocus: Right,]
          key: [ Alt: 'l', Right,]
        - action: [MoveFocus: Down,]
          key: [ Alt: 'j', Down,]
        - action: [MoveFocus: Up,]
          key: [ Alt: 'k', Up,]
        - action: [SwitchFocus,]
          key: [Char: 'p']
        - action: [NewPane: , SwitchToMode: Locked,]
          key: [Char: 'n', Alt: 'n',]
        - action: [NewPane: ,]
          key: [Char: 'N', ]
        - action: [NewPane: Down, SwitchToMode: Locked,]
          key: [Char: 'd',]
        - action: [NewPane: Right, SwitchToMode: Locked,]
          key: [Char: 'r',]
        - action: [TogglePaneFrames, SwitchToMode: Locked,]
          key: [Char: 'z',]
        - action: [TogglePaneFrames,]
          key: [Char: 'Z',]
        - action: [NewPane: Down,]
          key: [Char: 'D',]
        - action: [NewPane: Right,]
          key: [Char: 'R',]
        - action: [CloseFocus, SwitchToMode: Locked,]
          key: [Char: 'x',]
        - action: [CloseFocus,]
          key: [Char: 'X',]
        - action: [ToggleFocusFullscreen, SwitchToMode: Locked,]
          key: [Char: 'f',]
        - action: [ToggleFocusFullscreen,]
          key: [Char: 'F',]
        - action: [FocusPreviousPane,]
          key: [ Alt: '[',]
        - action: [FocusNextPane,]
          key: [ Alt: ']',]
    tab:
        - action: [SwitchToMode: Normal,]
          key: [Ctrl: 't']
        - action: [SwitchToMode: Pane,]
          key: [Ctrl: 'p',]
        - action: [SwitchToMode: Locked,]
          key: [Ctrl: 'b', Char: "\n", Char: ' ',]
        - action: [SwitchToMode: Scroll,]
          key: [Ctrl: 's']
        - action: [SwitchToMode: RenameTab, TabNameInput: [0],]
          key: [Char: 'r']
        - action: [Quit,]
          key: [Ctrl: 'q',]
        - action: [FocusPreviousPane,]
          key: [ Alt: '[',]
        - action: [FocusNextPane,]
          key: [ Alt: ']',]
        - action: [GoToPreviousTab,]
          key: [ Char: 'h',]
        - action: [GoToNextTab,]
          key: [ Char: 'l',]
        - action: [GoToNextTab,]
          key: [ Char: 'j',]
        - action: [GoToPreviousTab,]
          key: [ Char: 'k',]
        - action: [NewTab: ,]
          key: [ Char: 'n',]
        - action: [CloseTab,]
          key: [ Char: 'x',]
        - 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',]
    scroll:
        - action: [SwitchToMode: Locked,]
          key: [Ctrl: 'r', Ctrl: 's', Char: ' ',
          Char: "\n",]
        - action: [SwitchToMode: Tab,]
          key: [Ctrl: 't',]
        - action: [SwitchToMode: Normal,]
          key: [Ctrl: 's',]
        - action: [SwitchToMode: Pane,]
          key: [Ctrl: 'p',]
        - action: [Quit,]
          key: [Ctrl: 'q',]
        - action: [ScrollDown,]
          key: [Char: 'j', Down,]
        - action: [ScrollUp,]
          key: [Char: 'k', Up,]
        - action: [PageScrollDown,]
          key: [Ctrl: 'f', PageDown,]
        - action: [PageScrollUp,]
          key: [Ctrl: 'b', PageUp,]
        - 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',]
        - action: [FocusPreviousPane,]
          key: [ Alt: '[',]
        - action: [FocusNextPane,]
          key: [ Alt: ']',]
    renametab:
        - action: [SwitchToMode: Normal,]
          key: [Ctrl: 'r']
        - action: [SwitchToMode: Locked,]
          key: [Ctrl: 'b', Ctrl: 's', Char: ' ',]
        - action: [SwitchToMode: Tab,]
          key: [Char: "\n",]
        - action: [TabNameInput: [27] , SwitchToMode: Tab,]
          key: [Esc,]
        - 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',]
        - action: [FocusPreviousPane,]
          key: [ Alt: '[',]
        - action: [FocusNextPane,]
          key: [ Alt: ']',]
    session:
        - action: [SwitchToMode: Normal,]
          key: [Ctrl: 'o']
        - action: [SwitchToMode: Resize,]
          key: [Ctrl: 'r',]
        - action: [SwitchToMode: Pane,]
          key: [Ctrl: 'p',]
        - action: [SwitchToMode: Tab,]
          key: [Ctrl: 't',]
        - action: [SwitchToMode: Locked,]
          key: [Ctrl: 'b', Char: "\n", Char: ' ',]
        - action: [SwitchToMode: Scroll,]
          key: [Ctrl: 's']
        - action: [Quit,]
          key: [Ctrl: 'q',]
        - action: [Detach,]
          key: [Char: 'd',]