Initial commit

This commit is contained in:
2020-04-23 14:50:36 +02:00
commit 0c743950ac
47 changed files with 3838 additions and 0 deletions

3
.Xresources Normal file
View File

@@ -0,0 +1,3 @@
Xft.dpi: 150
*.font: Liberation Mono:pixelsize=20:antialias=true:autohint=true;
*.alpha: 0.77

146
.config/dircolors/dircolors Normal file
View File

@@ -0,0 +1,146 @@
# This file is based on the standard dircolors but with bright colors when using bold font
TERM xterm*
# NORMAL 00
# FILE 00
RESET 0
DIR 01;94
LINK 01;96
MULTIHARDLINK 01;96
FIFO 40;33
SOCK 01;95
DOOR 01;95
BLK 40;33;01 # block device driver
CHR 40;33;01 # character device driver
ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file ...
MISSING 00 # ... and the files they point to
SETUID 37;41
SETGID 30;43
CAPABILITY 30;41
STICKY_OTHER_WRITABLE 30;42
OTHER_WRITABLE 34;42
STICKY 37;44
EXEC 01;92
## Archives
*.tar 01;91
*.tgz 01;91
*.arc 01;91
*.arj 01;91
*.taz 01;91
*.lha 01;91
*.lz4 01;91
*.lzh 01;91
*.lzma 01;91
*.tlz 01;91
*.txz 01;91
*.tzo 01;91
*.t7z 01;91
*.zip 01;91
*.z 01;91
*.Z 01;91
*.dz 01;91
*.gz 01;91
*.lrz 01;91
*.lz 01;91
*.lzo 01;91
*.xz 01;91
*.zst 01;91
*.tzst 01;91
*.bz2 01;91
*.bz 01;91
*.tbz 01;91
*.tbz2 01;91
*.tz 01;91
*.deb 01;91
*.rpm 01;91
*.jar 01;91
*.war 01;91
*.ear 01;91
*.sar 01;91
*.rar 01;91
*.alz 01;91
*.ace 01;91
*.zoo 01;91
*.cpio 01;91
*.7z 01;91
*.rz 01;91
*.cab 01;91
*.wim 01;91
*.swm 01;91
*.dwm 01;91
*.esd 01;91
## Images
*.jpg 01;95
*.jpeg 01;95
*.mjpg 01;95
*.mjpeg 01;95
*.gif 01;95
*.bmp 01;95
*.pbm 01;95
*.pgm 01;95
*.ppm 01;95
*.tga 01;95
*.xbm 01;95
*.xpm 01;95
*.tif 01;95
*.tiff 01;95
*.png 01;95
*.svg 01;95
*.svgz 01;95
*.mng 01;95
*.pcx 01;95
## Videos
*.mov 01;95
*.mpg 01;95
*.mpeg 01;95
*.m2v 01;95
*.mkv 01;95
*.webm 01;95
*.ogm 01;95
*.mp4 01;95
*.m4v 01;95
*.mp4v 01;95
*.vob 01;95
*.qt 01;95
*.nuv 01;95
*.wmv 01;95
*.asf 01;95
*.rm 01;95
*.rmvb 01;95
*.flc 01;95
*.avi 01;95
*.fli 01;95
*.flv 01;95
*.gl 01;95
*.dl 01;95
*.xcf 01;95
*.xwd 01;95
*.yuv 01;95
*.cgm 01;95
*.emf 01;95
## Audio
*.aac 00;36
*.au 00;36
*.flac 00;36
*.m4a 00;36
*.mid 00;36
*.midi 00;36
*.mka 00;36
*.mp3 00;36
*.mpc 00;36
*.ogg 00;36
*.ra 00;36
*.wav 00;36
## https://wiki.xiph.org/MIME_Types_and_File_Extensions
*.ogv 01;95
*.ogx 01;95
*.oga 00;36
*.opus 00;36
*.spx 00;36
*.xspf 00;36

15
.config/git/config Normal file
View File

@@ -0,0 +1,15 @@
[include]
path = gitlab.config
[includeIf "gitdir:~/Projects/dotfiles-github/"]
path = github.config
[commit]
gpgsign = true
[difftool "meld"]
path = /usr/bin/meld
[submodule]
recurse = true
[color "status"]
added = 076
untracked = 014
[core]
pager = diff-so-fancy | less --tabs=4 -RFX

View File

@@ -0,0 +1,8 @@
#!/bin/sh
if [ "$(rfkill -o SOFT --noheadings list wlan)" = "blocked" ]; then
notify-send "Airplane mode toggled" "On"
else
notify-send "Airplane mode toggled" "Off"
fi

243
.config/i3/config Normal file
View File

@@ -0,0 +1,243 @@
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!
set $mod Mod4
# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
# font pango:monospace 8
# This font is widely installed, provides lots of unicode glyphs, right-to-left
# text rendering and scalability on retina/hidpi displays (thanks to pango).
font pango:DejaVu Sans Mono 10
# Before i3 v4.8, we used to recommend this one as the default:
# font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
# The font above is very space-efficient, that is, it looks good, sharp and
# clear in small sizes. However, its unicode glyph coverage is limited, the old
# X core fonts rendering does not support right-to-left and this being a bitmap
# font, it doesnt scale on retina/hidpi displays.
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
# start a terminal
# set $TERMINAL kitty
# bindsym $mod+Return exec i3-sensible-terminal
# bindsym $mod+Return exec kitty
bindsym $mod+Return exec gnome-terminal --hide-menubar
# kill focused window
bindsym $mod+Shift+q kill
# start dmenu (a program launcher)
bindsym $mod+Shift+d exec dmenu_run
# There also is the (new) i3-dmenu-desktop which only displays applications
# shipping a .desktop file. It is a wrapper around dmenu, so you need that
# installed.
# bindsym $mod+d exec --no-startup-id i3-dmenu-desktop
bindsym $mod+d exec rofi -show drun
# change focus
focus_wrapping no
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# move focused window
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
# split in horizontal orientation
bindsym $mod+h split h
# split in vertical orientation
bindsym $mod+v split v
# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
# change container layout (stacked, tabbed, toggle split)
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
# toggle tiling / floating
bindsym $mod+Shift+space floating toggle
# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle
# focus the parent container
bindsym $mod+a focus parent
# focus the child container
#bindsym $mod+d focus child
# switch to workspace
bindsym $mod+1 workspace 1
bindsym $mod+2 workspace 2
bindsym $mod+3 workspace 3
bindsym $mod+4 workspace 4
bindsym $mod+5 workspace 5
bindsym $mod+6 workspace 6
bindsym $mod+7 workspace 7
bindsym $mod+8 workspace 8
bindsym $mod+9 workspace 9
bindsym $mod+0 workspace 10
# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace 1
bindsym $mod+Shift+2 move container to workspace 2
bindsym $mod+Shift+3 move container to workspace 3
bindsym $mod+Shift+4 move container to workspace 4
bindsym $mod+Shift+5 move container to workspace 5
bindsym $mod+Shift+6 move container to workspace 6
bindsym $mod+Shift+7 move container to workspace 7
bindsym $mod+Shift+8 move container to workspace 8
bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+Shift+0 move container to workspace 10
# move focused container and switch to workspace
bindsym Mod1+Shift+1 move container to workspace 1; workspace 1
bindsym Mod1+Shift+2 move container to workspace 2; workspace 2
bindsym Mod1+Shift+3 move container to workspace 3; workspace 3
bindsym Mod1+Shift+4 move container to workspace 4; workspace 4
bindsym Mod1+Shift+5 move container to workspace 5; workspace 5
bindsym Mod1+Shift+6 move container to workspace 6; workspace 6
bindsym Mod1+Shift+7 move container to workspace 7; workspace 7
bindsym Mod1+Shift+8 move container to workspace 8; workspace 8
bindsym Mod1+Shift+9 move container to workspace 9; workspace 9
bindsym Mod1+Shift+0 move container to workspace 10; workspace 10
# reload the configuration file
bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart
# exit i3 (logs you out of your X session)
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"
# resize window (you can also use the mouse for that)
mode "resize" {
# These bindings trigger as soon as you enter the resize mode
# Pressing left will shrink the windows width.
# Pressing right will grow the windows width.
# Pressing up will shrink the windows height.
# Pressing down will grow the windows height.
bindsym Left resize shrink width 10 px or 10 ppt
bindsym Down resize grow height 10 px or 10 ppt
bindsym Up resize shrink height 10 px or 10 ppt
bindsym Right resize grow width 10 px or 10 ppt
# Set window size to predefined values
# firefox anti fingerprinting
bindsym p resize set 1920 1080
# scratchpad default size
bindsym s resize set 1600 900
# "fullscreen"
bindsym f resize set 3200 1770
# Move window to center
bindsym c move position center
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Caps_Lock mode "default"
bindsym Escape mode "default"
bindsym $mod+r mode "default"
}
bindsym $mod+r mode "resize"
# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
# bar {
# status_command i3blocks
# position top
# }
exec_always --no-startup-id ~/.config/polybar/launch.sh &
# Touchpad configuration
set $touchpad DLL082A:01 06CB:76AF Touchpad
exec xinput set-prop "$touchpad" "libinput Tapping Enabled" 1
exec xinput set-prop "$touchpad" "libinput Natural Scrolling Enabled" 1
exec xinput set-prop "$touchpad" "libinput Accel Speed" 0.45
# Brightness controls (/etc/X11/xorg.conf necessary)
bindsym XF86MonBrightnessDown exec xbacklight -dec 10
bindsym XF86MonBrightnessUp exec xbacklight -inc 10
# Volume controls (see https://faq.i3wm.org/question/125/how-to-change-the-systems-volume.1.html)
# Note: just add unmute add the end of the amixer command if the volume keys should unmute
bindsym XF86AudioRaiseVolume exec --no-startup-id amixer -q -D pulse sset Master 5%+
bindsym XF86AudioLowerVolume exec --no-startup-id amixer -q -D pulse sset Master 5%-
bindsym XF86AudioMute exec --no-startup-id amixer -q -D pulse sset Master toggle-mute
# volume at startup
exec amixer -q -D pulse sset Master mute
default_border pixel 1
hide_edge_borders smart
# Power
bindsym $mod+l exec xset s activate
bindsym $mod+p exec ~/.config/rofi/powermenu.sh &
exec --no-startup-id xss-lock -l ~/.config/xsecurelock/transfer-sleep-lock.sh &
# Wallpaper
exec feh --bg-scale --no-fehbg ~/Pictures/Wallpapers/tractor-blur.png
# Notify when toggling airplane mode
bindsym XF86RFKill exec --no-startup-id ~/.config/i3/airplane-mode-notify.sh
# compositor for transparency
exec --no-startup-id compton -b
# scratchpad-terminal
for_window [class="Gnome-terminal" title="^scratchpad-terminal$"] \
move scratchpad, \
sticky enable, \
scratchpad show, \
resize set 1600 900, \
border none, \
move position center
# show scratchpad-terminal or create one if none exists
bindsym $mod+comma exec ~/.config/i3/scratchpad-terminal.sh -s
# hide scratchpad-terminal indepedent of where the focus sits
bindsym $mod+Shift+comma exec ~/.config/i3/scratchpad-terminal.sh -h
bindsym $mod+Shift+m move scratchpad
bindsym $mod+Shift+s [class="^Spotify$"] scratchpad show
bindsym $mod+Shift+t [class="^TelegramDesktop$"] scratchpad show
# screenshots
bindsym --release Print exec gnome-screenshot -i
bindsym --release $mod+Print exec gnome-screenshot -a
# keyboard layout (de layout without dead keys and switched ESC and CAPS_LOCK)
exec setxkbmap own
# Restore GNOME's settings
exec --no-startup-id /usr/libexec/gnome-settings-daemon-localeexec
# Fix a bug in gnome-settings-daemon: http://feeding.cloud.geek.nz/posts/creating-a-modern-tiling-desktop-environment-using-i3/
exec --no-startup-id dconf write /org/gnome/settings-daemon/plugins/cursor/active false
# Launch gnome-keyring
exec --no-startup-id gnome-keyring-daemon
# Focus should not follow mouse
# This is sometimes usefull when picking colors on the screen in combination with deactivated dim
# focus_follows_mouse no

View File

@@ -0,0 +1,51 @@
#!/bin/sh
exec >/dev/null
CLASS="Gnome-terminal"
NAME="scratchpad-terminal"
while getopts "hn:s" FLAGS; do
case "$FLAGS" in
h) HIDE=1;;
n) NAME="$OPTARG";;
s) SHOW=1;;
*) exit 1;;
esac
done
shift $(($OPTIND - 1 ))
TREE="$(i3-msg -t get_tree)"
if ! (echo "$TREE" | grep -Po "\"name\":\"${NAME}\".*?floating\":\"[^\"]*\"" \
| grep -q '"floating":"user_on"')
then
EXIST_NOT=1
elif (echo "$TREE" | grep -Po '"focused":true.*?name":"[^"]*"' \
| grep -q "\"name\":\"${NAME}\"")
then
FOCUS_ON_PAD=1
elif [ ! $EXIST_NOT ] && (echo "$TREE" | grep -Po '"output":"__i3".*?"name":"[^"]*"' \
| grep -q "\"name\":\"${NAME}\"")
then
HIDDEN=1
fi
if [ $HIDE ] && [ ! $EXIST_NOT ] && [ ! $HIDDEN ]; then
# There is a visible scratchpad-terminal that shall be hidden
i3-msg "[class=\"$CLASS\" title=\"^${NAME}$\"] scratchpad show"
exit 0
fi
if [ $SHOW ]; then
if [ $EXIST_NOT ]; then
# terminal does not exist yet
gnome-terminal --window-with-profile="$NAME" --hide-menubar
elif [ $HIDDEN ]; then
# terminal is "hidden" in scratchpad
i3-msg "[class=\"$CLASS\" title=\"^${NAME}$\"] scratchpad show"
elif [ ! $FOCUS_ON_PAD ]; then
# terminal is visible but focus lays somewhere else
i3-msg "[class=\"$CLASS\" title=\"^${NAME}$\"] scratchpad show, scratchpad show"
fi
exit 0
fi

159
.config/polybar/config Normal file
View File

@@ -0,0 +1,159 @@
; vi: ft=dosini
[colors]
background = #202020
background-alt = #444
foreground = #fff
foreground-alt = #fff
primary = #fff
secondary = #fff
alert = #f00
[bar/main]
monitor = eDP1
bottom = false
fixed-center = true
width = 100%
height = 32
padding-left = 1
padding-right = 1
module-margin-left = 1
module-margin-right = 2
modules-left = i3 pulseaudio xbacklight
modules-center = datetime
modules-right = battery-custom vpn wlan powermenu
tray-position = right
tray-detached = false
tray-scale = 1.0
font-0 = MesloLGS NF:style=Regular:size=18;4
; used for the colume ramp
font-1 = MesloLGS NF:style=Regular:size=10;2
; used for the dots in module/powermenu
font-2 = MesloLGS NF:size=18;-2
; used for small space in scripts/battery.sh
font-3 = MesloLGS NF:size=8
background = ${colors.background}
foreground = ${colors.foreground}
line-size = 3
line-color = ${colors.primary}
;#################################################
[module/i3]
type = internal/i3
format = <label-state> <label-mode>
index-sort = true
wrapping-scroll = false
; focused = Active workspace on focused monitor
label-focused = %index%
label-focused-background = ${colors.background-alt}
label-focused-underline= ${colors.primary}
label-focused-padding = 1
; unfocused = Inactive workspace on any monitor
label-unfocused = %index%
label-unfocused-padding = ${self.label-focused-padding}
; visible = Active workspace on unfocused monitor
label-visible = %index%
label-visible-underline = ${colors.secondary}
label-visible-padding = ${self.label-focused-padding}
; urgent = Workspace with urgency hint set
label-urgent = %index%
label-urgent-background = ${colors.alert}
label-urgent-padding = ${self.label-focused-padding}
;#################################################
[module/pulseaudio]
type = internal/pulseaudio
format-volume = <label-volume> <bar-volume>
label-volume = VOL: %percentage%%
label-muted = VOL: muted
bar-volume-width = 10
bar-volume-empty = -
bar-volume-fill = -
bar-volume-indicator = |
;format-volume = <ramp-volume> <label-volume>
;format-volume-font = 2
;label-muted = muted
;
;ramp-volume-0 =  
;ramp-volume-1 = █ 
;ramp-volume-2 = ██ 
;ramp-volume-3 = ███ 
;ramp-volume-4 = ████ 
;ramp-volume-5 = █████ 
;ramp-volume-6 = ██████ 
;ramp-volume-7 = ███████ 
;ramp-volume-8 = ████████ 
;ramp-volume-9 = █████████ 
;ramp-volume-10 = ██████████
;#################################################
[module/xbacklight]
type = internal/xbacklight
format = <label> <bar>
label = BL: %percentage%%
bar-width = 10
bar-empty = -
bar-fill = -
bar-indicator = |
;#################################################
;#################################################
;#################################################
[module/datetime]
type = internal/date
interval = 1
date = %Y-%m-%d%
time = "%H:%M:%S "
label = "%date% - %time%"
;#################################################
;#################################################
;#################################################
[module/battery-custom]
type = custom/script
exec = ~/.config/polybar/scripts/battery.sh
interval = 5
;#################################################
[module/vpn]
type = custom/script
exec = ~/.config/polybar/scripts/running-vpn.sh
click-left = ~/.config/polybar/scripts/pub-ipv4.sh &
interval = 5
;#################################################
[module/wlan]
type = internal/network
interface = wlp58s0
interval = 3
format-connected = <label-connected>
label-connected = %{A1:gnome-terminal -x nmtui connect:} %essid:0:20:...%:%signal%% %{A}
fomat-disconnected = <label-disconnected>
label-disconnected = %{A1:gnome-terminal -x nmtui connect:} %ifname% disconnected %{A}
;#################################################
[module/powermenu]
type = custom/text
content = %{A1:~/.config/rofi/powermenu.sh &:}%{T3}...%{T-}%{A}

12
.config/polybar/launch.sh Executable file
View File

@@ -0,0 +1,12 @@
#!/bin/sh
# Terminate already running bar instances
killall -q polybar
# Wait until the processes have been shut down
while pgrep -x polybar >/dev/null; do sleep 1; done
# Launch Polybar
polybar -c "$HOME/.config/polybar/config" main &
echo "Polybar launched..."

View File

@@ -0,0 +1,27 @@
#!/bin/sh
## config
full=80
low=20
############################
red='%{F#f00}'
green='%{F#0f0}'
end='%{F-}'
# hack to put a little space between the lightning and the percentage
smallspace='%{T4} %{T-}'
bat="$(cat /sys/class/power_supply/BAT0/capacity)"
ac="$(cat /sys/class/power_supply/AC/online)"
# display in red when under $low and no charger is connected
[ "$bat" -gt "$low" ] || [ "$ac" -eq 1 ] || color="$red"
# display in green when over $full and a charger is connected
[ "$bat" -lt "$full" ] || [ "$ac" -eq 0 ] || color="$green"
prefix=" "
[ "$ac" -eq 0 ] || prefix="⚡"
echo "${color}${prefix}${smallspace}${bat}%"

View File

