Skip to content

Commit

Permalink
adding my bashrc and aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
Heus-Sueh committed Oct 4, 2024
1 parent de9f543 commit 34d9d9f
Show file tree
Hide file tree
Showing 5 changed files with 410 additions and 4 deletions.
118 changes: 118 additions & 0 deletions files/system/etc/skel/.aliases
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
#!/usr/bin/env bash
# Shortcuts
alias profile="$EDITOR ~/.profile"
alias bashrc="$EDITOR ~/.bashrc"
alias zshrc="$EDITOR ~/.zshrc"
# alias ohmyzsh="$EDITOR ~/.oh-my-zsh"
alias clickpaste='sleep 3; xdotool type "$(xclip -o -selection clipboard)"'

# Change directory aliases
if [ "$(command -v zoxide)" ]; then
alias cd="z"
fi

# Remove a directory and all files
alias rmd='/bin/rm --recursive --force --verbose '

# ls aliases
if [ "$(command -v eza)" ]; then
alias ll='eza -l --icons=auto --group-directories-first'
alias l.='eza -d .*'
alias ls='eza'
alias l1='eza -1'
fi

if [ "$(command -v fd)" ]; then
alias find="fd"
fi

if [ "$(command -v bat)" ]; then
alias cat="bat"
fi

# ugrep for grep
if [ "$(command -v ug)" ]; then
alias grep='ug'
alias egrep='ug -E'
alias fgrep='ug -F'
alias xzgrep='ug -z'
alias xzegrep='ug -zE'
alias xzfgrep='ug -zF'
fi

# Check if ripgrep is installed
if [ "$(command -v rg)" ]; then
# Alias grep to rg if ripgrep is installed
alias grep='rg'
else
# Alias grep to /usr/bin/grep with GREP_OPTIONS if ripgrep is not installed
alias grep="/usr/bin/grep $GREP_OPTIONS"
fi
unset GREP_OPTIONS

if [ "$(command -v trash)" ]; then
alias rm='trash -v'
fi

case "$(command -v apt pacman dnf rpm-ostree 2>/dev/null | head -n 1)" in
*apt)
alias pkg='sudo apt'
;;
*pacman)
alias pkg='sudo pacman'
;;
*dnf)
alias pkg='sudo dnf'
;;
*rpm-ostree)
alias pkg='rpm-ostree'
;;
*)
echo "No supported package manager found."
;;
esac

alias home='cd ~'
alias cd..='cd ..'
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'

# Always interactive
alias cp='cp -i'
alias mv='mv -i'

alias mkdir='mkdir -p'
alias ps='ps auxf'
alias ping='ping -c 10'
alias less='less -R'
alias h="history | grep "
alias f="find . | grep "
alias openports='netstat -nape --inet'
alias unexport="unset"
alias readf="less"
alias seef="bat"
alias help="man"
alias cls="clear"
alias xkill="pkill -i"
alias pkg="rpm-ostree"
# alias chmod commands
alias mkexe='chmod a+x'
alias mx='chmod a+x'
alias 000='chmod -R 000'
alias 644='chmod -R 644'
alias 666='chmod -R 666'
alias 755='chmod -R 755'
alias 777='chmod -R 777'
# Alias's for archives
alias mktar='tar -cvf'
alias mkbz2='tar -cvjf'
alias mkgz='tar -cvzf'
alias untar='tar -xvf'
alias unbz2='tar -xvjf'
alias ungz='tar -xvzf'
# Nvidia
alias nrun='__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia'
# Others

107 changes: 107 additions & 0 deletions files/system/etc/skel/.bashrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#!/usr/bin/env bash
iatest=$(expr index "$-" i)

# Source profile definitions
if [ -f $HOME/.profile ]; then
. $HOME/.profile
fi

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

# Enable bash programmable completion features in interactive shells
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi

# Expand the history size
export HISTFILESIZE=10000
export HISTSIZE=500
export HISTTIMEFORMAT="%F %T" # add timestamp to history

# Don't put duplicate lines in the history and do not add lines that start with a space
export HISTCONTROL=erasedups:ignoredups:ignorespace

