1
0
Fork 0
This commit is contained in:
Luca Bilke 2022-09-27 18:34:36 +02:00
commit bbde1c1f1e
11 changed files with 98 additions and 89 deletions

View file

@ -154,7 +154,7 @@ cmd share $curl -F"file=@$fx" https://0x0.snaile.de | xclip -r -selection c
# Bindings
map <c-t> $lf -remote "send $id select '$(fzf)'"
map <c-f> $lf -remote "send $id select '$(cat ${XDG_DATA_HOME:-$HOME/.local/share}/lf/tags | sed 's/:\*$//' | fzf)'"
map <c-f> $lf -remote "send $id select '$(cat ${XDG_DATA_HOME:-$HOME/.local/share}/lf/*tags | sed 's/:\*$//' | fzf)'"
map J $dir=$(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf) && lf -remote "send $id cd $(eval echo $dir)"
map D trash
map <c-d> delete
@ -186,6 +186,3 @@ map gh
# Kitty Specific
map W $setsid -f $TERMINAL -e lf >/dev/null 2>&1
# source directory shortcuts
source "~/.config/lf/shortcutrc"

View file

@ -1,26 +0,0 @@
map Ch cd "/home/luca"
map Cch cd "/home/luca/.cache"
map Ccf cd "/home/luca/.config"
map Cdt cd "/home/luca/.local/share"
map Crr cd "/home/luca/.local/src"
map Csc cd "/home/luca/.local/bin"
map Cmn cd "/mnt"
map Cdl cd "/home/luca/Downloads"
map Cdm cd "/home/luca/Documents"
map Cms cd "/home/luca/Music"
map Cpc cd "/home/luca/Pictures"
map Cvd cd "/home/luca/Videos"
map Cdot cd "/home/luca/.local/share/dotfiles"
map Ebf $$EDITOR "/home/luca/.config/shell/bm-files"
map Ebd $$EDITOR "/home/luca/.config/shell/bm-dirs"
map Ecfx $$EDITOR "/home/luca/.config/x11/xresources"
map EcfX $$EDITOR "/home/luca/.config/x11/xprofile"
map Ecfb $$EDITOR "/home/luca/.local/src/dwmblocks/config.h"
map Ecfk $$EDITOR "/home/luca/.config/kitty/kitty.conf"
map EcfK $$EDITOR "/home/luca/.config/kitty/kittyfullscreen.conf"
map Ecfv $$EDITOR "/home/luca/.config/lvim/config.lua"
map Ecfz $$EDITOR "/home/luca/.config/zsh/.zshrc"
map Ecfa $$EDITOR "/home/luca/.config/shell/aliasrc"
map Ecfp $$EDITOR "/home/luca/.config/shell/profile"
map Ecfl $$EDITOR "/home/luca/.config/lf/lfrc"
map EcfL $$EDITOR "/home/luca/.config/lf/preview"

View file

@ -20,6 +20,7 @@ vim.opt.foldlevelstart = 99
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
lvim.format_on_save = false
lvim.line_wrap_cursor_movement = false
lvim.transparent_window = true
-- Vimwiki Settings
vim.g.vimwiki_ext2syntax = { ['.Rmd'] = 'markdown', ['.rmd'] = 'markdown', ['.md'] = 'markdown',
@ -47,6 +48,14 @@ formatters.setup {
{ command = "black", filetypes = { "python" } },
}
local linters = require "lvim.lsp.null-ls.linters"
linters.setup {
{
command = "shellcheck",
args = { "--severity", "warning" },
},
}
-- Autocommands (https://neovim.io/doc/user/autocmd.html)
vim.api.nvim_create_autocmd({ "BufEnter", "FocusGained", "InsertLeave", "WinEnter" }, {
pattern = "*",

View file

@ -36,7 +36,7 @@ case "$ext" in
cs) mcs "$file" && mono "$base".exe ;;
go) go run "$file" ;;
h) sudo make install ;;
java) javac -d classes "$file" && java -cp classes "${1%.*}" ;;
java) java -d classes "$file" && java -cp classes "${1%.*}" ;;
m) octave "$file" ;;
md) if [ -x "$(command -v lowdown)" ]; then
lowdown --parse-no-intraemph "$file" -Tms | groff -mpdfmark -ms -kept > "$base".pdf

View file

