Compare commits
13 Commits
zsh
..
ac8fc8529b
| Author | SHA1 | Date | |
|---|---|---|---|
| ac8fc8529b | |||
| e6b082f38c | |||
| 614a57652f | |||
| 80a119972f | |||
| 05d3aaa8dd | |||
| 9afb3328ba | |||
| e866e94303 | |||
| 283b4f0e56 | |||
| 01035f61bd | |||
| 1f697ecc23 | |||
| 4703c6c492 | |||
| a9aa507b4c | |||
| f2cb448b37 |
@@ -0,0 +1,2 @@
|
|||||||
|
env.nu
|
||||||
|
history.txt
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
# Disable global autocomplete
|
|
||||||
skip_global_compinit=1
|
|
||||||
|
|
||||||
# Set ZFS Directory
|
|
||||||
ZDOTDIR=~/.config/zsh
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
# History
|
|
||||||
export HISTFILE=$XDG_CACHE_HOME/zsh/.zsh_history
|
|
||||||
export HISTSIZE=10000
|
|
||||||
export SAVEHIST=10000
|
|
||||||
setopt HIST_IGNORE_ALL_DUPS
|
|
||||||
setopt HIST_FIND_NO_DUPS
|
|
||||||
|
|
||||||
# Bitwarden ssh agent
|
|
||||||
export SSH_AUTH_SOCK=/home/lumen/.bitwarden-ssh-agent.sock
|
|
||||||
|
|
||||||
# Editors
|
|
||||||
export EDITOR="nvim"
|
|
||||||
export VISUAL="nvim"
|
|
||||||
|
|
||||||
# Disable Global autocomplete
|
|
||||||
export skip_global_compinit=1
|
|
||||||
|
|
||||||
# Autocomplete
|
|
||||||
source $ZDOTDIR/modules/completion.zsh
|
|
||||||
|
|
||||||
# Allow CTRL+Arrow move
|
|
||||||
bindkey "^[[1;5C" forward-word
|
|
||||||
bindkey "^[[1;5D" backward-word
|
|
||||||
|
|
||||||
# Prompt
|
|
||||||
prompt_builder() {
|
|
||||||
local EXITCODE=$?
|
|
||||||
if [ $UID = 0 ] && [ $EXITCODE = 0 ]; then
|
|
||||||
PROMPT=$'%F{red}%~ %B%F{red}#%F{red}>%f%b '
|
|
||||||
RPROMPT='%F{white}%? %F{red}%n'
|
|
||||||
elif [ $UID = 0 ]; then
|
|
||||||
PROMPT=$'%F{red}%~ %B%F{red}#%F{red}>%f%b '
|
|
||||||
RPROMPT=$'%F{red}%? %F{red}%n'
|
|
||||||
elif [ $UID != 0 ] && [ $EXITCODE = 0 ]; then
|
|
||||||
PROMPT=$'%F{white}%~ %B%F{blue}>%f%b '
|
|
||||||
RPROMPT='%F{white}%? %F{white}%n'
|
|
||||||
else
|
|
||||||
PROMPT=$'%F{white}%~ %B%F{blue}>%f%b '
|
|
||||||
RPROMPT=$'%F{red}%? %F{white}%n'
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
precmd_functions+=(prompt_builder)
|
|
||||||
|
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
export def lumen-assono-backup-nexttape [dateinput: datetime]: nothing -> nothing {
|
||||||
|
print 'Next Required Tape:'
|
||||||
|
print $'($dateinput | get-backup-string)'
|
||||||
|
print ''
|
||||||
|
print 'Tapes after that:'
|
||||||
|
|
||||||
|
1..9 | each {|i|
|
||||||
|
print $'($i): (($dateinput + ((7 * $i) | into duration -u day)) | get-backup-string)'
|
||||||
|
} | ignore
|
||||||
|
}
|
||||||
|
|
||||||
|
def get-backup-string []: datetime -> string {
|
||||||
|
let backupDay = $in - ($in | format date '%w' | into duration -u day) + 6day
|
||||||
|
let saturdayOfMonth = $backupDay | get-week-of-month
|
||||||
|
let monthOfQuarter = $backupDay | get-month-of-quarter
|
||||||
|
let quarter = $backupDay | get-quarter
|
||||||
|
let year = $backupDay | get-year
|
||||||
|
if ($saturdayOfMonth == 1) {
|
||||||
|
if ($monthOfQuarter == 1) {
|
||||||
|
if ($quarter == 1) {
|
||||||
|
$'TapeLTO5-Y(($year | into string | str substring 3..))'
|
||||||
|
} else {
|
||||||
|
$'TapeLTO5-Q($quarter)'
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$'TapeLTO5-M($monthOfQuarter)'
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$'TapeLTO5-W($saturdayOfMonth)'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def get-week-of-month []: datetime -> int {
|
||||||
|
let firstDay = ($in - ($in | format date '%d' | into duration -u day) + 1day)
|
||||||
|
let $firstSpecificDay = $firstDay + (((($in | format date '%w' | into int) + 7 - ($firstDay | format date '%w' | into int)) mod 7) | into duration -u day)
|
||||||
|
((($in - $firstSpecificDay) | into int | into datetime | format date '%d' | into int) / 7 | math floor) + 1
|
||||||
|
}
|
||||||
|
|
||||||
|
def get-month-of-quarter []: datetime -> int {
|
||||||
|
let month = ($in | format date '%m' | into int) + 3
|
||||||
|
($month..($month - 3)..1) | last
|
||||||
|
}
|
||||||
|
|
||||||
|
def get-quarter []: datetime -> int {
|
||||||
|
(($in | format date '%m') | into int) / 3 | math ceil
|
||||||
|
}
|
||||||
|
|
||||||
|
def get-year []: datetime -> int {
|
||||||
|
$in | format date '%Y'
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
export def lumen-assono-overtime-calc [startdate: datetime]: nothing -> string {
|
||||||
|
pwsh -command $'Invoke-assOrgaOvertimeCalculator ($startdate | format date '%d/%m/%Y')'
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
export def lumen-assono-worktime-calc [datestr: string]: nothing -> string {
|
||||||
|
let $datestr = $datestr | str replace ' +' ' '
|
||||||
|
mut $dateArray = []
|
||||||
|
let $rawDateArray = $datestr | split row ' '
|
||||||
|
if (($rawDateArray | length) mod 2 == 1) {
|
||||||
|
mut $spliceCounter = true
|
||||||
|
for $i in $rawDateArray {
|
||||||
|
if ($spliceCounter) {
|
||||||
|
$dateArray = $dateArray | append $i
|
||||||
|
}
|
||||||
|
$spliceCounter = not $spliceCounter
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$dateArray = $rawDateArray
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($dateArray | length) mod 2 == 1) {
|
||||||
|
error make {msg: 'Uneven Times given!'}
|
||||||
|
}
|
||||||
|
|
||||||
|
mut $dateArrayOutput = []
|
||||||
|
mut $dateArrayOutputBuilderCounter = true
|
||||||
|
for $i in $dateArray {
|
||||||
|
$dateArrayOutput = $dateArrayOutput | append ($i | date from-human | format date '%H:%M')
|
||||||
|
if ($dateArrayOutputBuilderCounter) {
|
||||||
|
$dateArrayOutput = $dateArrayOutput | append '-'
|
||||||
|
} else {
|
||||||
|
$dateArrayOutput = $dateArrayOutput | append '|'
|
||||||
|
}
|
||||||
|
$dateArrayOutputBuilderCounter = not $dateArrayOutputBuilderCounter
|
||||||
|
}
|
||||||
|
let $dateArrayOutput = ($dateArrayOutput | drop 1) | str join ' '
|
||||||
|
|
||||||
|
# $dateArray[0]
|
||||||
|
mut $hours = 0min
|
||||||
|
while (($dateArray | length) > 0) {
|
||||||
|
$hours += ($dateArray | get 1 | into datetime) - ($dateArray | get 0 | into datetime)
|
||||||
|
$dateArray = $dateArray | skip 2
|
||||||
|
}
|
||||||
|
$"($dateArrayOutput)\n($hours | into string)"
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
export def lumen-kwin-get-class [waittimesec: int]: nothing -> string {
|
||||||
|
for $i in $waittimesec..1 {
|
||||||
|
$i | print
|
||||||
|
sleep 1sec
|
||||||
|
}
|
||||||
|
qdbus6 org.kde.KWin /KWin queryWindowInfo
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
export def lumen-search-content [searchstr: string]: any -> table {
|
||||||
|
let $tmp = (if ($in != null) {
|
||||||
|
$in
|
||||||
|
} else {
|
||||||
|
pwd
|
||||||
|
})
|
||||||
|
cd $tmp
|
||||||
|
ls -a **/* | par-each {|i|
|
||||||
|
{file: $i.name,
|
||||||
|
content: (if (($i | get type) == file ) {
|
||||||
|
try {open $i.name --raw | find $searchstr} catch {{}}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} | compact content -e
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# config.nu
|
||||||
|
#
|
||||||
|
# Installed by:
|
||||||
|
# version = "0.104.1"
|
||||||
|
#
|
||||||
|
# This file is used to override default Nushell settings, define
|
||||||
|
# (or import) custom commands, or run any other startup tasks.
|
||||||
|
# See https://www.nushell.sh/book/configuration.html
|
||||||
|
#
|
||||||
|
# This file is loaded after env.nu and before login.nu
|
||||||
|
#
|
||||||
|
# You can open this file in your default editor using:
|
||||||
|
# config nu
|
||||||
|
#
|
||||||
|
# See `help config nu` for more options
|
||||||
|
#
|
||||||
|
# You can remove these comments if you want or leave
|
||||||
|
# them for future reference.
|
||||||
|
|
||||||
|
$env.config.show_banner = false
|
||||||
|
$env.EDITOR = 'hx'
|
||||||
|
$env.VISUAL = 'hx'
|
||||||
|
$env.SSH_AUTH_SOCK = '/home/lumen/.bitwarden-ssh-agent.sock'
|
||||||
@@ -1,97 +0,0 @@
|
|||||||
# +---------+
|
|
||||||
# | General |
|
|
||||||
# +---------+
|
|
||||||
|
|
||||||
# Load more completions
|
|
||||||
fpath=($ZSH/plugins/completions $fpath)
|
|
||||||
|
|
||||||
# Should be called before compinit
|
|
||||||
zmodload zsh/complist
|
|
||||||
|
|
||||||
# Use hjlk in menu selection (during completion)
|
|
||||||
# Doesn't work well with interactive mode
|
|
||||||
bindkey -M menuselect 'h' vi-backward-char
|
|
||||||
bindkey -M menuselect 'k' vi-up-line-or-history
|
|
||||||
bindkey -M menuselect 'j' vi-down-line-or-history
|
|
||||||
bindkey -M menuselect 'l' vi-forward-char
|
|
||||||
|
|
||||||
bindkey -M menuselect '^xg' clear-screen
|
|
||||||
bindkey -M menuselect '^xi' vi-insert # Insert
|
|
||||||
bindkey -M menuselect '^xh' accept-and-hold # Hold
|
|
||||||
bindkey -M menuselect '^xn' accept-and-infer-next-history # Next
|
|
||||||
bindkey -M menuselect '^xu' undo # Undo
|
|
||||||
|
|
||||||
autoload -U compinit; compinit -d $XDG_CACHE_HOME/zsh/.zcompdump
|
|
||||||
_comp_options+=(globdots) # With hidden files
|
|
||||||
|
|
||||||
# Only work with the Zsh function vman
|
|
||||||
# See $DOTFILES/zsh/scripts.zsh
|
|
||||||
compdef vman="man"
|
|
||||||
|
|
||||||
# +---------+
|
|
||||||
# | Options |
|
|
||||||
# +---------+
|
|
||||||
|
|
||||||
# setopt GLOB_COMPLETE # Show autocompletion menu with globs
|
|
||||||
setopt MENU_COMPLETE # Automatically highlight first element of completion menu
|
|
||||||
setopt AUTO_LIST # Automatically list choices on ambiguous completion.
|
|
||||||
setopt COMPLETE_IN_WORD # Complete from both ends of a word.
|
|
||||||
|
|
||||||
# +---------+
|
|
||||||
# | zstyles |
|
|
||||||
# +---------+
|
|
||||||
|
|
||||||
# Ztyle pattern
|
|
||||||
# :completion:<function>:<completer>:<command>:<argument>:<tag>
|
|
||||||
|
|
||||||
# Define completers
|
|
||||||
zstyle ':completion:*' completer _extensions _complete _approximate
|
|
||||||
|
|
||||||
# Use cache for commands using cache
|
|
||||||
zstyle ':completion:*' use-cache on
|
|
||||||
zstyle ':completion:*' cache-path "$XDG_CACHE_HOME/zsh/.zcompcache"
|
|
||||||
# Complete the alias when _expand_alias is used as a function
|
|
||||||
zstyle ':completion:*' complete true
|
|
||||||
|
|
||||||
zle -C alias-expension complete-word _generic
|
|
||||||
bindkey '^Xa' alias-expension
|
|
||||||
zstyle ':completion:alias-expension:*' completer _expand_alias
|
|
||||||
|
|
||||||
# Use cache for commands which use it
|
|
||||||
|
|
||||||
# Allow you to select in a menu
|
|
||||||
zstyle ':completion:*' menu select
|
|
||||||
|
|
||||||
# Autocomplete options for cd instead of directory stack
|
|
||||||
zstyle ':completion:*' complete-options true
|
|
||||||
|
|
||||||
zstyle ':completion:*' file-sort modification
|
|
||||||
|
|
||||||
|
|
||||||
zstyle ':completion:*:*:*:*:corrections' format '%F{yellow}!- %d (errors: %e) -!%f'
|
|
||||||
zstyle ':completion:*:*:*:*:descriptions' format '%F{blue}-- %D %d --%f'
|
|
||||||
zstyle ':completion:*:*:*:*:messages' format ' %F{purple} -- %d --%f'
|
|
||||||
zstyle ':completion:*:*:*:*:warnings' format ' %F{red}-- no matches found --%f'
|
|
||||||
# zstyle ':completion:*:default' list-prompt '%S%M matches%s'
|
|
||||||
# Colors for files and directory
|
|
||||||
zstyle ':completion:*:*:*:*:default' list-colors ${(s.:.)LS_COLORS}
|
|
||||||
|
|
||||||
# Only display some tags for the command cd
|
|
||||||
zstyle ':completion:*:*:cd:*' tag-order local-directories directory-stack path-directories
|
|
||||||
# zstyle ':completion:*:complete:git:argument-1:' tag-order !aliases
|
|
||||||
|
|
||||||
# Required for completion to be in good groups (named after the tags)
|
|
||||||
zstyle ':completion:*' group-name ''
|
|
||||||
|
|
||||||
zstyle ':completion:*:*:-command-:*:*' group-order aliases builtins functions commands
|
|
||||||
|
|
||||||
# See ZSHCOMPWID "completion matching control"
|
|
||||||
zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
|
|
||||||
|
|
||||||
zstyle ':completion:*' keep-prefix true
|
|
||||||
|
|
||||||
zstyle -e ':completion:*:(ssh|scp|sftp|rsh|rsync):hosts' hosts 'reply=(${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) /dev/null)"}%%[# ]*}//,/ })'
|
|
||||||
|
|
||||||
## For kubernetes
|
|
||||||
#source $DOTFILES/zsh/plugins/kubectl-completion/_kubectl
|
|
||||||
#zstyle ':completion:*:*:kubectl:*' list-grouped false
|
|
||||||
Reference in New Issue
Block a user