make shortcuts script portable
This commit is contained in:
parent
ed5606dffe
commit
62baa20028
4 changed files with 49 additions and 13 deletions
22
.config/lf/shortcuts
Normal file
22
.config/lf/shortcuts
Normal file
|
@ -0,0 +1,22 @@
|
|||
# NOTE: Managed by shortcuts script
|
||||
map gcf cd ~/.config
|
||||
map gch cd ~/.cache
|
||||
map gco cd ~/Documents/dev
|
||||
map gdk cd ~/Desktop
|
||||
map gdl cd ~/Downloads
|
||||
map gdm cd ~/Documents
|
||||
map gds cd ~/.local/share/stow/dots
|
||||
map gdt cd ~/.local/share
|
||||
map ge cd /etc
|
||||
map gh cd ~
|
||||
map glo cd /usr/local
|
||||
map gle cd ~/.local/libexec
|
||||
map glg cd /var/log
|
||||
map gmn cd /mnt
|
||||
map gms cd ~/Music
|
||||
map gpc cd ~/Pictures
|
||||
map gr cd /
|
||||
map gsc cd ~/.local/bin
|
||||
map gst cd ~/.local/state
|
||||
map gsv cd ~/.local/sv
|
||||
map gvd cd ~/Videos
|
22
.config/zsh/configs/hashes
Normal file
22
.config/zsh/configs/hashes
Normal file
|
@ -0,0 +1,22 @@
|
|||
# NOTE: Managed by shortcuts script
|
||||
hash -d cf=~/.config
|
||||
hash -d ch=~/.cache
|
||||
hash -d co=~/Documents/dev
|
||||
hash -d dk=~/Desktop
|
||||
hash -d dl=~/Downloads
|
||||
hash -d dm=~/Documents
|
||||
hash -d ds=~/.local/share/stow/dots
|
||||
hash -d dt=~/.local/share
|
||||
hash -d e=/etc
|
||||
hash -d h=~
|
||||
hash -d lo=/usr/local
|
||||
hash -d le=~/.local/libexec
|
||||
hash -d lg=/var/log
|
||||
hash -d mn=/mnt
|
||||
hash -d ms=~/Music
|
||||
hash -d pc=~/Pictures
|
||||
hash -d r=/
|
||||
hash -d sc=~/.local/bin
|
||||
hash -d st=~/.local/state
|
||||
hash -d sv=~/.local/sv
|
||||
hash -d vd=~/Videos
|
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -3,9 +3,6 @@
|
|||
.local/share/xkb/compiled/keymap
|
||||
.config/nvim/lazy-lock.json
|
||||
.config/lazygit/state.yml
|
||||
.config/nvim/lua/config/keys.lua
|
||||
.config/gtk-2.0/gtkfilechooser.ini
|
||||
.config/nvim/spell/en.utf-8.add.spl
|
||||
.config/nvim/lua/custom/secrets.lua
|
||||
.config/lf/shortcuts
|
||||
.config/zsh/configs/hashes
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
zsh=$ZDOTDIR/configs/hashes
|
||||
lf=$XDG_CONFIG_HOME/lf/shortcuts
|
||||
nvim=$XDG_CONFIG_HOME/nvim/lua/config/shortcuts.lua
|
||||
zsh=${ZDOTDIR}/configs/hashes
|
||||
lf=${XDG_CONFIG_HOME}/lf/shortcuts
|
||||
nvim=${XDG_CONFIG_HOME}/nvim/lua/config/shortcuts.lua
|
||||
|
||||
clean() {
|
||||
echo "# NOTE: Managed by shortcuts script" >"$zsh"
|
||||
|
@ -18,7 +18,7 @@ write() {
|
|||
while IFS= read -r line; do
|
||||
shortcut=$(echo "$line" | cut -d' ' -f1)
|
||||
path=$(echo "$line" | cut -d' ' -f2)
|
||||
path=$(eval "echo $path")
|
||||
path=$(eval "echo $path" | sed "s|${HOME}|~|g")
|
||||
|
||||
printf "hash -d %s=%s\n" "$shortcut" "$path" >>"$zsh"
|
||||
printf "map g%s cd %s\n" "$shortcut" "$path" >>"$lf"
|
||||
|
@ -26,13 +26,8 @@ write() {
|
|||
done
|
||||
}
|
||||
|
||||
filter() {
|
||||
input=$1
|
||||
sed 's/#.*//;/^$/d;s/ \+/ /g' "$input"
|
||||
}
|
||||
|
||||
clean
|
||||
|
||||
filter "$XDG_CONFIG_HOME/directories" | write
|
||||
sed 's/#.*//;/^$/d;s/ \+/ /g' <"${XDG_CONFIG_HOME}/directories" | write
|
||||
|
||||
finalize
|
||||
|
|
Loading…
Add table
Reference in a new issue