aboutsummaryrefslogtreecommitdiff
path: root/functions
diff options
context:
space:
mode:
Diffstat (limited to 'functions')
-rwxr-xr-xfunctions/fzf.sh17
-rwxr-xr-xfunctions/zig.sh24
2 files changed, 41 insertions, 0 deletions
diff --git a/functions/fzf.sh b/functions/fzf.sh
new file mode 100755
index 0000000..8761247
--- /dev/null
+++ b/functions/fzf.sh
@@ -0,0 +1,17 @@
+#!/bin/zsh
+
+function frg {
+ result=$(rg --ignore-case --color=always --line-number --no-heading "$@" |
+ fzf --ansi \
+ --color 'hl:-1:underline,hl+:-1:underline:reverse' \
+ --delimiter ':' \
+ --preview "bat --color=always {1} --theme='gruvbox-dark' --highlight-line {2}" \
+ --preview-window 'up,60%,border-bottom,+{2}+3/3,~3')
+ file=${result%%:*}
+ linenumber=$(echo "${result}" | cut -d: -f2)
+ if [[ -n "$file" ]]; then
+ nvim +"${linenumber}" "$file"
+ fi
+}
+
+alias rgf=frg
diff --git a/functions/zig.sh b/functions/zig.sh
new file mode 100755
index 0000000..49b437a
--- /dev/null
+++ b/functions/zig.sh
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+zb () {
+ zig build "$@"
+}
+
+zbs() {
+ zig build "$@" --summary all
+}
+
+zt () {
+ zig build test "$@"
+}
+
+zts() {
+ zig build test "$@" --summary all
+}
+
+zr () {
+ zig build run "$@"
+}
+
+zrs() {
+ zig build run "$@" --summary all
+}