about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--config/ksh/00-opts.ksh1
-rw-r--r--config/ksh/exports.ksh10
-rw-r--r--config/ksh/functions/l.8
-rw-r--r--config/ksh/functions/man_complete4
-rw-r--r--config/ksh/functions/mc4
-rw-r--r--config/ksh/functions/mpvpin (renamed from config/ksh/functions.ksh)4
-rw-r--r--config/ksh/functions/pkg_complete5
-rw-r--r--config/ksh/functions/update_completion_manpages8
-rw-r--r--config/ksh/functions/update_completion_packages_obsd8
-rw-r--r--config/ksh/functions/update_completion_pkg_inst_obsd4
-rw-r--r--config/ksh/functions/update_completions6
-rw-r--r--config/ksh/kshrc23
-rw-r--r--config/ksh/prompt.ksh20
-rw-r--r--config/ksh/zz-prompt.ksh32
14 files changed, 84 insertions, 53 deletions
diff --git a/config/ksh/00-opts.ksh b/config/ksh/00-opts.ksh
deleted file mode 100644
index 4b7ff4c..0000000
--- a/config/ksh/00-opts.ksh
+++ /dev/null
@@ -1 +0,0 @@
-set -o vi
diff --git a/config/ksh/exports.ksh b/config/ksh/exports.ksh
deleted file mode 100644
index c2ec25d..0000000
--- a/config/ksh/exports.ksh
+++ /dev/null
@@ -1,10 +0,0 @@
-# exports for convenience
-export GITHUB="https://github.com"
-# programs
-export IRC_SERVERS_FILE="$HOME/.local/share/ircservers"
-# make pfetch show what i want
-export PF_INFO="ascii title os host shell editor wm pkgs uptime palette"
-# color
-export CLICOLOR=1
-# fix manpath so local man pages work
-export MANPATH="/usr/share/man:/usr/X11R6/man:/usr/local/man:$XDG_DATA_HOME/man"
diff --git a/config/ksh/functions/l. b/config/ksh/functions/l.
new file mode 100644
index 0000000..8beac4e
--- /dev/null
+++ b/config/ksh/functions/l.
@@ -0,0 +1,8 @@
+#!/bin/ksh
+l.() {
+	if [[ -n "$1" ]]; then
+		exa -Fbd "$1"/.*
+	else
+		exa -Fbd .*
+	fi
+}
diff --git a/config/ksh/functions/man_complete b/config/ksh/functions/man_complete
new file mode 100644
index 0000000..291db3d
--- /dev/null
+++ b/config/ksh/functions/man_complete
@@ -0,0 +1,4 @@
+#!/bin/ksh
+man_complete() {
+	set -A complete_man -- $(<$HOME/.cache/ksh/precompletions/manpages)
+}
diff --git a/config/ksh/functions/mc b/config/ksh/functions/mc
new file mode 100644
index 0000000..db8a46f
--- /dev/null
+++ b/config/ksh/functions/mc
@@ -0,0 +1,4 @@
+#!/bin/ksh
+mc() {
+	mkdir "$1" && cd "$1";
+}
diff --git a/config/ksh/functions.ksh b/config/ksh/functions/mpvpin
index e5d2668..0cc3cf5 100644
--- a/config/ksh/functions.ksh
+++ b/config/ksh/functions/mpvpin
@@ -1,6 +1,4 @@
-mc() {
-	mkdir "$1" && cd "$1";
-}
+#!/bin/ksh
 mpvpin() {
 	mpv --input-ipc-server=/tmp/mpv-socket$(date +%s) --quiet --title "PIN" "$1" >/dev/null 2>&1 &
 }
