Compare commits

...

21 Commits
master ... main

Author SHA1 Message Date
27e774892a remove check for mpd binary as it might be in a different location on a different system 2021-06-21 14:16:02 +00:00
1916450d90 add zpatch, a function to apply a patch file to cwd (lists files in $OHMYPATCHES) 2021-06-21 14:13:58 +00:00
aafbf3f101 Allow pkg index to be specified via env var 2021-06-21 14:11:52 +00:00
a4957f1899
Merge pull request #7 from rjc/man
Fix and improve man(1) completion
2021-03-31 06:59:37 -06:00
Raf Czlonka
d27c85fbe1 Fix and improve man(1) completion
Fixes several issues in the current `man(1)` completion:

- _section_ numbers are not stripped off
- _Perl Programmers Reference Guide_ (`3p`) section is ignored
- manual page name can only be completed as the 1st argument

While there, add several more manual page hierarchies, i.e. `cat*`
for _graphiz_ on OpenBSD, `/usr/local/share/man` on macOS, etc.
2021-03-31 13:56:03 +01:00
fdbb432ad1
Merge pull request #6 from felix/git-commands
List git commands simply and portably
2021-03-23 16:49:21 -06:00
Felix Hanley
0515b471fd List git commands simply and portably 2021-03-24 09:42:54 +11:00
5ca81764aa fzf has a few features! 2021-03-20 05:45:33 -06:00
458c6d5866 remove stray workingtree 2021-03-19 22:14:46 +00:00
3afbd7ac41 update man doc to reflect what currently happens 2021-03-19 22:12:01 +00:00
434b815e34 update git doc to reflect current info, switch backticks to $(). 2021-03-19 16:07:46 -06:00
0c31f525dd
Merge pull request #5 from bijanebrahimi/feature-git
Update git commands and aliases to git auto-completion
2021-03-19 16:04:59 -06:00
896839477f
Merge pull request #4 from bijanebrahimi/feature-load
fix load function not to depend on execution flag of file
2021-03-19 16:03:55 -06:00
542d94193b
Merge pull request #3 from bijanebrahimi/feature-man
added X11R6 and local manpage dirs
2021-03-19 16:03:02 -06:00
f4b38ff89c
Merge pull request #2 from bijanebrahimi/feature-k
Add optional argument to k's rm command
2021-03-19 16:02:10 -06:00
Bijan
bdd34b5429 populate list of git commands from git manual-page 2020-09-20 13:09:12 +04:30
Bijan
7f2a3f3fcc fix load function, does not depend on execution flag 2020-09-20 09:41:48 +04:30
Bijan
1cd3d8ec39 added git gloabl configured aliases to completion 2020-09-17 12:43:43 +04:30
Bijan
7bea5a33d4 added X11R6 and local manpage dirs 2020-09-16 14:58:02 +04:30
Bijan
b6fb7da353 added optional argument to 'k rm' command 2020-09-16 13:23:21 +04:30
Bijan
e332e744a1 added sort -u and -o to remove the pipes 2020-09-16 13:22:38 +04:30
11 changed files with 47 additions and 58 deletions

View File

