zsh replacing nushell

This commit is contained in:
Henrik Bakken
2025-10-30 16:23:07 +01:00
parent 3dba4eed8e
commit 6164c47093
8 changed files with 398 additions and 1774 deletions
-5
View File
@@ -1,8 +1,3 @@
# required for qt5ct to know QT_QPA_PLATFORMTHEME # required for qt5ct to know QT_QPA_PLATFORMTHEME
export QT_QPA_PLATFORMTHEME=qt5ct export QT_QPA_PLATFORMTHEME=qt5ct
export SYSTEMD_EDITOR=/usr/bin/nvim
export EDITOR=/usr/bin/nvim
export VISUAL=/usr/bin/nvim
export TERMINAL=/usr/bin/footclient export TERMINAL=/usr/bin/footclient
export PAGER="bat --style=header,rule,snip"
export BROWSER=/usr/bin/qutebrowser
+1
View File
@@ -0,0 +1 @@
export ZDOTDIR="$HOME/.config/zsh"
+281
View File
@@ -0,0 +1,281 @@
## where to store your database, default is your system data directory
## linux/mac: ~/.local/share/atuin/history.db
## windows: %USERPROFILE%/.local/share/atuin/history.db
# db_path = "~/.history.db"
## where to store your encryption key, default is your system data directory
## linux/mac: ~/.local/share/atuin/key
## windows: %USERPROFILE%/.local/share/atuin/key
# key_path = "~/.key"
## where to store your auth session token, default is your system data directory
## linux/mac: ~/.local/share/atuin/session
## windows: %USERPROFILE%/.local/share/atuin/session
# session_path = "~/.session"
## date format used, either "us" or "uk"
# dialect = "us"
## default timezone to use when displaying time
## either "l", "local" to use the system's current local timezone, or an offset
## from UTC in the format of "<+|->H[H][:M[M][:S[S]]]"
## for example: "+9", "-05", "+03:30", "-01:23:45", etc.
# timezone = "local"
## enable or disable automatic sync
# auto_sync = true
## enable or disable automatic update checks
update_check = false
## address of the sync server
# sync_address = "https://api.atuin.sh"
## how often to sync history. note that this is only triggered when a command
## is ran, so sync intervals may well be longer
## set it to 0 to sync after every command
# sync_frequency = "10m"
## which search mode to use
## possible values: prefix, fulltext, fuzzy, skim
search_mode = "fulltext"
## which filter mode to use by default
## possible values: "global", "host", "session", "directory", "workspace"
## consider using search.filters to customize the enablement and order of filter modes
# filter_mode = "global"
## With workspace filtering enabled, Atuin will filter for commands executed
## in any directory within a git repository tree (default: false).
##
## To use workspace mode by default when available, set this to true and
## set filter_mode to "workspace" or leave it unspecified and
## set search.filters to include "workspace" before other filter modes.
# workspaces = false
## which filter mode to use when atuin is invoked from a shell up-key binding
## the accepted values are identical to those of "filter_mode"
## leave unspecified to use same mode set in "filter_mode"
# filter_mode_shell_up_key_binding = "global"
## which search mode to use when atuin is invoked from a shell up-key binding
## the accepted values are identical to those of "search_mode"
## leave unspecified to use same mode set in "search_mode"
# search_mode_shell_up_key_binding = "fuzzy"
## which style to use
## possible values: auto, full, compact
# style = "auto"
## the maximum number of lines the interface should take up
## set it to 0 to always go full screen
inline_height = 20
## the maximum number of lines the interface should take up
## when atuin is invoked from a shell up-key binding
## the accepted values are identical to those of "inline_height"
inline_height_shell_up_key_binding = 5
## Invert the UI - put the search bar at the top , Default to `false`
# invert = false
## enable or disable showing a preview of the selected command
## useful when the command is longer than the terminal width and is cut off
# show_preview = true
## what to do when the escape key is pressed when searching
## possible values: return-original, return-query
exit_mode = "return-query"
## possible values: emacs, subl
# word_jump_mode = "emacs"
## characters that count as a part of a word
# word_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
## number of context lines to show when scrolling by pages
# scroll_context_lines = 1
## use ctrl instead of alt as the shortcut modifier key for numerical UI shortcuts
## alt-0 .. alt-9
ctrl_n_shortcuts = true
## default history list format - can also be specified with the --format arg
# history_format = "{time}\t{command}\t{duration}"
## prevent commands matching any of these regexes from being written to history.
## Note that these regular expressions are unanchored, i.e. if they don't start
## with ^ or end with $, they'll match anywhere in the command.
## For details on the supported regular expression syntax, see
## https://docs.rs/regex/latest/regex/#syntax
history_filter = [
"^exit$",
"^ .*",
"_secret="
]
## prevent commands run with cwd matching any of these regexes from being written
## to history. Note that these regular expressions are unanchored, i.e. if they don't
## start with ^ or end with $, they'll match anywhere in CWD.
## For details on the supported regular expression syntax, see
## https://docs.rs/regex/latest/regex/#syntax
# cwd_filter = [
# "^/very/secret/area",
# ]
## Configure the maximum height of the preview to show.
## Useful when you have long scripts in your history that you want to distinguish
## by more than the first few lines.
# max_preview_height = 4
## Configure whether or not to show the help row, which includes the current Atuin
## version (and whether an update is available), a keymap hint, and the total
## amount of commands in your history.
# show_help = true
## Configure whether or not to show tabs for search and inspect
# show_tabs = true
## Configure whether or not the tabs row may be auto-hidden, which includes the current Atuin
## tab, such as Search or Inspector, and other tabs you may wish to see. This will
## only be hidden if there are fewer than this count of lines available, and does not affect the use
## of keyboard shortcuts to switch tab. 0 to never auto-hide, default is 8 (lines).
## This is ignored except in `compact` mode.
# auto_hide_height = 8
## Defaults to true. This matches history against a set of default regex, and will not save it if we get a match. Defaults include
## 1. AWS key id
## 2. Github pat (old and new)
## 3. Slack oauth tokens (bot, user)
## 4. Slack webhooks
## 5. Stripe live/test keys
# secrets_filter = true
## Defaults to true. If enabled, upon hitting enter Atuin will immediately execute the command. Press tab to return to the shell and edit.
# This applies for new installs. Old installs will keep the old behaviour unless configured otherwise.
# enter_accept = true
## Defaults to false. If enabled, when triggered after && or ||, Atuin will complete commands to chain rather than replace the current line.
# command_chaining = false
## Defaults to "emacs". This specifies the keymap on the startup of `atuin
## search`. If this is set to "auto", the startup keymap mode in the Atuin
## search is automatically selected based on the shell's keymap where the
## keybinding is defined. If this is set to "emacs", "vim-insert", or
## "vim-normal", the startup keymap mode in the Atuin search is forced to be
## the specified one.
keymap_mode = "auto"
## Cursor style in each keymap mode. If specified, the cursor style is changed
## in entering the cursor shape. Available values are "default" and
## "{blink,steady}-{block,underline,bar}".
# keymap_cursor = { emacs = "blink-block", vim_insert = "blink-block", vim_normal = "steady-block" }
# network_connect_timeout = 5
# network_timeout = 5
## Timeout (in seconds) for acquiring a local database connection (sqlite)
# local_timeout = 5
## Set this to true and Atuin will minimize motion in the UI - timers will not update live, etc.
## Alternatively, set env NO_MOTION=true
# prefers_reduced_motion = false
[stats]
## Set commands where we should consider the subcommand for statistics. Eg, kubectl get vs just kubectl
# common_subcommands = [
# "apt",
# "cargo",
# "composer",
# "dnf",
# "docker",
# "git",
# "go",
# "ip",
# "jj",
# "kubectl",
# "nix",
# "nmcli",
# "npm",
# "pecl",
# "pnpm",
# "podman",
# "port",
# "systemctl",
# "tmux",
# "yarn",
# ]
## Set commands that should be totally stripped and ignored from stats
# common_prefix = ["sudo"]
## Set commands that will be completely ignored from stats
# ignored_commands = [
# "cd",
# "ls",
# "vi"
# ]
[keys]
# Defaults to true. If disabled, using the up/down key won't exit the TUI when scrolled past the first/last entry.
# scroll_exits = true
# Defaults to true. The left arrow key will exit the TUI when scrolling before the first character
# exit_past_line_start = true
# Defaults to true. The right arrow key performs the same functionality as Tab and copies the selected line to the command line to be modified.
# accept_past_line_end = true
[sync]
# Enable sync v2 by default
# This ensures that sync v2 is enabled for new installs only
# In a later release it will become the default across the board
records = true
[preview]
## which preview strategy to use to calculate the preview height (respects max_preview_height).
## possible values: auto, static
## auto: length of the selected command.
## static: length of the longest command stored in the history.
## fixed: use max_preview_height as fixed height.
# strategy = "auto"
[daemon]
## Enables using the daemon to sync. Requires the daemon to be running in the background. Start it with `atuin daemon`
# enabled = false
## How often the daemon should sync in seconds
# sync_frequency = 300
## The path to the unix socket used by the daemon (on unix systems)
## linux/mac: ~/.local/share/atuin/atuin.sock
## windows: Not Supported
# socket_path = "~/.local/share/atuin/atuin.sock"
## Use systemd socket activation rather than opening the given path (the path must still be correct for the client)
## linux: false
## mac/windows: Not Supported
# systemd_socket = false
## The port that should be used for TCP on non unix systems
# tcp_port = 8889
# [theme]
## Color theme to use for rendering in the terminal.
## There are some built-in themes, including the base theme ("default"),
## "autumn" and "marine". You can add your own themes to the "./themes" subdirectory of your
## Atuin config (or ATUIN_THEME_DIR, if provided) as TOML files whose keys should be one or
## more of AlertInfo, AlertWarn, AlertError, Annotation, Base, Guidance, Important, and
## the string values as lowercase entries from this list:
## https://ogeon.github.io/docs/palette/master/palette/named/index.html
## If you provide a custom theme file, it should be called "NAME.toml" and the theme below
## should be the stem, i.e. `theme = "NAME"` for your chosen NAME.
# name = "autumn"
## Whether the theme manager should output normal or extra information to help fix themes.
## Boolean, true or false. If unset, left up to the theme manager.
# debug = true
[search]
## The list of enabled filter modes, in order of priority.
## The "workspace" mode is skipped when not in a workspace or workspaces = false.
## Default filter mode can be overridden with the filter_mode setting.
# filters = [ "global", "host", "session", "workspace", "directory" ]
+22 -9
View File
@@ -31,7 +31,17 @@ DOTFILES = HOME / "dotfiles"
CUSTOMDIR = DOTFILES / f"custom-{open('/etc/hostname').read().strip()}" CUSTOMDIR = DOTFILES / f"custom-{open('/etc/hostname').read().strip()}"
installmap = dict( installmap = dict(
fonts=("noto-fonts-emoji", "ttf-hack", "font-manager"), fonts=("noto-fonts-emoji", "ttf-hack", "font-manager"),
nushell=("nushell", "oh-my-posh", "carapace-bin", "zoxide"), zsh=(
"zsh",
"zsh-autosuggestions",
"zsh-syntax-highlighting",
"zsh-vi-mode",
"atuin",
"fzf",
"git-delta",
"starship",
"zoxide",
),
tmux=("tmux", "urlscan"), tmux=("tmux", "urlscan"),
nvim=("neovim", "ripgrep"), nvim=("neovim", "ripgrep"),
utils=("uv", "bat", "ncdu", "unzip", "jq"), utils=("uv", "bat", "ncdu", "unzip", "jq"),
@@ -169,12 +179,15 @@ def install_fonts(reinstall: bool) -> None:
helper_install(*installmap["fonts"], reinstall=reinstall) helper_install(*installmap["fonts"], reinstall=reinstall)
def install_nushell(overwrite: bool, reinstall: bool) -> None: def install_zsh(overwrite: bool, reinstall: bool) -> None:
helper_install(*installmap["nushell"], reinstall=reinstall) helper_install(*installmap["zsh"], reinstall=reinstall)
helper_symlink_contents(DOTFILES / "nushell", CFG / "nushell", overwrite) helper_symlink_contents(DOTFILES / "zsh", CFG / "zsh", overwrite)
run("sudo chsh -s /usr/bin/nu".split()) run("sudo chsh -s /usr/bin/zsh".split())
url = "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/refs/heads/main/themes/peru.omp.json" helper_maybe_symlink(DOTFILES / "starship.toml", CFG / "starship.toml", overwrite)
run(["oh-my-posh", "init", "nu", "--config", url]) helper_maybe_symlink(DOTFILES / "HOME/.zshenv", HOME / ".zshenv", overwrite)
helper_maybe_symlink(
DOTFILES / "atuin/config.toml", CFG / "atuin/config.toml", overwrite
)
def install_tmux(overwrite: bool, reinstall: bool) -> None: def install_tmux(overwrite: bool, reinstall: bool) -> None:
@@ -273,8 +286,8 @@ def installer(
print("removed cliphist") print("removed cliphist")
install_fonts(reinstall) install_fonts(reinstall)
print("installed fonts") print("installed fonts")
install_nushell(overwrite, reinstall) install_zsh(overwrite, reinstall)
print("installed nushell") print("installed zsh")
install_tmux(overwrite, reinstall) install_tmux(overwrite, reinstall)
print("installed tmux") print("installed tmux")
install_nvim(overwrite, reinstall) install_nvim(overwrite, reinstall)
+1 -3
View File
@@ -3,7 +3,7 @@ vim.g.maplocalleader = vim.keycode("/")
vim.o.langmap = "ø:" vim.o.langmap = "ø:"
-- general options -- general options
vim.o.shell = "/usr/bin/nu" vim.o.shell = "/usr/bin/zsh"
vim.g.BASH_Ctrl_j = "off" vim.g.BASH_Ctrl_j = "off"
vim.g.BASH_Ctrl_l = "off" vim.g.BASH_Ctrl_l = "off"
vim.opt.clipboard:append("unnamedplus") vim.opt.clipboard:append("unnamedplus")
@@ -527,7 +527,6 @@ local function makespec_lspconfig()
vim.lsp.enable("clangd") vim.lsp.enable("clangd")
vim.lsp.enable("html") vim.lsp.enable("html")
vim.lsp.enable("lua_ls") vim.lsp.enable("lua_ls")
vim.lsp.enable("nushell")
vim.lsp.enable("ty") vim.lsp.enable("ty")
-- vim.lsp.enable("pyrefly") -- vim.lsp.enable("pyrefly")
-- vim.lsp.enable("pylsp") -- vim.lsp.enable("pylsp")
@@ -1345,7 +1344,6 @@ local function makespec_treesitter()
"git_rebase", "git_rebase",
"gitcommit", "gitcommit",
"lua", "lua",
"nu",
"python", "python",
"regex", "regex",
"vimdoc", "vimdoc",
+31
View File
@@ -0,0 +1,31 @@
add_newline = true
right_format = """$cmd_duration"""
[line_break]
disabled = true
[time]
disabled = false
[cmd_duration]
min_time = 1000
format = 'underwent [$duration](bold yellow)'
show_milliseconds = true
[directory]
truncation_length = 5
truncation_symbol = '…/'
repo_root_style = "red"
repo_root_format = ' [$repo_root]($repo_root_style)[$path]($style)[$read_only]($read_only_style) '
[git_branch]
symbol = " "
[git_status]
disabled = true
[package]
disabled = true
[python]
disabled = true
-1713
View File
File diff suppressed because it is too large Load Diff
+62 -44
View File
@@ -1,50 +1,68 @@
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. # --- env ---
# Initialization code that may require console input (password prompts, [y/n] export SYSTEMD_EDITOR=nvim
# confirmations, etc.) must go above this block; everything else may go below. export EDITOR=nvim
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then export VISUAL=nvim
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" export PAGER="bat --style=header,rule,snip"
export PATH=~/.local/bin:$PATH
export BROWSER=/usr/bin/qutebrowser
export HISTFILE=~/.config/zsh/history
export HISTSIZE=200000
export SAVEHIST=200000
# --- aliases ---
alias ls='ls --color=auto -Ah'
alias ..='cd ..'
alias ...='cd ../..'
# --- basic keybinds ---
bindkey '^[[Z' reverse-menu-complete # shift-tab
bindkey '^[^M' self-insert-unmeta # alt+enter newline
bindkey "^[^?" backward-kill-word # alt+backspace
# --- options ---
setopt HIST_IGNORE_ALL_DUPS HIST_IGNORE_SPACE SHARE_HISTORY EXTENDED_HISTORY
setopt AUTO_CD AUTO_MENU
setopt AUTO_PUSHD PUSHD_SILENT PUSHD_TO_HOME
setopt NO_NOMATCH
WORDCHARS='_-*?.[]~=&;!#$%^(){}<>'
# --- command line to EDITOR ---
autoload -Uz edit-command-line
zle -N edit-command-line
bindkey '^X^E' edit-command-line
# --- autocompletion ---
autoload -Uz compinit
compinit -d "~/.config/zsh/zcompdump"
zstyle ':completion:*' menu select
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' 'r:|[._-]=** r:|=**'
zstyle ':completion:*' list-colors ''
if command -v kubectl >/dev/null 2>&1; then
source <(kubectl completion zsh)
fi fi
# Lines configured by zsh-newuser-install # --- div plugins ---
HISTFILE=~/.zsh_history # autosuggestions must come before atuin
HISTSIZE=200000 source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
SAVEHIST=200000 eval "$(zoxide init zsh)"
# End of lines configured by zsh-newuser-install eval "$(starship init zsh)"
# The following lines were added by compinstall # --- vi mode ---
zstyle :compinstall filename "/home/hjalmarlucius/.zshrc"
autoload -Uz compinit
compinit
# End of lines added by compinstall
setopt HIST_EXPIRE_DUPS_FIRST
setopt HIST_IGNORE_DUPS
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_IGNORE_SPACE
setopt HIST_FIND_NO_DUPS
setopt HIST_SAVE_NO_DUPS
source <(kubectl completion zsh)
source /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.plugin.zsh
source /usr/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh
source /usr/share/zsh/plugins/zsh-vi-mode/zsh-vi-mode.plugin.zsh
alias ls="ls --color=auto"
bindkey -v bindkey -v
bindkey "^F" autosuggest-accept # ctrl+f source /usr/share/zsh/plugins/zsh-vi-mode/zsh-vi-mode.plugin.zsh
bindkey "^[[1;3C" forward-word # alt+right
bindkey "^[[1;3D" backward-word # alt+left
bindkey "[[3~" delete-char # delete
bindkey "^[^?" backward-kill-word # alt+backspace
bindkey '^[[Z' reverse-menu-complete
bindkey '^[^M' self-insert-unmeta # alt+enter newline
# substring search # --- search ---
bindkey "^[[A" history-substring-search-up # up # fzf: Ctrl-T, Alt-C
bindkey "^[[B" history-substring-search-down # down source /usr/share/fzf/key-bindings.zsh
HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE=1 source /usr/share/fzf/completion.zsh
# atuin: Ctrl+R, /
eval "$(atuin init zsh)"
# handle collisions
function zvm_after_init() {
bindkey -M vicmd '^R' redo
bindkey -M viins '^R' atuin-search
}
zstyle ':completion:*' menu select # --- syntax hl ---
# must be the last plugins sourced
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh