Menu
Pimp my Vim
- ale Asynchronous linting/fixing for Vim
- dracula-theme A dark theme for Vim
- fzf-vim Things you can do with fzf and Vim NOTE: Requires** [fzf
- neocomplete.vim Next generation completion framework after neocomplcache
- nerdtree A tree explorer plugin for vim
- the_silver_searcher Vim plugin for the_silver_searcher, 'ag' NOTE: Requires the_silver_searcher
- undotree The ultimate undo history visualizer
- vim-airline lean & mean status/tabline for vim
- vim-commentary comment stuff out easy peasy
- vim-fugitive A Git wrapper so awesome
- vim-gitgutter A Vim plugin which shows a git diff in the gutter (sign column) and stages/undoes hunks.
- vim-go Go development plugin for Vim
- vim-multiple-cursors True Sublime Text style multiple selections for Vim
- vim-surround Quoting/parenthesizing made simple
- vim-terraform Basic vim/terraform integration
- vim-tmux-navigator Seamless navigation between tmux panes and vim splits
- vim-yapf Python linter NOTE: Requires yapf
- shellcheck ShellCheck, a static analysis tool for shell scripts
Pimp my zsh
Set PYTHONPATH when in poetry environment
# Update PYTHONPATH with the project directory when entering a Poetry environment
function poetry_enter() {
local project_dir
project_dir=$(poetry run python -c 'import os; print(os.path.dirname(os.path.realpath("pyproject.toml")))')
if [[ -n "$project_dir" ]]; then
# Check if any parent directory is already present in PYTHONPATH
local parent_dir
parent_dir=$project_dir
while [[ "$parent_dir" != "/" ]]; do
if [[ ":$PYTHONPATH:" == *":$parent_dir:"* ]]; then
return
fi
parent_dir=$(dirname "$parent_dir")
done
export PYTHONPATH="$project_dir:$PYTHONPATH"
fi
}
# Remove PYTHONPATH when exiting a Poetry environment
function poetry_exit() {
unset PYTHONPATH
}
# Check if current or parent directory contains the pyproject.toml file
function is_in_poetry_project() {
local dir
dir=$PWD
while [[ "$dir" != "/" ]]; do
if [[ -f "$dir/pyproject.toml" ]]; then
return 0
fi
dir=$(dirname "$dir")
done
return 1
}
# Hook into directory changes and activate/deactivate PYTHONPATH accordingly
function chpwd() {
if is_in_poetry_project; then
poetry_enter
else
poetry_exit
fi
}
iTerm Move cursor with ctrl + arrow keys
Set it to work using option (⌥) + arrows
bindkey "\e\e[D" backward-word
bindkey "\e\e[C" forward-word
Prefered Theme
Plugins
- https://www.freecodecamp.org/news/jazz-up-your-zsh-terminal-in-seven-steps-a-visual-guide-e81a8fd59a38/
- zsh Your terminal never felt this good before
- oh-my-zsh Framework for managing your zsh configuration
- zsh-completions [Additional completion definitions for Zsh)
- zsh-syntax-highlighting Fish shell like syntax highlighting for Zsh.
- bat A cat(1) clone with wings
- Automaticaly switch to Vevn
Modern Unix
- Cool tools that helps making the terminal even better modern-unix
Aliases
alias lql='ls -lA *sql'
alias hg='history | grep'
alias pd='$HOME/workspace/scripts/pd.sh'
alias cat='bat'
#alias python='python3'
alias ipython='ipython3'
alias ptp='ptpython3'
alias stree='tree -I \'igore1|ignore2|ignore3_*\''
FZF
### fzf ############################
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
export FZF_DEFAULT_OPTS='-m --color fg:-1,bg:-1,hl:120,fg+:3,bg+:233,hl+:229 --color info:140,prompt:120,spinner:150,pointer:167,marker:174'
# fe - Open the selected files with the default editor
fe() {
local files=$(fzf --query="$1" --select-1 --exit-0 | sed -e "s/\(.*\)/\'\1\'/")
local command="${EDITOR:-vim} -p $files"
[ -n "$files" ] && eval $command
}
# fag - find an argument with ag and fzf and open with vim
fag() {
[ $# -eq 0 ] && return
local out cols
if out=$(ag --nogroup --color "$@" | fzf --ansi); then
setopt sh_word_split
cols=(${out//:/ })
unsetopt sh_word_split
vim ${cols[1]} +"normal! ${cols[2]}zz"
fi
}
# cdf - cd into the directory of the selected file\
cdf() {
local file
local dir
file=$(fzf +m -q "$1") && dir=$(dirname "$file") && cd "$dir"
}
fep() {
local files=$(fzf --query="$1" --select-1 --exit-0 --preview="bat --color=always {}" --preview-window=right:50%:wrap | sed -e "s/\(.*\)/\'\1\'/")
local command="${EDITOR:-vim} -p $files"
[ -n "$files" ] && eval $command
}
#####################################
Other Stuff
- Change your PS1 BashRC Generator
- Configure crontab schedule Crontab Guru
pd.sh
#!/bin/bash
export LC_ALL=C
head /dev/urandom | tr -dc 'A-Za-z0-9"#$%&'\''()*+,-./:;<=>?@[\]^_`{|}~' | head -c 30 ; echo ''
Mac
Upgrade bash from 3.2.57 to 5.x
Mac comes with bash 3.2.57
due to licensing issues. in order to upgrade to the latest version (5.1.12 / Dec, 2021), run
brew install bash
newbash="$(echo $(brew --prefix)/bin/bash | sudo tee -a /private/etc/shells)"
sudo chpass -s $newbash
Modifier Keys
When using mac with external keyboard, it's best to modify the keys to comply with Mac layout. I set this way:
- Caps Lock > Caps Lock
- Control > Control
- Option > Command
- Command > Option
- Function > fn (function)
Make sure to select the correct keyboard on the upper drop down menu.
IDE extensions
- Tabnine - TabNine uses deep learning to help you write code faster.
Kubernetes
- K3s - Lightweight Kubernetes https://k3s.io
- K9s - Kubernetes CLI To Manage Your Clusters In Style
- PGcli - Pgcli is a command line interface for Postgres with auto-completion and syntax highlighting.