aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pkgs.nix8
-rw-r--r--shellrc.d/alias4
-rw-r--r--shellrc.d/dev90
-rw-r--r--shellrc.d/git1
-rw-r--r--shellrc.d/less25
5 files changed, 76 insertions, 52 deletions
diff --git a/pkgs.nix b/pkgs.nix
index a62e8b2..1f01470 100644
--- a/pkgs.nix
+++ b/pkgs.nix
@@ -41,12 +41,12 @@
cmdbash='eval $(shellrc-bash)'
cmdzsh='eval $(shellrc-zsh)'
if command -v shellrc-bash 2>/dev/null >&2 \
- && ! grep -qxF "$cmdbash" ~/.profile 2>/dev/null; then
- echo "$cmdbash" >>~/.profile
+ && ! grep -qxF "$cmdbash" ~/.bashrc 2>/dev/null; then
+ echo "$cmdbash" >>~/.bashrc
fi
if command -v shellrc-zsh 2>/dev/null >&2 \
- && ! grep -qxF "$cmdzsh" ~/.zprofile 2>/dev/null; then
- echo "$cmdzsh" >>~/.zprofile
+ && ! grep -qxF "$cmdzsh" ~/.zshrc 2>/dev/null; then
+ echo "$cmdzsh" >>~/.zshrc
fi
'';
};
diff --git a/shellrc.d/alias b/shellrc.d/alias
index 5e412a3..c84c83a 100644
--- a/shellrc.d/alias
+++ b/shellrc.d/alias
@@ -33,7 +33,3 @@ fi
if command -v sdcv 2>/dev/null >&2; then
alias sdcv='sdcv -c'
fi
-
-if command -v nix 2>/dev/null >&2; then
- alias nrun='nix run .'
-fi
diff --git a/shellrc.d/dev b/shellrc.d/dev
index e66369c..c394a8a 100644
--- a/shellrc.d/dev
+++ b/shellrc.d/dev
@@ -1,57 +1,59 @@
# vim: ft=sh:
-
if command -v valgrind >/dev/null; then
- alias memcheck="valgrind --track-fds=yes --leak-check=full --track-origins=yes"
- alias massif="valgrind --tool=massif"
- alias drd="valgrind --tool=drd"
- alias helgrind="valgrind --tool=helgrind"
+ alias memcheck="valgrind --error-exitcode=118 --track-fds=yes --leak-check=full --track-origins=yes"
+ alias callgrind="valgrind --error-exitcode=118 --tool=callgrind"
+ alias massif="valgrind --error-exitcode=118 --tool=massif"
+ alias drd="valgrind --error-exitcode=118 --tool=drd"
+ alias helgrind="valgrind --error-exitcode=118 --tool=helgrind"
+ alias dhat="valgrind --error-exitcode=118 --tool=dhat"
fi
-
if command -v meson >/dev/null; then
-_meson_setup() {
- if [ ! -f "build/build.ninja" ]; then
- meson setup -Doptimization=plain build
- fi
-}
+ msetup() {
+ set -- "-Doptimization=plain" "$@"
+ if [[ -f "build/build.ninja" ]]; then
+ [[ $# -eq 0 ]] ||
+ meson configure build "$@"
+ else
+ meson setup "$@" build
+ fi
+ }
-mbuild() {
- _meson_setup \
- && meson compile -C build "$@"
-}
+ mbuild() {
+ msetup &&
+ meson compile -C build "$@"
+ }
-mtest() {
- _meson_setup \
- && meson test -C build "$@"
-}
+ mtest() {
+ msetup &&
+ meson test -C build "$@"
+ }
-mcoverage() {
- _meson_setup \
- && meson configure build -Db_coverage=true \
- && meson test -C build "$@" \
- && ninja -C build coverage-html
-}
+ mcoverage() {
+ msetup -Db_coverage=true &&
+ meson test -C build "$@" &&
+ ninja -C build coverage-html
+ }
-mdist() {
- _meson_setup \
- && meson dist -C build --formats xztar,gztar,zip "$@"
-}
+ mdist() {
+ msetup &&
+ meson dist -C build --formats xztar,gztar,zip "$@"
+ }
-mupdate() {
- meson subprojects update
-}
+ mupdate() {
+ meson subprojects update
+ }
-mpurge() {
- meson subprojects purge
-}
+ mpurge() {
+ meson subprojects purge
+ }
fi
-
if command -v bear >/dev/null; then
bmake() {
@@ -59,6 +61,11 @@ if command -v bear >/dev/null; then
bear --output build/compile_commands.json --append -- make "$@"
}
+ bmmake() {
+ mkdir -p build
+ bear --output build/compile_commands.json --append -- make "-j$(($(nproc) * 2))" "-l$(nproc)" "$@"
+ }
+
alias mbmake='bmake -j$(($(nproc) * 2)) -l$(nproc)'
fi
@@ -70,3 +77,14 @@ glv() {
nvim_config() (
cd ~/.config/nvim && nvim init.vim
)
+
+if command -v nix 2>/dev/null >&2; then
+ nrun() {
+ nix run .?submodules=1# -- "$@"
+ }
+ nrun_() {
+ local package="$1"
+ shift
+ nix run ".?submodules=1#$package" -- "$@"
+ }
+fi
diff --git a/shellrc.d/git b/shellrc.d/git
index 15b949a..18b3b79 100644
--- a/shellrc.d/git
+++ b/shellrc.d/git
@@ -47,6 +47,7 @@ gitbmerge() (
fi
git merge --ff-only "$branch" \
&& git push \
+ && sleep 1 \
&& git branch -d "$branch" \
&& { if [ -n "$upstream" ]; then git push origin :"$branch"; fi; }
)
diff --git a/shellrc.d/less b/shellrc.d/less
index d2490a5..b9d4c90 100644
--- a/shellrc.d/less
+++ b/shellrc.d/less
@@ -1,10 +1,19 @@
# vim: ft=sh:
export LESS=-R
-export LESS_TERMCAP_mb=$'\E[1;31m'
-export LESS_TERMCAP_md=$'\E[1;36m'
-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[1;32m'
-[ -x /usr/bin/src-hilite-lesspipe.sh ] && export LESSOPEN="| /usr/bin/src-hilite-lesspipe.sh %s"
+export LESS_TERMCAP_mb=$(tput bold; tput setaf 2)
+export LESS_TERMCAP_md=$(tput bold; tput setaf 6)
+export LESS_TERMCAP_me=$(tput sgr0)
+export LESS_TERMCAP_so=$(tput bold; tput setaf 3; tput setab 4)
+export LESS_TERMCAP_se=$(tput rmso; tput sgr0)
+export LESS_TERMCAP_us=$(tput smul; tput bold; tput setaf 7)
+export LESS_TERMCAP_ue=$(tput rmul; tput sgr0)
+export LESS_TERMCAP_mr=$(tput rev)
+export LESS_TERMCAP_mh=$(tput dim)
+export LESS_TERMCAP_ZN=$(tput ssubm)
+export LESS_TERMCAP_ZV=$(tput rsubm)
+export LESS_TERMCAP_ZO=$(tput ssupm)
+export LESS_TERMCAP_ZW=$(tput rsupm)
+export GROFF_NO_SGR=1 # For Konsole and Gnome-terminal
+if command -v src-hilite-lesspipe.sh >/dev/null; then
+ export LESSOPEN="| $(command -v src-hilite-lesspipe.sh) %s"
+fi