Skip to content

Commit 81b617e

Browse files
committed
Add bash configuration
1 parent 9d36e54 commit 81b617e

9 files changed

Lines changed: 194 additions & 0 deletions

File tree

‎default/bash/aliases‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# File system
2+
alias ls='eza -lh --group-directories-first --icons=auto'
3+
alias lsa='ls -a'
4+
alias lt='eza --tree --level=2 --long --icons --git'
5+
alias lta='lt -a'
6+
alias ff="fzf --preview 'batcat --style=numbers --color=always {}'"
7+
alias fd='fdfind'
8+
# alias cd='zoxide'
9+
10+
# Directories
11+
alias ..='cd ..'
12+
alias ...='cd ../..'
13+
alias ....='cd ../../..'
14+
15+
# Tools
16+
alias n='nvim'
17+
alias g='git'
18+
alias d='docker'
19+
alias r='rails'
20+
alias bat='batcat'
21+
alias lzg='lazygit'
22+
alias lzd='lazydocker'
23+
24+
# Git
25+
alias gcm='git commit -m'
26+
alias gcam='git commit -a -m'
27+
alias gcad='git commit -a --amend'

‎default/bash/envs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Editor used by CLI
2+
export EDITOR="nvim"
3+
export SUDO_EDITOR="$EDITOR"

