diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index d896da5..862ca41 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -4,11 +4,13 @@ source ~/.profile ZSH_THEME="robbyrussell" # Oh my zsh -export ZSH="$HOME/.oh-my-zsh" +export ZSH="$HOME/.local/share/ohmyzsh" source $ZSH/oh-my-zsh.sh # Load cargo env -. "$CARGO_HOME/env" +if [ -d "$CARGO_HOME" ]; then + . "$CARGO_HOME/env" +fi # Set cursor to beam shape echo -ne '\e[5 q' @@ -19,7 +21,8 @@ compinit -d $XDG_CACHE_HOME/zsh/zcompdump-$ZSH_VERSION export HISTORY_IGNORE="ce" ### zinit plugins - start -source $HOME/.zinit/bin/zinit.zsh +ZINIT_PATH="$HOME/.local/share/zinit" +source $ZINIT_PATH/zinit.zsh zinit light zdharma-continuum/fast-syntax-highlighting zinit light zsh-users/zsh-autosuggestions @@ -31,7 +34,11 @@ export ZSH_PLUGINS_ALIAS_TIPS_EXCLUDES="_" # Fzf keybinds # search history of shell commands -source /usr/share/fzf/key-bindings.zsh +if [ $OS_RELEASE = "debian" ]; then + source /usr/share/doc/fzf/examples/key-bindings.zsh +else + source /usr/share/fzf/key-bindings.zsh +fi # Alias config to manage dotfiles with git alias config="git --git-dir=\$HOME/.dotfiles/ --work-tree=\$HOME" @@ -49,7 +56,7 @@ fzf_fast_file_edit() { config_files="$(config ls-tree -r "$current_branch" --name-only "$HOME")" # Select file - selected_file=$(printf "%s\n%s" "$scripts" "$config_files" | fzf --info=inline --prompt='Select a file: ' --preview='bat --paging=never --style=plain --color=always {}') + selected_file=$(printf "%s\n%s" "$scripts" "$config_files" | fzf --info=inline --prompt='Select a file: ' --preview="$bat_cmd --paging=never --style=plain --color=always {}") if [ -n "$selected_file" ]; then @@ -63,14 +70,15 @@ alias python="python3" alias pip="pip3" # Alias to bat instead of cat -alias cat="bat --paging=never --style=header,grid" +[ $OS_RELEASE = "debian" ] && bat_cmd="batcat" || bat_cmd="bat" +alias cat="$bat_cmd --paging=never --style=header,grid" # Alias to exa instead of ls alias ls="exa --color=always --icons --group-directories-first" alias tree="ls --tree" # Alias to bat instead of less -alias less="bat -p --paging=always" +alias less="$bat_cmd -p --paging=always" # Alias to nvim instead of vim alias vim="nvim" @@ -96,9 +104,13 @@ alias btw="neofetch" # Alias for qrcode alias qrcode="qrencode -s 10 -l H" -# This loads nvm -source $HOME/.config/fast-nvm.sh -source $NVM_DIR/bash_completion +# This loads fnm/nvm +if [ $(command -v fnm) ]; then + eval "$(fnm env --use-on-cd)" +else + source $HOME/.config/fast-nvm.sh + source $NVM_DIR/bash_completion +fi # Check if is integrated terminal emulator if [ "$EMULATOR" = "code" ]; then diff --git a/.profile b/.profile index e4b60ad..40b215a 100644 --- a/.profile +++ b/.profile @@ -1,5 +1,7 @@ #!/bin/sh +export OS_RELEASE="$(cat /etc/os-release | grep '^ID=' | sed 's|ID=||')" + ### SET PATHS ### # XDG Defaults @@ -26,9 +28,11 @@ export ZDOTDIR="$HOME"/.config/zsh eval `ssh-agent -s` > /dev/null ### Default programs ### +[ $OS_RELEASE = "debian" ] && bat_cmd="batcat" || bat_cmd="bat" + export EDITOR="nvim" export READER="zathura" -export MANPAGER="sh -c 'col -bx | bat -l man --paging always -p'" +export MANPAGER="sh -c \"col -bx | $bat_cmd -l man --paging always -p\"" export TERMINAL="alacritty" export BROWSER="firefox" export VIDEO="mpv"