- Published on
.zshrc file for penetration testing
- Authors
- Name
- Chris Alupului
- @chrisalupului
my zshrc file
plugins=(git eza zsh-autosuggestions grc sudo colorize zsh-syntax-highlighting tmux)
ZSH_COLORIZE_STYLE="colorful"
ZSH_TMUX_AUTOSTART=true
#Alias
alias nmap='grc nmap'
alias ls='eza -a --color=always --group-directories-first --icons'
alias la='eza -la --color=always --group-directories-first --icons'
alias cat='batcat'
fzf
# Set up fzf key bindings and fuzzy completion
source <(fzf --zsh)
export FZF_DEFAULT_COMMAND="fd --hidden --strip-cwd-prefix --exclude .git"
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
export FZF_ALT_C_COMMAND="fd --type=d --hidden --strip-cwd-prefix"
export FZF_DEFAULT_OPTS="--height 70% --layout=reverse --border --color=hl:#2dd4bf"
# fzf default for tmux
export FZF_TMUX_OPTS=" -p100%,100% "
# setup fzf previews
# pwd without nano
#export FZF_CTRL_T_OPTS="--preview 'batcat --color=always -n --line-range :500 {}'"
# open with nano
export FZF_CTRL_T_OPTS="--preview 'batcat --color=always -n --line-range :500 {}' --bind 'enter:execute(nano {})'"
export FZF_ALT_C_OPTS="--preview 'eza --tree --color=always {} | head -200'"
@Link1995Kid
from Youtube!
Shoutout to @chrisalupului this preview command allows us to adapt preview based on selected file or folder:
fzf --preview '([[ -r {} && ! -d {} ]] && (file --mime-type -b {} | grep -qE '\''^(text|application/(x-shellscript|json|xml|javascript))'\'' && batcat --color=always --terminal-width $(tput cols) -n --line-range :500 {} || file {} | cut -d: -f2) || ([[ -d {} ]] && eza --tree --color=always {} | head -200 || file {} | cut -d: -f2))'
It use batcat to display readable
files, eza to display directories and file otherwise.