diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 15e0a70..b65abfd 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -85,15 +85,16 @@ alias svim="sudoedit" alias fuck='sudo $(fc -ln -1)' # Config -alias i3b="$EDITOR $XDG_CONFIG_HOME/i3/blocks" +alias c="$HOME/.scripts/config.sh" alias i3c="$EDITOR $XDG_CONFIG_HOME/i3/config" alias vrc="$EDITOR $XDG_CONFIG_HOME/vim/vimrc" alias xrc="$EDITOR $XDG_CONFIG_HOME/xorg/xinitrc" -alias Xr="$EDITOR $XDG_CONFIG_HOME/xorg/Xresources" +alias xr="$EDITOR $XDG_CONFIG_HOME/xorg/Xresources" +alias zp="$EDITOR $ZDOTDIR/.zprofile" alias zrc="$EDITOR $ZDOTDIR/.zshrc && source $ZDOTDIR/.zshrc" alias li3="i3-msg restart" -alias lXr="xrdb $XDG_CONFIG_HOME/xorg/Xresources" +alias lxr="xrdb $XDG_CONFIG_HOME/xorg/Xresources" alias lzrc="source $ZDOTDIR/.zshrc" # Pacman diff --git a/.scripts/config.sh b/.scripts/config.sh new file mode 100755 index 0000000..f417c40 --- /dev/null +++ b/.scripts/config.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +# Script that searches config files and scripts + +# Define editor to open file in +EDITOR="$EDITOR" + +# List of locations to search +LOCATIONS="$HOME/.config $HOME/.scripts" + +# Find the files +FILES="$(find -L $LOCATIONS -maxdepth 3 -type f | sort)" +HOME="$(find -L $HOME -maxdepth 1 -type f | sort)" + +# If no name provided +if [ -z "$1" ]; then + SELECTED="$(printf "%s\n%s" "$FILES" "$HOME" \ + | uniq | rofi -dmenu -p "Select file to edit")" + +# Else try to search for that file +else + SELECTED="$(printf "%s\n%s" "$FILES" "$HOME" | grep "$1" | head -n 1)" +fi + +# Start editor with selected file (if any) +[ -n "$SELECTED" ] && $EDITOR "$SELECTED"