Basic updates.
This commit is contained in:
parent
08c122f3fd
commit
a3bd316ea2
12 changed files with 352 additions and 152 deletions
|
@ -2,14 +2,21 @@
|
|||
|
||||
# Cd into a directory using fzf
|
||||
fcd () {
|
||||
dir=$(fd -a --type d --hidden --exclude ".git|.github" | fzf --prompt "Choose directory: ")
|
||||
dir=$(fd -a --type d --hidden --exclude ".git|.github" --color=never | fzf --prompt "Choose directory: ")
|
||||
[ -z $dir ] && return 1
|
||||
cd $dir
|
||||
}
|
||||
|
||||
# Cd into specific repo
|
||||
fr () {
|
||||
dir=$(fd . ~/repos --maxdepth 1 -a --type d --hidden --exclude ".git|.github" --color=never | fzf --prompt "Choose directory: ")
|
||||
[ -z $dir ] && return 1
|
||||
cd $dir
|
||||
}
|
||||
|
||||
# Remove choosed stuff
|
||||
frm () {
|
||||
remove=$(fd --hidden --maxdepth 1 | fzf -m --prompt "Choose to delete: ")
|
||||
remove=$(fd --hidden --maxdepth 1 --color=never | fzf -m --prompt "Choose to delete: ")
|
||||
[ -z $remove ] && return 1
|
||||
rm -rf $(printf '%s' $remove)
|
||||
}
|
||||
|
@ -33,6 +40,7 @@ md () {
|
|||
mvln () {
|
||||
from=$(readlink -f $1)
|
||||
to=$(readlink -f $2)
|
||||
[ ! -d "$(basename $to)" ] && mkdir "$to"
|
||||
mv $from $to
|
||||
ln -s $to $from
|
||||
}
|
||||
|
@ -45,13 +53,17 @@ se() {
|
|||
|
||||
# List my config and open the dir in a editor
|
||||
ce() {
|
||||
fd . ~/.config -L --maxdepth 1 --color=never | fzf --prompt \
|
||||
"Choose config to edit: " --preview 'tree -a -C {}' | xargs -r $EDITOR
|
||||
current=$(pwd)
|
||||
dir=$(fd . ~/.config -L --maxdepth 1 --color=never | fzf --prompt \
|
||||
"Choose config to edit: " --preview 'tree -a -C {}')
|
||||
[ "$dir" = "" ] && return
|
||||
cd "$dir" && nvim .
|
||||
cd "$current"
|
||||
}
|
||||
|
||||
# List files in a directory and edit choosen one
|
||||
vf(){
|
||||
fd -L --maxdepth 1 --type f --color=never --hidden | fzf --prompt "Choose script to edit: " \
|
||||
fd -L --maxdepth 1 --type f --color=never --hidden | fzf --prompt "Choose file to edit: " \
|
||||
--preview 'bat --color=always --style=plain --pager=never {}' | xargs -r $EDITOR
|
||||
}
|
||||
|
||||
|
@ -84,3 +96,31 @@ erm() {
|
|||
printf '%s\n' ""
|
||||
done
|
||||
}
|
||||
|
||||
# Check use flags of package in world
|
||||
u() {
|
||||
cat /var/lib/portage/world | fzf --prompt "Choose package to uninstall: " --preview "equery u {}" --multi
|
||||
}
|
||||
|
||||
# Check dependencies of packages in world
|
||||
d() {
|
||||
cat /var/lib/portage/world | fzf --prompt "Choose package to uninstall: " --preview "emerge -pqe {}"
|
||||
}
|
||||
|
||||
n () {
|
||||
# Block nesting of nnn in subshells
|
||||
[ "${NNNLVL:-0}" -eq 0 ] || {
|
||||
echo "nnn is already running"
|
||||
return
|
||||
}
|
||||
|
||||
# Tempfile location
|
||||
export NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd"
|
||||
|
||||
nnn "$@"
|
||||
|
||||
[ ! -f "$NNN_TMPFILE" ] || {
|
||||
. "$NNN_TMPFILE"
|
||||
rm -f "$NNN_TMPFILE" > /dev/null
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue