about summary refs log tree commit diff stats
path: root/config/ksh/functions
diff options
context:
space:
mode:
authorEnsa <psychoticfervor@tuta.io>2020-03-07 07:08:38 -0800
committerEnsa <psychoticfervor@tuta.io>2020-03-07 07:08:38 -0800
commitc4632455cff4a5097a3a35ad9d0531388776d028 (patch)
treed31eb3b660ef94decb06c407057d1cdb2532cd25 /config/ksh/functions
parent8fa69fc68072910f855958b3b79360ede1a32682 (diff)
downloadcfg-c4632455cff4a5097a3a35ad9d0531388776d028.tar.gz
ksh config update
synopsis: now utilizes FPATH instead of one functions file, relocated
more into kshrc, fancy prompt

prompt.ksh
	formerly zz-prompt.ksh, now doesn't need a weird name because
	i'm not using loops to load in config files.
	prompt.ksh provides a different appearance than the previous
	PS1, and has a section for displaying the git repo branch if PWD
	is a git repo.
	it also now uses a (commented out) reference table for ANSI
	escape codes because variable names were too long.
kshrc
	now simply loads shrc from ~/.config instead of setting up the
	XDG vars in advance
	uses FPATH pointing to config/ksh/functions
	poured in exports.ksh, changed one export to a normal variable
	because it wasn't needed
	checks for /usr/X11R6 to see if MANPATH should be what works on
	openbsd
	now uses checkloads for all config files instead of for file in
funcions/
	WIP zone, a lot of this isn't named properly yet but
	everything's contents should be self-explanatory
Diffstat (limited to 'config/ksh/functions')
-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/mpvpin4
-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
9 files changed, 51 insertions, 0 deletions
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/mpvpin b/config/ksh/functions/mpvpin
new file mode 100644
index 0000000..0cc3cf5
--- /dev/null
+++ b/config/ksh/functions/mpvpin
@@ -0,0 +1,4 @@
+#!/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&
+}