mirror of
https://github.com/basecamp/omarchy.git
synced 2025-07-27 12:19:24 +00:00
Add bash configuration
This commit is contained in:
27
default/bash/aliases
Normal file
27
default/bash/aliases
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# File system
|
||||||
|
alias ls='eza -lh --group-directories-first --icons=auto'
|
||||||
|
alias lsa='ls -a'
|
||||||
|
alias lt='eza --tree --level=2 --long --icons --git'
|
||||||
|
alias lta='lt -a'
|
||||||
|
alias ff="fzf --preview 'batcat --style=numbers --color=always {}'"
|
||||||
|
alias fd='fdfind'
|
||||||
|
# alias cd='zoxide'
|
||||||
|
|
||||||
|
# Directories
|
||||||
|
alias ..='cd ..'
|
||||||
|
alias ...='cd ../..'
|
||||||
|
alias ....='cd ../../..'
|
||||||
|
|
||||||
|
# Tools
|
||||||
|
alias n='nvim'
|
||||||
|
alias g='git'
|
||||||
|
alias d='docker'
|
||||||
|
alias r='rails'
|
||||||
|
alias bat='batcat'
|
||||||
|
alias lzg='lazygit'
|
||||||
|
alias lzd='lazydocker'
|
||||||
|
|
||||||
|
# Git
|
||||||
|
alias gcm='git commit -m'
|
||||||
|
alias gcam='git commit -a -m'
|
||||||
|
alias gcad='git commit -a --amend'
|
3
default/bash/envs
Normal file
3
default/bash/envs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Editor used by CLI
|
||||||
|
export EDITOR="nvim"
|
||||||
|
export SUDO_EDITOR="$EDITOR"
|
79
default/bash/functions
Normal file
79
default/bash/functions
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
# Compression
|
||||||
|
compress() { tar -czf "${1%/}.tar.gz" "${1%/}"; }
|
||||||
|
alias decompress="tar -xzf"
|
||||||
|
|
||||||
|
# Convert webm files generated by the Gnome screenshot video recorder to mp4s that are more compatible
|
||||||
|
webm2mp4() {
|
||||||
|
input_file="$1"
|
||||||
|
output_file="${input_file%.webm}.mp4"
|
||||||
|
ffmpeg -i "$input_file" -c:v libx264 -preset slow -crf 22 -c:a aac -b:a 192k "$output_file"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Write iso file to sd card
|
||||||
|
iso2sd() {
|
||||||
|
if [ $# -ne 2 ]; then
|
||||||
|
echo "Usage: iso2sd <input_file> <output_device>"
|
||||||
|
echo "Example: iso2sd ~/Downloads/ubuntu-25.04-desktop-amd64.iso /dev/sda"
|
||||||
|
echo -e "\nAvailable SD cards:"
|
||||||
|
lsblk -d -o NAME | grep -E '^sd[a-z]' | awk '{print "/dev/"$1}'
|
||||||
|
else
|
||||||
|
sudo dd bs=4M status=progress oflag=sync if="$1" of="$2"
|
||||||
|
sudo eject $2
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Create a desktop launcher for a web app
|
||||||
|
web2app() {
|
||||||
|
if [ "$#" -ne 3 ]; then
|
||||||
|
echo "Usage: web2app <AppName> <AppURL> <IconURL> (IconURL must be in PNG -- use https://dashboardicons.com)"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local APP_NAME="$1"
|
||||||
|
local APP_URL="$2"
|
||||||
|
local ICON_URL="$3"
|
||||||
|
local ICON_DIR="$HOME/.local/share/applications/icons"
|
||||||
|
local DESKTOP_FILE="$HOME/.local/share/applications/${APP_NAME}.desktop"
|
||||||
|
local ICON_PATH="${ICON_DIR}/${APP_NAME}.png"
|
||||||
|
|
||||||
|
mkdir -p "$ICON_DIR"
|
||||||
|
|
||||||
|
if ! curl -sL -o "$ICON_PATH" "$ICON_URL"; then
|
||||||
|
echo "Error: Failed to download icon."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat > "$DESKTOP_FILE" <<EOF
|
||||||
|
[Desktop Entry]
|
||||||
|
Version=1.0
|
||||||
|
Name=$APP_NAME
|
||||||
|
Comment=$APP_NAME
|
||||||
|
Exec=google-chrome --app="$APP_URL" --name="$APP_NAME" --class="$APP_NAME" --window-size=800,600
|
||||||
|
Terminal=false
|
||||||
|
Type=Application
|
||||||
|
Icon=$ICON_PATH
|
||||||
|
Categories=GTK;
|
||||||
|
MimeType=text/html;text/xml;application/xhtml_xml;
|
||||||
|
StartupNotify=true
|
||||||
|
EOF
|
||||||
|
|
||||||
|
chmod +x "$DESKTOP_FILE"
|
||||||
|
}
|
||||||
|
|
||||||
|
web2app-remove() {
|
||||||
|
if [ "$#" -ne 1 ]; then
|
||||||
|
echo "Usage: web2app-remove <AppName>"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local APP_NAME="$1"
|
||||||
|
local ICON_DIR="$HOME/.local/share/applications/icons"
|
||||||
|
local DESKTOP_FILE="$HOME/.local/share/applications/${APP_NAME}.desktop"
|
||||||
|
local ICON_PATH="${ICON_DIR}/${APP_NAME}.png"
|
||||||
|
|
||||||
|
rm "$DESKTOP_FILE"
|
||||||
|
rm "$ICON_PATH"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Ensure that external keyboards that use an fn key has the F keys as the default
|
||||||
|
alias fix_fkeys='echo 2 | sudo tee /sys/module/hid_apple/parameters/fnmode'
|
16
default/bash/init
Normal file
16
default/bash/init
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
if command -v mise &> /dev/null; then
|
||||||
|
eval "$(mise activate bash)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v zoxide &> /dev/null; then
|
||||||
|
eval "$(zoxide init bash)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v fzf &> /dev/null; then
|
||||||
|
if [[ -f /usr/share/bash-completion/completions/fzf ]]; then
|
||||||
|
source /usr/share/bash-completion/completions/fzf
|
||||||
|
fi
|
||||||
|
if [[ -f /usr/share/doc/fzf/examples/key-bindings.bash ]]; then
|
||||||
|
source /usr/share/doc/fzf/examples/key-bindings.bash
|
||||||
|
fi
|
||||||
|
fi
|
41
default/bash/inputrc
Normal file
41
default/bash/inputrc
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
set meta-flag on
|
||||||
|
set input-meta on
|
||||||
|
set output-meta on
|
||||||
|
set convert-meta off
|
||||||
|
set completion-ignore-case on
|
||||||
|
set completion-prefix-display-length 2
|
||||||
|
set show-all-if-ambiguous on
|
||||||
|
set show-all-if-unmodified on
|
||||||
|
|
||||||
|
# Arrow keys match what you've typed so far against your command history
|
||||||
|
"\e[A": history-search-backward
|
||||||
|
"\e[B": history-search-forward
|
||||||
|
"\e[C": forward-char
|
||||||
|
"\e[D": backward-char
|
||||||
|
|
||||||
|
# Immediately add a trailing slash when autocompleting symlinks to directories
|
||||||
|
set mark-symlinked-directories on
|
||||||
|
|
||||||
|
# Do not autocomplete hidden files unless the pattern explicitly begins with a dot
|
||||||
|
set match-hidden-files off
|
||||||
|
|
||||||
|
# Show all autocomplete results at once
|
||||||
|
set page-completions off
|
||||||
|
|
||||||
|
# If there are more than 200 possible completions for a word, ask to show them all
|
||||||
|
set completion-query-items 200
|
||||||
|
|
||||||
|
# Show extra file information when completing, like `ls -F` does
|
||||||
|
set visible-stats on
|
||||||
|
|
||||||
|
$if Bash
|
||||||
|
# Be more intelligent when autocompleting by also looking at the text after
|
||||||
|
# the cursor. For example, when the current line is "cd ~/src/mozil", and
|
||||||
|
# the cursor is on the "z", pressing Tab will not autocomplete it to "cd
|
||||||
|
# ~/src/mozillail", but to "cd ~/src/mozilla". (This is supported by the
|
||||||
|
# Readline used by Bash 4.)
|
||||||
|
set skip-completed-text on
|
||||||
|
|
||||||
|
# Coloring for Bash 4 tab completions.
|
||||||
|
set colored-stats on
|
||||||
|
$endif
|
7
default/bash/prompt
Normal file
7
default/bash/prompt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# Technicolor dreams
|
||||||
|
force_color_prompt=yes
|
||||||
|
color_prompt=yes
|
||||||
|
|
||||||
|
# Simple prompt with path in the window/pane title and caret for typing line
|
||||||
|
PS1=$'\uf0a9 '
|
||||||
|
PS1="\[\e]0;\w\a\]$PS1"
|
6
default/bash/rc
Normal file
6
default/bash/rc
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
source ~/.local/share/omarchy/default/bash/shell
|
||||||
|
source ~/.local/share/omarchy/default/bash/aliases
|
||||||
|
source ~/.local/share/omarchy/default/bash/functions
|
||||||
|
source ~/.local/share/omarchy/default/bash/prompt
|
||||||
|
source ~/.local/share/omarchy/default/bash/init
|
||||||
|
source ~/.local/share/omarchy/default/bash/envs
|
12
default/bash/shell
Normal file
12
default/bash/shell
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# History control
|
||||||
|
shopt -s histappend
|
||||||
|
HISTCONTROL=ignoreboth
|
||||||
|
HISTSIZE=32768
|
||||||
|
HISTFILESIZE="${HISTSIZE}"
|
||||||
|
|
||||||
|
# Autocompletion
|
||||||
|
# source /usr/share/bash-completion/bash_completion
|
||||||
|
|
||||||
|
# Set complete path
|
||||||
|
export PATH="./bin:$HOME/.local/bin:$PATH"
|
||||||
|
set +h
|
@ -5,5 +5,8 @@ rm -rf ~/.config/nvim/.git
|
|||||||
# Copy over Omarchy configs
|
# Copy over Omarchy configs
|
||||||
cp -R ~/.local/share/omarchy/config/* ~/.config/
|
cp -R ~/.local/share/omarchy/config/* ~/.config/
|
||||||
|
|
||||||
|
# Use default bashrc from Omarchy
|
||||||
|
echo "source ~/.local/share/omarchy/default/bash/rc" >~/.bashrc
|
||||||
|
|
||||||
# Turn off relative line numbers in nvim
|
# Turn off relative line numbers in nvim
|
||||||
echo "vim.opt.relativenumber = false" >>~/.config/nvim/lua/config/options.lua
|
echo "vim.opt.relativenumber = false" >>~/.config/nvim/lua/config/options.lua
|
||||||
|
Reference in New Issue
Block a user