diff --git a/config/ksh/functions/pkg_complete b/config/ksh/functions/pkg_complete
new file mode 100644
index 0000000..ee1b9fb
--- /dev/null
+++ b/config/ksh/functions/pkg_complete
@@ -0,0 +1,5 @@
+#!/bin/ksh
+pkg_complete() {
+	set -A complete_pa -- $(<$HOME/.cache/ksh/precompletions/packages)
+	set -A complete_pi -- $complete_pa
+}
diff --git a/config/ksh/functions/update_completion_manpages b/config/ksh/functions/update_completion_manpages
new file mode 100644
index 0000000..dc4e77a
--- /dev/null
+++ b/config/ksh/functions/update_completion_manpages
@@ -0,0 +1,8 @@
+#!/bin/ksh
+update_completion_manpages() {
+	rm $XDG_CACHE_HOME/ksh/precompletions/manpages
+	for manpage in $(man -kw Nm~.);
+	do
+		basename $manpage|sed 's/\..*//'>>$XDG_CACHE_HOME/ksh/precompletions/manpages
+	done
+}
diff --git a/config/ksh/functions/update_completion_packages_obsd b/config/ksh/functions/update_completion_packages_obsd
new file mode 100644
index 0000000..2de477f
--- /dev/null
+++ b/config/ksh/functions/update_completion_packages_obsd
@@ -0,0 +1,8 @@
+#!/bin/ksh
+update_completion_packages() {
+	if [[ -e /usr/local/share/ports-INDEX ]]; then
+		sed 's/|.*$//' /usr/local/share/ports-INDEX>$XDG_CACHE_HOME/ksh/precompletions/packages
+	else
+		echo "install portslist if you want the completions for pkg_add and pkg_info" > /dev/stderr
+	fi
+}
diff --git a/config/ksh/functions/update_completion_pkg_inst_obsd b/config/ksh/functions/update_completion_pkg_inst_obsd
new file mode 100644
index 0000000..0442a77
--- /dev/null
+++ b/config/ksh/functions/update_completion_pkg_inst_obsd
@@ -0,0 +1,4 @@
+#!/bin/ksh
+update_completion_pkg_inst() {
+	ls -1 /var/db/pkg>$XDG_CACHE_HOME/ksh/precompletions/pkg_inst
+}
diff --git a/config/ksh/functions/update_completions b/config/ksh/functions/update_completions
new file mode 100644
index 0000000..cc1e82b
--- /dev/null
+++ b/config/ksh/functions/update_completions
@@ -0,0 +1,6 @@
+#!/bin/ksh
+update_completions() {
+	update_completion_packages&
+	update_completion_pkg_inst&
+	update_completion_manpages&
+}
diff --git a/config/ksh/kshrc b/config/ksh/kshrc
index abf9bf0..bd8f48b 100644
--- a/config/ksh/kshrc
+++ b/config/ksh/kshrc
@@ -1,22 +1,31 @@
 #!/bin/ksh
-export XDG_CACHE_HOME=${XDG_CACHE_HOME:=~/.cache}
-export XDG_CONFIG_HOME=${XDG_CONFIG_HOME:=~/.config}
-export XDG_DATA_HOME=${XDG_DATA_HOME:=~/.local/share}
-. $XDG_CONFIG_HOME/shrc
+. $HOME/.config/shrc
 KSHCONFIG="$XDG_CONFIG_HOME/ksh"
 if ! echo "$PATH"|grep -q ".local/bin"; then
   export PATH="$HOME/.local/bin:$PATH"
 fi
+FPATH=$XDG_CONFIG_HOME/ksh/functions
 
 HISTFILE=$XDG_DATA_HOME/ksh/histfile
 HISTSIZE=5000
 HISTCONTROL="ignoredups"
 TMPDIR=$XDG_CACHE_HOME/ksh
+# shortcut for cloning
+GITHUB="https://github.com"
+# make pfetch show what i want
+export PF_INFO="ascii title os host shell editor wm pkgs uptime palette"
+# fix manpath so local man pages work
+# crude *bsd detection
+if [[ -d /usr/X11R6 ]]; then
+export MANPATH="/usr/share/man:/usr/X11R6/man:/usr/local/man:$XDG_DATA_HOME/man"
+else
+export MANPATH="/usr/share/man:/usr/local/share/man:$XDG_DATA_HOME/man"
+fi
+set -o vi
 
 #load ksh external configs
