Skip to content

Instantly share code, notes, and snippets.

@tsathis
Last active April 16, 2021 02:51
Show Gist options
  • Save tsathis/750071e07b561fa540d9ea48a0896c94 to your computer and use it in GitHub Desktop.
Save tsathis/750071e07b561fa540d9ea48a0896c94 to your computer and use it in GitHub Desktop.
#!/bin/bash
# hello... just a test function
hello_world() {
echo 'Hello there,' $1
}
# Key bindings
bind '"\C-f":"cd_with_fzf\n"'
bind '"\C-o":"open_with_fzf\n"'
open_with_fzf() {
fd-find -t f -H -I | fzf -m --preview="xdg-mime query default {}" | xargs -ro -d "\n" xdg-open 2>&-
}
cd_with_fzf() {
cd / && cd "$(fd -t d | fzf --preview="tree -L 1 {}" --bind="space:toggle-preview" --preview-window=:hidden)"
}
# evn variables
export PATH=/usr/local/cuda-11.1/bin${PATH:+:${PATH}}
# make grep output colorful
alias grep='grep --color=auto'
# fuzzy search
alias z='fzf'
alias apti='sudo apt install'
alias apps='dpkg-query --show | fzf'
alias h='history | fzf'
## turn off screen
alias x='xset -display :0.0 dpms force off'
##<easy-cd>
cdd() {
path='.'
if [ $# -eq 1 ]
then
path=$1
fi
cd $(find $path -type d | z --preview="tree -L 1 {}")
}
alias cdz='cdd'
alias cdz='cdz'
##</easy-cd>
alias yt18='youtube-dl -f 18'
# bat
alias cat='batcat'
alias lsf="fzf --preview 'batcat --color=always --style=numbers --line-range=:500 {}'"
alias lf="lsf"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment