Browse Source

Add quick config edit script

master
Riyyi 5 years ago
parent
commit
97dd1e9171
  1. 7
      .config/zsh/.zshrc
  2. 26
      .scripts/config.sh

7
.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

26
.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"
Loading…
Cancel
Save