-for file in $KSHCONFIG/*.ksh; do
-	. "$file"
-done
 . $XDG_CONFIG_HOME/lf/lfcd.sh
 [[ -f "$KSHCONFIG/diraliases" ]] && . "$KSHCONFIG/diraliases"
 [[ -f "$XDG_CONFIG_HOME/aliasrc" ]] && . "$XDG_CONFIG_HOME/aliasrc"
+[[ -f "$KSHCONFIG/completions.ksh" ]] && . "$KSHCONFIG/completions.ksh"
+[[ -f "$KSHCONFIG/prompt.ksh" ]] && . "$KSHCONFIG/prompt.ksh"
diff --git a/config/ksh/prompt.ksh b/config/ksh/prompt.ksh
new file mode 100644
index 0000000..e5dfaf5
--- /dev/null
+++ b/config/ksh/prompt.ksh
@@ -0,0 +1,20 @@
+#!/bin/ksh
+SEP=""
+RSEP=""
+#_PS1='\[\033[';
+#_END='m\]';
+#_CLEAR=0;	_FG_BLACK=30;	_BG_BLACK=40
+#_BRIGHT=1;	_FG_RED=31;	_BG_RED=41
+#_DIM=2;	_FG_GREEN=32;	_BG_GREEN=42
+#_UNDER=4;	_FG_YELLOW=33;	_BG_YELLOW=43
+#_BLINK=5;	_FG_BLUE=34;	_BG_BLUE=44
+#_REVERSE=7;	_FG_MAGENTA=35;	_BG_MAGENTA=45
+#_HIDDEN=8;	_FG_CYAN=36;	_BG_CYAN=46
+#		_FG_WHITE=37;	_BG_WHITE=47
+vcs() {
+	if git status >/dev/null 2>&1; then
+		_GIT_BRANCH="$(git branch|grep -F '*'|sed 's/* //')"
+		printf '  %s\n' "$_GIT_BRANCH"
+	fi
+}
+PS1='\[\033[7;32m\]$?\[\033[0;32;45m\]$SEP\[\033[0;7;35m\]\A$RSEP\[\033[0;1;31m\]\u\[\033[0;32m\]@\[\033[1;34m\]\h\[\033[7;36m\]$SEP\[\033[7m\]\w$RSEP\[\033[0;32m\]$(vcs)\n\[\033[0;32m\]\$\[\033[0m\] '
diff --git a/config/ksh/zz-prompt.ksh b/config/ksh/zz-prompt.ksh
deleted file mode 100644
index b7f80cf..0000000
--- a/config/ksh/zz-prompt.ksh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/ksh
-SEP="|"
-_PS1='\[\033['
-_END='m\]'
-
-_CLEAR='0'
-_BRIGHT='1'
-_DIM='2'
-_UNDER='4'
-_BLINK='5'
-_REVERSE='7'
-_HIDDEN='8'
-
-_FG_BLACK='30'
-_FG_RED='31'
-_FG_GREEN='32'
-_FG_YELLOW='33'
-_FG_BLUE='34'
-_FG_MAGENTA='35'
-_FG_CYAN='36'
-_FG_WHITE='37'
-
-_BG_BLACK='40'
-_BG_RED='41'
-_BG_GREEN='42'
-_BG_YELLOW='43'
-_BG_BLUE='44'
-_BG_MAGENTA='45'
-_BG_CYAN='46'
-_BG_WHITE='47'
-PS1='$_PS1$_FG_BLACK;$_BG_GREEN$_END$?$_PS1$_CLEAR$_END$SEP$_PS1$_FG_BLACK;$_BG_MAGENTA$_END\A$_PS1$_CLEAR$_END$SEP$_PS1$_BRIGHT;$_FG_RED$_END\u$_PS1$_CLEAR;$_FG_GREEN$_END@$_PS1$_BRIGHT;$_FG_BLUE$_END\h$_PS1$_CLEAR$_END:$_PS1$_BRIGHT;$_FG_CYAN$_END\w$_PS1$_CLEAR;$_FG_GREEN$_END\$$_PS1$_CLEAR$_END '
-export PS1