From 8d5056d6737b1776843ba7cdac73538b565f5431 Mon Sep 17 00:00:00 2001 From: Nihilazo Date: Sat, 21 Nov 2020 15:42:50 +0000 Subject: [PATCH] initial commit --- README.md | 9 +++++++++ chatstart | 3 +++ mdlink | 7 +++++++ t+ | 2 ++ t- | 2 ++ wg | 31 +++++++++++++++++++++++++++++++ 6 files changed, 54 insertions(+) create mode 100644 README.md create mode 100755 chatstart create mode 100755 mdlink create mode 100755 t+ create mode 100755 t- create mode 100755 wg diff --git a/README.md b/README.md new file mode 100644 index 0000000..ee474f8 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# Plan9 Scripts + +Scripts I use on my 9front install. + +* chatstart: mounts the 9gridchan chat. +* t+: indents in acme +* t-: unindents in acme +* mdlink: Inserts a markdown link (see [this page](https://itwont.work/vimwiki-acme.html)) +* wg: searches for markdown files (see [this page](https://itwont.work/vimwiki-acme.html)) \ No newline at end of file diff --git a/chatstart b/chatstart new file mode 100755 index 0000000..c557940 --- /dev/null +++ b/chatstart @@ -0,0 +1,3 @@ +#!/bin/rc +srv tcp!107.191.50.176!9997 chat +mount /srv/chat /n/chat diff --git a/mdlink b/mdlink new file mode 100755 index 0000000..267da93 --- /dev/null +++ b/mdlink @@ -0,0 +1,7 @@ +#!/bin/rc +text = `{cat} +link = `{echo $text | sed 's/ /_/g'} +if(! test -f $link) { +echo '# '^$"text > $link^'.md' +} +echo '['^$"text^']'^'('^$link^'.md)' diff --git a/t+ b/t+ new file mode 100755 index 0000000..5a1bf82 --- /dev/null +++ b/t+ @@ -0,0 +1,2 @@ +#!/bin/rc +sed 's/^/ /' diff --git a/t- b/t- new file mode 100755 index 0000000..5be82ac --- /dev/null +++ b/t- @@ -0,0 +1,2 @@ +#!/bin/rc +sed 's/^ //' diff --git a/wg b/wg new file mode 100755 index 0000000..a55dd72 --- /dev/null +++ b/wg @@ -0,0 +1,31 @@ +#!/bin/rc +rfork e +nl=' +' +flags=() +recurse=() +while(! ~ $#* 1 && ~ $1 -* && ! ~ $1 --){ + if(~ $1 '-n') + recurse=-n1 + if not + flags=($flags $1); + shift +} +if(~ $1 --) + shift + +switch($#*){ +case 0 + echo 'usage: wg [flags] pattern [files]' >[1=2] + exit usage +case 1 + pattern=$1 + fullnames='mkfile$' + suffixes='\.([bcChlmsy]|md|gmi)$' + files=`$nl{walk -f $recurse | grep -e $fullnames -e $suffixes >[2]/dev/null} +case * + pattern=$1 + shift + files=`$nl{walk -f $recurse -- $*} +} +grep -ni $flags -- $pattern $files /dev/null