# Check the window size after each command and, if necessary, update the values of LINES and COLUMNS
shopt -s checkwinsize

# Causes bash to append to history instead of overwriting it so if you start a new terminal, you have old session history
shopt -s histappend
PROMPT_COMMAND='history -a'

# Allow ctrl-S for history navigation (with ctrl-R)
[[ $- == *i* ]] && stty -ixon

# Disable the bell
if [[ $iatest -gt 0 ]]; then bind "set bell-style visible"; fi

# Ignore case on auto-completion
# Note: bind used instead of sticking these in .inputrc
if [[ $iatest -gt 0 ]]; then bind "set completion-ignore-case on"; fi

# Show auto-completion list automatically, without double tab
if [[ $iatest -gt 0 ]]; then bind "set show-all-if-ambiguous On"; fi

# To have colors for ls and all grep commands such as grep, egrep and zgrep
export CLICOLOR=1
export LS_COLORS='no=00:fi=00:di=00;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:*.xml=00;31:'

# Color for manpages in less makes manpages a little easier to read
export LESS_TERMCAP_mb=$'\E[01;31m'
export LESS_TERMCAP_md=$'\E[01;31m'
export LESS_TERMCAP_me=$'\E[0m'
export LESS_TERMCAP_se=$'\E[0m'
export LESS_TERMCAP_so=$'\E[01;44;33m'
export LESS_TERMCAP_ue=$'\E[0m'
export LESS_TERMCAP_us=$'\E[01;32m'

# Functions
extract() {
for archive in "$@"; do
if [ -f "$archive" ]; then
case $archive in
*.tar.bz2) tar xvjf $archive ;;
*.tar.gz) tar xvzf $archive ;;
*.bz2) bunzip2 $archive ;;
*.rar) rar x $archive ;;
*.gz) gunzip $archive ;;
*.tar) tar xvf $archive ;;
*.tbz2) tar xvjf $archive ;;
*.tgz) tar xvzf $archive ;;
*.zip) unzip $archive ;;
*.Z) uncompress $archive ;;
*.7z) 7z x $archive ;;
*) echo "don't know how to extract '$archive'..." ;;
esac
else
echo "'$archive' is not a valid file!"
fi
done
}

# Path
export PATH=$PATH:"$HOME/.local/bin"
export PATH=$PATH:"$HOME/.cargo/bin"

export GOPATH=$HOME/.go
export GOMODCACHE=$HOME/.go/pkg/mod

# Aliases
source $HOME/.aliases

# Init
if command -v starship &>/dev/null; then
eval "$(starship init bash)"
fi

if command -v zoxide &>/dev/null; then
eval "$(zoxide init bash)"
fi

if command -v mise &>/dev/null; then
eval "$(~/.local/bin/mise activate bash)"
fi
8 changes: 4 additions & 4 deletions files/system/etc/skel/.config/hypr/keybinds.conf
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ bind = CTRL ALT, tab, changegroupactive
bind = $mainMod, left, changegroupactive, b
bind = $mainMod, right, changegroupactive, f

bind = CTRL ALT, K, togglegroup
bind = CTRL ALT, J, moveoutofgroup
bind = CTRL ALT, L, moveintogroup, l
bind = CTRL ALT, H, moveintogroup, r
# bind = CTRL ALT, K, togglegroup
bind = CTRL $mainMod, Q, moveoutofgroup
bind = CTRL ALT, L, moveintogroup, l # Not so good
bind = CTRL ALT, H, moveintogroup, r # Not so good
bind = $mainMod, H, changegroupactive, b
bind = $mainMod, L, changegroupactive, f

Expand Down
15 changes: 15 additions & 0 deletions files/system/etc/skel/.local/bin/nvim-arch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

container_name="nvim-arch"

# Verifica se o caminho foi passado como argumento
if [ -z "$1" ]; then
echo "Usage: $0 <path>"
exit 1
fi

# Resolve o caminho absoluto do argumento
real_path=$(realpath "$1")

# Entra no container e executa o nvim com o caminho passado
distrobox-enter -n "$container_name" -- nvim "$real_path"
Loading

0 comments on commit 34d9d9f

Please sign in to comment.