@ -6,28 +6,25 @@ bmfiles="${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-files"
# Output locations. Unactivated progs should go to /dev/null.
shell_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc"
zsh_named_dirs="${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc"
lf_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/lf/shortcutrc"
ranger_shortcuts="/dev/null"
qute_shortcuts="/dev/null"
fish_shortcuts="/dev/null"
vifm_shortcuts="/dev/null"
lf_tags="${XDG_DATA_HOME:-$HOME/.local/share}/lf/shortcut-tags"
tmp="/tmp/shortcut-tmp"
# Remove, prepare files
rm -f "$lf_shortcuts" "$ranger_shortcuts" "$qute_shortcuts" "$zsh_named_dirs" 2>/dev/null
printf "# vim: filetype=sh\\n" > "$fish_shortcuts"
rm -f "$shell_shortcuts" "$lf_tags" "$zsh_named_dirs" 2>/dev/null
printf "# vim: filetype=sh\\nalias " > "$shell_shortcuts"
printf "\" vim: filetype=vim\\n" > "$vifm_shortcuts"
# Format the `directories` file in the correct syntax and sent it to all three configs.
eval "echo \"$(cat "$bmdirs")\"" | \
awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\");
printf(\"%s=\42cd %s && tput cuu1;tput el\42 \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\" ;
printf(\"hash -d %s=%s \n\",\$1,\$2) >> \"$zsh_named_dirs\" ;
printf(\"map C%s cd \42%s\42 \n\",\$1,\$2) >> \"$lf_shortcuts\" }"
printf(\"%s=\42cd %s && tput cuu1;tput el\42 \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\" ;
printf(\"hash -d %s=%s \n\",\$1,\$2) >> \"$zsh_named_dirs\" ;
printf(\"%s:\52\n\",\$2) > \"$tmp\" }"
# Format the `files` file in the correct syntax and sent it to both configs.
eval "echo \"$(cat "$bmfiles")\"" | \
awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\");
printf(\"%s=\42\$EDITOR %s\42 \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\" ;
printf(\"hash -d %s=%s \n\",\$1,\$2) >> \"$zsh_named_dirs\" ;
printf(\"map E%s \$\$EDITOR \42%s\42 \n\",\$1,\$2) >> \"$lf_shortcuts\" }"
printf(\"%s=\42\$EDITOR %s\42 \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\" ;
printf(\"hash -d %s=%s \n\",\$1,\$2) >> \"$zsh_named_dirs\" ;
printf(\"%s:\52\n\",\$2) > \"$tmp\" }"
mv $tmp $lf_tags

View file

@ -9,34 +9,37 @@ for battery in /sys/class/power_supply/BAT?*; do
[ -n "${capacity+x}" ] && printf " "
capacity="$(cat "$battery/capacity" 2>&1)"
case "$(cat "$battery/status" 2>&1)" in
"Full") icon=""; color="$green" ;;
"Charging") icon=""; color="$cyan" ;;
"Not charging") icon=""; color="$white" ;;
"Unknown") icon=""; color="$orange" ;;
"Full") icon=""; color="$green" ;;
"Charging") icon=""; color="$cyan" ;;
"Not charging") icon=""; color="$white" ;;
"Unknown") icon=""; color="$orange" ;;
"Discharging")
if [ "$capacity" -le 10 ]; then
icon=""; color="$red"
icon=""; color="$red"
elif [ "$capacity" -le 20 ]; then
icon=""; color="$red"
icon=""; color="$red"
elif [ "$capacity" -le 30 ]; then
icon=""; color="$white"
icon=""; color="$white"
elif [ "$capacity" -le 40 ]; then
icon=""; color="$white"
icon=""; color="$white"
elif [ "$capacity" -le 50 ]; then
icon=""; color="$white"
icon=""; color="$white"
elif [ "$capacity" -le 60 ]; then
icon=""; color="$white"
icon=""; color="$white"
elif [ "$capacity" -le 70 ]; then
icon=""; color="$white"
icon=""; color="$white"
elif [ "$capacity" -le 80 ]; then
icon=""; color="$white"
icon=""; color="$white"
elif [ "$capacity" -le 90 ]; then
icon=""; color="$white"
icon=""; color="$white"
elif [ "$capacity" -le 95 ]; then
icon=""; color="$white"
else
icon=""; color="$white"
icon=""; color="$white"
fi
;;
*) exit 1 ;;
esac
printf "$color%s$reset %d%%" "$icon" "$capacity";
printf "$color%s$reset %d" "$icon" "$capacity";
done && printf "\\n"

View file

@ -1,18 +1,19 @@
#!/bin/sh
clock=$(date '+%I')
case "$clock" in
"00") icon="" ;;
"01") icon="" ;;
"02") icon="" ;;
"03") icon="" ;;
"04") icon="" ;;
"05") icon="" ;;
"06") icon="" ;;
"07") icon="" ;;
"08") icon="" ;;
"09") icon="" ;;
"10") icon="" ;;
"11") icon="" ;;
"12") icon="" ;;
esac
printf "%s \033[11m%s\033[10m %s\n" "$(date "+%H:%M")" "$icon" "$(date "+%d.%m.%Y")"
# clock=$(date '+%I')
# case "$clock" in
# "00") icon="" ;;
# "01") icon="" ;;
# "02") icon="" ;;
# "03") icon="" ;;
# "04") icon="" ;;
# "05") icon="" ;;
# "06") icon="" ;;
# "07") icon="" ;;
# "08") icon="" ;;
# "09") icon="" ;;
# "10") icon="" ;;
# "11") icon="" ;;
# "12") icon="" ;;
# esac
# printf "%s \033[11m%s\033[10m %s\n" "$(date "+%H:%M")" "$icon" "$(date "+%d.%m.%Y")"
date "+%H:%M "

