Craksy / nu-tabline

A Vim-inspired tabline for Nushell
4 stars 0 forks source link

nu-tabline

A Vim inspired tabline for Nushell to keep track of your subshells.

example

Basic setup

That's it.
Although you'll probably want to customize it a bit, so read on.

Configuration

You can customize looks through the environment variable tabline. Example:

let-env tabline = { 
    separator_hard: "" 
    separator_soft: ""
    inactive_foreground: "#C0FFEE"
    active_background: "#541514"
}

tabline init

The available options and their default values:

let-env tabline = { 
    # Symbols that separate segments. Note that the default ones requires a Nerdfont
    separator_hard: ""
    separator_soft: ""

    # Colors used for inactive segments
    inactive_foreground: '#0d5f99' 
    inactive_background: '#111111'

    # Colors used for active segments
    active_foreground: '#ffffff'
    active_background: '#0d5f99'

    # Whether or not add a separator after the last tab
    end_separator: false
}

Additionally the module exposes a few functions that can be used in keybindings

Example configuration:


use tabline
def tabmap [key:int] {
    let event = {
        send: executehostcommand
        cmd: $"tabline switch ($key - 1)"
    }
    {
        name: $"tab($key)"
        modifier: alt
        keycode: $"char_($key)"
        mode: [emacs vi_normal]
        event: $event
    }
}
let keybindings = [
    (tabmap 1)
    (tabmap 2)
    (tabmap 3)
    (tabmap 4)
    (tabmap 5)
    {
        name: close_tab
        modifier: alt
        keycode: char_q
        mode: [emacs vi_normal] 
        event: { send: executehostcommand cmd: 'tabline close' }
    }
    {
        name: clear_screen
        modifier: control
        keycode: char_l
        mode: [emacs vi_normal] 
        event: { send: executehostcommand cmd: 'tabline clear' }
    }
]