Compare commits

..

2 Commits

Author SHA1 Message Date
Felix Pankratz 0d61dc21b9 zsh 5 months ago
Felix Pankratz cc6a54b8f2 buncha things 5 months ago

@ -1,18 +1,9 @@
-- Pull in the wezterm API
local wezterm = require 'wezterm' local wezterm = require 'wezterm'
-- This will hold the configuration.
local config = wezterm.config_builder() local config = wezterm.config_builder()
-- This is where you actually apply your config choices
-- For example, changing the color scheme:
config.color_scheme = 'Argonaut (Gogh)'
-- keybinds -- keybinds
config.leader = { key = 'a', mods = 'CTRL', timeout_milliseconds = 1000 } config.leader = { key = 'a', mods = 'CTRL', timeout_milliseconds = 1000 }
config.keys = { config.keys = {
-- splitting
{ {
mods = "LEADER|SHIFT", mods = "LEADER|SHIFT",
key = '"', key = '"',
@ -60,6 +51,21 @@ config.keys = {
mods = 'ALT', mods = 'ALT',
action = wezterm.action.ScrollToPrompt(1) action = wezterm.action.ScrollToPrompt(1)
}, },
{
key = 'c',
mods = 'LEADER',
action = wezterm.action.ScrollToPrompt(1)
},
{
key = 'n',
mods = 'LEADER',
action = wezterm.action.SwitchWorkspaceRelative(1)
},
{
key = 'p',
mods = 'LEADER',
action = wezterm.action.SwitchWorkspaceRelative(-1)
},
} }
config.mouse_bindings = { config.mouse_bindings = {
@ -70,16 +76,204 @@ config.mouse_bindings = {
} }
} }
-- stylin'
local color = (function()
local COLOR = require "colors"
local coolors = {
COLOR.VERIDIAN,
COLOR.PAYNE,
COLOR.INDIGO,
COLOR.CAROLINA,
COLOR.FLAME,
COLOR.JET,
COLOR.TAUPE,
COLOR.ECRU,
COLOR.VIOLET,
COLOR.VERDIGRIS
}
return coolors[math.random(#coolors)]
end)()
local color_primary = color
local title_color_bg = color_primary.bg
local title_color_fg = color_primary.fg
local color_off = title_color_bg:lighten(0.4)
local color_on = color_off:lighten(0.4)
wezterm.on('update-right-status', function(window)
local bat = ''
local b = wezterm.battery_info()[1]
bat = wezterm.format {
{ Foreground = {
Color =
b.state_of_charge > 0.2 and color_on or color_off,
} },
{ Text = '' },
{ Foreground = {
Color =
b.state_of_charge > 0.4 and color_on or color_off,
} },
{ Text = '' },
{ Foreground = {
Color =
b.state_of_charge > 0.6 and color_on or color_off,
} },
{ Text = '' },
{ Foreground = {
Color =
b.state_of_charge > 0.8 and color_on or color_off,
} },
{ Text = '' },
{ Background = {
Color =
b.state_of_charge > 0.98 and color_on or color_off,
} },
{ Foreground = {
Color =
b.state == "Charging"
and color_on:lighten(0.3):complement()
or
(b.state_of_charge < 0.2 and wezterm.GLOBAL.count % 2 == 0)
and color_on:lighten(0.1):complement()
or color_off:darken(0.1)
} },
{ Text = '' },
}
local time = wezterm.strftime '%k:%M '
local bg1 = title_color_bg:lighten(0.1)
local bg2 = title_color_bg:lighten(0.2)
window:set_right_status(
wezterm.format {
{ Background = { Color = title_color_bg } },
{ Foreground = { Color = bg1 } },
{ Text = '' },
{ Background = { Color = title_color_bg:lighten(0.1) } },
{ Foreground = { Color = title_color_fg } },
{ Text = ' ' .. window:active_workspace() .. ' ' },
{ Foreground = { Color = bg1 } },
{ Background = { Color = bg2 } },
{ Text = '' },
{ Foreground = { Color = title_color_bg:lighten(0.4) } },
{ Foreground = { Color = title_color_fg } },
{ Text = ' ' .. time .. ' ' .. bat }
}
)
end)
wezterm.on('gui-startup', function(cmd)
local mux = wezterm.mux
local padSize = 80
local screenWidth = 1920
local screenHeight = 1080
local tab, pane, window = mux.spawn_window(cmd or {
workspace = 'main',
})
if window ~= nil then
window:gui_window():set_position(padSize, padSize)
window:gui_window():set_inner_size(screenWidth - (padSize * 2), screenHeight - (padSize * 2) - 48)
end
end)
local TAB_EDGE_LEFT = wezterm.nerdfonts.ple_left_half_circle_thick
local TAB_EDGE_RIGHT = wezterm.nerdfonts.ple_right_half_circle_thick
local function tab_title(tab_info)
local title = tab_info.tab_title
local icon = tab_info.active_pane.user_vars.ICON
if icon then
return icon .. ' ' .. tab_info.active_pane.title:gsub("%.exe", ""):gsub("panki: ", "")
else
return tab_info.active_pane.title:gsub("%.exe", ""):gsub("panki: ", "")
end
end
wezterm.on(
'format-tab-title',
function(tab, _, _, _, hover, max_width)
local edge_background = title_color_bg
local background = title_color_bg:lighten(0.05)
local foreground = title_color_fg
if tab.is_active then
background = background:lighten(0.1)
foreground = foreground:lighten(0.1)
elseif hover then
background = background:lighten(0.2)
foreground = foreground:lighten(0.2)
end
local edge_foreground = background
local title = tab_title(tab)
-- ensure that the titles fit in the available space,
-- and that we have room for the edges.
title = wezterm.truncate_right(title, max_width - 2)
return {
{ Background = { Color = edge_background } },
{ Foreground = { Color = edge_foreground } },
{ Text = TAB_EDGE_LEFT },
{ Background = { Color = background } },
{ Foreground = { Color = foreground } },
{ Text = title },
{ Background = { Color = edge_background } },
{ Foreground = { Color = edge_foreground } },
{ Text = TAB_EDGE_RIGHT },
}
end
)
config.colors = {
tab_bar = {
active_tab = {
bg_color = title_color_bg:lighten(0.03),
fg_color = title_color_fg:lighten(0.8),
intensity = "Bold",
},
inactive_tab = {
bg_color = title_color_bg:lighten(0.01),
fg_color = title_color_fg,
intensity = "Half",
},
inactive_tab_edge = title_color_bg
},
split = title_color_bg:lighten(0.3):desaturate(0.5)
}
config.window_background_opacity = 0.9
config.window_frame = {
active_titlebar_bg = title_color_bg,
inactive_titlebar_bg = title_color_bg,
font_size = 10.0,
}
config.window_decorations = 'RESIZE'
config.win32_system_backdrop = "Disable"
config.show_tab_index_in_tab_bar = false
config.show_new_tab_button_in_tab_bar = false
config.color_scheme = 'Argonaut (Gogh)'
config.font = wezterm.font 'JetBrains Mono' config.font = wezterm.font 'JetBrains Mono'
-- terminal padding
config.window_padding = { config.window_padding = {
left = 0, left = 0,
right = 0, right = 0,
top = 0, top = 0,
bottom = 0, bottom = 0,
} }
config.use_fancy_tab_bar = false config.use_fancy_tab_bar = true
config.hide_tab_bar_if_only_one_tab = true config.hide_tab_bar_if_only_one_tab = false
config.tab_bar_at_bottom = true
config.tab_max_width=24
config.inactive_pane_hsb = { config.inactive_pane_hsb = {
saturation = 0.6, saturation = 0.6,
@ -87,11 +281,11 @@ config.inactive_pane_hsb = {
} }
config.quick_select_alphabet = "asdfqweryxcvjkluiopmghtzbn" config.quick_select_alphabet = "asdfqweryxcvjkluiopmghtzbn"
config.scrollback_lines = 9001
-- WSL -- WSL
if wezterm.target_triple == 'x86_64-pc-windows-msvc' then if wezterm.target_triple == 'x86_64-pc-windows-msvc' then
config.default_domain = 'WSL:Debian' config.default_domain = 'WSL:Debian'
end end
-- and finally, return the configuration to wezterm
return config return config

@ -2,25 +2,27 @@
# .zshrc - started by panki on 20200226 # .zshrc - started by panki on 20200226
# #
fpath+=($HOME/.zsh/pure)
autoload -Uz compinit promptinit autoload -Uz compinit promptinit
autoload -z edit-command-line autoload -z edit-command-line
zle -N edit-command-line zle -N edit-command-line
compinit compinit
promptinit promptinit
# This will set the default prompt to the fade theme # fix background color being black...
prompt fade green PS1=${PS1//\%K{black}/%k}
# Return Code on right prompt # Return Code on right prompt
RPS1='[%F{yellow}%?%f]' RPS1='[%F{yellow}%?%f]'
# history stuff # history stuff
HISTFILE=~/.histfile HISTSIZE=9000
HISTSIZE=1000 SAVEHIST=9000
SAVEHIST=1000
setopt appendhistory setopt appendhistory
bindkey -e bindkey -e
path+=('/home/panki/.local/bin')
# thanks to slashbeast for these ones # thanks to slashbeast for these ones
@ -40,41 +42,61 @@ cd() {
fi fi
} }
setup_git_prompt() { alias sudo='sudo --preserve-env=HOME'
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then alias grep='grep --colour=auto'
unset git_prompt alias ls='ls --color=auto'
return 0 alias ll='ls -alFh'
fi alias vi='nvim'
alias vim='vi'
local git_status_dirty git_branch alias devel='cd /mnt/c/devel'
alias desk='cd /mnt/c/Users/PankratzF/Desktop'
if [ "$(git status --untracked-files='no' --porcelain)" ]; then alias e='explorer.exe .'
git_status_dirty='%F{green}*' alias nmap='/mnt/c/Program\ Files\ \(x86\)/Nmap/nmap.exe'
else alias sudo='sudo '
unset git_status_dirty alias ds='dig +short'
fi alias kw='date +%V'
lt () { ls -lt ${1} | head }
git_branch="$(git symbolic-ref HEAD 2>/dev/null)" # define slash and underscore as word separators
git_branch="${git_branch#refs/heads/}" WORDCHARS=${WORDCHARS/\/}
WORDCHARS=${WORDCHARS/_}
if [ "${#git_branch}" -ge 24 ]; then # vi stuff
git_branch="${git_branch:0:21}..." if [[ "$(command -v nvim)" ]]; then
export EDITOR='nvim'
export MANPAGER='nvim +Man!'
export MANWIDTH=999
fi fi
git_branch="${git_branch:-no branch}" # jump to man flag
function fman () { man -P "less -p \"^ +$2\"" $1 }
git_prompt=" %F{blue}[%F{253}${git_branch}${git_status_dirty}%F{blue}]" # fzf stuff
export FZF_TMUX=1
export FZF_DEFAULT_OPTS='--height 40%'
export FZF_COMPLETION_TRIGGER='~~'
source /usr/share/doc/fzf/examples/key-bindings.zsh
alias fp='fzf --preview "bat --style=numbers --color=always --line-range :500 {}"'
# cheat - display text reminders
function cheat() {
bat -l md -p ~/cheat/"$1"
} }
compdef '_files -W "/home/panki/cheat"' cheat
precmd() { # tokens etc
setup_git_prompt source ~/.exports
}
PS1='%F{green}%B%K{green}█▓▒░%F{white}%K{green}%B%n@%m%b%F{green}%K{black}█▓▒░%F{white}%K{black}%B %D{%a %b %d} %D{%I:%M:%S%P} # wezterm
%}%F{green}%K{black}%B%~/%b%k${git_prompt}%f ' source ~/.zsh/wezterm.sh
# aliases # This will set the default prompt to the fade theme
alias grep='grep --colour=auto' if [[ $UID -eq 0 ]]; then
alias ll='ls -alFh' HISTFILE="${HISTFILE%_history}_root_history"
lt () { ls -lt ${1} | head } prompt fade red
EDITOR=vim else
HISTFILE=~/.histfile
prompt pure
fi
ICONS=(😈 💀 🤡 👻 👽 👾 🤖 😺 💋 💥 🦥 🐣 🐧 🐸 🐢 🐍 🐳 🌴 🍉 🍎 🍒 🥝 🥥 🥨 🍕 ☕ 🚨 🚀 🛸 🪐 🌠 🌙 🌞 🌈 ⚡ 🔥 💧 ✨ 🎉 💎 💾 📎 💣 📡 )
export PURE_PROMPT_SYMBOL="$(shuf -n1 -e "${ICONS[@]}")"
__wezterm_set_user_var "ICON" $PURE_PROMPT_SYMBOL

Loading…
Cancel
Save