@@ -0,0 +1,3 @@
#!/bin/bash
echo $(curl -s https://ipinfo.io/ip)

View File

@@ -0,0 +1,13 @@
#!/bin/sh
connection="$(nmcli con show --active | awk '$3 == "vpn" { print $1 }')"
if [ -n "$connection" ]; then
echo "VPN: $connection"
exit 0
fi
# [o] is a hack to not grep the grep-command
# see: https://stackoverflow.com/questions/9375711/more-elegant-ps-aux-grep-v-grep
! ps ax | grep -q "[o]penvpn" || echo -n "VPN"
echo

95
.config/rofi/config Normal file
View File

@@ -0,0 +1,95 @@
// vi: ft=css
configuration {
modi: "window,drun";
matching: "glob";
drun-match-fields: "all";
/*display-drun: "Apps";*/
/*display-window: "Window";*/
show-icons: true;
// continous scrolling
scroll-method: 1;
}
* {
lines: 5;
columns: 1;
background-color: #00000090;
// background-color: #00000065;
border-color: #00000000;
text-color: #EFEFEF;
font: "Hack 20";
}
#window {
border: 0;
border-radius: 4px;
padding: 30;
width: 40%;
height: 60%;
}
#scrollbar {
handle-color: #00a0e6;
border-color: #00a0e6;
}
#mainbox {
background-color: #00000000;
children: [inputbar, listview];
spacing: 10px;
/*margin: 20%;*/
padding: 7px 0;
border: 1px;
border-color: @base0D;
}
#listview {
background-color: #00000000;
fixed-height: 0;
border: 0px;
spacing: 5px;
scrollbar: true;
padding: 10px 10px 0px;
}
#element {
background-color: #00000000;
border: 0;
border-radius: 15px;
padding: 3 0 3 4 ;
}
#element selected {
background-color: #00a0e6;
text-color: #EFEFEF;
}
#inputbar {
children: [ prompt,textbox-prompt-colon,entry,case-indicator ];
background-color: #00000000;
}
#case-indicator {
background-color: #00000000;
spacing: 0;
}
#entry {
background-color: #00000000;
spacing: 0;
}
#prompt {
background-color: #00000000;
spacing: 0;
}
#textbox-prompt-colon {
background-color: #00000000;
expand: false;
str: ":";
margin: 0px 0.3em 0em 0em ;
}

95
.config/rofi/config.rasi Normal file
View File

@@ -0,0 +1,95 @@
// vi: ft=css
configuration {
modi: "window,drun";
matching: "glob";
drun-match-fields: "all";
/*display-drun: "Apps";*/
/*display-window: "Window";*/
show-icons: true;
// continous scrolling
scroll-method: 1;
}
* {
lines: 5;
columns: 1;
background-color: #00000090;
// background-color: #00000065;
border-color: #00000000;
text-color: #EFEFEF;
font: "Hack 20";
}
#window {
border: 0;
border-radius: 4px;
padding: 30;
width: 40%;
height: 60%;
}
#scrollbar {
handle-color: #00a0e6;
border-color: #00a0e6;
}
#mainbox {
background-color: #00000000;
children: [inputbar, listview];
spacing: 10px;
/*margin: 20%;*/
padding: 7px 0;
border: 1px;
border-color: @base0D;
}
#listview {
background-color: #00000000;
fixed-height: 0;
border: 0px;
spacing: 5px;
scrollbar: true;
padding: 10px 10px 0px;
}
#element {
background-color: #00000000;
border: 0;
border-radius: 15px;
padding: 3 0 3 4 ;
}
#element selected {
background-color: #00a0e6;
text-color: #EFEFEF;
}
#inputbar {
children: [ prompt,textbox-prompt-colon,entry,case-indicator ];
background-color: #00000000;
}
#case-indicator {
background-color: #00000000;
spacing: 0;
}
#entry {
background-color: #00000000;
spacing: 0;
}
#prompt {
background-color: #00000000;
spacing: 0;
}
#textbox-prompt-colon {
background-color: #00000000;
expand: false;
str: ":";
margin: 0px 0.3em 0em 0em ;
}

52
.config/rofi/powermenu.sh Executable file
View File