‎default/bash/functions‎

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Compression
2+
compress() { tar -czf "${1%/}.tar.gz" "${1%/}"; }
3+
alias decompress="tar -xzf"
4+
5+
# Convert webm files generated by the Gnome screenshot video recorder to mp4s that are more compatible
6+
webm2mp4() {
7+
input_file="$1"
8+
output_file="${input_file%.webm}.mp4"
9+
ffmpeg -i "$input_file" -c:v libx264 -preset slow -crf 22 -c:a aac -b:a 192k "$output_file"
10+
}
11+
12+
# Write iso file to sd card
13+
iso2sd() {
14+
if [ $# -ne 2 ]; then
15+
echo "Usage: iso2sd <input_file> <output_device>"
16+
echo "Example: iso2sd ~/Downloads/ubuntu-25.04-desktop-amd64.iso /dev/sda"
17+
echo -e "\nAvailable SD cards:"
18+
lsblk -d -o NAME | grep -E '^sd[a-z]' | awk '{print "/dev/"$1}'
19+
else
20+
sudo dd bs=4M status=progress oflag=sync if="$1" of="$2"
21+
sudo eject $2
22+
fi
23+
}
24+
25+
# Create a desktop launcher for a web app
26+
web2app() {
27+
if [ "$#" -ne 3 ]; then
28+
echo "Usage: web2app <AppName> <AppURL> <IconURL> (IconURL must be in PNG -- use https://dashboardicons.com)"
29+
return 1
30+
fi
31+
32+
local APP_NAME="$1"
33+
local APP_URL="$2"
34+
local ICON_URL="$3"
35+
local ICON_DIR="$HOME/.local/share/applications/icons"
36+
local DESKTOP_FILE="$HOME/.local/share/applications/${APP_NAME}.desktop"
37+
local ICON_PATH="${ICON_DIR}/${APP_NAME}.png"
38+
39+
mkdir -p "$ICON_DIR"
40+
41+
if ! curl -sL -o "$ICON_PATH" "$ICON_URL"; then
42+
echo "Error: Failed to download icon."
43+
return 1
44+
fi
45+
46+
cat > "$DESKTOP_FILE" <<EOF
47+
[Desktop Entry]
48+
Version=1.0
49+
Name=$APP_NAME
50+
Comment=$APP_NAME
51+
Exec=google-chrome --app="$APP_URL" --name="$APP_NAME" --class="$APP_NAME" --window-size=800,600
52+
Terminal=false
53+
Type=Application
54+
Icon=$ICON_PATH
55+
Categories=GTK;
56+
MimeType=text/html;text/xml;application/xhtml_xml;
57+
StartupNotify=true
58+
EOF
59+
60+
chmod +x "$DESKTOP_FILE"
61+
}
62+
63+
web2app-remove() {
64+
if [ "$#" -ne 1 ]; then
65+
echo "Usage: web2app-remove <AppName>"
66+
return 1
67+
fi
68+
69+
local APP_NAME="$1"
70+
local ICON_DIR="$HOME/.local/share/applications/icons"
71+
local DESKTOP_FILE="$HOME/.local/share/applications/${APP_NAME}.desktop"
72+
local ICON_PATH="${ICON_DIR}/${APP_NAME}.png"
73+
74+
rm "$DESKTOP_FILE"
75+
rm "$ICON_PATH"
76+
}
77+
78+
# Ensure that external keyboards that use an fn key has the F keys as the default
79+
alias fix_fkeys='echo 2 | sudo tee /sys/module/hid_apple/parameters/fnmode'

‎default/bash/init‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
if command -v mise &> /dev/null; then
2+
eval "$(mise activate bash)"
3+
fi
4+
5+
if command -v zoxide &> /dev/null; then
6+
eval "$(zoxide init bash)"
7+
fi
8+
9+
if command -v fzf &> /dev/null; then
10+
if [[ -f /usr/share/bash-completion/completions/fzf ]]; then
11+
source /usr/share/bash-completion/completions/fzf
12+
fi
13+
if [[ -f /usr/share/doc/fzf/examples/key-bindings.bash ]]; then
14+
source /usr/share/doc/fzf/examples/key-bindings.bash
15+
fi
16+
fi

‎default/bash/inputrc‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
set meta-flag on
2+
set input-meta on
3+
set output-meta on
4+
set convert-meta off
5+
set completion-ignore-case on
6+
set completion-prefix-display-length 2
7+
set show-all-if-ambiguous on
8+
set show-all-if-unmodified on
9+
10+
# Arrow keys match what you've typed so far against your command history
11+
"\e[A": history-search-backward
12+
"\e[B": history-search-forward
13+
"\e[C": forward-char
14+
"\e[D": backward-char
15+
16+
# Immediately add a trailing slash when autocompleting symlinks to directories
17+
set mark-symlinked-directories on
18+
19+
# Do not autocomplete hidden files unless the pattern explicitly begins with a dot
20+
set match-hidden-files off
21+
22+
# Show all autocomplete results at once
23+
set page-completions off
24+
25+
# If there are more than 200 possible completions for a word, ask to show them all
26+
set completion-query-items 200
27+
28+
# Show extra file information when completing, like `ls -F` does
29+
set visible-stats on
30+
31+
$if Bash
32+
# Be more intelligent when autocompleting by also looking at the text after
33+
# the cursor. For example, when the current line is "cd ~/src/mozil", and
34+
# the cursor is on the "z", pressing Tab will not autocomplete it to "cd
35+
# ~/src/mozillail", but to "cd ~/src/mozilla". (This is supported by the
36+
# Readline used by Bash 4.)
37+
set skip-completed-text on
38+
39+
# Coloring for Bash 4 tab completions.
40+
set colored-stats on
41+
$endif

‎default/bash/prompt‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Technicolor dreams
2+
force_color_prompt=yes
3+
color_prompt=yes
4+
5+
# Simple prompt with path in the window/pane title and caret for typing line
6+
PS1=$'\uf0a9 '
7+
PS1="\[\e]0;\w\a\]$PS1"

‎default/bash/rc‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
source ~/.local/share/omarchy/default/bash/shell
2+
source ~/.local/share/omarchy/default/bash/aliases
3+
source ~/.local/share/omarchy/default/bash/functions
4+
source ~/.local/share/omarchy/default/bash/prompt
5+
source ~/.local/share/omarchy/default/bash/init
6+
source ~/.local/share/omarchy/default/bash/envs

‎default/bash/shell‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# History control
2+
shopt -s histappend
3+
HISTCONTROL=ignoreboth
4+
HISTSIZE=32768
5+
HISTFILESIZE="${HISTSIZE}"
6+
7+
# Autocompletion
8+
# source /usr/share/bash-completion/bash_completion
9+
10+
# Set complete path
11+
export PATH="./bin:$HOME/.local/bin:$PATH"
12+
set +h

‎install/configurations.sh‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,8 @@ rm -rf ~/.config/nvim/.git
55
# Copy over Omarchy configs
66
cp -R ~/.local/share/omarchy/config/* ~/.config/
77

8+
# Use default bashrc from Omarchy
9+
echo "source ~/.local/share/omarchy/default/bash/rc" >~/.bashrc
10+
811
# Turn off relative line numbers in nvim
912
echo "vim.opt.relativenumber = false" >>~/.config/nvim/lua/config/options.lua

0 commit comments

Comments
 (0)