Repository navigation
Expand file tree
/
Copy pathdot_bashrc.tmpl
More file actions
100 lines (88 loc) · 3.59 KB
/
Copy pathdot_bashrc.tmpl
File metadata and controls
100 lines (88 loc) · 3.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# .bashrc — sourced by interactive non-login bash shells,
# and by login bash shells via .bash_profile (see dot_bash_profile.tmpl).
#
# Mirrors the monolithic dot_zshrc.tmpl approach: one file holds all
# interactive bash config so login and non-login shells behave identically.
shopt -s autocd
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific environment
# Use bash glob matching instead of [[ =~ ]] so shellcheck does not flag
# a quoted regex (SC2076).
if [[ ":${PATH}:" != *:"$HOME/.local/bin:$HOME/bin:"* ]]; then
PATH="$HOME/.local/bin:$HOME/bin:$PATH"
fi
export PATH
# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
# Linuxbrew: ensure Homebrew/Linuxbrew bins are on PATH for bash login shells
# on Linux. `bash -l` reads `~/.bash_profile` (not `~/.profile`), and the
# linuxbrew shellenv block in dot_profile.tmpl is therefore skipped on login
# bash. Duplicating it here closes that gap without leaking the darwin-only
# atuin/.local/bin env into the bash startup chain (fixes #55).
{{ if ne .chezmoi.os "darwin" -}}
if [ -d /home/linuxbrew/.linuxbrew ]; then
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
fi
{{ end }}
# User specific aliases and functions
if [ -d ~/.shellrc.d ]; then
for rc in ~/.shellrc.d/*; do
if [ -f "$rc" ]; then
# shellcheck source=/dev/null
. "$rc"
fi
done
fi
unset rc
# LM Studio CLI (lms): only add the flatpak install path to PATH if installed
if [ -d "$HOME/.var/app/ai.lmstudio.lm-studio/.lmstudio/bin" ]; then
export PATH="$PATH:$HOME/.var/app/ai.lmstudio.lm-studio/.lmstudio/bin"
fi
## Aliases
# see .shellrc.d/55-aliases.sh
{{ if .dev.java -}}
# Maven
alias mciskip='mvn clean install -DskipTests'
alias mci='mvn clean install'
alias mcu='mvn clean install -U'
alias mvntree='mvn dependency:tree'
alias mcrun='mvn spring-boot:run -Dspring.profiles.active=LOCAL'
{{- end }}
# Z (https://github.com/rupa/z) and bash-completion (Homebrew on macOS).
# Resolve "$(brew --prefix)" dynamically so the lookups work on both
# Apple Silicon (/opt/homebrew) and Intel (/usr/local) Macs — the
# hardcoded /usr/local paths silently no-op on arm64 (fixes #86).
# TODO How did you install Z? (override here if not installed via Homebrew.)
if command -v brew >/dev/null 2>&1; then
BREW_PREFIX="$(brew --prefix)"
[ -f "$BREW_PREFIX/etc/profile.d/z.sh" ] && . "$BREW_PREFIX/etc/profile.d/z.sh"
[ -f "$BREW_PREFIX/etc/bash_completion" ] && . "$BREW_PREFIX/etc/bash_completion"
fi
# Atuin: Magical Shell History (https://atuin.sh)
# Two install paths are supported:
# 1. Standalone curl script -> ships ~/.atuin/bin/env, which prepends
# ~/.atuin/bin to PATH (idempotent — skips if already prepended).
# 2. Package manager (e.g. linuxbrew in the Bazzite-DX base image,
# Homebrew on macOS) -> atuin is already on PATH; no env script.
# Source env only when the curl installer provided it, then init the
# bash plugin whenever atuin is reachable from either path. The `bash`
# arg matches the documented invocation; the env script currently
# ignores it but this stays forward-compatible.
if [ -f "$HOME/.atuin/bin/env" ]; then
. "$HOME/.atuin/bin/env" bash
fi
if command -v atuin >/dev/null 2>&1; then
eval "$(atuin init bash)"
eval "$(atuin gen-completions --shell bash)"
fi
# install https://github.com/nvbn/thefuck
if command -v thefuck >/dev/null 2>&1; then
eval "$(thefuck --alias)"
fi
# Starship: Cross-Shell Prompt (https://starship.rs/)
if command -v starship >/dev/null 2>&1; then
eval "$(starship init bash)"
fi