@ -1,6 +1,7 @@
#+TITLE: ohmyksh
** About
Have your cake and eat it too!
~ohmyksh~ is a framework for expanding OpenBSD's [[https://man.openbsd.org/ksh][ksh]]. It offers:
@ -28,17 +29,17 @@ Have your cake and eat it too!
** Extensions
| Name | Description |
|------------+--------------------------------------------------------------|
| [[file:extensions/fonts.org][fonts]] | Load fonts from common locations. |
| [[file:extensions/fzf.org][fzf]] | - |
| [[file:extensions/git-prompt.org][git-prompt]] | A port of git-prompt for KSH. |
| [[file:extensions/got.org][got]] | Adds PS1 support for got, as well as a few helper functions. |
| [[file:extensions/k.org][k]] | A tool to quickly change directories. |
| [[file:extensions/keychain.org][keychain]] | Wrapper for [[https://www.funtoo.org/Keychain][Funtoo's Keychain]] utility. |
| [[file:extensions/nocolor.org][nocolor]] | Disable terminal color options for many tools. |
| [[file:extensions/openbsd.org][openbsd]] | A set of tools for working with the OpenBSD source trees. |
| [[file:extensions/pkgup.org][pkgup]] | Utility to speed up OpenBSD' [[https://man.openbsd.org/pkg_add][pkg_add(1)]]. |
| Name | Description |
|------------+-------------------------------------------------------------------------|
| [[file:extensions/fonts.org][fonts]] | Load fonts from common locations. |
| [[file:extensions/fzf.org][fzf]] | Set of interactive wrappers for things like packages and shell history. |
| [[file:extensions/git-prompt.org][git-prompt]] | A port of git-prompt for KSH. |
| [[file:extensions/got.org][got]] | Adds PS1 support for got, as well as a few helper functions. |
| [[file:extensions/k.org][k]] | A tool to quickly change directories. |
| [[file:extensions/keychain.org][keychain]] | Wrapper for [[https://www.funtoo.org/Keychain][Funtoo's Keychain]] utility. |
| [[file:extensions/nocolor.org][nocolor]] | Disable terminal color options for many tools. |
| [[file:extensions/openbsd.org][openbsd]] | A set of tools for working with the OpenBSD source trees. |
| [[file:extensions/pkgup.org][pkgup]] | Utility to speed up OpenBSD' [[https://man.openbsd.org/pkg_add][pkg_add(1)]]. |
** Prompts

View File

@ -1,17 +1,4 @@
#: | git | add, fetch... |
set -A complete_git_1 -- \
add am archive \
bisect branch bundle \
checkout cherry-pick citool clean clone commit config \
describe diff \
fetch format-patch \
gc grep gui \
init \
log \
merge mv \
notes \
pull push \
range-diff rebase reset restore revert rm \
shortlog show sparse-checkout stash status submodule switch \
tag \
worktree
$(git --list-cmds=main) \
$(git config --get-regexp ^alias\. | awk -F '[\. ]' '{ print $2 }')

View File

@ -3,20 +3,11 @@
The ~git~ completion currently supports the following arguments:
** Level 1
The completions for level one are dynamically created using the following
commands:
#+begin_src ksh
add am archive \
bisect branch bundle \
checkout cherry-pick citool clean clone commit config \
describe diff \
fetch format-patch \
gc grep gui \
init \
log \
merge mv \
notes \
pull push \
range-diff rebase reset restore revert rm \
shortlog show sparse-checkout stash status submodule switch \
tag \
worktree
$(git --list-cmds=main) \
$(git config --get-regexp ^alias\. | awk -F '[\. ]' '{ print $2 }')
#+end_src

View File

@ -1,10 +1,11 @@
#: | man | man pages |
MAN_CACHE=$LOAD_PATH/cache/man
if [ ! -f $MAN_CACHE ]; then
MANPATH=/usr/share/man man -k Nm~. | cut -d\( -f1 | tr -d , | \
sort | \
uniq > $MAN_CACHE
mkdir -p $(dirname ${MAN_CACHE})
for i in /usr{,/X11R6,/local}{,/share}/man/{,cat,man}[1-9lnp]{,f,p}
do
test -d $i && ls $i
done | rev | cut -d. -f2- | rev | sort -u > $MAN_CACHE
fi
set -A complete_man_1 -- $(cat $MAN_CACHE)
set -A complete_man -- $(cat $MAN_CACHE)

View File

@ -5,9 +5,10 @@
Completions for man pages are found via:
#+begin_src shell
MANPATH=/usr/share/man man -k Nm~. | cut -d\( -f1 | tr -d , | \
sort | \
uniq > $MAN_CACH
for i in /usr{,/X11R6,/local}{,/share}/man/{,cat,man}[1-9lnp]{,f,p}
do
test -d $i && ls $i
done | rev | cut -d. -f2- | rev | sort -u > $MAN_CACHE
#+end_src
Currently the cache is never re-created. Operating without a cache causes

View File

@ -20,7 +20,4 @@ set -A complete_mpc_1 -- \
version volume \
waitmessage
pgrep -fq '/usr/local/sbin/mpd'
if [ $? = 0 ]; then
set -A complete_mpc_2 -- $(mpc lsplaylists | sort)
fi
set -A complete_mpc_2 -- $(mpc lsplaylists | sort)

View File

@ -1,5 +1,15 @@
zpatch() {
if [ -z $OHMYPATCHES ]; then
echo "please set OHMYPATCHES to the directory that contains your patches."
return 1
fi
local _patch_file="$(ls ${OHMYPATCHES}/* | fzf)"
/usr/bin/patch $@ < "${_patch_file}"
}
zh() {
fc -ln | eval `fzf`
fc -ln | eval $(fzf)
}
zpkg() {

View File

@ -5,5 +5,6 @@
|------+---------------------------------|
| zh | Interactive shell history. |
| zpkg | Interactive package add/remove. |
| zpatch | Interactive function for applying patches. |

View File

@ -21,8 +21,8 @@ k() {
else
K=~/.k
case $1 in
clean) sort $K | uniq > ${K}.tmp && mv ${K}.tmp ${K};;
rm) sed -i -E "\#^${PWD}\$#d" ${K};;
clean) sort -u $K -o ${K};;
rm) sed -i -E "\#^${2:-${PWD}}\$#d" ${K};;
ls) cat ${K};;
*) cd "$(grep -e "$1" ${K} | head -n 1)";;
esac

View File

@ -2,7 +2,7 @@
pkgup() {
local _up_url
_up_url="https://pintobyte.com/pkgup/"
_up_url="${OHMY_PKGUP_URL:-https://pintobyte.com/pkgup/}"
[ ! -z $1 ] && _up_url=$1
if which obsdpkgup >/dev/null 2>&1; then

View File

@ -13,7 +13,7 @@ _loaded() {
load() {
local _e=$1
[[ -x $_e ]] && \
[[ -f $_e ]] && \
. $_e
}