View file

@ -2,4 +2,4 @@
# $1 should be drive mountpoint, otherwise assumed /.
location=${1:-/}
[ -d "$location" ] || exit
printf "\033[11m%s\033[10m\n" " $(df -h "$location" | awk ' /[0-9]/ {print $3 "/" $2}')"
printf "\033[11m\033[10m %s\n" "$(df -h "$location" | awk ' /[0-9]/ {print $3 "/" $2}')"

View file

@ -1,15 +1,28 @@
#!/bin/sh
if grep -xq 'up' /sys/class/net/w*/operstate 2>/dev/null ; then
percent=$(tail -1 /proc/net/wireless | tr -s ' ' | cut -d ' ' -f3 | sed 's/\.//')
wifi_icon="直"
elif grep -xq 'down' /sys/class/net/w*/operstate 2>/dev/null ; then
grep -xq '0x1003' /sys/class/net/w*/flags && wifi_icon="睊" || wifi_icon=""
else
wifi_icon=""
percent=""
shift=""
if ls /sys/class/net/w*/operstate 1>/dev/null 2>&1; then
for w in /sys/class/net/w*/operstate; do
percent="$(cat /proc/net/wireless | grep "$(basename "$(dirname $w)")" | tr -s ' ' | cut -d ' ' -f3 | tr -dc "[:digit:]")"
grep -vxq '0x1003' && wifi_icon="" || wifi_icon="$(sed "s/up/直/;s/down/睊/" $w | tr -d "[:space:]")"
printf "$shift\033[11m%s\033[10m %s" "$wifi_icon" "$percent"
shift=" "
done
fi
ls /sys/class/net/tun* 1> /dev/null 2>&1 && vpn_icon="$(sed "s/.*/嬨/" /sys/class/net/tun*/operstate 2>/dev/null)" || vpn_icon=""
if ls /sys/class/net/e*/operstate 1>/dev/null 2>&1; then
for e in /sys/class/net/e*/operstate; do
if_icon="$(sed "s/down//;s/up//" $e)"
printf "$shift\033[11m%s\033[10m" "$if_icon"
shift=" "
done
fi
printf "%s%s%s%s\n" "$wifi_icon" "$percent" "$(sed "s/down//;s/up//;s/\n//" /sys/class/net/e*/operstate 2>/dev/null)" "$vpn_icon"
if ls /sys/class/net/tun*/operstate 1>/dev/null 2>&1; then
for _ in /sys/class/net/tun*/operstate; do
printf "$shift\033[11m%s\033[10m" "嬨"
shift=" "
done
fi
printf "\n"

View file

@ -1,6 +1,6 @@
#!/bin/sh
# https://www.maketecheasier.com/ip-address-geolocation-lookups-linux/
loc_addr="$(ip route get 9.9.9.9 | head -1 | cut -d ' ' -f7)"
pub_addr="$(curl icanhazip.com 2>/dev/null)" || exit
pub_addr="$(curl ipv4.icanhazip.com 2>/dev/null)" || exit
# flag="$(grep "flag: " "${XDG_DATA_HOME:-$HOME/.local/share}/emoji" | grep "$(geoiplookup "$addr" | sed 's/.*, //')" | sed 's/ flag: .*//')"
printf "%s %s\n" "$loc_addr" "$pub_addr"

View file

@ -0,0 +1,15 @@
#!/bin/sh
vals=$(aptitude full-upgrade --simulate --assume-yes |\
grep -m1 '^[0-9]\+ packages upgraded,' |\
tr -cd '0-9 ' |\
tr ' ' '\n' |\
grep '[0-9]\+' |\
xargs echo)
print=" "
for i in $vals; do
[ $i != 0 ] && icon="\033[11m\033[10m"
print="$print$i/"
done
[ -n "$icon" ] && printf "$icon " && echo $print | sed 's/\/$//'