From 46b6968238e3565d7a9a131aa86ec44d418cbe28 Mon Sep 17 00:00:00 2001 From: caem Date: Wed, 31 Jul 2024 16:39:15 +0200 Subject: [PATCH] Add support for distrobox --- .gitignore | 2 ++ dotfiles/nvim/lua/util/get_distro.lua | 11 +++++++++++ dotfiles/zsh/conf.d/distrobox.zsh | 3 +++ dotfiles/zsh/conf.d/manpager.zsh | 1 + dotfiles/zsh/conf.d/ps1.zsh | 4 ++++ 5 files changed, 21 insertions(+) create mode 100644 dotfiles/zsh/conf.d/distrobox.zsh diff --git a/.gitignore b/.gitignore index 4bd922a..43f7455 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ secrets/ +dotfiles/zsh/.zcompdump +dotfiles/nvim/lazy-lock.json diff --git a/dotfiles/nvim/lua/util/get_distro.lua b/dotfiles/nvim/lua/util/get_distro.lua index c9c2931..5136dac 100644 --- a/dotfiles/nvim/lua/util/get_distro.lua +++ b/dotfiles/nvim/lua/util/get_distro.lua @@ -20,6 +20,10 @@ local function distro_traits(name) icon = "", color = "#73ba25", }, + [ "distrobox" ] = { + icon = "[󰏗 " .. os.getenv("CONTAINER_ID") .. "]", + color = "#917d62", + }, } local icon = icons[name] @@ -31,6 +35,13 @@ local function distro_traits(name) end return function() + if os.getenv("CONTAINER_ID") ~= nil then + return { + name = "distrobox", + traits = distro_traits("distrobox"), + } + end + local release_file = io.open("/etc/os-release", "rb") if release_file == nil then return { diff --git a/dotfiles/zsh/conf.d/distrobox.zsh b/dotfiles/zsh/conf.d/distrobox.zsh new file mode 100644 index 0000000..1f4e6e4 --- /dev/null +++ b/dotfiles/zsh/conf.d/distrobox.zsh @@ -0,0 +1,3 @@ +#!/usr/bin/env zsh + +# TODO: Script to prompt which environment the user wants to enter in to diff --git a/dotfiles/zsh/conf.d/manpager.zsh b/dotfiles/zsh/conf.d/manpager.zsh index 4260c24..ef34d2a 100755 --- a/dotfiles/zsh/conf.d/manpager.zsh +++ b/dotfiles/zsh/conf.d/manpager.zsh @@ -2,5 +2,6 @@ if [ -n "$(command -v "nvim")" ]; then export MANPAGER='nvim +Man!' + export EDITOR="nvim" fi diff --git a/dotfiles/zsh/conf.d/ps1.zsh b/dotfiles/zsh/conf.d/ps1.zsh index 8a741c4..2c1f48b 100755 --- a/dotfiles/zsh/conf.d/ps1.zsh +++ b/dotfiles/zsh/conf.d/ps1.zsh @@ -19,6 +19,10 @@ else nix_shell_ps1="" fi +if [ -n "$CONTAINER_ID" ]; then + dicon="%F{bg-yellow}[󰏗 $CONTAINER_ID]%f" +fi + setopt prompt_subst autoload -Uz vcs_info precmd () { vcs_info }