summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Vink <ivi@vinkies.net>2025-05-27 08:36:32 +0000
committerMike Vink <ivi@vinkies.net>2025-05-28 11:06:39 +0000
commit4c9ba1cd0cf3e0fc3653c5e0588a0a4e54f5524f (patch)
treef1f99fa66ff7cd6b568d2217a836faa48465ad36
parentf192fcc7111691b973d413a36a242491425dc437 (diff)
add bash
l---------.bash_profile1
l---------.bashrc1
-rw-r--r--.config/aerospace/aerospace.toml3
-rw-r--r--.config/bash/bash_profile15
-rw-r--r--.config/bash/bashrc7
-rw-r--r--.config/ghostty/config3
-rw-r--r--.config/kak/autoload/buffers.kak267
-rw-r--r--.config/kak/kakrc11
-rw-r--r--.config/shell/bm-dirs2
-rw-r--r--.config/shell/inputrc13
-rw-r--r--.config/shell/profile10
l---------.inputrc1
-rwxr-xr-x.local/bin/cs1
-rwxr-xr-x.local/bin/rk3
-rw-r--r--.zprofile1
15 files changed, 333 insertions, 6 deletions
diff --git a/.bash_profile b/.bash_profile
new file mode 120000
index 0000000..e03d784
--- /dev/null
+++ b/.bash_profile
@@ -0,0 +1 @@
+.config/bash/bash_profile \ No newline at end of file
diff --git a/.bashrc b/.bashrc
new file mode 120000
index 0000000..6d5541f
--- /dev/null
+++ b/.bashrc
@@ -0,0 +1 @@
+.config/bash/bashrc \ No newline at end of file
diff --git a/.config/aerospace/aerospace.toml b/.config/aerospace/aerospace.toml
index 930661b..a9b3533 100644
--- a/.config/aerospace/aerospace.toml
+++ b/.config/aerospace/aerospace.toml
@@ -139,6 +139,9 @@ automatically-unhide-macos-hidden-apps = true
# See: https://nikitabobko.github.io/AeroSpace/commands#resize
cmd-minus = 'resize smart -100'
cmd-equal = 'resize smart +100'
+ cmd-leftSquareBracket = 'resize smart-opposite -100'
+ cmd-rightSquareBracket = 'resize smart-opposite +100'
+ cmd-quote = 'balance-sizes'
# See: https://nikitabobko.github.io/AeroSpace/commands#workspace
cmd-1 = 'workspace 1'
diff --git a/.config/bash/bash_profile b/.config/bash/bash_profile
new file mode 100644
index 0000000..74f3252
--- /dev/null
+++ b/.config/bash/bash_profile
@@ -0,0 +1,15 @@
+if [ -f ~/.profile ]; then
+ . ~/.profile
+fi
+# If the shell is interactive and .bashrc exists, get the aliases and functions
+if [[ $- == *i* && -f ~/.bashrc ]]; then
+ # Enable programmable completion features
+ if ! shopt -oq posix; then
+ if [ -f /usr/share/bash-completion/bash_completion ]; then
+ . /usr/share/bash-completion/bash_completion
+ elif [ -f /etc/bash_completion ]; then
+ . /etc/bash_completion
+ fi
+ fi
+ . ~/.bashrc
+fi
diff --git a/.config/bash/bashrc b/.config/bash/bashrc
new file mode 100644
index 0000000..81af60d
--- /dev/null
+++ b/.config/bash/bashrc
@@ -0,0 +1,7 @@
+if [ -f ~/.local.bashrc ]; then
+ . ~/.local.bashrc
+fi
+# clear screen and save scrollback
+clear() {
+ printf "\e[H\e[22J"
+}
diff --git a/.config/ghostty/config b/.config/ghostty/config
index 128bdf7..8d076e7 100644
--- a/.config/ghostty/config
+++ b/.config/ghostty/config
@@ -7,8 +7,11 @@ keybind = alt+v=paste_from_clipboard
# keybind = alt+shift+k=increase_font_size:1
# keybind = alt+shift+j=decrease_font_size:1
+keybind = ctrl+l=unbind
+keybind = ctrl+w=unbind
keybind = ctrl+zero=unbind
keybind = ctrl+enter=unbind
+
keybind = super+q=close_window
keybind = super+r=reload_config
theme=gruber-darker
diff --git a/.config/kak/autoload/buffers.kak b/.config/kak/autoload/buffers.kak
new file mode 100644
index 0000000..b1a4931
--- /dev/null
+++ b/.config/kak/autoload/buffers.kak
@@ -0,0 +1,267 @@
+# buflist++: names AND modified bool
+# debug buffers (like *debug*, *lint*…) are excluded
+declare-option -hidden str-list buffers_info
+
+declare-option int buffers_total
+
+# keys to use for buffer picking
+declare-option str buffer_keys "1234567890qwertyuiopasdfghjklzxcvbnm"
+
+# used to handle [+] (modified) symbol in list
+define-command -hidden refresh-buffers-info %{
+ set-option global buffers_info
+ set-option global buffers_total 0
+ # iteration over all buffers (except debug ones)
+ evaluate-commands -no-hooks -buffer * %{
+ set-option -add global buffers_info "%val{bufname}_%val{modified}"
+ }
+ evaluate-commands %sh{
+ total=$(printf '%s\n' "$kak_opt_buffers_info" | tr ' ' '\n' | wc -l)
+ printf "set-option global buffers_total $total"
+ }
+}
+
+# used to handle # (alt) symbol in list
+declare-option str alt_bufname
+declare-option str current_bufname
+# adjust this number to display more buffers in info
+declare-option int max_list_buffers 42
+
+hook global WinDisplay .* %{
+ set-option global alt_bufname %opt{current_bufname}
+ set-option global current_bufname %val{bufname}
+}
+
+define-command info-buffers -docstring 'populate an info box with a numbered buffers list' %{
+ refresh-buffers-info
+ evaluate-commands %sh{
+ # info title
+ printf "info -title '$kak_opt_buffers_total buffers' -- %%^"
+
+ index=0
+ eval "set -- $kak_quoted_opt_buffers_info"
+ while [ "$1" ]; do
+ # limit lists too big
+ index=$((index + 1))
+ if [ "$index" -gt "$kak_opt_max_list_buffers" ]; then
+ printf ' …'
+ break
+ fi
+
+ name=${1%_*}
+ if [ "$name" = "$kak_bufname" ]; then
+ printf '>'
+ elif [ "$name" = "$kak_opt_alt_bufname" ]; then
+ printf '#'
+ else
+ printf ' '
+ fi
+
+ modified=${1##*_}
+ if [ "$modified" = true ]; then
+ printf '+ '
+ else
+ printf ' '
+ fi
+
+ if [ "$index" -lt 10 ]; then
+ echo "0$index - $name"
+ else
+ echo "$index - $name"
+ fi
+
+ shift
+ done
+ printf ^\\n
+ }
+}
+
+declare-user-mode pick-buffers
+define-command pick-buffers -docstring 'enter buffer pick mode' %{
+ refresh-buffers-info
+ unmap global pick-buffers
+ evaluate-commands %sh{
+ docstring() {
+ if [ "$1" = true ]; then
+ printf "%s+ %s" "$2" "$3"
+ else
+ printf "%s %s" "$2" "$3"
+ fi
+ }
+ index=0
+ keys=" $kak_opt_buffer_keys"
+ num_keys=${#kak_opt_buffer_keys}
+ eval "set -- $kak_quoted_opt_buffers_info"
+ while [ "$1" ]; do
+ # limit lists too big
+ index=$((index + 1))
+ if [ "$index" -gt "$num_keys" ]; then
+ break
+ fi
+
+ buf_id=$(echo ${keys} | cut -c${index})
+ name=${1%_*}
+ modified=${1##*_}
+ if [ "$name" = "$kak_bufname" ]; then
+ printf "map global pick-buffers %s ': buffer-by-index %s<ret>' -docstring '%s'\n" ${buf_id} $index "$(docstring $modified '>' "$name")"
+ elif [ "$name" = "$kak_opt_alt_bufname" ]; then
+ printf "map global pick-buffers %s ': buffer-by-index %s<ret>' -docstring '%s'\n" ${buf_id} $index "$(docstring $modified '#' "$name")"
+ else
+ printf "map global pick-buffers %s ': buffer-by-index %s<ret>' -docstring '%s'\n" ${buf_id} $index "$(docstring $modified ':' "$name")"
+ fi
+
+ shift
+ done
+ }
+ enter-user-mode pick-buffers
+}
+
+define-command buffer-first -docstring 'move to the first buffer in the list' 'buffer-by-index 1'
+
+define-command buffer-last -docstring 'move to the last buffer in the list' %{
+ buffer-by-index %opt{buffers_total}
+}
+
+define-command -hidden -params 1 buffer-by-index %{
+ refresh-buffers-info
+ evaluate-commands %sh{
+ target=$1
+ index=0
+ eval "set -- $kak_quoted_opt_buffers_info"
+ while [ "$1" ]; do
+ index=$((index+1))
+ name=${1%_*}
+ if [ $index = $target ]; then
+ printf "buffer '$name'"
+ fi
+ shift
+ done
+ }
+}
+
+define-command buffer-first-modified -docstring 'move to the first modified buffer in the list' %{
+ refresh-buffers-info
+ evaluate-commands %sh{
+ eval "set -- $kak_quoted_opt_buffers_info"
+ while [ "$1" ]; do
+ name=${1%_*}
+ modified=${1##*_}
+ if [ "$modified" = true ]; then
+ printf "buffer '$name'"
+ fi
+ shift
+ done
+ }
+}
+
+define-command delete-buffers -docstring 'delete all saved buffers' %{
+ evaluate-commands %sh{
+ deleted=0
+ eval "set -- $kak_quoted_buflist"
+ while [ "$1" ]; do
+ echo "try %{delete-buffer '$1'}"
+ echo "echo -markup '{Information}$deleted buffers deleted'"
+ deleted=$((deleted+1))
+ shift
+ done
+ }
+}
+
+define-command buffer-only -docstring 'delete all saved buffers except current one' %{
+ evaluate-commands %sh{
+ deleted=0
+ eval "set -- $kak_quoted_buflist"
+ while [ "$1" ]; do
+ if [ "$1" != "$kak_bufname" ]; then
+ echo "try %{delete-buffer '$1'}"
+ echo "echo -markup '{Information}$deleted buffers deleted'"
+ deleted=$((deleted+1))
+ fi
+ shift
+ done
+ }
+}
+
+define-command buffer-only-force -docstring 'delete all buffers except current one' %{
+ evaluate-commands %sh{
+ deleted=0
+ eval "set -- $kak_quoted_buflist"
+ while [ "$1" ]; do
+ if [ "$1" != "$kak_bufname" ]; then
+ echo "delete-buffer! '$1'"
+ echo "echo -markup '{Information}$deleted buffers deleted'"
+ deleted=$((deleted+1))
+ fi
+ shift
+ done
+ }
+}
+
+define-command buffer-only-directory -docstring 'delete all saved buffers except the ones in the same current buffer directory' %{
+ evaluate-commands %sh{
+ deleted=0
+ current_buffer_dir=$(dirname "$kak_bufname")
+ eval "set -- $kak_quoted_buflist"
+ while [ "$1" ]; do
+ dir=$(dirname "$1")
+ if [ $dir != "$current_buffer_dir" ]; then
+ echo "try %{delete-buffer '$1'}"
+ echo "echo -markup '{Information}$deleted buffers deleted'"
+ deleted=$((deleted+1))
+ fi
+ shift
+ done
+ }
+}
+
+define-command edit-kakrc -docstring 'open kakrc in a new buffer' %{
+ evaluate-commands %sh{
+ printf "edit $kak_config/kakrc"
+ }
+}
+
+declare-user-mode buffers
+
+map global buffers a 'ga' -docstring 'alternate ↔'
+map global buffers b ': info-buffers<ret>' -docstring 'info'
+map global buffers c ': edit-kakrc<ret>' -docstring 'config'
+map global buffers d ': delete-buffer<ret>' -docstring 'delete'
+map global buffers D ': delete-buffers<ret>' -docstring 'delete all'
+map global buffers f ': buffer<space>' -docstring 'find'
+map global buffers h ': buffer-first<ret>' -docstring 'first ⇐'
+map global buffers l ': buffer-last<ret>' -docstring 'last ⇒'
+map global buffers m ': buffer-first-modified<ret>' -docstring 'modified'
+map global buffers n ': buffer-next<ret>' -docstring 'next →'
+map global buffers o ': buffer-only<ret>' -docstring 'only'
+map global buffers p ': buffer-previous<ret>' -docstring 'previous ←'
+map global buffers r ': rename-buffer ' -docstring 'rename'
+map global buffers s ': edit -scratch *scratch*<ret>' -docstring '*scratch*'
+map global buffers u ': buffer *debug*<ret>' -docstring '*debug*'
+
+# trick to access count, 3b → display third buffer
+define-command -hidden enter-buffers-mode %{
+ evaluate-commands %sh{
+ if [ "$kak_count" -eq 0 ]; then
+ printf 'enter-user-mode buffers'
+ else
+ printf "buffer-by-index $kak_count"
+ fi
+ }
+}
+
+# Suggested hook
+
+#hook global WinDisplay .* info-buffers
+
+# Suggested mappings
+
+#map global user b ':enter-buffers-mode<ret>' -docstring 'buffers…'
+#map global user B ':enter-user-mode -lock buffers<ret>' -docstring 'buffers (lock)…'
+
+# Suggested aliases
+
+#alias global bd delete-buffer
+#alias global bf buffer-first
+#alias global bl buffer-last
+#alias global bo buffer-only
+#alias global bo! buffer-only-force
diff --git a/.config/kak/kakrc b/.config/kak/kakrc
index 5cab379..e3ba67f 100644
--- a/.config/kak/kakrc
+++ b/.config/kak/kakrc
@@ -64,3 +64,14 @@ define-command delete-buffers-matching -params 1..2 %{
} fi
}
}
+
+map global user b ':enter-buffers-mode<ret>' -docstring 'buffers…'
+map global user B ':enter-user-mode -lock buffers<ret>' -docstring 'buffers (lock)…'
+
+# Suggested aliases
+
+alias global bd delete-buffer
+alias global bf buffer-first
+alias global bl buffer-last
+alias global bo buffer-only
+alias global bo! buffer-only-force
diff --git a/.config/shell/bm-dirs b/.config/shell/bm-dirs
index e7affce..f196c88 100644
--- a/.config/shell/bm-dirs
+++ b/.config/shell/bm-dirs
@@ -8,9 +8,7 @@ rr $HOME/.local/src
h $HOME
m ${XDG_MUSIC_DIR:-$HOME/Music}
mn /mnt
-pp ${XDG_PICTURES_DIR:-$HOME/Pictures}
sc $HOME/.local/bin
src $HOME/.local/src
vv ${XDG_VIDEOS_DIR:-$HOME/Videos}
pro $HOME/Programming
-
diff --git a/.config/shell/inputrc b/.config/shell/inputrc
new file mode 100644
index 0000000..9119437
--- /dev/null
+++ b/.config/shell/inputrc
@@ -0,0 +1,13 @@
+set bind-tty-special-chars off
+set show-all-if-ambiguous on
+set menu-complete-display-prefix on
+set colored-completion-prefix on
+set colored-stats on
+
+# next tab(s) will cycle through matches
+TAB: menu-complete
+# shift tab cycles backward
+"\e[Z": menu-complete-backward
+Control-l: 'clear\n'
+"\C-w": unix-filename-rubout
+"\C-x\C-w": unix-filename-rubout
diff --git a/.config/shell/profile b/.config/shell/profile
index 1f4cdc1..39f2ebd 100644
--- a/.config/shell/profile
+++ b/.config/shell/profile
@@ -6,13 +6,15 @@ export PASSWORD_STORE_DIR=$HOME/.local/share/password-store
if ! [ -d "${XDG_RUNTIME_DIR}" ] && [ "$(uname -s)" = "Linux" ]
then d="/run/user/$(id -u)"
- sudo mkdir -p "$d"
- sudo chown -R "$USER:$USER" "$d"
- sudo chmod 700 "$d"
+ if command -v sudo >/dev/null 2>&1; then
+ mkdir -p "$d"
+ chown -R "$USER:$USER" "$d"
+ chmod 700 "$d"
export XDG_RUNTIME_DIR="$d"
+ fi
fi
-export EDITOR="c s"
+export EDITOR="cs"
export GIT_EDITOR="kak "
export PATH="$PATH:$HOME/go/bin:/usr/local/go/bin"
diff --git a/.inputrc b/.inputrc
new file mode 120000
index 0000000..475648d
--- /dev/null
+++ b/.inputrc
@@ -0,0 +1 @@
+.config/shell/inputrc \ No newline at end of file
diff --git a/.local/bin/cs b/.local/bin/cs
new file mode 100755
index 0000000..a9bfaa4
--- /dev/null
+++ b/.local/bin/cs
@@ -0,0 +1 @@
+exec c s "$@"
diff --git a/.local/bin/rk b/.local/bin/rk
new file mode 100755
index 0000000..63b05cd
--- /dev/null
+++ b/.local/bin/rk
@@ -0,0 +1,3 @@
+#!/bin/sh
+rg --vimgrep "$@" |
+ c s -e 'db! *grep*; rename-buffer *grep*; set-option window filetype grep; evaluate-commands -try-client %opt{toolsclient} %{ buffer *grep*; set-option window filetype grep }'
diff --git a/.zprofile b/.zprofile
new file mode 100644
index 0000000..c7b8b63
--- /dev/null
+++ b/.zprofile
@@ -0,0 +1 @@
+. "${HOME}/.profile"