stable and currently used dotfiles
This commit is contained in:
73
.zshrc
Normal file
73
.zshrc
Normal file
@@ -0,0 +1,73 @@
|
||||
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
|
||||
# Initialization code that may require console input (password prompts, [y/n]
|
||||
# confirmations, etc.) must go above this block; everything else may go below.
|
||||
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
|
||||
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
|
||||
fi
|
||||
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
|
||||
|
||||
|
||||
#ZSH_THEME="gozilla"
|
||||
ZSH_THEME="powerlevel10k/powerlevel10k"
|
||||
export ZSH="$HOME/.oh-my-zsh"
|
||||
|
||||
source "$HOME/.config/zsh/utilities.sh"
|
||||
|
||||
# Path
|
||||
pathadd "$HOME/.local/bin"
|
||||
|
||||
# Initializing plugins
|
||||
plugins=(
|
||||
git
|
||||
zoxide
|
||||
fast-syntax-highlighting
|
||||
zsh-autocomplete
|
||||
zsh-syntax-highlighting
|
||||
zsh-autosuggestions
|
||||
fzf-tab
|
||||
aws
|
||||
autoupdate
|
||||
)
|
||||
|
||||
source $ZSH/oh-my-zsh.sh
|
||||
autoload -Uz compinit
|
||||
compinit -i -u
|
||||
eval "$(zoxide init zsh --cmd cd)"
|
||||
zstyle ':completion:*' completer _extensions _expand _expand_alias _complete _approximate _correct _ignored
|
||||
zstyle ':completion:*' squeeze-slashes true
|
||||
zstyle ':completion:*' use-cache on
|
||||
zstyle ':completion:*' cache-path "$XDG_CACHE_HOME/zsh/.zcompcache"
|
||||
zstyle ':completion:*' menu select
|
||||
source <(kubectl completion zsh)
|
||||
|
||||
export FZF_DEFAULT_OPTS="--cycle --no-sort --reverse --border=rounded --header-first --prompt=' ' --pointer='' --marker=' '"
|
||||
bindkey '\t' menu-select "$terminfo[kcbt]" menu-select
|
||||
bindkey -M menuselect '\t' menu-complete "$terminfo[kcbt]" reverse-menu-complete
|
||||
|
||||
source "$HOME/.config/zsh/aliases.sh"
|
||||
source "$HOME/.config/zsh/aws.sh"
|
||||
|
||||
# >>> conda initialize >>>
|
||||
# !! Contents within this block are managed by 'conda init' !!
|
||||
__conda_setup="$("$HOME/.miniconda3/bin/conda" 'shell.zsh' 'hook' 2> /dev/null)"
|
||||
if [ $? -eq 0 ]; then
|
||||
eval "$__conda_setup"
|
||||
else
|
||||
if [ -f "$HOME/.miniconda3/etc/profile.d/conda.sh" ]; then
|
||||
. "$HOME/.miniconda3/etc/profile.d/conda.sh"
|
||||
else
|
||||
export PATH="$HOME/.miniconda3/bin:$PATH"
|
||||
fi
|
||||
fi
|
||||
unset __conda_setup
|
||||
# <<< conda initialize <<<
|
||||
|
||||
# Initialize toolbox env
|
||||
source "$HOME/.config/zsh/toolbox.sh"
|
||||
container=${container:-""}
|
||||
if [ "$container" = "oci" ]; then
|
||||
toolbox_entrypoint
|
||||
else
|
||||
alias docker="podman"
|
||||
fi
|
||||
|
||||
16
README.md
16
README.md
@@ -1,3 +1,17 @@
|
||||
# dotfiles
|
||||
|
||||
My personal dotfiles for Neovim, ZSH, Termux and many more
|
||||
My personal dotfiles for Neovim, ZSH, Termux and many more
|
||||
|
||||
## Utilities needed
|
||||
* [fzf](https://github.com/junegunn/fzf)
|
||||
* zsh with [ohmyzsh](https://github.com/ohmyzsh/ohmyzsh)
|
||||
* [eza](https://github.com/eza-community/eza)
|
||||
* [bat](https://github.com/sharkdp/bat) with [batextras](https://github.com/eth-p/bat-extras/tree/master)
|
||||
* [fd](https://github.com/sharkdp/fd)
|
||||
* [ripgrep](https://github.com/BurntSushi/ripgrep)
|
||||
* [zoxide](https://github.com/ajeetdsouza/zoxide)
|
||||
* tmux
|
||||
* alacritty
|
||||
* neovim
|
||||
|
||||
|
||||
|
||||
28
alacritty/alacritty.toml
Normal file
28
alacritty/alacritty.toml
Normal file
@@ -0,0 +1,28 @@
|
||||
[env]
|
||||
TERM = "xterm-256color"
|
||||
|
||||
[font]
|
||||
size = 13
|
||||
|
||||
[font.bold]
|
||||
family = "IosevkaTerm Nerd Font"
|
||||
style = "Bold"
|
||||
|
||||
[font.italic]
|
||||
family = "IosevkaTerm Nerd Font"
|
||||
style = "Italic"
|
||||
|
||||
[font.normal]
|
||||
family = "IosevkaTerm Nerd Font"
|
||||
style = "Light"
|
||||
|
||||
[shell]
|
||||
args = ["-l", "-c", "tmux"]
|
||||
program = "/bin/zsh"
|
||||
|
||||
[window]
|
||||
opacity = 0.9
|
||||
|
||||
[window.padding]
|
||||
x = 5
|
||||
y = 5
|
||||
1
nvim
Submodule
1
nvim
Submodule
Submodule nvim added at 7ecd6f5c97
79
tmux/tmux.conf
Normal file
79
tmux/tmux.conf
Normal file
@@ -0,0 +1,79 @@
|
||||
# List of plugins
|
||||
set -g @plugin 'tmux-plugins/tpm'
|
||||
set -g @plugin 'tmux-plugins/tmux-sensible'
|
||||
set -g status off
|
||||
|
||||
set -g @plugin 'catppuccin/tmux'
|
||||
set -g @catppuccin_flavour 'macchiato' # or frappe, macchiato, mocha
|
||||
set -g @plugin 'tmux-plugins/tmux-resurrect'
|
||||
set -g @plugin 'tmux-plugins/tmux-continuum'
|
||||
|
||||
set-option -sg escape-time 10
|
||||
set-option -g focus-events on
|
||||
|
||||
set -g default-terminal 'tmux-256color'
|
||||
set -ag terminal-overrides ",xterm-256color:RGB"
|
||||
set-option -g detach-on-destroy off
|
||||
|
||||
# remap prefix from 'C-b' to 'C-a'
|
||||
unbind C-b
|
||||
set-option -g prefix C-z
|
||||
bind-key C-z send-prefix
|
||||
|
||||
# split panes using h and v
|
||||
bind c new-window -c "#{pane_current_path}"
|
||||
bind v split-window -h -c "#{pane_current_path}"
|
||||
bind h split-window -v -c "#{pane_current_path}"
|
||||
unbind '"'
|
||||
unbind %
|
||||
|
||||
# reload config file (change file location to your the tmux.conf you want to use)
|
||||
bind r source-file $HOME/.config/tmux/tmux.conf
|
||||
|
||||
# switch panes using Alt-arrow without prefix
|
||||
bind -n M-Left select-pane -L
|
||||
bind -n M-Right select-pane -R
|
||||
bind -n M-Up select-pane -U
|
||||
bind -n M-Down select-pane -D
|
||||
|
||||
# Copy and Paste the normal way
|
||||
bind Y copy-mode
|
||||
setw -g mode-keys vi
|
||||
bind-key -T copy-mode-vi v send -X begin-selection
|
||||
bind-key -T copy-mode-vi 'C-v' send -X rectangle-toggle
|
||||
|
||||
# Copy selection to clipboard
|
||||
# Adapted from https://unix.stackexchange.com/questions/348913/copy-selection-to-a-clipboard-in-tmux
|
||||
set -g mouse on
|
||||
set -g set-clipboard off
|
||||
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "wl-copy"
|
||||
bind-key -T copy-mode MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "wl-copy"
|
||||
|
||||
bind s display-popup -E "\
|
||||
tmux list-sessions -F '#{?session_attached,,#{session_name}}' |\
|
||||
sed '/^$/d' |\
|
||||
fzf --reverse --preview 'tmux capture-pane -pt {}' |\
|
||||
xargs tmux switch-client -t"
|
||||
|
||||
bind q display-menu -x W -y S \
|
||||
"New Session" S "command-prompt -p 'New Session:' 'new-session -A -s %%'" \
|
||||
"Kill Session" x kill-session \
|
||||
"Kill Other Session(s)" X "kill-session -a" \
|
||||
"Rename Session" r "command-prompt -p 'New name:' 'rename-session %%'" \
|
||||
"" \
|
||||
"New Window" m new-window \
|
||||
"Kill Window" k kill-window \
|
||||
"Choose Window" w choose-window \
|
||||
"Previous Window" ← previous-window \
|
||||
"Next Window" → next-window \
|
||||
"Swap Window Right" ↑ "swap-window -t -1" \
|
||||
"Swap Window Left" ↓ "swap-window -t +1" \
|
||||
"" \
|
||||
"Swap Pane Up" < "swap-pane -U" \
|
||||
"Swap Pane Down" > "swap-pane -D" \
|
||||
"Break Pane" t break-pane \
|
||||
"Join Pane" j "choose-window 'join-pane -h -s %%'"
|
||||
|
||||
|
||||
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
|
||||
run '~/.tmux/plugins/tpm/tpm'
|
||||
16
zsh/aliases.sh
Normal file
16
zsh/aliases.sh
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
alias findfiles="fd --type file --type symlink --strip-cwd-prefix | fzf --ansi --prompt=' ' --header=' Find file' --preview='bat --style header,grid,numbers --color always {}'"
|
||||
alias findtext="rg --smart-case --field-match-separator ' ' --line-number --with-filename --no-heading --color=always . | fzf -d ' ' -n 2.. --ansi --prompt=' ' --header=' Find Text' --preview 'bat --color=always {1} --highlight-line {2}' --preview-window ~8,+{2}-5"
|
||||
alias ff=findfiles
|
||||
alias ft=findtext
|
||||
alias cd="z"
|
||||
alias ls="eza --icons"
|
||||
alias ll="eza -lah --icons"
|
||||
alias cat="bat"
|
||||
alias tree="eza -Tah --icons"
|
||||
alias vim="nvim"
|
||||
alias man="batman"
|
||||
alias clc="clipcopy"
|
||||
alias clp="clippaste"
|
||||
|
||||
20
zsh/aws.sh
Normal file
20
zsh/aws.sh
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
function assume-role() {
|
||||
OUT=$(aws sts assume-role --role-arn $1 --role-session-name $2)
|
||||
if [ "$?" -ne 0 ]; then
|
||||
return 1
|
||||
fi
|
||||
export AWS_ACCESS_KEY_ID=$(echo $OUT | jq -r '.Credentials''.AccessKeyId')
|
||||
export AWS_SECRET_ACCESS_KEY=$(echo $OUT | jq -r '.Credentials''.SecretAccessKey')
|
||||
export AWS_SESSION_TOKEN=$(echo $OUT | jq -r '.Credentials''.SessionToken')
|
||||
export AWS_DEFAULT_REGION=$2;
|
||||
return 0
|
||||
}
|
||||
|
||||
function resign-role() {
|
||||
unset AWS_ACCESS_KEY_ID
|
||||
unset AWS_SECRET_ACCESS_KEY
|
||||
unset AWS_SESSION_TOKEN
|
||||
unset AWS_DEFAULT_REGION
|
||||
}
|
||||
|
||||
28
zsh/kubectl.sh
Normal file
28
zsh/kubectl.sh
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
klogs() {
|
||||
# Definir um manipulador de sinal para SIGINT
|
||||
trap 'echo "Interrompido. Parando todos os logs..."; kill $(jobs -pr); exit' SIGINT
|
||||
|
||||
# Obter todos os pods em todos os namespaces
|
||||
pods=$(kubectl get pods --all-namespaces -o jsonpath='{range .items[*]}{.metadata.namespace}{" "}{.metadata.name}{"\n"}{end}')
|
||||
|
||||
# Usar fzf para selecionar múltiplos pods com preview dos logs
|
||||
selected_pods=$(echo "$pods" | fzf --multi --preview 'kubectl logs --namespace $(echo {} | cut -d" " -f1) $(echo {} | cut -d" " -f2) -n 20')
|
||||
|
||||
# Verificar se algum pod foi selecionado
|
||||
if [ -n "$selected_pods" ]; then
|
||||
# Para cada pod selecionado, exibir os logs em paralelo
|
||||
echo "$selected_pods" | while read -r line; do
|
||||
namespace=$(echo "$line" | cut -d' ' -f1)
|
||||
pod=$(echo "$line" | cut -d' ' -f2)
|
||||
|
||||
# Exibir os logs em paralelo
|
||||
kubectl logs --namespace "$namespace" "$pod" -f &
|
||||
done
|
||||
# Aguardar todos os comandos de logs
|
||||
wait
|
||||
else
|
||||
echo "Nenhum pod selecionado."
|
||||
fi
|
||||
}
|
||||
28
zsh/toolbox.sh
Normal file
28
zsh/toolbox.sh
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
|
||||
TOOLBOXES_DIR="$HOME/.toolboxes"
|
||||
|
||||
get_container_id() {
|
||||
_ret_var=${1:-"CONTAINER_ID"}
|
||||
_container_id=$(grep '^id=' /run/.containerenv | sed -e 's/^id="\(.*\)"$/\1/')
|
||||
eval "$_ret_var='$_container_id'"
|
||||
}
|
||||
|
||||
toolbox_entrypoint() {
|
||||
get_container_id "CONTAINER_ID"
|
||||
_env_location="$TOOLBOXES_DIR/$CONTAINER_ID"
|
||||
if [ ! -d "$_env_location" ]; then
|
||||
conda create --prefix "$_env_location" --yes >/dev/null 2>&1
|
||||
mkdir -p "$_env_location"/bin
|
||||
mkdir -p "$_env_location"/lib
|
||||
fi
|
||||
|
||||
# Setup podman to use host engine
|
||||
podman-remote system connection add "$USER" unix:///run/user/"$(id -u)"/podman/podman.sock
|
||||
ln -sf "$(which podman-remote)" "$_env_location"/bin/podman
|
||||
ln -sf "$(which podman-remote)" "$_env_location"/bin/docker
|
||||
|
||||
# Setup environement variables to use container env
|
||||
conda activate "$TOOLBOXES_DIR"/"$CONTAINER_ID" --no-stack
|
||||
export PATH="$_env_location/bin:$PATH"
|
||||
}
|
||||
27
zsh/utilities.sh
Normal file
27
zsh/utilities.sh
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
|
||||
function pathadd() {
|
||||
case ":${PATH:=$1}:" in
|
||||
*:"$1":*)
|
||||
;;
|
||||
*)
|
||||
PATH="$1:$PATH"
|
||||
;;
|
||||
esac;
|
||||
}
|
||||
|
||||
function library_pathadd() {
|
||||
case ":${LD_LIBRARY_PATH:=$1}:" in
|
||||
*:"$1":*)
|
||||
;;
|
||||
*)
|
||||
LD_LIBRARY_PATH="$1:$LD_LIBRARY_PATH"
|
||||
;;
|
||||
esac;
|
||||
}
|
||||
|
||||
function open() {
|
||||
_folder=${1:-$PWD}
|
||||
xdg-open "$_folder"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user