@@ -0,0 +1,52 @@
#!/bin/bash
# Inspired by https://github.com/cramermarius/rofi-menus/blob/master/scripts/powermenu.sh
# entries with associated commands
declare -A entries
entries=( [lock]="xset s activate"
[logout]="i3-msg exit"
[reboot]="systemctl reboot"
[shutdown]="systemctl poweroff"
[suspend]="systemctl suspend"
[suspend (scheduled)]="scheduled_suspend")
declare -a rofi_args
rofi_args=( -no-config
-theme /usr/share/rofi/themes/android_notification.rasi
-lines ${#entries[@]}
-width 12
-location 3
-yoffset 32
-dmenu
-no-case-sensitive
-p) # has to end with -p!
function scheduled_suspend {
declare -i min=0
min=$(rofi "${rofi_args[@]}" "minutes: ")
# make sure the input was a valid number
# side effect: 0 minutes is not possible
[ "$min" -ne 0 ] || exit 1
notify-send "suspend in" "$min minutes"
sleep $((min*60)) && systemctl suspend
}
# Choose option over rofi
# Note: bash does not keep the order of the keys thus they get sorted
chosen="$(printf '%s\n' "${!entries[@]}" | sort | rofi "${rofi_args[@]}" "power: ")"
# exit if nothing was selected
[ -n "$chosen" ] || exit 1
# handle scheduled suspend different
[ "$chosen" != "suspend (scheduled)" ] || { ${entries[$chosen]}; exit $?; }
# Confirm choice
yesNo="$(echo -e "yes\nno" | rofi "${rofi_args[@]}" "Are you sure you want to ${chosen}? ")"
# Exit if "No"
[ "$yesNo" == "yes" ] || exit 1
# Execute
${entries[$chosen]}

View File

@@ -0,0 +1,101 @@
#!/usr/bin/env bash
# from https://github.com/zbaylin/rofi-wifi-menu/blob/master/rofi-wifi-menu.sh
# Starts a scan of available broadcasting SSIDs
# nmcli dev wifi rescan
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
FIELDS=SSID,SECURITY
POSITION=0
YOFF=0
XOFF=0
FONT="DejaVu Sans Mono 8"
# if [ -r "$DIR/config" ]; then
# source "$DIR/config"
# elif [ -r "$HOME/.config/rofi/wifi" ]; then
# source "$HOME/.config/rofi/wifi"
# else
# echo "WARNING: config file not found! Using default values."
# fi
LIST=$(nmcli --fields "$FIELDS" device wifi list | sed '/^--/d')
# For some reason rofi always approximates character width 2 short... hmmm
RWIDTH=$(($(echo "$LIST" | head -n 1 | awk '{print length($0); }')+2))
# Dynamically change the height of the rofi menu
LINENUM=$(echo "$LIST" | wc -l)
# Gives a list of known connections so we can parse it later
KNOWNCON=$(nmcli connection show)
# Really janky way of telling if there is currently a connection
CONSTATE=$(nmcli -fields WIFI g)
CURRSSID=$(LANGUAGE=C nmcli -t -f active,ssid dev wifi | awk -F: '$1 ~ /^yes/ {print $2}')
if [[ ! -z $CURRSSID ]]; then
HIGHLINE=$(echo "$(echo "$LIST" | awk -F "[ ]{2,}" '{print $1}' | grep -Fxn -m 1 "$CURRSSID" | awk -F ":" '{print $1}') + 1" | bc )
fi
# HOPEFULLY you won't need this as often as I do
# If there are more than 8 SSIDs, the menu will still only have 8 lines
if [ "$LINENUM" -gt 8 ] && [[ "$CONSTATE" =~ "enabled" ]]; then
LINENUM=8
elif [[ "$CONSTATE" =~ "disabled" ]]; then
LINENUM=1
fi
if [[ "$CONSTATE" =~ "enabled" ]]; then
TOGGLE="toggle off"
elif [[ "$CONSTATE" =~ "disabled" ]]; then
TOGGLE="toggle on"
fi
CHENTRY=$(echo -e "$TOGGLE\nmanual\n$LIST" | uniq -u | rofi -dmenu -p "Wi-Fi SSID: " -lines "$LINENUM" -a "$HIGHLINE" -location "$POSITION" -yoffset "$YOFF" -xoffset "$XOFF" -font "$FONT" -width -"$RWIDTH")
#echo "$CHENTRY"
CHSSID=$(echo "$CHENTRY" | sed 's/\s\{2,\}/\|/g' | awk -F "|" '{print $1}')
#echo "$CHSSID"
# If the user inputs "manual" as their SSID in the start window, it will bring them to this screen
if [ "$CHENTRY" = "manual" ] ; then
# Manual entry of the SSID and password (if appplicable)
MSSID=$(echo "enter the SSID of the network (SSID,password)" | rofi -dmenu -p "Manual Entry: " -font "$FONT" -lines 1)
# Separating the password from the entered string
MPASS=$(echo "$MSSID" | awk -F "," '{print $2}')
#echo "$MSSID"
#echo "$MPASS"
# If the user entered a manual password, then use the password nmcli command
if [ "$MPASS" = "" ]; then
nmcli dev wifi con "$MSSID"
else
nmcli dev wifi con "$MSSID" password "$MPASS"
fi
elif [ "$CHENTRY" = "toggle on" ]; then
nmcli radio wifi on
elif [ "$CHENTRY" = "toggle off" ]; then
nmcli radio wifi off
else
# If the connection is already in use, then this will still be able to get the SSID
if [ "$CHSSID" = "*" ]; then
CHSSID=$(echo "$CHENTRY" | sed 's/\s\{2,\}/\|/g' | awk -F "|" '{print $3}')
fi
# Parses the list of preconfigured connections to see if it already contains the chosen SSID. This speeds up the connection process
if [[ $(echo "$KNOWNCON" | grep "$CHSSID") = "$CHSSID" ]]; then
nmcli con up "$CHSSID"
else
if [[ "$CHENTRY" =~ "WPA2" ]] || [[ "$CHENTRY" =~ "WEP" ]]; then
WIFIPASS=$(echo "if connection is stored, hit enter" | rofi -dmenu -p "password: " -lines 1 -font "$FONT" )
fi
nmcli dev wifi con "$CHSSID" password "$WIFIPASS"
fi
fi

62
.config/tmux/tmux.conf Normal file
View File

@@ -0,0 +1,62 @@
set -g default-terminal "tmux-256color"
set -g mouse on
# Set C-a as new prefix
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# Split panes with > and <
unbind %
bind-key < split-window -v
unbind '"'
bind-key > split-window -h
# Change panes with Alt-<arrow>
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# Resize panes with Alt-Shift-<arrow>
bind -n M-S-Left resize-pane -L
# Change installation location of plugins
set-environment -g TMUX_PLUGIN_MANAGER_PATH '~/.config/tmux/plugins/'
## Plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
# Capture pane content
set -g @resurrect-capture-pane-contents 'on'
# Change keybindings
set -g @resurrect-save 'C-s'
set -g @resurrect-restore 'C-s'
# Save session every 5 min
set -g @continuum-save-interval '5'
# Last saved environment is automatically restored when tmux is started.
set -g @continuum-restore 'on'
## Theming (inspired by https://github.com/Who23/dots/blob/21976e76644d8d9261ebdcf61733d2181a1612eb/tmux.conf)
set -g status-bg black
set -g status-fg white
# set -g status-right "Continuum status: #{continuum_status}"
set -g @prefix_highlight_fg 'black'
set -g @prefix_highlight_bg 'yellow'
set -g @prefix_highlight_output_prefix ' '
set -g @prefix_highlight_output_suffix ' '
set -g status-right "#{prefix_highlight}"
set -g status-left "#{prefix_highlight}"
set -g status-justify centre
set -g window-status-current-format "#[fg=yellow]#[fg=black]#[bg=yellow]#I #W#[fg=yellow]#[bg=black] "
set -g window-status-format "#[fg=brightblack]#[fg=white]#[bg=brightblack]#I #W#[fg=brightblack]#[bg=black] "
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run -b '~/.config/tmux/plugins/tpm/tpm'

View File

@@ -0,0 +1,28 @@
" [onedark.vim](https://github.com/joshdick/onedark.vim/)
let s:overrides = get(g:, "onedark_color_overrides", {})
let s:colors = {
\ "red": get(s:overrides, "red", { "gui": "#E06C75", "cterm": "204", "cterm16": "1" }),
\ "dark_red": get(s:overrides, "dark_red", { "gui": "#BE5046", "cterm": "196", "cterm16": "9" }),
\ "green": get(s:overrides, "green", { "gui": "#98C379", "cterm": "114", "cterm16": "2" }),
\ "yellow": get(s:overrides, "yellow", { "gui": "#E5C07B", "cterm": "180", "cterm16": "3" }),
\ "dark_yellow": get(s:overrides, "dark_yellow", { "gui": "#D19A66", "cterm": "173", "cterm16": "11" }),
\ "blue": get(s:overrides, "blue", { "gui": "#61AFEF", "cterm": "39", "cterm16": "4" }),
\ "purple": get(s:overrides, "purple", { "gui": "#C678DD", "cterm": "170", "cterm16": "5" }),
\ "cyan": get(s:overrides, "cyan", { "gui": "#56B6C2", "cterm": "38", "cterm16": "6" }),
\ "white": get(s:overrides, "white", { "gui": "#ABB2BF", "cterm": "145", "cterm16": "7" }),
\ "black": get(s:overrides, "black", { "gui": "#282C34", "cterm": "235", "cterm16": "0" }),
\ "visual_black": get(s:overrides, "visual_black", { "gui": "NONE", "cterm": "NONE", "cterm16": "0" }),
\ "comment_grey": get(s:overrides, "comment_grey", { "gui": "#5C6370", "cterm": "59", "cterm16": "15" }),
\ "gutter_fg_grey": get(s:overrides, "gutter_fg_grey", { "gui": "#4B5263", "cterm": "238", "cterm16": "15" }),
\ "cursor_grey": get(s:overrides, "cursor_grey", { "gui": "#2C323C", "cterm": "236", "cterm16": "8" }),
\ "visual_grey": get(s:overrides, "visual_grey", { "gui": "#3E4452", "cterm": "237", "cterm16": "15" }),
\ "menu_grey": get(s:overrides, "menu_grey", { "gui": "#3E4452", "cterm": "237", "cterm16": "8" }),
\ "special_grey": get(s:overrides, "special_grey", { "gui": "#3B4048", "cterm": "238", "cterm16": "15" }),
\ "vertsplit": get(s:overrides, "vertsplit", { "gui": "#181A1F", "cterm": "59", "cterm16": "15" }),
\}
function! onedark#GetColors()
return s:colors
endfunction

View File

@@ -0,0 +1,629 @@
" vim:fdm=marker
" Vim Color File
" Name: onedark.vim
" Maintainer: https://github.com/joshdick/onedark.vim/
" License: The MIT License (MIT)
" Based On: https://github.com/MaxSt/FlatColor/
" A companion [vim-airline](https://github.com/bling/vim-airline) theme is available at: https://github.com/joshdick/airline-onedark.vim
" Color Reference {{{
" The following colors were measured inside Atom using its built-in inspector.
" +---------------------------------------------+
" | Color Name | RGB | Hex |
" |--------------+--------------------+---------|
" | Black | rgb(40, 44, 52) | #282c34 |
" |--------------+--------------------+---------|
" | White | rgb(171, 178, 191) | #abb2bf |
" |--------------+--------------------+---------|
" | Light Red | rgb(224, 108, 117) | #e06c75 |
" |--------------+--------------------+---------|
" | Dark Red | rgb(190, 80, 70) | #be5046 |
" |--------------+--------------------+---------|
" | Green | rgb(152, 195, 121) | #98c379 |
" |--------------+--------------------+---------|
" | Light Yellow | rgb(229, 192, 123) | #e5c07b |
" |--------------+--------------------+---------|
" | Dark Yellow | rgb(209, 154, 102) | #d19a66 |
" |--------------+--------------------+---------|
" | Blue | rgb(97, 175, 239) | #61afef |
" |--------------+--------------------+---------|
" | Magenta | rgb(198, 120, 221) | #c678dd |
" |--------------+--------------------+---------|
" | Cyan | rgb(86, 182, 194) | #56b6c2 |
" |--------------+--------------------+---------|
" | Gutter Grey | rgb(76, 82, 99) | #4b5263 |
" |--------------+--------------------+---------|
" | Comment Grey | rgb(92, 99, 112) | #5c6370 |
" +---------------------------------------------+
" }}}
" Initialization {{{
highlight clear
if exists("syntax_on")
syntax reset
endif
set t_Co=256
let g:colors_name="onedark"
" Set to "256" for 256-color terminals, or
" set to "16" to use your terminal emulator's native colors
" (a 16-color palette for this color scheme is available; see
" < https://github.com/joshdick/onedark.vim/blob/master/README.md >
" for more information.)
if !exists("g:onedark_termcolors")
let g:onedark_termcolors = 256
endif
" Not all terminals support italics properly. If yours does, opt-in.
if !exists("g:onedark_terminal_italics")
let g:onedark_terminal_italics = 0
endif
" This function is based on one from FlatColor: https://github.com/MaxSt/FlatColor/
" Which in turn was based on one found in hemisu: https://github.com/noahfrederick/vim-hemisu/
let s:group_colors = {} " Cache of default highlight group settings, for later reference via `onedark#extend_highlight`
function! s:h(group, style, ...)
if (a:0 > 0) " Will be true if we got here from onedark#extend_highlight
let s:highlight = s:group_colors[a:group]
for style_type in ["fg", "bg", "sp"]
if (has_key(a:style, style_type))
let l:default_style = (has_key(s:highlight, style_type) ? s:highlight[style_type] : { "cterm16": "NONE", "cterm": "NONE", "gui": "NONE" })
let s:highlight[style_type] = extend(l:default_style, a:style[style_type])
endif
endfor
if (has_key(a:style, "gui"))
let s:highlight.gui = a:style.gui
endif
else
let s:highlight = a:style
let s:group_colors[a:group] = s:highlight " Cache default highlight group settings
endif
if g:onedark_terminal_italics == 0
if has_key(s:highlight, "cterm") && s:highlight["cterm"] == "italic"
unlet s:highlight.cterm
endif
if has_key(s:highlight, "gui") && s:highlight["gui"] == "italic"
unlet s:highlight.gui
endif
endif
if g:onedark_termcolors == 16
let l:ctermfg = (has_key(s:highlight, "fg") ? s:highlight.fg.cterm16 : "NONE")
let l:ctermbg = (has_key(s:highlight, "bg") ? s:highlight.bg.cterm16 : "NONE")
else
let l:ctermfg = (has_key(s:highlight, "fg") ? s:highlight.fg.cterm : "NONE")
let l:ctermbg = (has_key(s:highlight, "bg") ? s:highlight.bg.cterm : "NONE")
endif
execute "highlight" a:group
\ "guifg=" (has_key(s:highlight, "fg") ? s:highlight.fg.gui : "NONE")
\ "guibg=" (has_key(s:highlight, "bg") ? s:highlight.bg.gui : "NONE")
\ "guisp=" (has_key(s:highlight, "sp") ? s:highlight.sp.gui : "NONE")
\ "gui=" (has_key(s:highlight, "gui") ? s:highlight.gui : "NONE")
\ "ctermfg=" . l:ctermfg
\ "ctermbg=" . l:ctermbg
\ "cterm=" (has_key(s:highlight, "cterm") ? s:highlight.cterm : "NONE")
endfunction
" public {{{
function! onedark#set_highlight(group, style)
call s:h(a:group, a:style)
endfunction
function! onedark#extend_highlight(group, style)
call s:h(a:group, a:style, 1)
endfunction
" }}}
" }}}
" Color Variables {{{
let s:colors = onedark#GetColors()
let s:red = s:colors.red
let s:dark_red = s:colors.dark_red
let s:green = s:colors.green
let s:yellow = s:colors.yellow
let s:dark_yellow = s:colors.dark_yellow
let s:blue = s:colors.blue
let s:purple = s:colors.purple
let s:cyan = s:colors.cyan
let s:white = s:colors.white
let s:black = s:colors.black
let s:visual_black = s:colors.visual_black " Black out selected text in 16-color visual mode
let s:comment_grey = s:colors.comment_grey
let s:gutter_fg_grey = s:colors.gutter_fg_grey
let s:cursor_grey = s:colors.cursor_grey
let s:visual_grey = s:colors.visual_grey
let s:menu_grey = s:colors.menu_grey
let s:special_grey = s:colors.special_grey
let s:vertsplit = s:colors.vertsplit
" }}}
" Terminal Colors {{{
let g:terminal_ansi_colors = [
\ s:black.gui, s:red.gui, s:green.gui, s:yellow.gui,
\ s:blue.gui, s:purple.gui, s:cyan.gui, s:white.gui,
\ s:visual_grey.gui, s:dark_red.gui, s:green.gui, s:dark_yellow.gui,
\ s:blue.gui, s:purple.gui, s:cyan.gui, s:comment_grey.gui
\]
" }}}
" Syntax Groups (descriptions and ordering from `:h w18`) {{{
call s:h("Comment", { "fg": s:comment_grey, "gui": "italic", "cterm": "italic" }) " any comment
call s:h("Constant", { "fg": s:cyan }) " any constant
call s:h("String", { "fg": s:green }) " a string constant: "this is a string"
call s:h("Character", { "fg": s:green }) " a character constant: 'c', '\n'
call s:h("Number", { "fg": s:dark_yellow }) " a number constant: 234, 0xff
call s:h("Boolean", { "fg": s:dark_yellow }) " a boolean constant: TRUE, false
call s:h("Float", { "fg": s:dark_yellow }) " a floating point constant: 2.3e10
call s:h("Identifier", { "fg": s:red }) " any variable name
call s:h("Function", { "fg": s:blue }) " function name (also: methods for classes)
call s:h("Statement", { "fg": s:purple }) " any statement
call s:h("Conditional", { "fg": s:purple }) " if, then, else, endif, switch, etc.
call s:h("Repeat", { "fg": s:purple }) " for, do, while, etc.
call s:h("Label", { "fg": s:purple }) " case, default, etc.
call s:h("Operator", { "fg": s:purple }) " sizeof", "+", "*", etc.
call s:h("Keyword", { "fg": s:red }) " any other keyword
call s:h("Exception", { "fg": s:purple }) " try, catch, throw
call s:h("PreProc", { "fg": s:yellow }) " generic Preprocessor
call s:h("Include", { "fg": s:blue }) " preprocessor #include
call s:h("Define", { "fg": s:purple }) " preprocessor #define
call s:h("Macro", { "fg": s:purple }) " same as Define
call s:h("PreCondit", { "fg": s:yellow }) " preprocessor #if, #else, #endif, etc.
call s:h("Type", { "fg": s:yellow }) " int, long, char, etc.
call s:h("StorageClass", { "fg": s:yellow }) " static, register, volatile, etc.
call s:h("Structure", { "fg": s:yellow }) " struct, union, enum, etc.
call s:h("Typedef", { "fg": s:yellow }) " A typedef
call s:h("Special", { "fg": s:blue }) " any special symbol
call s:h("SpecialChar", {}) " special character in a constant
call s:h("Tag", {}) " you can use CTRL-] on this
call s:h("Delimiter", {}) " character that needs attention
call s:h("SpecialComment", { "fg": s:comment_grey }) " special things inside a comment
call s:h("Debug", {}) " debugging statements
call s:h("Underlined", { "gui": "underline", "cterm": "underline" }) " text that stands out, HTML links
call s:h("Ignore", {}) " left blank, hidden
call s:h("Error", { "fg": s:red }) " any erroneous construct
call s:h("Todo", { "fg": s:purple }) " anything that needs extra attention; mostly the keywords TODO FIXME and XXX
" }}}
" Highlighting Groups (descriptions and ordering from `:h highlight-groups`) {{{
call s:h("ColorColumn", { "bg": s:cursor_grey }) " used for the columns set with 'colorcolumn'
call s:h("Conceal", {}) " placeholder characters substituted for concealed text (see 'conceallevel')
call s:h("Cursor", { "fg": s:black, "bg": s:blue }) " the character under the cursor
call s:h("CursorIM", {}) " like Cursor, but used when in IME mode
call s:h("CursorColumn", { "bg": s:cursor_grey }) " the screen column that the cursor is in when 'cursorcolumn' is set
if &diff
" Don't change the background color in diff mode
call s:h("CursorLine", { "gui": "underline" }) " the screen line that the cursor is in when 'cursorline' is set
else
call s:h("CursorLine", { "bg": s:cursor_grey }) " the screen line that the cursor is in when 'cursorline' is set
endif
call s:h("Directory", { "fg": s:blue }) " directory names (and other special names in listings)
call s:h("DiffAdd", { "bg": s:green, "fg": s:black }) " diff mode: Added line
call s:h("DiffChange", { "fg": s:yellow, "gui": "underline", "cterm": "underline" }) " diff mode: Changed line
call s:h("DiffDelete", { "bg": s:red, "fg": s:black }) " diff mode: Deleted line
call s:h("DiffText", { "bg": s:yellow, "fg": s:black }) " diff mode: Changed text within a changed line
if get(g:, 'onedark_hide_endofbuffer', 0)
" If enabled, will style end-of-buffer filler lines (~) to appear to be hidden.
call s:h("EndOfBuffer", { "fg": s:black }) " filler lines (~) after the last line in the buffer
endif
call s:h("ErrorMsg", { "fg": s:red }) " error messages on the command line
call s:h("VertSplit", { "fg": s:vertsplit }) " the column separating vertically split windows
call s:h("Folded", { "fg": s:comment_grey }) " line used for closed folds
call s:h("FoldColumn", {}) " 'foldcolumn'
call s:h("SignColumn", {}) " column where signs are displayed
call s:h("IncSearch", { "fg": s:yellow, "bg": s:comment_grey }) " 'incsearch' highlighting; also used for the text replaced with ":s///c"
call s:h("LineNr", { "fg": s:gutter_fg_grey }) " Line number for ":number" and ":#" commands, and when 'number' or 'relativenumber' option is set.
call s:h("CursorLineNr", {}) " Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line.
call s:h("MatchParen", { "fg": s:blue, "gui": "underline" }) " The character under the cursor or just before it, if it is a paired bracket, and its match.
call s:h("ModeMsg", {}) " 'showmode' message (e.g., "-- INSERT --")
call s:h("MoreMsg", {}) " more-prompt
call s:h("NonText", { "fg": s:special_grey }) " '~' and '@' at the end of the window, characters from 'showbreak' and other characters that do not really exist in the text (e.g., ">" displayed when a double-wide character doesn't fit at the end of the line).
call s:h("Normal", { "fg": s:white, "bg": s:black }) " normal text
call s:h("Pmenu", { "bg": s:menu_grey }) " Popup menu: normal item.
call s:h("PmenuSel", { "fg": s:black, "bg": s:blue }) " Popup menu: selected item.
call s:h("PmenuSbar", { "bg": s:special_grey }) " Popup menu: scrollbar.
call s:h("PmenuThumb", { "bg": s:white }) " Popup menu: Thumb of the scrollbar.
call s:h("Question", { "fg": s:purple }) " hit-enter prompt and yes/no questions
call s:h("QuickFixLine", { "fg": s:black, "bg": s:yellow }) " Current quickfix item in the quickfix window.
call s:h("Search", { "fg": s:black, "bg": s:yellow }) " Last search pattern highlighting (see 'hlsearch'). Also used for similar items that need to stand out.
call s:h("SpecialKey", { "fg": s:special_grey }) " Meta and special keys listed with ":map", also for text used to show unprintable characters in the text, 'listchars'. Generally: text that is displayed differently from what it really is.
call s:h("SpellBad", { "fg": s:red, "gui": "underline", "cterm": "underline" }) " Word that is not recognized by the spellchecker. This will be combined with the highlighting used otherwise.
call s:h("SpellCap", { "fg": s:dark_yellow }) " Word that should start with a capital. This will be combined with the highlighting used otherwise.
call s:h("SpellLocal", { "fg": s:dark_yellow }) " Word that is recognized by the spellchecker as one that is used in another region. This will be combined with the highlighting used otherwise.
call s:h("SpellRare", { "fg": s:dark_yellow }) " Word that is recognized by the spellchecker as one that is hardly ever used. spell This will be combined with the highlighting used otherwise.
call s:h("StatusLine", { "fg": s:white, "bg": s:cursor_grey }) " status line of current window
call s:h("StatusLineNC", { "fg": s:comment_grey }) " status lines of not-current windows Note: if this is equal to "StatusLine" Vim will use "^^^" in the status line of the current window.
call s:h("StatusLineTerm", { "fg": s:white, "bg": s:cursor_grey }) " status line of current :terminal window
call s:h("StatusLineTermNC", { "fg": s:comment_grey }) " status line of non-current :terminal window
call s:h("TabLine", { "fg": s:comment_grey }) " tab pages line, not active tab page label
call s:h("TabLineFill", {}) " tab pages line, where there are no labels
call s:h("TabLineSel", { "fg": s:white }) " tab pages line, active tab page label
call s:h("Terminal", { "fg": s:white, "bg": s:black }) " terminal window (see terminal-size-color)
call s:h("Title", { "fg": s:green }) " titles for output from ":set all", ":autocmd" etc.
call s:h("Visual", { "fg": s:visual_black, "bg": s:visual_grey }) " Visual mode selection
call s:h("VisualNOS", { "bg": s:visual_grey }) " Visual mode selection when vim is "Not Owning the Selection". Only X11 Gui's gui-x11 and xterm-clipboard supports this.
call s:h("WarningMsg", { "fg": s:yellow }) " warning messages
call s:h("WildMenu", { "fg": s:black, "bg": s:blue }) " current match in 'wildmenu' completion
" }}}
" Termdebug highlighting for Vim 8.1+ {{{
" See `:h hl-debugPC` and `:h hl-debugBreakpoint`.
call s:h("debugPC", { "bg": s:special_grey }) " the current position
call s:h("debugBreakpoint", { "fg": s:black, "bg": s:red }) " a breakpoint
" }}}
" Language-Specific Highlighting {{{
" CSS
call s:h("cssAttrComma", { "fg": s:purple })
call s:h("cssAttributeSelector", { "fg": s:green })
call s:h("cssBraces", { "fg": s:white })
call s:h("cssClassName", { "fg": s:dark_yellow })
call s:h("cssClassNameDot", { "fg": s:dark_yellow })
call s:h("cssDefinition", { "fg": s:purple })
call s:h("cssFontAttr", { "fg": s:dark_yellow })
call s:h("cssFontDescriptor", { "fg": s:purple })
call s:h("cssFunctionName", { "fg": s:blue })
call s:h("cssIdentifier", { "fg": s:blue })
call s:h("cssImportant", { "fg": s:purple })
call s:h("cssInclude", { "fg": s:white })
call s:h("cssIncludeKeyword", { "fg": s:purple })
call s:h("cssMediaType", { "fg": s:dark_yellow })
call s:h("cssProp", { "fg": s:white })
call s:h("cssPseudoClassId", { "fg": s:dark_yellow })
call s:h("cssSelectorOp", { "fg": s:purple })
call s:h("cssSelectorOp2", { "fg": s:purple })
call s:h("cssTagName", { "fg": s:red })
" Fish Shell
call s:h("fishKeyword", { "fg": s:purple })
call s:h("fishConditional", { "fg": s:purple })
" Go
call s:h("goDeclaration", { "fg": s:purple })
call s:h("goBuiltins", { "fg": s:cyan })
call s:h("goFunctionCall", { "fg": s:blue })
call s:h("goVarDefs", { "fg": s:red })
call s:h("goVarAssign", { "fg": s:red })
call s:h("goVar", { "fg": s:purple })
call s:h("goConst", { "fg": s:purple })
call s:h("goType", { "fg": s:yellow })
call s:h("goTypeName", { "fg": s:yellow })
call s:h("goDeclType", { "fg": s:cyan })
call s:h("goTypeDecl", { "fg": s:purple })
" HTML (keep consistent with Markdown, below)
call s:h("htmlArg", { "fg": s:dark_yellow })
call s:h("htmlBold", { "fg": s:dark_yellow, "gui": "bold", "cterm": "bold" })
call s:h("htmlEndTag", { "fg": s:white })
call s:h("htmlH1", { "fg": s:red })
call s:h("htmlH2", { "fg": s:red })
call s:h("htmlH3", { "fg": s:red })
call s:h("htmlH4", { "fg": s:red })
call s:h("htmlH5", { "fg": s:red })
call s:h("htmlH6", { "fg": s:red })
call s:h("htmlItalic", { "fg": s:purple, "gui": "italic", "cterm": "italic" })
call s:h("htmlLink", { "fg": s:cyan, "gui": "underline", "cterm": "underline" })
call s:h("htmlSpecialChar", { "fg": s:dark_yellow })
call s:h("htmlSpecialTagName", { "fg": s:red })
call s:h("htmlTag", { "fg": s:white })
call s:h("htmlTagN", { "fg": s:red })
call s:h("htmlTagName", { "fg": s:red })
call s:h("htmlTitle", { "fg": s:white })
" JavaScript
call s:h("javaScriptBraces", { "fg": s:white })
call s:h("javaScriptFunction", { "fg": s:purple })
call s:h("javaScriptIdentifier", { "fg": s:purple })
call s:h("javaScriptNull", { "fg": s:dark_yellow })
call s:h("javaScriptNumber", { "fg": s:dark_yellow })
call s:h("javaScriptRequire", { "fg": s:cyan })
call s:h("javaScriptReserved", { "fg": s:purple })
" https://github.com/pangloss/vim-javascript
call s:h("jsArrowFunction", { "fg": s:purple })
call s:h("jsClassKeyword", { "fg": s:purple })
call s:h("jsClassMethodType", { "fg": s:purple })
call s:h("jsDocParam", { "fg": s:blue })
call s:h("jsDocTags", { "fg": s:purple })
call s:h("jsExport", { "fg": s:purple })
call s:h("jsExportDefault", { "fg": s:purple })
call s:h("jsExtendsKeyword", { "fg": s:purple })
call s:h("jsFrom", { "fg": s:purple })
call s:h("jsFuncCall", { "fg": s:blue })
call s:h("jsFunction", { "fg": s:purple })
call s:h("jsGenerator", { "fg": s:yellow })
call s:h("jsGlobalObjects", { "fg": s:yellow })
call s:h("jsImport", { "fg": s:purple })
call s:h("jsModuleAs", { "fg": s:purple })
call s:h("jsModuleWords", { "fg": s:purple })
call s:h("jsModules", { "fg": s:purple })
call s:h("jsNull", { "fg": s:dark_yellow })
call s:h("jsOperator", { "fg": s:purple })
call s:h("jsStorageClass", { "fg": s:purple })
call s:h("jsSuper", { "fg": s:red })
call s:h("jsTemplateBraces", { "fg": s:dark_red })
call s:h("jsTemplateVar", { "fg": s:green })
call s:h("jsThis", { "fg": s:red })
call s:h("jsUndefined", { "fg": s:dark_yellow })
" https://github.com/othree/yajs.vim
call s:h("javascriptArrowFunc", { "fg": s:purple })
call s:h("javascriptClassExtends", { "fg": s:purple })
call s:h("javascriptClassKeyword", { "fg": s:purple })
call s:h("javascriptDocNotation", { "fg": s:purple })
call s:h("javascriptDocParamName", { "fg": s:blue })
call s:h("javascriptDocTags", { "fg": s:purple })
call s:h("javascriptEndColons", { "fg": s:white })
call s:h("javascriptExport", { "fg": s:purple })
call s:h("javascriptFuncArg", { "fg": s:white })
call s:h("javascriptFuncKeyword", { "fg": s:purple })
call s:h("javascriptIdentifier", { "fg": s:red })
call s:h("javascriptImport", { "fg": s:purple })
call s:h("javascriptMethodName", { "fg": s:white })
call s:h("javascriptObjectLabel", { "fg": s:white })
call s:h("javascriptOpSymbol", { "fg": s:cyan })
call s:h("javascriptOpSymbols", { "fg": s:cyan })
call s:h("javascriptPropertyName", { "fg": s:green })
call s:h("javascriptTemplateSB", { "fg": s:dark_red })
call s:h("javascriptVariable", { "fg": s:purple })
" JSON
call s:h("jsonCommentError", { "fg": s:white })
call s:h("jsonKeyword", { "fg": s:red })
call s:h("jsonBoolean", { "fg": s:dark_yellow })
call s:h("jsonNumber", { "fg": s:dark_yellow })
call s:h("jsonQuote", { "fg": s:white })
call s:h("jsonMissingCommaError", { "fg": s:red, "gui": "reverse" })
call s:h("jsonNoQuotesError", { "fg": s:red, "gui": "reverse" })
call s:h("jsonNumError", { "fg": s:red, "gui": "reverse" })
call s:h("jsonString", { "fg": s:green })
call s:h("jsonStringSQError", { "fg": s:red, "gui": "reverse" })
call s:h("jsonSemicolonError", { "fg": s:red, "gui": "reverse" })
" LESS
call s:h("lessVariable", { "fg": s:purple })
call s:h("lessAmpersandChar", { "fg": s:white })
call s:h("lessClass", { "fg": s:dark_yellow })
" Markdown (keep consistent with HTML, above)
call s:h("markdownBlockquote", { "fg": s:comment_grey })
call s:h("markdownBold", { "fg": s:dark_yellow, "gui": "bold", "cterm": "bold" })
call s:h("markdownCode", { "fg": s:green })
call s:h("markdownCodeBlock", { "fg": s:green })
call s:h("markdownCodeDelimiter", { "fg": s:green })
call s:h("markdownH1", { "fg": s:red })
call s:h("markdownH2", { "fg": s:red })
call s:h("markdownH3", { "fg": s:red })
call s:h("markdownH4", { "fg": s:red })
call s:h("markdownH5", { "fg": s:red })
call s:h("markdownH6", { "fg": s:red })
call s:h("markdownHeadingDelimiter", { "fg": s:red })
call s:h("markdownHeadingRule", { "fg": s:comment_grey })
call s:h("markdownId", { "fg": s:purple })
call s:h("markdownIdDeclaration", { "fg": s:blue })
call s:h("markdownIdDelimiter", { "fg": s:purple })
call s:h("markdownItalic", { "fg": s:purple, "gui": "italic", "cterm": "italic" })
call s:h("markdownLinkDelimiter", { "fg": s:purple })
call s:h("markdownLinkText", { "fg": s:blue })
call s:h("markdownListMarker", { "fg": s:red })
call s:h("markdownOrderedListMarker", { "fg": s:red })
call s:h("markdownRule", { "fg": s:comment_grey })
call s:h("markdownUrl", { "fg": s:cyan, "gui": "underline", "cterm": "underline" })
" Perl
call s:h("perlFiledescRead", { "fg": s:green })
call s:h("perlFunction", { "fg": s:purple })
call s:h("perlMatchStartEnd",{ "fg": s:blue })
call s:h("perlMethod", { "fg": s:purple })
call s:h("perlPOD", { "fg": s:comment_grey })
call s:h("perlSharpBang", { "fg": s:comment_grey })
call s:h("perlSpecialString",{ "fg": s:cyan })
call s:h("perlStatementFiledesc", { "fg": s:red })
call s:h("perlStatementFlow",{ "fg": s:red })
call s:h("perlStatementInclude", { "fg": s:purple })
call s:h("perlStatementScalar",{ "fg": s:purple })
call s:h("perlStatementStorage", { "fg": s:purple })
call s:h("perlSubName",{ "fg": s:yellow })
call s:h("perlVarPlain",{ "fg": s:blue })
" PHP
call s:h("phpVarSelector", { "fg": s:red })
call s:h("phpOperator", { "fg": s:white })
call s:h("phpParent", { "fg": s:white })
call s:h("phpMemberSelector", { "fg": s:white })
call s:h("phpType", { "fg": s:purple })
call s:h("phpKeyword", { "fg": s:purple })
call s:h("phpClass", { "fg": s:yellow })
call s:h("phpUseClass", { "fg": s:white })
call s:h("phpUseAlias", { "fg": s:white })
call s:h("phpInclude", { "fg": s:purple })
call s:h("phpClassExtends", { "fg": s:green })
call s:h("phpDocTags", { "fg": s:white })
call s:h("phpFunction", { "fg": s:blue })
call s:h("phpFunctions", { "fg": s:cyan })
call s:h("phpMethodsVar", { "fg": s:dark_yellow })
call s:h("phpMagicConstants", { "fg": s:dark_yellow })
call s:h("phpSuperglobals", { "fg": s:red })
call s:h("phpConstants", { "fg": s:dark_yellow })
" Ruby
call s:h("rubyBlockParameter", { "fg": s:red})
call s:h("rubyBlockParameterList", { "fg": s:red })
call s:h("rubyClass", { "fg": s:purple})
call s:h("rubyConstant", { "fg": s:yellow})
call s:h("rubyControl", { "fg": s:purple })
call s:h("rubyEscape", { "fg": s:red})
call s:h("rubyFunction", { "fg": s:blue})
call s:h("rubyGlobalVariable", { "fg": s:red})
call s:h("rubyInclude", { "fg": s:blue})
call s:h("rubyIncluderubyGlobalVariable", { "fg": s:red})
call s:h("rubyInstanceVariable", { "fg": s:red})
call s:h("rubyInterpolation", { "fg": s:cyan })
call s:h("rubyInterpolationDelimiter", { "fg": s:red })
call s:h("rubyInterpolationDelimiter", { "fg": s:red})
call s:h("rubyRegexp", { "fg": s:cyan})
call s:h("rubyRegexpDelimiter", { "fg": s:cyan})
call s:h("rubyStringDelimiter", { "fg": s:green})
call s:h("rubySymbol", { "fg": s:cyan})
" Sass
" https://github.com/tpope/vim-haml
call s:h("sassAmpersand", { "fg": s:red })
call s:h("sassClass", { "fg": s:dark_yellow })
call s:h("sassControl", { "fg": s:purple })
call s:h("sassExtend", { "fg": s:purple })
call s:h("sassFor", { "fg": s:white })
call s:h("sassFunction", { "fg": s:cyan })
call s:h("sassId", { "fg": s:blue })
call s:h("sassInclude", { "fg": s:purple })
call s:h("sassMedia", { "fg": s:purple })
call s:h("sassMediaOperators", { "fg": s:white })
call s:h("sassMixin", { "fg": s:purple })
call s:h("sassMixinName", { "fg": s:blue })
call s:h("sassMixing", { "fg": s:purple })
call s:h("sassVariable", { "fg": s:purple })
" https://github.com/cakebaker/scss-syntax.vim
call s:h("scssExtend", { "fg": s:purple })
call s:h("scssImport", { "fg": s:purple })
call s:h("scssInclude", { "fg": s:purple })
call s:h("scssMixin", { "fg": s:purple })
call s:h("scssSelectorName", { "fg": s:dark_yellow })
call s:h("scssVariable", { "fg": s:purple })
" TeX
call s:h("texStatement", { "fg": s:purple })
call s:h("texSubscripts", { "fg": s:dark_yellow })
call s:h("texSuperscripts", { "fg": s:dark_yellow })
call s:h("texTodo", { "fg": s:dark_red })
call s:h("texBeginEnd", { "fg": s:purple })
call s:h("texBeginEndName", { "fg": s:blue })
call s:h("texMathMatcher", { "fg": s:blue })
call s:h("texMathDelim", { "fg": s:blue })
call s:h("texDelimiter", { "fg": s:dark_yellow })
call s:h("texSpecialChar", { "fg": s:dark_yellow })
call s:h("texCite", { "fg": s:blue })
call s:h("texRefZone", { "fg": s:blue })
" TypeScript
call s:h("typescriptReserved", { "fg": s:purple })
call s:h("typescriptEndColons", { "fg": s:white })
call s:h("typescriptBraces", { "fg": s:white })
" XML
call s:h("xmlAttrib", { "fg": s:dark_yellow })
call s:h("xmlEndTag", { "fg": s:red })
call s:h("xmlTag", { "fg": s:red })
call s:h("xmlTagName", { "fg": s:red })
" }}}
" Plugin Highlighting {{{
" airblade/vim-gitgutter
hi link GitGutterAdd SignifySignAdd
hi link GitGutterChange SignifySignChange
hi link GitGutterDelete SignifySignDelete
" easymotion/vim-easymotion
call s:h("EasyMotionTarget", { "fg": s:red, "gui": "bold", "cterm": "bold" })
call s:h("EasyMotionTarget2First", { "fg": s:yellow, "gui": "bold", "cterm": "bold" })
call s:h("EasyMotionTarget2Second", { "fg": s:dark_yellow, "gui": "bold", "cterm": "bold" })
call s:h("EasyMotionShade", { "fg": s:comment_grey })
" mhinz/vim-signify
call s:h("SignifySignAdd", { "fg": s:green })
call s:h("SignifySignChange", { "fg": s:yellow })
call s:h("SignifySignDelete", { "fg": s:red })
" neomake/neomake
call s:h("NeomakeWarningSign", { "fg": s:yellow })
call s:h("NeomakeErrorSign", { "fg": s:red })
call s:h("NeomakeInfoSign", { "fg": s:blue })
" plasticboy/vim-markdown (keep consistent with Markdown, above)
call s:h("mkdDelimiter", { "fg": s:purple })
call s:h("mkdHeading", { "fg": s:red })
call s:h("mkdLink", { "fg": s:blue })
call s:h("mkdUrl", { "fg": s:cyan, "gui": "underline", "cterm": "underline" })
" tpope/vim-fugitive
call s:h("diffAdded", { "fg": s:green })
call s:h("diffRemoved", { "fg": s:red })
" }}}
" Git Highlighting {{{
call s:h("gitcommitComment", { "fg": s:comment_grey })
call s:h("gitcommitUnmerged", { "fg": s:green })
call s:h("gitcommitOnBranch", {})
call s:h("gitcommitBranch", { "fg": s:purple })
call s:h("gitcommitDiscardedType", { "fg": s:red })
call s:h("gitcommitSelectedType", { "fg": s:green })
call s:h("gitcommitHeader", {})
call s:h("gitcommitUntrackedFile", { "fg": s:cyan })
call s:h("gitcommitDiscardedFile", { "fg": s:red })
call s:h("gitcommitSelectedFile", { "fg": s:green })
call s:h("gitcommitUnmergedFile", { "fg": s:yellow })
call s:h("gitcommitFile", {})
call s:h("gitcommitSummary", { "fg": s:white })
call s:h("gitcommitOverflow", { "fg": s:red })
hi link gitcommitNoBranch gitcommitBranch
hi link gitcommitUntracked gitcommitComment
hi link gitcommitDiscarded gitcommitComment
hi link gitcommitSelected gitcommitComment
hi link gitcommitDiscardedArrow gitcommitDiscardedFile
hi link gitcommitSelectedArrow gitcommitSelectedFile
hi link gitcommitUnmergedArrow gitcommitUnmergedFile
" }}}
" Neovim terminal colors {{{
if has("nvim")
let g:terminal_color_0 = s:black.gui
let g:terminal_color_1 = s:red.gui
let g:terminal_color_2 = s:green.gui
let g:terminal_color_3 = s:yellow.gui
let g:terminal_color_4 = s:blue.gui
let g:terminal_color_5 = s:purple.gui
let g:terminal_color_6 = s:cyan.gui
let g:terminal_color_7 = s:white.gui
let g:terminal_color_8 = s:visual_grey.gui
let g:terminal_color_9 = s:dark_red.gui
let g:terminal_color_10 = s:green.gui " No dark version
let g:terminal_color_11 = s:dark_yellow.gui
let g:terminal_color_12 = s:blue.gui " No dark version
let g:terminal_color_13 = s:purple.gui " No dark version
let g:terminal_color_14 = s:cyan.gui " No dark version
let g:terminal_color_15 = s:comment_grey.gui
let g:terminal_color_background = g:terminal_color_0
let g:terminal_color_foreground = g:terminal_color_7
endif
" }}}
" Must appear at the end of the file to work around this oddity:
" https://groups.google.com/forum/#!msg/vim_dev/afPqwAFNdrU/nqh6tOM87QUJ
set background=dark

71
.config/vim/vimrc Normal file
View File

@@ -0,0 +1,71 @@
" Keybinds ##########################################################################
" Disable arrow keys
noremap <Up> ""
noremap! <Up> <Esc>
noremap <Down> ""
noremap! <Down> <Esc>
noremap <Left> ""
noremap! <Left> <Esc>
noremap <Right> ""
noremap! <Right> <Esc>
" Stop highlighting search result when pressing Return
nnoremap <silent> <CR> :nohlsearch<CR><CR>
" Settings ##########################################################################
" hybrid linenumbers
set number relativenumber
" no timeout when exiting insert-mode (see https://www.johnhawthorn.com/2012/09/vi-escape-delays/)
set timeoutlen=1000 ttimeoutlen=0
" smart case insensitive search (insens: /copy /Copy\c; sens: /Copy /copy\C)
set ignorecase smartcase
" Tab size
set tabstop=4
" Shift the same amount as tabstop
set shiftwidth=0
" Highlight current line
set cursorline
" Automatically add leading comment (when pressing o/O or enter in Insert)
set formatoptions+=cro
" see :help persistent-undo
set undofile
" Aesthetics #######################################################################
" use onedark as theme for syntax highlighting
syntax on
colorscheme onedark
" Use 24-bit (true-color) mode
if (has("termguicolors"))
set termguicolors
endif
" get transparent background of the terminal back
" (at least in nvim, i can't get it to work in vanilla)
if (has('nvim'))
highlight Normal guibg=NONE
highlight NonText guibg=NONE
endif
" zshOption is a huge regex that leads to massive lags when scrolling
" Be sure to disable it after activating syntax highlighting
autocmd filetype zsh syntax clear zshOption
" change cursor shape depending on mode
if (has('nvim'))
" reset when exiting
autocmd VimLeave * set guicursor=a:ver25
else
" https://vim.fandom.com/wiki/Change_cursor_shape_in_different_modes
" start insert mode - vertical bar
let &t_SI = "\<Esc>[5 q"
" start replace mode - horizontal/underline bar
let &t_SR = "\<Esc>[3 q"
" end insert or replace mode - block cursor
let &t_EI = "\<Esc>[1 q"
" Set when entering
autocmd VimEnter * silent !echo -ne "\e[2 q"
" Reset when exiting
" Finally found out how to do that by looking at:
" https://github.com/jszakmeister/vim-togglecursor/blob/master/plugin/togglecursor.vim
autocmd VimLeave * let &t_te = "\<Esc>[5 q" . &t_te
endif

45
.config/vim/xdg.vim Normal file
View File

@@ -0,0 +1,45 @@
" XDG Environment For VIM
" =======================
"
" References
" ----------
"
" - http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html#variables
" - http://tlvince.com/vim-respect-xdg
" - https://wiki.archlinux.org/index.php/XDG_Base_Directory
" - https://raw.githubusercontent.com/kaleb/vim-files/master/xdg.vim
if empty($XDG_CACHE_HOME)
let $XDG_CACHE_HOME = '~/.cache'
endif
if empty($XDG_CONFIG_HOME)
let $XDG_CONFIG_HOME = '~/.config'
endif
if empty($XDG_DATA_HOME)
let $XDG_DATA_HOME = '~/.local/share'
endif
if !isdirectory($XDG_CACHE_HOME . "/vim/swap")
call mkdir($XDG_CACHE_HOME . "/vim/swap", "p")
endif
set directory=$XDG_CACHE_HOME/vim/swap/
if !isdirectory($XDG_DATA_HOME . "/vim/backup")
call mkdir($XDG_DATA_HOME . "/vim/backup", "p")
endif
set backupdir=$XDG_DATA_HOME/vim/backup/
if !isdirectory($XDG_DATA_HOME . "/vim/undo")
call mkdir($XDG_DATA_HOME . "/vim/undo", "p")
endif
set undodir=$XDG_DATA_HOME/vim/undo/
if (!has('nvim'))
set viminfo+=n$XDG_DATA_HOME/vim/viminfo
endif
set runtimepath-=~/.vim
set runtimepath^=$XDG_CONFIG_HOME/vim
set runtimepath-=~/.vim/after
set runtimepath+=$XDG_CONFIG_HOME/vim/after
source $XDG_CONFIG_HOME/vim/vimrc

View File

@@ -0,0 +1,36 @@
# specifies the time (in seconds) to wait for response to a prompt by auth_x11 before giving up and
# reverting to the screen saver.
XSECURELOCK_AUTH_TIMEOUT=10
# specifies the time (in seconds) before telling X11 to fully blank the screen; a negative value
# disables X11 blanking. The time is measured since the closing of the auth window or xsecurelock
# startup. Setting this to 0 is rather nonsensical, as key-release events (e.g. from the keystroke
# to launch xsecurelock or from pressing escape to close the auth dialog) always wake up the screen.
XSECURELOCK_BLANK_TIMEOUT=10
# create a second full-screen window to obscure window content in case a running compositor unmaps
# its own window. Helps with some instances of bad compositor behavior (such as compositor crashes/
# restarts, but also compton has been caught at drawing notification icons above the screen locker
# when not using the GLX backend), should prevent compositors from unredirecting as it's 1 pixel
# smaller than the screen from every side, and should otherwise be harmless, so it's enabled by
# default.
XSECURELOCK_COMPOSITE_OBSCURER=1
# the date format to show. Defaults to the locale settings.
XSECURELOCK_DATETIME_FORMAT=%F %T
# time_ shows the current time since the epoch on each keystroke. This may be the most secure mode,
# as it gives feedback to keystroke based exclusively on public information, and does not carry
# over any state between keystrokes whatsoever - not even some form of randomness.
# time_hex: same as time, but in microseconds and hexadecimal. "Because we can".
XSECURELOCK_PASSWORD_PROMPT=time_hex
# whether to show local date and time on the login. Disabled by default.
XSECURELOCK_SHOW_DATETIME=1
# whether to show the hostname on the login screen of auth_x11. Possible values are 0 for not
# showing the hostname, 1 for showing the short form, and 2 for showing the long form.
XSECURELOCK_SHOW_HOSTNAME=0
# whether to show the username on the login screen of auth_x11.
XSECURELOCK_SHOW_USERNAME=0

View File

@@ -0,0 +1,57 @@
#!/bin/bash
# !Modified! /usr/share/doc/xss-lock/transfer-sleep-lock-generic-delay.sh
# Example locker script -- demonstrates how to use the --transfer-sleep-lock
# option with a fixed delay to give simple lockers a little bit of time to lock
# the screen before the system goes the sleep.
## CONFIGURATION ##############################################################
# hack: remove space from IFS so that the config can have spaces in the keys
# TODO: find a better way to do this (I'm desperate)
IFS=$'\n\t'
# Command to start the locker (should not fork)
# Beware the tabs instead of spaces!
locker="env $(grep -v '^#\|^$' ~/.config/xsecurelock/config) xsecurelock"
# Delay in seconds. Note that by default systemd-logind allows a maximum sleep
# delay of 5 seconds.
sleep_delay=1
# Run before starting the locker
pre_lock() {
# mpc pause
killall -q compton
amixer -q -D pulse sset Master mute
return
}
# Run after the locker exits
post_lock() {
compton -b
return
}
###############################################################################
pre_lock
# kill locker if we get killed
trap 'kill %%' TERM INT
if [[ -e /dev/fd/${XSS_SLEEP_LOCK_FD:--1} ]]; then
# lock fd is open, make sure the locker does not inherit a copy
$locker {XSS_SLEEP_LOCK_FD}<&- &
sleep $sleep_delay
# now close our fd (only remaining copy) to indicate we're ready to sleep
exec {XSS_SLEEP_LOCK_FD}<&-
else
$locker &
fi
wait # for locker to exit
post_lock

View File

@@ -0,0 +1,4 @@
set recolor true
set recolor-lightcolor "#333333"
set recolor-darkcolor "#FFFFFF"
set default-bg "#252525"

157
.config/zsh/.zshrc Normal file
View File

@@ -0,0 +1,157 @@
## Author: druckdev
## Created 2018-11-23
# echo ${(pl.$LINES..\n.)}
# Enable Powerlevel10k instant prompt. Should stay at the top of ~/.config/zsh/.zshrc.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
export ZSH_CONF="$ZDOTDIR/plugins"
## set zshoptions
# setopt AUTO_CD # cd is not necessary
setopt AUTO_CONTINUE # Stopped jobs with 'disown' are automatically sent a CONT signal to make them running.
setopt AUTO_PARAM_SLASH # Add a trailing slash when completing directories
setopt AUTO_PUSHD # Make cd push the old directory onto the directory stack.
setopt NO_AUTO_REMOVE_SLASH # Keeps trailing slash for directories when auto completing.
# (Beware: commands will act on the target directory not the symlink with the slash)
setopt NO_BEEP # Do not beep on error in ZLE.
setopt C_BASES # Output hexadecimal numbers in the standard C format ('16#FF' -> '0xFF').
setopt CDABLE_VARS # Enables changing into hashes without the '~'-prefix
setopt CHASE_LINKS # Resolve symbolic links to their true values when changing directory.
setopt NO_CLOBBER # '>!' or '>|' must be used to truncate a file, and '>>!' or '>>|' to create a file.
setopt COMPLETE_IN_WORD # Complete from the cursor rather than from the end of the word
setopt CORRECT # Try to correct the spelling of a command
setopt CORRECT_ALL # Try to correct the spelling of all arguments
export CORRECT_IGNORE_FILE=".*" # Do not offer hidden files as correction
setopt EXTENDED_HISTORY # Saves timedata into the history (:<beginning time>:<elapsed seconds>:<command>).
setopt EXTENDED_GLOB # Treat the `#', `~' and `^' characters as part of patterns for filename generation, etc.
setopt NO_FLOW_CONTROL # Disables output flow control in the shell's editor via start/stop characters (usually ^S/^Q).
setopt GLOB_DOTS # Do not require a leading `.' in a filename to be matched explicitly.
setopt HIST_IGNORE_DUPS
setopt HIST_IGNORE_SPACE # History should ignore commands beginning with a space
setopt HIST_VERIFY # perform history expansion and reload line in editing buffer instead of executing it directly
setopt INC_APPEND_HISTORY_TIME # enter lines as soon as there ary entered (_time is necessary for <elapsed seconds> of ext_hist)
setopt INTERACTIVE_COMMENTS # Allow comments even in interactive shells.
setopt NO_MENU_COMPLETE # Do not autoselect the first entry when completing
# setopt SHARE_HISTORY # write + read history after every command
autoload -U select-word-style && select-word-style bash
## Setup the prompt
# use bright version of colors when printing bold
if [ -r "${XDG_CONFIG_HOME:-$HOME/.config}/dircolors/dircolors" ]; then
eval "$(dircolors -b "${XDG_CONFIG_HOME:-$HOME/.config}/dircolors/dircolors")"
else
eval "$(dircolors -b)"
fi
if [ -r "$ZSH_CONF/powerlevel10k/powerlevel10k.zsh-theme" ]; then
source "$ZSH_CONF/powerlevel10k/powerlevel10k.zsh-theme"
# run `p10k configure` or edit $ZSH_CONF/p10k.zsh-theme to customize
[ ! -r "$ZSH_CONF/p10k.zsh-theme" ] || source "$ZSH_CONF/p10k.zsh-theme"
fi
## Setup zsh completion system
[ ! -d "$ZSH_CONF/completion" ] || fpath=("$ZSH_CONF/completion" $fpath)
autoload -Uz compinit
compinit -d "${XDG_CACHE_HOME:-$HOME/.cache}/zsh/zcompdump-$ZSH_VERSION"
zstyle ':completion:*' auto-description 'specify: %d'
zstyle ':completion:*' completer _expand _complete _correct _approximate
zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*' group-name ''
zstyle ':completion:*' menu select=2
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*'
zstyle ':completion:*' menu select=long
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle ':completion:*' use-compctl false
zstyle ':completion:*' verbose true
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
zstyle ':completion:*' menu select
zstyle -e ':completion:*:users' users 'local user; getent passwd | while IFS=: read -rA user; do (( user[3] >= 1000 || user[3] == 0 )) && reply+=($user[1]); done'
_comp_options+=(globdots) # Include hidden files
## Load external config files and modules
autoload edit-command-line; zle -N edit-command-line
autoload zmv
# stderred
if [ -r "$ZSH_CONF/stderred/build/libstderred.so" ]; then
export LD_PRELOAD="$ZSH_CONF/stderred/build/libstderred.so${LD_PRELOAD:+:$LD_PRELOAD}"
export STDERRED_ESC_CODE="$(tput bold && tput setaf 1)"
export STDERRED_BLACKLIST="^(git|curl|wget|swipl)$"
fi
[ ! -r "$ZSH_CONF/functionsPre.zsh" ] || source "$ZSH_CONF/functionsPre.zsh"
[ ! -r "$ZSH_CONF/alias.zsh" ] || source "$ZSH_CONF/alias.zsh"
[ ! -r "$ZSH_CONF/functionsPost.zsh" ] || source "$ZSH_CONF/functionsPost.zsh"
[ ! -r "$ZSH_CONF/transfer.zsh" ] || source "$ZSH_CONF/transfer.zsh"
[ ! -r "$ZSH_CONF/zsh-autosuggestions/zsh-autosuggestions.zsh" ] || source "$ZSH_CONF/zsh-autosuggestions/zsh-autosuggestions.zsh"
[ ! -r "$ZSH_CONF/completion.zsh" ] || source "$ZSH_CONF/completion.zsh"
# [ ! -r "$ZSH_CONF/zsh-async/async.zsh" ] || source "$ZSH_CONF/zsh-async/async.zsh"
# async_init
### syntax-highlight > history-substring > keys
# syntax highlighting
if [ -r "$ZSH_CONF/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" ]; then
source $ZSH_CONF/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source $ZSH_CONF/zsh-syntax-highlighting.zsh-theme
fi
# history substr search
if [ -r "$ZSH_CONF/zsh-history-substring-search/zsh-history-substring-search.zsh" ]; then
source $ZSH_CONF/zsh-history-substring-search/zsh-history-substring-search.zsh
HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE=true
HISTORY_SUBSTRING_SEARCH_FUZZY=true
fi
[ ! -r "$ZSH_CONF/keys.zsh" ] || source "$ZSH_CONF/keys.zsh"
## Env variables that have nothing to do with zsh
export EDITOR=nvim
# `sudo nano` won't work without this (?)
if [ "$TERM" = "xterm-kitty" ]; then
export TERM=xterm-256color
fi
## https://www.tecmint.com/view-colored-man-pages-in-linux/
## First seen in Fox Kiesters dotfiles
export LESS_TERMCAP_mb=$'\e[1;32m'
export LESS_TERMCAP_md=$'\e[1;32m'
export LESS_TERMCAP_me=$'\e[0m'
export LESS_TERMCAP_se=$'\e[0m'
export LESS_TERMCAP_so=$'\E[01;44;33m'
export LESS_TERMCAP_ue=$'\e[0m'
export LESS_TERMCAP_us=$'\e[1;4;31m'
## Less clutter in $HOME by enforcing the XDG base directory standard
export ATOM_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/atom"
export GOPATH="${XDG_DATA_HOME:-$HOME/.local/share}/go"
export LESSHISTFILE=-
export SQLITE_HISTORY="${XDG_DATA_HOME:-$HOME/.local/share}/sqlite3/sqlite_history"
export ANDROID_SDK_HOME="${XDG_CONFIG_HOME:-$HOME/.config}/android"
export VIMINIT='let $MYVIMRC="/home/user/.config/vim/xdg.vim" | source $MYVIMRC'
## Setup asynchronous jobs
# async_start_worker msg_completion
# async_job msg_completion tg-completion
## Setup zle
zle_highlight=('paste:none')
## History
HISTSIZE=1000000
SAVEHIST=1000000
HISTFILE="${XDG_DATA_HOME:-$HOME/.local/share}/zsh/.zsh_history"
# Finalize Powerlevel10k instant prompt. Should stay at the bottom of ~/.config/zsh/.zshrc.
(( ! ${+functions[p10k-instant-prompt-finalize]} )) || p10k-instant-prompt-finalize

View File

@@ -0,0 +1,103 @@
## Author: druckdev
## Created: 2019-01-16
## Add fslint-directory to PATH
PATH=$PATH:/usr/share/fslint/fslint
## Add flags or shorten commands that I cannot remember
alias getclip="xclip -selection c -o"
alias setclip="perl -pe 'chomp if eof' | xclip -selection c"
alias pdfviewer='evince'
alias pdf='launch evince'
alias darkpdf='launch zathura'
alias geeqie='launch qeeqie'
alias grep='grep --color'
alias igrep='grep -i'
alias emacs-game='emacs -batch -l dunnet'
alias trash-restore='restore-trash'
alias cp='cp -i'
alias mv='mv -i' # --backup=t ??
alias rm='rm -I'
alias less='less -N'
alias lsblk='lsblk -f'
alias rd='rmdir'
alias md='mkdir -p'
alias o='xdg-open'
alias p='pwd'
alias :q='exit'
alias :Q=:q
alias update='sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y'
alias pdf2text='pdftotext'
alias pdf2txt='pdftotext'
alias rm='printf "\033[1;031mUse trash!\n\033[0m"; false'
alias bat='upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -E "to full|percentage" | tr -d " " | sed "s/:/: /"'
alias battery='bat'
alias qrdecode='zbarimg'
alias pdfmerge='pdfunite'
alias loadhist='fc -RI'
alias wget='wget --config=${XDG_CONFIG_HOME:-$HOME/.config}/wget/wgetrc --hsts-file="${XDG_DATA_HOME:-$HOME/.local/share}/wget/wget-hsts"'
alias -g G='| grep '
alias -g no2='2>/dev/null'
alias hex=xxd
alias bin='xxd -b -c4 | cut -d" " -f2-5'
alias vim=nvim
alias vi=nvim
alias tmux='tmux -f "$HOME/.config/tmux/tmux.conf"'
alias resetCursor='echo -ne "\e[5 q"'
alias makeThisScratchpad='echo -ne "\033]0;scratchpad-terminal\007"'
alias tmsu='tmsu -D "${XDG_DATA_HOME:-$HOME/.local/share}/tmsu/db"'
## functions
alias trash=_trash_list_default
alias nemo=_nemo_wd_default
## git
alias gs='git status --short' # overrides ghostscript
alias gits='gs'
alias gstat='gs'
alias gitstat='gs'
alias ga='git add'
alias gaa='git add -A'
alias gc='git commit -m'
alias gpsh='git push'
alias gpush='git push'
alias gpll='git pull'
alias gpull='git pull'
alias gdiff='git diff'
alias gd='git diff'
## Navigation
alias ls='_ls_show_hidden --color=auto --group-directories-first -p -v'
alias sl='ls'
alias la='ls -A'
alias l='ls -lh --time-style=long-iso'
alias ll='l -A'
alias cd..='cd ..'
alias cd~='cd ~'
## Hashes for often visited folders
hash -d Desktop=$HOME/Desktop/
hash -d Documents=$HOME/Documents/
hash -d Pictures=$HOME/Pictures/
hash -d Downloads=$HOME/Downloads/
hash -d Projects=$HOME/Projects/
hash -d dot=~Projects/dotfiles/
hash -d dots=~dot
local UNI="$HOME/Documents/uni"
hash -d cheat=$HOME/Documents/Cheat\ Sheet/
hash -d uni=$UNI/
# hash for current/last wise
local YEAR=$(date +"%y")
if [ -d "$UNI/$YEAR-WiSe" ]; then
hash -d wise="$UNI/$YEAR-WiSe/"
elif [ -d "$UNI/$(($YEAR - 1))-WiSe" ]; then
hash -d wise="$UNI/$(($YEAR - 1))-WiSe/"
fi
# hash for current/last sose
if [ -d "$UNI/$YEAR-SoSe" ]; then
hash -d sose="$UNI/$YEAR-SoSe"/
elif [ -d "$UNI/$(($YEAR - 1))-SoSe" ]; then
hash -d sose="$UNI/$(($YEAR - 1))-SoSe/"
fi

View File

@@ -0,0 +1,10 @@
## Author: druckdev
## Created: 2019-08-18
## TelegramCLI msg completion
function tg-completion() {
contactList=( $(telegram-cli -W -C -e "contact_list" | tail -n +9 | head -n -2 | grep -vE "(>>>|<<<|»»»|«««)" | sed 's/ /_/g; s/.*\[K//; s/(/\\(/g; s/)/\\)/g; s/"/\\"/g') )
echo '#compdef msg' >! $ZSH_CONF/completion/_msg
echo >> $ZSH_CONF/completion/_msg
echo '_arguments "1:<Recipient>:('"$contactList[*]"')"' >> $ZSH_CONF/completion/_msg
}

View File

@@ -0,0 +1,43 @@
#compdef conf
## Author: druckdev
## Created: 2020-04-19
local _MAX_DEPTH=2
local w1="${words[$#words - 1]}"
local w2="${words[$#words - 2]}"
local w3="${words[$#words - 3]}"
if [ -z $w2 ]; then # first word to complete
# move into config directory
pushd -q "${XDG_CONFIG_HOME:-$HOME/.config}/"
# list all directories
local paths="$(find -L *(-/) -maxdepth $_MAX_DEPTH -type d 2>/dev/null | xargs)"
# TODO: find in $HOME
# move back
popd -q
# use list for completion
_multi_parts / '('"$paths"')'
elif [ -z $w3 ]; then # second word to complete
# move into chosen config directory
if [ -d "${XDG_CONFIG_HOME:-$HOME/.config}/$w1" ]; then
pushd -q "${XDG_CONFIG_HOME:-$HOME/.config}/$w1"
elif [ -d "$HOME/.$w1" ]; then
pushd -q "$HOME/.$w1"
fi
# check if there are any files here
# eval "local $(echo $functions[conf] | grep CONF_PATTERNS= | sed -E 's/\$(\{?)1(\}?)/\$\1w1\2/g; s/^[ \t]*//')"
local exist=( *(-.) ) 2>/dev/null
# complete (symlinks pointing to) files
[ -z "$exist" ] || _values "config:" *(-.)
# move back
popd -q
fi

View File

@@ -0,0 +1,320 @@
## Author: druckdev
## Created: 2019-10-27 (originally 2019-08-28 as functions.zsh)
## change into dir and print accordingly
function cl() {
cd "$@" && ls
}
## Copy file and append .bkp extension
function bkp() {
for file in "$@"; do
cp -i "$file" "$file.bkp"
done
}
## Launches program and detaches it from the shell
function launch() {
# eval "$@" ## does not work with special characters?
launch_command="$1"
shift
$launch_command "$@" &>/dev/null & disown
}
## Compares two pdfs based on the result of pdftotext
function pdfdiff() {
if [[ $# -eq 2 && -r "$1" && -r "$2" ]]; then
diff <(pdftotext "$1" -) <(pdftotext "$2" -)
else
echo "something went wrong" 2>&1
return 1
fi
}
## Gets Passwd from bitwarden and copies it into the clipboard
function bwpwd() {
if bw "get" "password" "$@" >/dev/null; then
bw "get" "password" "$@" | tr -d '\n' | setclip
else
bw "get" "password" "$@"
fi
}
## creates directory and changes into it
function mkcd () {
mkdir "$@" # create directory
while [ $# -gt 1 ]; do # shift arguments if mkdir options were used
shift
done
if [ -d "$1" ]; then
cd "$1"
pwd
fi
}
## Send a message over telegram by using the -e flag
function msg() {
if [ $# -ge 2 ]; then
telegram-cli -W -e "msg $*" | grep -E "${${*/ /.*}//_/ }"
# | grep -E "$(echo "$*" | sed 's/ /.*/; s/_/ /g')"
else
printf "\033[1;31mPlease specify a contact and a message.\n\033[0m" >&2
fi
}
## Execute tg -e command but cuts of the uninteresting parts
function tg() {
tg="telegram-cli"
if [ "$1" = "-e" ]; then
shift
$tg -N -W -e "$@" | tail -n +9 | head -n -2
else
$tg -N -W "$@"
fi
}
## Encode and decode qr-codes
function qr() {
if [[ $# -eq 1 && -r "$1" ]]; then
zbarimg "$1"
else
qrencode "$@"
fi
}
## Edit config file
function conf() {
# default to vim if no editor is set
local CONF_EDITOR=${EDITOR:-vim}
# parse otions
while getopts "e:" opt 2>/dev/null; do
case $opt in
e) CONF_EDITOR="$OPTARG";;
*) printf "\033[1;31mUsage: $0 [-e <editor>] <program>[/subdirs] [<config_file>]\n\033[0m" >&2
return 1 ;;
esac
done
shift $(($OPTIND - 1 ))
# CONF_EDITOR=( $(resolve -s $CONF_EDITOR) )
# conf needs an argument
if [ $# -eq 0 ]; then
printf "\033[1;31mPlease specify a config.\n\033[0m" >&2
return 1
fi
# search for program name in XDG_CONFIG_HOME and $HOME
local CONF_DIR="$(_get_config_dir "$1")"
if [ $? -ne 0 ]; then
printf "\033[1;31mFalling back to $HOME.\n\033[0m" >&2
CONF_DIR="$HOME"
fi
# open file with specified name if
if [ $# -gt 1 ]; then
if [ -r "$CONF_DIR/$2" ]; then
$CONF_EDITOR "$CONF_DIR/$2"
return 0
else
printf "\033[1;31mCould not find config file with that name.\n\033[0m" >&2
return 1
fi
fi
# possible config-file names + same in hidden
local -a CONF_PATTERNS
CONF_PATTERNS=(
"$1.conf"
"$1.config"
"${1}rc"
"config"
"conf"
"$1.yml"
"$1.yaml"
"$1"
)
# check if config file exists
for config in $CONF_PATTERNS; do
if [ -r "$CONF_DIR/$config" ]; then
$CONF_EDITOR "$CONF_DIR/$config"
return 0
elif [ -r "$CONF_DIR/.$config" ]; then
$CONF_EDITOR "$CONF_DIR/.$config"
return 0
fi
done
# if no config was found in a location other than HOME, look again in HOME.
# (For cases like default vim with ~/.vim/ and ~/.vimrc)
if [ "$CONF_DIR" != "$HOME" ];then
for config in $CONF_PATTERNS; do
# Only look for hidden files
if [ -r "$HOME/.$config" ]; then
$CONF_EDITOR "$HOME/.$config"
return 0
fi
done
fi
printf "\033[1;31mCould not find config file.\n\033[0m" >&2
return 1
}
## Change into config dir
function c() {
CONF_DIR="$(_get_config_dir $*)"
if [ $? -eq 0 ]; then
cd "$CONF_DIR"
else
printf "$CONF_DIR" >&2
return 1
fi
}
## Get config directory
function _get_config_dir() {
if [ $# -gt 1 ]; then
printf "\033[1;31mPlease specify one config.\n\033[0m" >&2
return 1
elif [ $# -eq 0 ]; then
echo "${XDG_CONFIG_HOME:-$HOME/.config}"
elif [ -d "${XDG_CONFIG_HOME:-$HOME/.config}/$1" ]; then
echo "${XDG_CONFIG_HOME:-$HOME/.config}/$1"
elif [ -d "$HOME/.$1" ]; then
echo "$HOME/.$1"
else
printf "\033[1;31mCould not find config home.\n\033[0m" >&2
return 1
fi
}
## Function that resolves a command to the end
function resolve() {
# TODO: comment!!
# In script mode only the result and its arguments are printed
# The result can then be used directly by other scripts without further
# manipulation
typeset SCRIPT_MODE VERBOSE_MODE 1>&2
while getopts "sv" opt 2>/dev/null; do
case $opt in
s) SCRIPT_MODE=1;;
v) VERBOSE_MODE=1;;
*) echo "Unknown flag!" >&2
return 1;;
esac
done
shift $(( $OPTIND - 1 ))
if (( $SCRIPT_MODE )) && (( $VERBOSE_MODE )); then
echo "Script and verbose mode do no work together." >&2
return 1
fi
typeset THIS THIS_COMMAND THIS_ARGUMENTS 1>&2
# When receiving a command with arguments, do not differ between
# one and multiple arguments.
THIS="$*"
THIS_COMMAND="${THIS%% *}"
# ${THIS%%* } would result in THIS_COMMAND when no arguements are specified.
# We want an empty string in this case.
THIS_ARGUMENTS="${THIS#${THIS_COMMAND}}"
# Resolve all aliases
while [[ "$(which $THIS_COMMAND | head -n1)" =~ "^${THIS_COMMAND}: aliased to " ]]; do
if (( $VERBOSE_MODE )); then
echo $THIS_COMMAND$THIS_ARGUMENTS
fi
THIS="$(which "$THIS_COMMAND" | cut -d' ' -f4-)"
THIS_COMMAND="${THIS%% *}"
THIS_ARGUMENTS="${THIS#${THIS_COMMAND}}$THIS_ARGUMENTS"
done
command_type="$(type $THIS_COMMAND)"
if [[ "$command_type" =~ "^$THIS_COMMAND is a shell function from " ]]; then
if (( $SCRIPT_MODE )); then
echo -n "$THIS_COMMAND$THIS_ARGUMENTS"
return 0
elif (( $VERBOSE_MODE )); then
echo "$THIS_COMMAND$THIS_ARGUMENTS"
else
echo "$* is resolved to:\n$THIS_COMMAND$THIS_ARGUMENTS"
fi
echo -n "${command_type}:"
from_file="$(echo $command_type | cut -d' ' -f7-)"
# from_file=${command_type##* }
grep -En -m1 "(function[ \t]+${THIS_COMMAND}[ \t]*(\(\)|)[ \t]*{|${THIS_COMMAND}[ \t]*\(\)[ \t]*{)" "$from_file" \
| cut -d: -f1
else
if (( $VERBOSE_MODE )); then
echo "$THIS_COMMAND$THIS_ARGUMENTS"
fi
THIS_COMMAND="$(which $THIS_COMMAND)"
if [ $? -ne 0 ]; then
echo "${THIS_COMMAND%% *} not found." >&2
return 1
fi
if (( $VERBOSE_MODE )); then
echo -n "$THIS_COMMAND"
NEXT_STEP="$(file -bh $THIS_COMMAND | cut -d' ' -f4-)"
if [ "${NEXT_STEP:0:1}" != '/' ]; then
NEXT_STEP="${THIS_COMMAND%/*}/$NEXT_STEP"
fi
while [[ "$(file -bh $THIS_COMMAND)" =~ "^symbolic link to" && "$NEXT_STEP" != "$THIS_COMMAND" ]]; do
THIS_COMMAND=$NEXT_STEP
NEXT_STEP="$(file -bh $THIS_COMMAND | cut -d' ' -f4-)"
if [ "${NEXT_STEP:0:1}" != '/' ]; then
NEXT_STEP="${THIS_COMMAND%/*}/$NEXT_STEP"
fi
echo -n "\n$THIS_COMMAND"
done
echo $THIS_ARGUMENTS
return 0
fi
THIS_COMMAND="$(realpath $THIS_COMMAND)"
if (( $SCRIPT_MODE )); then
echo -n "$THIS_COMMAND$THIS_ARGUMENTS"
return 0
fi
echo "$* is resolved to:\n$THIS_COMMAND$THIS_ARGUMENTS"
fi
}
## Grep a keyword at the beginning of a line (ignoring whitespace) in a man page
function mangrep() {
mangrep_file="$1"
mangrep_pattern="$2"
shift
shift
man -P 'less -p "^ *'"${mangrep_pattern}\"" "$@" "${mangrep_file}"
unset mangrep_{file,pattern}
}
## Grep in zsh history file
function histgrep() {
grep "$@" "${HISTFILE:-$HOME/.zsh_history}"
}
function format() {
# TODO: respect manual changes made in meld
CLANG_FORMAT_FILE="$HOME/Projects/C/.clang.format"
FORMAT="{$(sed -E '/^\s*$/d' "$CLANG_FORMAT_FILE" | tr '\n' ',' | sed 's/,$//')}"
if [ $# -eq 1 ]; then
meld <(clang-format -style="$FORMAT" $1) $1
fi
echo -n "Are you happy? [yn] "
read yn
if [ $yn = "y" ]; then
clang-format -i -style="$FORMAT" $1
fi
}
function urlenc() {
python3 -c "from urllib import parse; print(parse.quote('$@'), end='')"
}
function urldec() {
python3 -c "from urllib import parse; print(parse.unquote('$@'), end='')"
}

View File

@@ -0,0 +1,45 @@
## Author: druckdev
## Created: 2019-10-27 (originally 2019-08-28 as functions.zsh)
## List items in trash if no argument is specified
function _trash_list_default() {
if [ $# -eq 0 ]; then
trash-list
else
\trash "$@"
fi
}
## Open nemo in current directory if no argument is specified
function _nemo_wd_default() {
if [ $# -eq 0 ]; then
\nemo ./
else
\nemo "$@"
fi
}
## ls function that prints hidden files when there are no regular files
## or if we are in a directory that matches the regex in LS_SHOW_ALL_DIRS
function _ls_show_hidden() {
# Can be overwritten by settings it before calling
LS_SHOW_ALL_DIRS=${LS_SHOW_ALL_DIRS:-"dotfiles|\.config"}
# if a path is given, target will contain the given directory or the directory in which the
# given file is located
local target
for arg in "$@"; do
if [ -d "$arg" ]; then
target="$arg"
break
elif [ -d "${arg%/*}" ]; then
target="${arg%/*}"
break
fi
done
if [[ -z "$(command ls "$@")" || "$( (cd "$target"; pwd) )" =~ "${LS_SHOW_ALL_DIRS:-^$}" ]]; then
command ls -A "$@"
else
command ls "$@"
fi
}

View File

@@ -0,0 +1,75 @@
## Author: druckdev
## Created: 2019-04-17
## Setup keybindings
bindkey -v
# no delay when switching into NORMAL
export KEYTIMEOUT=1
## History
## Alternatives to check out: {up,down}-line-or-search
bindkey '^[[A' history-substring-search-up # up
bindkey '^[[B' history-substring-search-down # down
bindkey '^R' history-incremental-search-backward
## Navigation
bindkey '^[[Z' reverse-menu-complete # shift-tab
bindkey '^K' kill-whole-line # ctrl-K
bindkey '^Q' push-input # ctrl-Q
bindkey '\e[H' beginning-of-line # home
bindkey '\e[F' end-of-line # end
bindkey -v '^?' backward-delete-char # normal delete not vim-bac...
bindkey '^[[3~' delete-char # map delete key
bindkey '^[[1;5D' backward-word # ctrl-left
bindkey '^[[1;5C' forward-word # ctrl-right
bindkey '^H' backward-kill-word # ctrl-backspace
bindkey '^[[3;5~' kill-word # ctrl-delete
## From https://github.com/nicoulaj/dotfiles/blob/1c7dd1b621bc8bae895bafc438562482ea245d7e/.config/zsh/functions/widgets/rationalize-dots
function _expandDots {
#[[ $LBUFFER = *.. ]] && LBUFFER+=/.. || LBUFFER+=.
setopt localoptions nonomatch
local MATCH dir split
split=(${(z)LBUFFER})
(( $#split > 1 )) && dir=$split[-1] || dir=$split
if [[ $LBUFFER =~ '(^|/| | |'$'\n''|\||;|&)\.\.$' ]]; then
LBUFFER+=/
zle self-insert
zle self-insert
[[ -e $dir ]] && zle -M ${dir:a:h}
elif [[ $LBUFFER[-1] == '.' ]]; then
zle self-insert
[[ -e $dir ]] && zle -M ${dir:a:h}
else
zle self-insert
fi
}
#autoload _expandDots
zle -N _expandDots
bindkey . _expandDots
## Support selecting with shift and the keyboard
## Does not quite work yet
shift-arrow() {
((REGION_ACTIVE)) || zle set-mark-command
zle $1
}
shift-left() shift-arrow backward-char
shift-right() shift-arrow forward-char
shift-left-word() shift-arrow backward-word
shift-right-word() shift-arrow forward-word
toggle-select() zle set-mark-command
#select-all()
zle -N shift-left
zle -N shift-right
zle -N shift-left-word
zle -N shift-right-word
zle -N toggle-select
bindkey '^[[1;2D' shift-left
bindkey '^[[1;2C' shift-right
bindkey '^[[1;6D' shift-left-word
bindkey '^[[1;6C' shift-right-word
# bindkey '^S' toggle-select
# bindkey '^A' select-all

View File

@@ -0,0 +1,858 @@
# Generated by Powerlevel10k configuration wizard on 2019-11-06 at 18:34 CET.
# Based on romkatv/powerlevel10k/config/p10k-lean.zsh, checksum 17238.
# Wizard options: nerdfont-complete + powerline, small icons, lean, time, 2 lines,
# disconnected, sparse, few icons, concise.
# Type `p10k configure` to generate another config.
#
# Config for Powerlevel10k with lean prompt style. Type `p10k configure` to generate
# your own config based on it.
#
# Tip: Looking for a nice color? Here's a one-liner to print colormap.
#
# for i in {0..255}; do print -Pn "%${i}F${(l:3::0:)i}%f " ${${(M)$((i%8)):#7}:+$'\n'}; done
# Temporarily change options.
'builtin' 'local' '-a' 'p10k_config_opts'
[[ ! -o 'aliases' ]] || p10k_config_opts+=('aliases')
[[ ! -o 'sh_glob' ]] || p10k_config_opts+=('sh_glob')
[[ ! -o 'no_brace_expand' ]] || p10k_config_opts+=('no_brace_expand')
'builtin' 'setopt' 'no_aliases' 'no_sh_glob' 'brace_expand'
() {
emulate -L zsh
setopt no_unset extended_glob
zmodload zsh/langinfo
if [[ ${langinfo[CODESET]:-} != (utf|UTF)(-|)8 ]]; then
local LC_ALL=${${(@M)$(locale -a):#*.(utf|UTF)(-|)8}[1]:-en_US.UTF-8}
fi
# Unset all configuration options. This allows you to apply configiguration changes without
# restarting zsh. Edit ~/.p10k.zsh and type `source ~/.p10k.zsh`.
unset -m 'POWERLEVEL9K_*'
# The list of segments shown on the left. Fill it with the most important segments.
typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
# =========================[ Line #1 ]=========================
# os_icon # os identifier
dir # current directory
vcs # git status
# =========================[ Line #2 ]=========================
newline
prompt_char # prompt symbol
)
# The list of segments shown on the right. Fill it with less important segments.
# Right prompt on the last prompt line (where you are typing your commands) gets
# automatically hidden when the input line reaches it. Right prompt above the
# last prompt line gets hidden if it would overlap with left prompt.
typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(
# =========================[ Line #1 ]=========================
status # exit code of the last command
command_execution_time # duration of the last command
background_jobs # presence of background jobs
# direnv # direnv status (https://direnv.net/)
virtualenv # python virtual environment (https://docs.python.org/3/library/venv.html)
anaconda # conda environment (https://conda.io/)
pyenv # python environment (https://github.com/pyenv/pyenv)
# nodenv # node.js version from nodenv (https://github.com/nodenv/nodenv)
# nvm # node.js version from nvm (https://github.com/nvm-sh/nvm)
# nodeenv # node.js environment (https://github.com/ekalinin/nodeenv)
# node_version # node.js version
# go_version # go version (https://golang.org)
# rust_version # rustc version (https://www.rust-lang.org)
# dotnet_version # .NET version (https://dotnet.microsoft.com)
# rbenv # ruby version from rbenv (https://github.com/rbenv/rbenv)
# rvm # ruby version from rvm (https://rvm.io)
# kubecontext # current kubernetes context (https://kubernetes.io/)
# terraform # terraform workspace (https://www.terraform.io)
# aws # aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html)
# aws_eb_env # aws elastic beanstalk environment (https://aws.amazon.com/elasticbeanstalk/)
# azure # azure account name (https://docs.microsoft.com/en-us/cli/azure)
context # user@hostname
nordvpn # nordvpn connection status, linux only (https://nordvpn.com/)
ranger # ranger shell (https://github.com/ranger/ranger)
# vpn_ip # virtual private network indicator
# ram # free RAM
# load # CPU load
time # current time
# =========================[ Line #2 ]=========================
newline
# public_ip # public IP address
# proxy # system-wide http/https/ftp proxy
battery # internal battery
# example # example user-defined segment (see prompt_example function below)
)
# Basic style options that define the overall look of your prompt. You probably don't want to
# change them.
typeset -g POWERLEVEL9K_BACKGROUND= # transparent background
typeset -g POWERLEVEL9K_{LEFT,RIGHT}_{LEFT,RIGHT}_WHITESPACE= # no surrounding whitespace
typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SUBSEGMENT_SEPARATOR=' ' # separate segments with a space
typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SEGMENT_SEPARATOR= # no end-of-line symbol
# To disable default icons for all segments, set POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION=''.
#
# To enable default icons for all segments, don't define POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION
# or set it to '${P9K_VISUAL_IDENTIFIER}'.
#
# To remove spaces from all default icons, set POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION
# to '${P9K_VISUAL_IDENTIFIER// }'. You'll know that you you need this option if you see extra
# spaces after icons.
#
# To enable default icons for one segment (e.g., dir), set
# POWERLEVEL9K_DIR_VISUAL_IDENTIFIER_EXPANSION='${P9K_VISUAL_IDENTIFIER}'.
#
# To assign a specific icon to one segment (e.g., dir), set
# POWERLEVEL9K_DIR_VISUAL_IDENTIFIER_EXPANSION='⭐'.
#
# To assign a specific icon to a segment in a given state (e.g., dir in state NOT_WRITABLE),
# set POWERLEVEL9K_DIR_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION='⭐'.
#
# Note: You can use $'\u2B50' instead of '⭐'. It's especially convenient when specifying
# icons that your text editor cannot render. Don't forget to put $ and use single quotes when
# defining icons via Unicode codepoints.
#
# Note: Many default icons cannot be displayed with system fonts. You'll need to install a
# capable font to use them. See POWERLEVEL9K_MODE below.
typeset -g POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION=''
# This option makes a difference only when default icons are enabled for all or some prompt
# segments (see POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION above). LOCK_ICON can be printed as
# $'\uE0A2', $'\uE138' or $'\uF023' depending on POWERLEVEL9K_MODE. The correct value of this
# parameter depends on the provider of the font your terminal is using.
#
# Font Provider | POWERLEVEL9K_MODE
# ---------------------------------+-------------------
# Powerline | powerline
# Font Awesome | awesome-fontconfig
# Adobe Source Code Pro | awesome-fontconfig
# Source Code Pro | awesome-fontconfig
# Awesome-Terminal Fonts (regular) | awesome-fontconfig
# Awesome-Terminal Fonts (patched) | awesome-patched
# Nerd Fonts | nerdfont-complete
# Other | compatible
#
# If this looks overwhelming, either stick with a preinstalled system font and set
# POWERLEVEL9K_MODE=compatible, or install the recommended Powerlevel10k font from
# https://github.com/romkatv/powerlevel10k/#recommended-meslo-nerd-font-patched-for-powerlevel10k
# and set POWERLEVEL9K_MODE=nerdfont-complete.
typeset -g POWERLEVEL9K_MODE=nerdfont-complete
# When set to true, icons appear before content on both sides of the prompt. When set
# to false, icons go after content. If empty or not set, icons go before content in the left
# prompt and after content in the right prompt.
#
# You can also override it for a specific segment:
#
# POWERLEVEL9K_STATUS_ICON_BEFORE_CONTENT=false
#
# Or for a specific segment in specific state:
#
# POWERLEVEL9K_DIR_NOT_WRITABLE_ICON_BEFORE_CONTENT=false
typeset -g POWERLEVEL9K_ICON_BEFORE_CONTENT=true
# Add an empty line before each prompt.
typeset -g POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
# Ruler, a.k.a. the horizontal line before each prompt. If you set it to true, you'll
# probably want to set POWERLEVEL9K_PROMPT_ADD_NEWLINE=false above and
# POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR=' ' below.
typeset -g POWERLEVEL9K_SHOW_RULER=false
typeset -g POWERLEVEL9K_RULER_CHAR='─' # reasonable alternative: '·'
typeset -g POWERLEVEL9K_RULER_FOREGROUND=240
# Filler between left and right prompt on the first prompt line. You can set it to '·' or '─'
# to make it easier to see the alignment between left and right prompt and to separate prompt
# from command output. It serves the same purpose as ruler (see above) without increasing
# the number of prompt lines. You'll probably want to set POWERLEVEL9K_SHOW_RULER=false
# if using this. You might also like POWERLEVEL9K_PROMPT_ADD_NEWLINE=false for more compact
# prompt.
typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR=' '
if [[ $POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR != ' ' ]]; then
# The color of the filler.
typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_FOREGROUND=240
# Add a space between the end of left prompt and the filler.
typeset -g POWERLEVEL9K_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL=' '
# Add a space between the filler and the start of right prompt.
typeset -g POWERLEVEL9K_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL=' '
# Start filler from the edge of the screen if there are no left segments on the first line.
typeset -g POWERLEVEL9K_EMPTY_LINE_LEFT_PROMPT_FIRST_SEGMENT_END_SYMBOL='%{%}'
# End filler on the edge of the screen if there are no right segments on the first line.
typeset -g POWERLEVEL9K_EMPTY_LINE_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL='%{%}'
fi
#################################[ os_icon: os identifier ]##################################
# OS identifier color.
typeset -g POWERLEVEL9K_OS_ICON_FOREGROUND=
# Make the icon bold.
typeset -g POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION='%B${P9K_CONTENT// }'
################################[ prompt_char: prompt symbol ]################################
# Green prompt symbol if the last command succeeded.
typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS}_FOREGROUND=76
# Red prompt symbol if the last command failed.
typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS}_FOREGROUND=196
# Default prompt symbol ().
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIINS_CONTENT_EXPANSION='>' # $'\e[5 q'
# Prompt symbol in command vi mode. ()
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VICMD_CONTENT_EXPANSION=$'<' # $'\e[1 q'
# Prompt symbol in visual vi mode.
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIVIS_CONTENT_EXPANSION=$'' # $'\e[3 q'
# Prompt symbol in overwrite vi mode.
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIOWR_CONTENT_EXPANSION='▶'
typeset -g POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=true
typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL=''
##################################[ dir: current directory ]##################################
# Default current directory color. (31)
typeset -g POWERLEVEL9K_DIR_FOREGROUND=39
# If directory is too long, shorten some of its segments to the shortest possible unique
# prefix. The shortened directory can be tab-completed to the original.
typeset -g POWERLEVEL9K_SHORTEN_STRATEGY=truncate_to_unique
# Replace removed segment suffixes with this symbol.
typeset -g POWERLEVEL9K_SHORTEN_DELIMITER=
# Color of the shortened directory segments.
typeset -g POWERLEVEL9K_DIR_SHORTENED_FOREGROUND=103
# Color of the anchor directory segments. Anchor segments are never shortened. The first
# segment is always an anchor.
typeset -g POWERLEVEL9K_DIR_ANCHOR_FOREGROUND=39
# Display anchor directory segments in bold.
typeset -g POWERLEVEL9K_DIR_ANCHOR_BOLD=true
# Don't shorten directories that contain any of these files. They are anchors.
local anchor_files=(
.bzr
.citc
.git
.hg
.node-version
.python-version
.ruby-version
.shorten_folder_marker
.svn
.terraform
CVS
Cargo.toml
composer.json
go.mod
package.json
)
typeset -g POWERLEVEL9K_SHORTEN_FOLDER_MARKER="(${(j:|:)anchor_files})"
# Don't shorten this many last directory segments. They are anchors.
typeset -g POWERLEVEL9K_SHORTEN_DIR_LENGTH=1
# Shorten directory if it's longer than this even if there is space for it. The value can
# be either absolute (e.g., '80') or a percentage of terminal width (e.g, '50%'). If empty,
# directory will be shortened only when prompt doesn't fit or when other parameters demand it
# (see POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS and POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT below).
typeset -g POWERLEVEL9K_DIR_MAX_LENGTH=80
# When `dir` segment is on the last prompt line, try to shorten it enough to leave at least this
# many columns for typing commands.
typeset -g POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS=40
# When `dir` segment is on the last prompt line, try to shorten it enough to leave at least
# COLUMNS * POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT * 0.01 columns for typing commands.
typeset -g POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT=50
# If set to true, embed a hyperlink into the directory. Useful for quickly
# opening a directory in the file manager simply by clicking the link.
# Can also be handy when the directory is shortened, as it allows you to see
# the full directory that was used in previous commands.
typeset -g POWERLEVEL9K_DIR_HYPERLINK=false
# Enable special styling for non-writable directories.
typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=true
# Show this icon when the current directory is not writable. POWERLEVEL9K_DIR_SHOW_WRITABLE
# above must be set to true for this parameter to have effect.
typeset -g POWERLEVEL9K_DIR_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION='#'
# Custom prefix.
# typeset -g POWERLEVEL9K_DIR_PREFIX='%fin '
# POWERLEVEL9K_DIR_CLASSES allows you to specify custom icons for different directories.
# It must be an array with 3 * N elements. Each triplet consists of:
#
# 1. A pattern against which the current directory is matched. Matching is done with
# extended_glob option enabled.
# 2. Directory class for the purpose of styling.
# 3. Icon.
#
# Triplets are tried in order. The first triplet whose pattern matches $PWD wins. If there
# are no matches, the directory will have no icon.
#
# Example:
#
# typeset -g POWERLEVEL9K_DIR_CLASSES=(
# '~/work(/*)#' WORK '(╯°□°)╯︵ ┻━┻'
# '~(/*)#' HOME '⌂'
# '*' DEFAULT '')
#
# With these settings, the current directory in the prompt may look like this:
#
# (╯°□°)╯︵ ┻━┻ ~/work/projects/important/urgent
#
# Or like this:
#
# ⌂ ~/best/powerlevel10k
#
# You can also set different colors for directories of different classes. Remember to override
# FOREGROUND, SHORTENED_FOREGROUND and ANCHOR_FOREGROUND for every directory class that you wish
# to have its own color.
#
# typeset -g POWERLEVEL9K_DIR_WORK_FOREGROUND=31
# typeset -g POWERLEVEL9K_DIR_WORK_SHORTENED_FOREGROUND=103
# typeset -g POWERLEVEL9K_DIR_WORK_ANCHOR_FOREGROUND=39
typeset -g POWERLEVEL9K_DIR_CLASSES=()
#####################################[ vcs: git status ]######################################
# Branch icon. Set this parameter to '\uF126 ' for the popular Powerline branch icon.
typeset -g POWERLEVEL9K_VCS_BRANCH_ICON='| '
POWERLEVEL9K_VCS_BRANCH_ICON=${(g::)POWERLEVEL9K_VCS_BRANCH_ICON}
# Untracked files icon. It's really a question mark, your font isn't broken.
# Change the value of this parameter to show a different icon.
typeset -g POWERLEVEL9K_VCS_UNTRACKED_ICON='?'
POWERLEVEL9K_VCS_UNTRACKED_ICON=${(g::)POWERLEVEL9K_VCS_UNTRACKED_ICON}
# Formatter for Git status.
#
# Example output: master ⇣42⇡42 *42 merge ~42 +42 !42 ?42.
#
# You can edit the function to customize how Git status looks.
#
# VCS_STATUS_* parameters are set by gitstatus plugin. See reference:
# https://github.com/romkatv/gitstatus/blob/master/gitstatus.plugin.zsh.
function my_git_formatter() {
emulate -L zsh
if [[ -n $P9K_CONTENT ]]; then
# If P9K_CONTENT is not empty, use it. It's either "loading" or from vcs_info (not from
# gitstatus plugin). VCS_STATUS_* parameters are not available in this case.
typeset -g my_git_format=$P9K_CONTENT
return
fi
if (( $1 )); then
# Styling for up-to-date Git status.
local meta='%f' # default foreground
local clean='%76F' # green foreground
local modified='%178F' # yellow foreground
local untracked='%39F' # blue foreground
local conflicted='%196F' # red foreground
else
# Styling for incomplete and stale Git status.
local meta='%244F' # grey foreground
local clean='%244F' # grey foreground
local modified='%244F' # grey foreground
local untracked='%244F' # grey foreground
local conflicted='%244F' # grey foreground
fi
local res
local where # branch name, tag or commit
if [[ -n $VCS_STATUS_LOCAL_BRANCH ]]; then
res+="${clean}${POWERLEVEL9K_VCS_BRANCH_ICON}"
where=${(V)VCS_STATUS_LOCAL_BRANCH}
elif [[ -n $VCS_STATUS_TAG ]]; then
res+="${meta}#"
where=${(V)VCS_STATUS_TAG}
else
res+="${meta}@"
where=${VCS_STATUS_COMMIT[1,8]}
fi
# If local branch name or tag is at most 32 characters long, show it in full.
# Otherwise show the first 12 … the last 12.
(( $#where > 32 )) && where[13,-13]="…"
res+="${clean}${where//\%/%%}" # escape %
# Show tracking branch name if it differs from local branch.
if [[ -n ${VCS_STATUS_REMOTE_BRANCH:#$VCS_STATUS_LOCAL_BRANCH} ]]; then
res+="${meta}:${clean}${(V)VCS_STATUS_REMOTE_BRANCH//\%/%%}" # escape %
fi
# ⇣42 if behind the remote.
(( VCS_STATUS_COMMITS_BEHIND )) && res+=" ${clean}⇣${VCS_STATUS_COMMITS_BEHIND}"
# ⇡42 if ahead of the remote; no leading space if also behind the remote: ⇣42⇡42.
(( VCS_STATUS_COMMITS_AHEAD && !VCS_STATUS_COMMITS_BEHIND )) && res+=" "
(( VCS_STATUS_COMMITS_AHEAD )) && res+="${clean}⇡${VCS_STATUS_COMMITS_AHEAD}"
# *42 if have stashes.
(( VCS_STATUS_STASHES )) && res+=" ${clean}*${VCS_STATUS_STASHES}"
# 'merge' if the repo is in an unusual state.
[[ -n $VCS_STATUS_ACTION ]] && res+=" ${conflicted}${VCS_STATUS_ACTION}"
# ~42 if have merge conflicts.
(( VCS_STATUS_NUM_CONFLICTED )) && res+=" ${conflicted}~${VCS_STATUS_NUM_CONFLICTED}"
# +42 if have staged changes.
(( VCS_STATUS_NUM_STAGED )) && res+=" ${modified}+${VCS_STATUS_NUM_STAGED}"
# !42 if have unstaged changes.
(( VCS_STATUS_NUM_UNSTAGED )) && res+=" ${modified}!${VCS_STATUS_NUM_UNSTAGED}"
# ?42 if have untracked files. It's really a question mark, your font isn't broken.
# See POWERLEVEL9K_VCS_UNTRACKED_ICON above if you want to use a different icon.
# Remove the next line if you don't want to see untracked files at all.
(( VCS_STATUS_NUM_UNTRACKED )) && res+=" ${untracked}${POWERLEVEL9K_VCS_UNTRACKED_ICON}${VCS_STATUS_NUM_UNTRACKED}"
typeset -g my_git_format=$res
}
functions -M my_git_formatter 2>/dev/null
# Disable the default Git status formatting.
typeset -g POWERLEVEL9K_VCS_DISABLE_GITSTATUS_FORMATTING=true
# Install our own Git status formatter.
typeset -g POWERLEVEL9K_VCS_CONTENT_EXPANSION='${$((my_git_formatter(1)))+${my_git_format}}'
typeset -g POWERLEVEL9K_VCS_LOADING_CONTENT_EXPANSION='${$((my_git_formatter(0)))+${my_git_format}}'
# Enable counters for staged, unstaged, etc.
typeset -g POWERLEVEL9K_VCS_{STAGED,UNSTAGED,UNTRACKED,CONFLICTED,COMMITS_AHEAD,COMMITS_BEHIND}_MAX_NUM=-1
# Icon color.
typeset -g POWERLEVEL9K_VCS_VISUAL_IDENTIFIER_COLOR=76
typeset -g POWERLEVEL9K_VCS_LOADING_VISUAL_IDENTIFIER_COLOR=244
# Custom icon.
typeset -g POWERLEVEL9K_VCS_VISUAL_IDENTIFIER_EXPANSION=
# Custom prefix.
# typeset -g POWERLEVEL9K_VCS_PREFIX='%fon '
# Show status of repositories of these types. You can add svn and/or hg if you are
# using them. If you do, your prompt may become slow even when your current directory
# isn't in an svn or hg reposotiry.
typeset -g POWERLEVEL9K_VCS_BACKENDS=(git)
# These settings are used for respositories other than Git or when gitstatusd fails and
# Powerlevel10k has to fall back to using vcs_info.
typeset -g POWERLEVEL9K_VCS_CLEAN_FOREGROUND=76
typeset -g POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND=76
typeset -g POWERLEVEL9K_VCS_MODIFIED_FOREGROUND=178
##########################[ status: exit code of the last command ]###########################
# Enable OK_PIPE, ERROR_PIPE and ERROR_SIGNAL status states to allow us to enable, disable and
# style them independently from the regular OK and ERROR state.
typeset -g POWERLEVEL9K_STATUS_EXTENDED_STATES=true
# Status on success. No content, just an icon. No need to show it if prompt_char is enabled as
# it will signify success by turning green.
typeset -g POWERLEVEL9K_STATUS_OK=false
typeset -g POWERLEVEL9K_STATUS_OK_FOREGROUND=70
# typeset -g POWERLEVEL9K_STATUS_OK_VISUAL_IDENTIFIER_EXPANSION='✔'
# Status when some part of a pipe command fails but the overall exit status is zero. It may look
# like this: 1|0.
typeset -g POWERLEVEL9K_STATUS_OK_PIPE=true
typeset -g POWERLEVEL9K_STATUS_OK_PIPE_FOREGROUND=70
# typeset -g POWERLEVEL9K_STATUS_OK_PIPE_VISUAL_IDENTIFIER_EXPANSION='✔'
# Status when it's just an error code (e.g., '1'). No need to show it if prompt_char is enabled as
# it will signify error by turning red.
typeset -g POWERLEVEL9K_STATUS_ERROR=true
typeset -g POWERLEVEL9K_STATUS_ERROR_FOREGROUND=160
# typeset -g POWERLEVEL9K_STATUS_ERROR_VISUAL_IDENTIFIER_EXPANSION='↵'
# Status when the last command was terminated by a signal.
typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL=true
typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_FOREGROUND=160
# Use terse signal names: "INT" instead of "SIGINT(2)".
typeset -g POWERLEVEL9K_STATUS_VERBOSE_SIGNAME=false
# typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_VISUAL_IDENTIFIER_EXPANSION='↵'
# Status when some part of a pipe command fails and the overall exit status is also non-zero.
# It may look like this: 1|0.
typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE=true
typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_FOREGROUND=160
# typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_VISUAL_IDENTIFIER_EXPANSION='↵'
###################[ command_execution_time: duration of the last command ]###################
# Show duration of the last command if takes longer than this many seconds.
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=1
# Show this many fractional digits. Zero means round to seconds.
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=2
# Execution time color.
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=101
# Duration format: 1d 2h 3m 4s.
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s'
# Custom icon.
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_VISUAL_IDENTIFIER_EXPANSION=
# Custom prefix.
# typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PREFIX='%ftook '
#######################[ background_jobs: presence of background jobs ]#######################
# Don't show the number of background jobs.
typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE=false
# Background jobs color.
typeset -g POWERLEVEL9K_BACKGROUND_JOBS_FOREGROUND=70
# Icon to show when there are background jobs.
typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VISUAL_IDENTIFIER_EXPANSION='☰ '
#######################[ direnv: direnv status (https://direnv.net/) ]########################
# Direnv color.
typeset -g POWERLEVEL9K_DIRENV_FOREGROUND=178
# Icon to show when direnv is active.
typeset -g POWERLEVEL9K_DIRENV_VISUAL_IDENTIFIER_EXPANSION='${P9K_VISUAL_IDENTIFIER}'
##########[ nordvpn: nordvpn connection status, linux only (https://nordvpn.com/) ]###########
# NordVPN connection indicator color.
typeset -g POWERLEVEL9K_NORDVPN_FOREGROUND=39
# Hide NordVPN connection indicator when not connected.
typeset -g POWERLEVEL9K_NORDVPN_{DISCONNECTED,CONNECTING,DISCONNECTING}_CONTENT_EXPANSION=
typeset -g POWERLEVEL9K_NORDVPN_{DISCONNECTED,CONNECTING,DISCONNECTING}_VISUAL_IDENTIFIER_EXPANSION=
# Custom icon.
# typeset -g POWERLEVEL9K_NORDVPN_VISUAL_IDENTIFIER_EXPANSION='⭐'
#################[ ranger: ranger shell (https://github.com/ranger/ranger) ]##################
# Ranger shell color.
typeset -g POWERLEVEL9K_RANGER_FOREGROUND=178
# Custom icon.
# typeset -g POWERLEVEL9K_RANGER_VISUAL_IDENTIFIER_EXPANSION='⭐'
######################################[ ram: free RAM ]#######################################
# RAM color.
typeset -g POWERLEVEL9K_RAM_FOREGROUND=66
# Custom icon.
# typeset -g POWERLEVEL9K_RAM_VISUAL_IDENTIFIER_EXPANSION='⭐'
######################################[ load: CPU load ]######################################
# Show average CPU load over this many last minutes. Valid values are 1, 5 and 15.
typeset -g POWERLEVEL9K_LOAD_WHICH=5
# Load color when load is under 50%.
typeset -g POWERLEVEL9K_LOAD_NORMAL_FOREGROUND=66
# Load color when load is between 50% and 70%.
typeset -g POWERLEVEL9K_LOAD_WARNING_FOREGROUND=178
# Load color when load is over 70%.
typeset -g POWERLEVEL9K_LOAD_CRITICAL_FOREGROUND=166
# Custom icon.
# typeset -g POWERLEVEL9K_LOAD_VISUAL_IDENTIFIER_EXPANSION='⭐'
##################################[ context: user@hostname ]##################################
# Default context color.
typeset -g POWERLEVEL9K_CONTEXT_FOREGROUND=180
# Default context format: %n is username, %m is hostname.
typeset -g POWERLEVEL9K_CONTEXT_TEMPLATE='%n@%m'
# Context color when running with privileges.
typeset -g POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=178
# Context format when running with privileges: bold user@hostname.
typeset -g POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE='%B%n@%m'
# Don't show context unless running with privileges or in SSH.
# Tip: Remove the next line to always show context.
typeset -g POWERLEVEL9K_CONTEXT_{DEFAULT,SUDO}_{CONTENT,VISUAL_IDENTIFIER}_EXPANSION=
# Custom icon.
# typeset -g POWERLEVEL9K_CONTEXT_VISUAL_IDENTIFIER_EXPANSION='⭐'
# Custom prefix.
# typeset -g POWERLEVEL9K_CONTEXT_PREFIX='%fwith '
###[ virtualenv: python virtual environment (https://docs.python.org/3/library/venv.html) ]###
# Python virtual environment color.
typeset -g POWERLEVEL9K_VIRTUALENV_FOREGROUND=37
# Don't show Python version next to the virtual environment name.
typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=false
# Separate environment name from Python version only with a space.
typeset -g POWERLEVEL9K_VIRTUALENV_{LEFT,RIGHT}_DELIMITER=
# Custom icon.
# typeset -g POWERLEVEL9K_VIRTUALENV_VISUAL_IDENTIFIER_EXPANSION='⭐'
#####################[ anaconda: conda environment (https://conda.io/) ]######################
# Anaconda environment color.
typeset -g POWERLEVEL9K_ANACONDA_FOREGROUND=37
# Don't show Python version next to the anaconda environment name.
typeset -g POWERLEVEL9K_ANACONDA_SHOW_PYTHON_VERSION=false
# Separate environment name from Python version only with a space.
typeset -g POWERLEVEL9K_ANACONDA_{LEFT,RIGHT}_DELIMITER=
# Custom icon.
# typeset -g POWERLEVEL9K_ANACONDA_VISUAL_IDENTIFIER_EXPANSION='⭐'
################[ pyenv: python environment (https://github.com/pyenv/pyenv) ]################
# Pyenv color.
typeset -g POWERLEVEL9K_PYENV_FOREGROUND=37
# Don't show the current Python version if it's the same as global.
typeset -g POWERLEVEL9K_PYENV_PROMPT_ALWAYS_SHOW=false
# Custom icon.
# typeset -g POWERLEVEL9K_PYENV_VISUAL_IDENTIFIER_EXPANSION='⭐'
##########[ nodenv: node.js version from nodenv (https://github.com/nodenv/nodenv) ]##########
# Nodenv color.
typeset -g POWERLEVEL9K_NODENV_FOREGROUND=70
# Don't show node version if it's the same as global: $(nodenv version-name) == $(nodenv global).
typeset -g POWERLEVEL9K_NODENV_PROMPT_ALWAYS_SHOW=false
# Custom icon.
# typeset -g POWERLEVEL9K_NODENV_VISUAL_IDENTIFIER_EXPANSION='⭐'
##############[ nvm: node.js version from nvm (https://github.com/nvm-sh/nvm) ]###############
# Nvm color.
typeset -g POWERLEVEL9K_NVM_FOREGROUND=70
# Custom icon.
# typeset -g POWERLEVEL9K_NVM_VISUAL_IDENTIFIER_EXPANSION='⭐'
############[ nodeenv: node.js environment (https://github.com/ekalinin/nodeenv) ]############
# Nodeenv color.
typeset -g POWERLEVEL9K_NODEENV_FOREGROUND=70
# Don't show Node version next to the environment name.
typeset -g POWERLEVEL9K_NODEENV_SHOW_NODE_VERSION=false
# Separate environment name from Node version only with a space.
typeset -g POWERLEVEL9K_NODEENV_{LEFT,RIGHT}_DELIMITER=
# Custom icon.
# typeset -g POWERLEVEL9K_NODEENV_VISUAL_IDENTIFIER_EXPANSION='⭐'
##############################[ node_version: node.js version ]###############################
# Node version color.
typeset -g POWERLEVEL9K_NODE_VERSION_FOREGROUND=70
# Show node version only when in a directory tree containing package.json.
typeset -g POWERLEVEL9K_NODE_VERSION_PROJECT_ONLY=true
# Custom icon.
# typeset -g POWERLEVEL9K_NODE_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐'
#######################[ go_version: go version (https://golang.org) ]########################
# Go version color.
typeset -g POWERLEVEL9K_GO_VERSION_FOREGROUND=37
# Show go version only when in a go project subdirectory.
typeset -g POWERLEVEL9K_GO_VERSION_PROJECT_ONLY=true
# Custom icon.
# typeset -g POWERLEVEL9K_GO_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐'
#################[ rust_version: rustc version (https://www.rust-lang.org) ]##################
# Rust version color.
typeset -g POWERLEVEL9K_RUST_VERSION_FOREGROUND=37
# Show rust version only when in a rust project subdirectory.
typeset -g POWERLEVEL9K_RUST_VERSION_PROJECT_ONLY=true
# Custom icon.
# typeset -g POWERLEVEL9K_RUST_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐'
###############[ dotnet_version: .NET version (https://dotnet.microsoft.com) ]################
# .NET version color.
typeset -g POWERLEVEL9K_DOTNET_VERSION_FOREGROUND=134
# Show .NET version only when in a .NET project subdirectory.
typeset -g POWERLEVEL9K_DOTNET_VERSION_PROJECT_ONLY=true
# Custom icon.
# typeset -g POWERLEVEL9K_DOTNET_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐'
#############[ rbenv: ruby version from rbenv (https://github.com/rbenv/rbenv) ]##############
# Rbenv color.
typeset -g POWERLEVEL9K_RBENV_FOREGROUND=168
# Don't show ruby version if it's the same as global: $(rbenv version-name) == $(rbenv global).
typeset -g POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW=false
# Custom icon.
# typeset -g POWERLEVEL9K_RBENV_VISUAL_IDENTIFIER_EXPANSION='⭐'
#######################[ rvm: ruby version from rvm (https://rvm.io) ]########################
# Rvm color.
typeset -g POWERLEVEL9K_RVM_FOREGROUND=168
# Don't show @gemset at the end.
typeset -g POWERLEVEL9K_RVM_SHOW_GEMSET=false
# Don't show ruby- at the front.
typeset -g POWERLEVEL9K_RVM_SHOW_PREFIX=false
# Custom icon.
# typeset -g POWERLEVEL9K_RVM_VISUAL_IDENTIFIER_EXPANSION='⭐'
#############[ kubecontext: current kubernetes context (https://kubernetes.io/) ]#############
# Kubernetes context classes for the purpose of using different colors, icons and expansions with
# different contexts.
#
# POWERLEVEL9K_KUBECONTEXT_CLASSES is an array with even number of elements. The first element
# in each pair defines a pattern against which the current kubernetes context gets matched.
# More specifically, it's P9K_CONTENT prior to the application of context expansion (see below)
# that gets matched. If you unset all POWERLEVEL9K_KUBECONTEXT_*CONTENT_EXPANSION parameters,
# you'll see this value in your prompt. The second element of each pair in
# POWERLEVEL9K_KUBECONTEXT_CLASSES defines the context class. Patterns are tried in order. The
# first match wins.
#
# For example, given these settings:
#
# typeset -g POWERLEVEL9K_KUBECONTEXT_CLASSES=(
# '*prod*' PROD
# '*test*' TEST
# '*' DEFAULT)
#
# If your current kubernetes context is "deathray-testing/default", its class is TEST
# because "deathray-testing/default" doesn't match the pattern '*prod*' but does match '*test*'.
#
# You can define different colors, icons and content expansions for different classes:
#
# typeset -g POWERLEVEL9K_KUBECONTEXT_TEST_FOREGROUND=28
# typeset -g POWERLEVEL9K_KUBECONTEXT_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐'
# typeset -g POWERLEVEL9K_KUBECONTEXT_TEST_CONTENT_EXPANSION='> ${P9K_CONTENT} <'
typeset -g POWERLEVEL9K_KUBECONTEXT_CLASSES=(
# '*prod*' PROD # These values are examples that are unlikely
# '*test*' TEST # to match your needs. Customize them as needed.
'*' DEFAULT)
typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_FOREGROUND=134
# typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_VISUAL_IDENTIFIER_EXPANSION='⭐'
# Use POWERLEVEL9K_KUBECONTEXT_CONTENT_EXPANSION to specify the content displayed by kubecontext
# segment. Parameter expansions are very flexible and fast, too. See reference:
# http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion.
#
# Within the expansion the following parameters are always available:
#
# - P9K_CONTENT The content that would've been displayed if there was no content
# expansion defined.
# - P9K_KUBECONTEXT_NAME The current context's name. Corresponds to column NAME in the
# output of `kubectl config get-contexts`.
# - P9K_KUBECONTEXT_CLUSTER The current context's cluster. Corresponds to column CLUSTER in the
# output of `kubectl config get-contexts`.
# - P9K_KUBECONTEXT_NAMESPACE The current context's namespace. Corresponds to column NAMESPACE
# in the output of `kubectl config get-contexts`. If there is no
# namespace, the parameter is set to "default".
#
# If the context points to Google Kubernetes Engine (GKE) or Elastic Kubernetes Service (EKS),
# the following extra parameters are available:
#
# - P9K_KUBECONTEXT_CLOUD_NAME Either "gke" or "eks".
# - P9K_KUBECONTEXT_CLOUD_ACCOUNT Account/project ID.
# - P9K_KUBECONTEXT_CLOUD_ZONE Availability zone.
# - P9K_KUBECONTEXT_CLOUD_CLUSTER Cluster.
#
# P9K_KUBECONTEXT_CLOUD_* parameters are derived from P9K_KUBECONTEXT_CLUSTER. For example,
# if P9K_KUBECONTEXT_CLUSTER is "gke_my-account_us-east1-a_my-cluster-01":
#
# - P9K_KUBECONTEXT_CLOUD_NAME=gke
# - P9K_KUBECONTEXT_CLOUD_ACCOUNT=my-account
# - P9K_KUBECONTEXT_CLOUD_ZONE=us-east1-a
# - P9K_KUBECONTEXT_CLOUD_CLUSTER=my-cluster-01
#
# If P9K_KUBECONTEXT_CLUSTER is "arn:aws:eks:us-east-1:123456789012:cluster/my-cluster-01":
#
# - P9K_KUBECONTEXT_CLOUD_NAME=eks
# - P9K_KUBECONTEXT_CLOUD_ACCOUNT=123456789012
# - P9K_KUBECONTEXT_CLOUD_ZONE=us-east-1
# - P9K_KUBECONTEXT_CLOUD_CLUSTER=my-cluster-01
typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_CONTENT_EXPANSION=
# Show P9K_KUBECONTEXT_CLOUD_CLUSTER if it's not empty and fall back to P9K_KUBECONTEXT_NAME.
POWERLEVEL9K_KUBECONTEXT_DEFAULT_CONTENT_EXPANSION+='${P9K_KUBECONTEXT_CLOUD_CLUSTER:-${P9K_KUBECONTEXT_NAME}}'
# Append the current context's namespace if it's not "default".
POWERLEVEL9K_KUBECONTEXT_DEFAULT_CONTENT_EXPANSION+='${${:-/$P9K_KUBECONTEXT_NAMESPACE}:#/default}'
# Custom prefix.
# typeset -g POWERLEVEL9K_KUBECONTEXT_PREFIX='%fat '
################[ terraform: terraform workspace (https://www.terraform.io) ]#################
# Terraform color.
typeset -g POWERLEVEL9K_TERRAFORM_FOREGROUND=38
# Custom icon.
# typeset -g POWERLEVEL9K_TERRAFORM_VISUAL_IDENTIFIER_EXPANSION='⭐'
#[ aws: aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) ]#
# AWS profile color.
typeset -g POWERLEVEL9K_AWS_FOREGROUND=208
# Custom icon.
# typeset -g POWERLEVEL9K_AWS_VISUAL_IDENTIFIER_EXPANSION='⭐'
#[ aws_eb_env: aws elastic beanstalk environment (https://aws.amazon.com/elasticbeanstalk/) ]#
# AWS Elastic Beanstalk environment color.
typeset -g POWERLEVEL9K_AWS_EB_ENV_FOREGROUND=70
# Custom icon.
# typeset -g POWERLEVEL9K_AWS_EB_ENV_VISUAL_IDENTIFIER_EXPANSION='⭐'
##########[ azure: azure account name (https://docs.microsoft.com/en-us/cli/azure) ]##########
# Azure account name color.
typeset -g POWERLEVEL9K_AZURE_FOREGROUND=32
# Custom icon.
# typeset -g POWERLEVEL9K_AZURE_VISUAL_IDENTIFIER_EXPANSION='⭐'
###############################[ public_ip: public IP address ]###############################
# Public IP color.
typeset -g POWERLEVEL9K_PUBLIC_IP_FOREGROUND=94
# Custom icon.
# typeset -g POWERLEVEL9K_PUBLIC_IP_VISUAL_IDENTIFIER_EXPANSION='⭐'
########################[ vpn_ip: virtual private network indicator ]#########################
# VPN IP color.
typeset -g POWERLEVEL9K_VPN_IP_FOREGROUND=81
# When on VPN, show just an icon without the IP address.
typeset -g POWERLEVEL9K_VPN_IP_CONTENT_EXPANSION=
# Regular expression for the VPN network interface. Run ifconfig while on VPN to see the
# name of the interface.
typeset -g POWERLEVEL9K_VPN_IP_INTERFACE='(wg|(.*tun))[0-9]*'
# Icon to show when on VPN.
typeset -g POWERLEVEL9K_VPN_IP_VISUAL_IDENTIFIER_EXPANSION='${P9K_VISUAL_IDENTIFIER// }'
#########################[ proxy: system-wide http/https/ftp proxy ]##########################
# Proxy color.
typeset -g POWERLEVEL9K_PROXY_FOREGROUND=68
# Custom icon.
# typeset -g POWERLEVEL9K_PROXY_VISUAL_IDENTIFIER_EXPANSION='⭐'
################################[ battery: internal battery ]#################################
# Show battery in red when it's below this level and not connected to power supply.
typeset -g POWERLEVEL9K_BATTERY_LOW_THRESHOLD=20
typeset -g POWERLEVEL9K_BATTERY_LOW_FOREGROUND=160
# Show battery in green when it's charging or fully charged.
typeset -g POWERLEVEL9K_BATTERY_{CHARGING,CHARGED}_FOREGROUND=70
# Show battery in yellow when it's discharging.
typeset -g POWERLEVEL9K_BATTERY_DISCONNECTED_FOREGROUND=178
# Battery pictograms going from low to high level of charge.
typeset -g POWERLEVEL9K_BATTERY_STAGES=$'\uf58d\uf579\uf57a\uf57b\uf57c\uf57d\uf57e\uf57f\uf580\uf581\uf578'
# Don't show the remaining time to charge/discharge.
typeset -g POWERLEVEL9K_BATTERY_VERBOSE=false
####################################[ time: current time ]####################################
# Current time color. (66)
typeset -g POWERLEVEL9K_TIME_FOREGROUND=39
# Format for the current time: 09:51:02. See `man 3 strftime`.
typeset -g POWERLEVEL9K_TIME_FORMAT='%D{%H:%M:%S}'
# If set to true, time will update when you hit enter. This way prompts for the past
# commands will contain the start times of their commands as opposed to the default
# behavior where they contain the end times of their preceding commands.
typeset -g POWERLEVEL9K_TIME_UPDATE_ON_COMMAND=true
# Custom icon.
typeset -g POWERLEVEL9K_TIME_VISUAL_IDENTIFIER_EXPANSION=
# Custom prefix.
# typeset -g POWERLEVEL9K_TIME_PREFIX='%fat '
# Example of a user-defined prompt segment. Function prompt_example will be called on every
# prompt if `example` prompt segment is added to POWERLEVEL9K_LEFT_PROMPT_ELEMENTS or
# POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS. It displays an icon and orange text greeting the user.
#
# Type `p10k help segment` for documentation and a more sophisticated example.
function prompt_example() {
p10k segment -f 208 -i '⭐' -t 'hello, %n'
}
# User-defined prompt segments may optionally provide an instant_prompt_* function. Its job
# is to generate the prompt segment for display in instant prompt. See
# https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt.
#
# Powerlevel10k will call instant_prompt_* at the same time as the regular prompt_* function
# and will record all `p10k segment` calls it makes. When displaying instant prompt, Powerlevel10k
# will replay these calls without actually calling instant_prompt_*. It is imperative that
# instant_prompt_* always makes the same `p10k segment` calls regardless of environment. If this
# rule is not observed, the content of instant prompt will be incorrect.
#
# Usually, you should either not define instant_prompt_* or simply call prompt_* from it. If
# instant_prompt_* is not defined for a segment, the segment won't be shown in instant prompt.
function instant_prompt_example() {
# Since prompt_example always makes the same `p10k segment` calls, we can call it from
# instant_prompt_example. This will give us the same `example` prompt segment in the instant
# and regular prompts.
prompt_example
}
# User-defined prompt segments can be customized the same way as built-in segments.
# typeset -g POWERLEVEL9K_EXAMPLE_FOREGROUND=208
# typeset -g POWERLEVEL9K_EXAMPLE_VISUAL_IDENTIFIER_EXPANSION='${P9K_VISUAL_IDENTIFIER}'
# Transient prompt works similarly to the builtin transient_rprompt option. It trims down prompt
# when accepting a command line. Supported values:
#
# - off: Don't change prompt when accepting a command line.
# - always: Trim down prompt when accepting a command line.
# - same-dir: Trim down prompt when accepting a command line unless this is the first command
# typed after changing current working directory.
typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=off
# Instant prompt mode.
#
# - off: Disable instant prompt. Choose this if you've tried instant prompt and found
# it incompatible with your zsh configuration files.
# - quiet: Enable instant prompt and don't print warnings when detecting console output
# during zsh initialization. Choose this if you've read and understood
# https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt.
# - verbose: Enable instant prompt and print a warning when detecting console output during
# zsh initialization. Choose this if you've never tried instant prompt, haven't
# seen the warning, or if you are unsure what this all means.
typeset -g POWERLEVEL9K_INSTANT_PROMPT=verbose
# typeset -g POWERLEVEL9K_INSTANT_PROMPT_COMMAND_LINES=0
# Hot reload allows you to change POWERLEVEL9K options after Powerlevel10k has been initialized.
# For example, you can type POWERLEVEL9K_BACKGROUND=red and see your prompt turn red. Hot reload
# can slow down prompt by 1-2 milliseconds, so it's better to keep it turned off unless you
# really need it.
typeset -g POWERLEVEL9K_DISABLE_HOT_RELOAD=true
}
(( ${#p10k_config_opts} )) && setopt ${p10k_config_opts[@]}
'builtin' 'unset' 'p10k_config_opts'

View File

@@ -0,0 +1,61 @@
#
# Defines transfer alias and provides easy command line file and folder sharing.
#
# Authors:
# Remco Verhoef <remco@dutchcoders.io>
#
curl --version 2>&1 > /dev/null
if [ $? -ne 0 ]; then
echo "Could not find curl."
return 1
fi
transfer() {
# check arguments
if [ $# -eq 0 ];
then
echo "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"
return 1
fi
# get temporarily filename, output is written to this file show progress can be showed
tmpfile=$( mktemp -t transferXXX )
# upload stdin or file
file=$1
if tty -s;
then
basefile=$(basename "$file" | sed -e 's/[^a-zA-Z0-9._-]/-/g')
if [ ! -e $file ];
then
echo "File $file doesn't exists."
return 1
fi
if [ -d $file ];
then
# zip directory and transfer
zipfile=$( mktemp -t transferXXX.zip )
cd $(dirname $file) && zip -r -q - $(basename $file) >> $zipfile
curl --progress-bar --upload-file "$zipfile" "https://transfer.sh/$basefile.zip" >> $tmpfile
rm -f $zipfile
else
# transfer file
curl --progress-bar --upload-file "$file" "https://transfer.sh/$basefile" >> $tmpfile
fi
else
# transfer pipe
curl --progress-bar --upload-file "-" "https://transfer.sh/$file" >> $tmpfile
fi
# cat output link
cat $tmpfile
# cleanup
rm -f $tmpfile
}

View File

@@ -0,0 +1,93 @@
# Copyright 2019 Roman Perepelitsa
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Measures how long it takes for your zsh prompt to render. Roughly speaking,
# if you press and hold [ENTER], how many prompts will be printed per second?
#
# $1 -- Benchmark for this many seconds. Default is 5.
# $2 -- Sleep for this many seconds before benchmarking to fill the keyboard input buffer.
# This mitigates the problem caused by slow key repeat rate (see below). Default is 10.
#
# After calling this function in an interactive shell you need to press and hold [ENTER] until
# you see benchmark results. It'll take 15 seconds with default arguments. The output also includes
# your prompt with all non-ascii characters escaped. This is to enable you to easily share the
# results with others (e.g., if you want to complain to your zsh theme provider about high prompt
# latency). Not only will they see how fast (or how slow!) your prompt renders but also what it
# actually looks like.
#
# Make sure your repeat key rate is high enough that your shell is unable to keep up. While not
# benchmarking, press and hold [ENTER]. If you see empty lines between prompts or if prompts keep
# being printed after you release [ENTER], your repeat key rate is sufficient. If it's not,
# you can artificially boost it by buffering keyboard input buffer. Your effective key repeat
# rate is multiplied by 1 + $2 / $1. With default settings this is 1 + 10 / 5 == 3.
function zsh-prompt-benchmark() {
typeset -gHF3 _BENCHMARK_PROMPT_DURATION=${1:-5}
typeset -gHi _BENCHMARK_PROMPT_WARMUP_DURATION=${2:-10}
typeset -gHi _BENCHMARK_PROMPT_SAMPLE_IDX=0
typeset -gHF3 _BENCHMARK_PROMPT_START_TIME=0
>&2 echo "Enabling prompt benchmarking for ${_BENCHMARK_PROMPT_DURATION}s" \
"after buffering keyboard input for ${_BENCHMARK_PROMPT_WARMUP_DURATION}s."
>&2 echo "Press and hold [ENTER] until you see benchmark results."
add-zsh-hook precmd _zsh_prompt_benchmark_precmd
typeset -gHf _zsh_prompt_benchmark_precmd() {
local -F now=$EPOCHREALTIME
((++_BENCHMARK_PROMPT_SAMPLE_IDX))
if ((now < _BENCHMARK_PROMPT_START_TIME + _BENCHMARK_PROMPT_DURATION)); then
return
fi
if (( _BENCHMARK_PROMPT_START_TIME )); then
local -i N=$((_BENCHMARK_PROMPT_SAMPLE_IDX - 1))
local -F3 T=$((now - _BENCHMARK_PROMPT_START_TIME))
local -F2 P=$((1000 * T / N))
local LP=$(eval LC_ALL=C printf '%q' \"$PROMPT\")
local RP=$(eval LC_ALL=C printf '%q' \"$RPROMPT\")
>&2 echo -E "************************************************************"
>&2 echo -E " Prompt Benchmark Results "
>&2 echo -E "************************************************************"
>&2 echo -E "Warmup duration ${_BENCHMARK_PROMPT_WARMUP_DURATION}s"
>&2 echo -E "Benchmarked prompts $N"
>&2 echo -E "Total time ${T}s"
>&2 echo -E "Time per prompt ${P}ms"
>&2 echo -E "************************************************************"
>&2 echo -E ""
>&2 echo -E "PROMPT=$LP"
>&2 echo -E ""
>&2 echo -E "RPROMPT=$RP"
>&2 echo -E ""
>&2 echo -E "Tip: To print one of the reported prompts, execute the"
>&2 echo -E "following command with \${P} replaced by the prompt string."
>&2 echo -E ""
>&2 echo -E " print -lP BEGIN \${P} '' END"
>&2 echo -E ""
>&2 echo -E "For example, here's how you can print the same left prompt"
>&2 echo -E "(PROMPT) that was benchmarked:"
>&2 echo -E ""
>&2 echo -E " print -lP BEGIN $LP END"
>&2 echo -E "************************************************************"
>&2 echo -E ""
>&2 echo -E "Press 'q' to continue..."
unset -m "_BENCHMARK_PROMPT_*"
unset -f _zsh_prompt_benchmark_precmd
add-zsh-hook -D precmd _zsh_prompt_benchmark_precmd
local _ && IFS='' read -rsd q _
else
sleep $_BENCHMARK_PROMPT_WARMUP_DURATION
typeset -gHF _BENCHMARK_PROMPT_START_TIME=$EPOCHREALTIME
fi
}
}
zmodload zsh/datetime
autoload -Uz add-zsh-hook

View File

@@ -0,0 +1,30 @@
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets)
## colors: 0-7 standard, 8-15 high-intensity
## red
ZSH_HIGHLIGHT_STYLES[bracket-error]='fg=009,bold'
ZSH_HIGHLIGHT_STYLES[unknown-token]='fg=009,bold'
## green
ZSH_HIGHLIGHT_STYLES[arg0]='fg=076'
ZSH_HIGHLIGHT_STYLES[suffix-alias]='fg=076,underline'
ZSH_HIGHLIGHT_STYLES[bracket-level-2]='fg=076,bold'
ZSH_HIGHLIGHT_STYLES[precommand]='fg=076,underline'
## blue
ZSH_HIGHLIGHT_STYLES[bracket-level-1]='fg=012,bold'
## yellow
ZSH_HIGHLIGHT_STYLES[double-quoted-argument]='fg=011'
ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]='fg=011'
ZSH_HIGHLIGHT_STYLES[bracket-level-4]='fg=011,bold'
ZSH_HIGHLIGHT_STYLES[single-quoted-argument]='fg=011'
ZSH_HIGHLIGHT_STYLES[reserved-word]='fg=011'
ZSH_HIGHLIGHT_STYLES[path_prefix]='fg=011,underline'
## cyan
ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]='fg=014'
ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]='fg=014'
ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]='fg=014'
ZSH_HIGHLIGHT_STYLES[bracket-level-5]='fg=014,bold'
ZSH_HIGHLIGHT_STYLES[rc-quote]='fg=014'
## black/dark grey
ZSH_HIGHLIGHT_STYLES[comment]='fg=008,bold'
## magenta
ZSH_HIGHLIGHT_STYLES[bracket-level-3]='fg=13,bold'

13
.gitignore vendored Normal file
View File

@@ -0,0 +1,13 @@
archive
.gitignore
!/.gitignore
.zcompdump
*.zwc
_msg
*.bkp
.netrwhist
github.config
gitlab.config
example.config
.config/tmux/plugins
!.config/tmux/plugins/tpm

24
.gitmodules vendored Normal file
View File

@@ -0,0 +1,24 @@
[submodule "dotbot"]
path = dotbot
url = https://github.com/anishathalye/dotbot
[submodule ".config/tmux/plugins/tpm"]
path = .config/tmux/plugins/tpm
url = https://github.com/tmux-plugins/tpm
[submodule ".config/zsh/plugins/powerlevel10k"]
path = .config/zsh/plugins/powerlevel10k
url = https://github.com/romkatv/powerlevel10k.git
[submodule ".config/zsh/plugins/stderred"]
path = .config/zsh/plugins/stderred
url = https://github.com/sickill/stderred
[submodule ".config/zsh/plugins/zsh-history-substring-search"]
path = .config/zsh/plugins/zsh-history-substring-search
url = https://github.com/zsh-users/zsh-history-substring-search
[submodule ".config/zsh/plugins/zsh-autosuggestions"]
path = .config/zsh/plugins/zsh-autosuggestions
url = https://github.com/zsh-users/zsh-autosuggestions
[submodule ".config/zsh/plugins/zsh-syntax-highlighting"]
path = .config/zsh/plugins/zsh-syntax-highlighting
url = https://github.com/zsh-users/zsh-syntax-highlighting.git
[submodule ".config/zsh/plugins/zsh-async"]
path = .config/zsh/plugins/zsh-async
url = https://github.com/mafredri/zsh-async

17
.zshenv Normal file
View File

@@ -0,0 +1,17 @@
## Author: druckdev
## Created: 2019-10-21
setopt NO_GLOBAL_RCS
if [ -n "$DESKTOP_SESSION" ]; then
eval $(/usr/bin/gnome-keyring-daemon --start)
export SSH_AUTH_SOCK
fi
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_DATA_HOME="$HOME/.local/share"
export ZDOTDIR="${XDG_CONFIG_HOME:-$HOME/.config}/zsh"
[ ! -r "$ZDOTDIR/.zshenv" ] || . "$ZDOTDIR/.zshenv"

1
dotbot Submodule

Submodule dotbot added at 7ffaa65482

15
install Executable file
View File

@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -e
CONFIG="install.conf.yaml"
DOTBOT_DIR="dotbot"
DOTBOT_BIN="bin/dotbot"
BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "${BASEDIR}"
git -C "${DOTBOT_DIR}" submodule sync --quiet --recursive
git submodule update --init --recursive "${DOTBOT_DIR}"
"${BASEDIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" -d "${BASEDIR}" -c "${CONFIG}" "${@}"

11
install.conf.yaml Normal file
View File

@@ -0,0 +1,11 @@
- shell:
- /bin/sh -c 'tmpd="$(mktemp -d)"; for file in .config/*; do [ ! -e "$HOME/$file" ] || mv "$HOME/$file" "$tmpd"; done; rmdir "$tmpd" 2>/dev/null || { tar czvf "existing-$(date +"%s").tar.gz" "$tmpd" && rm -rf "$tmpd"; }'
- link:
~/.Xresources:
.Xresources
~/.zshenv:
.zshenv
~/.config/:
create: true
glob: true
path: .config/*