initial commit

This commit is contained in:
Nico 2020-11-21 15:42:50 +00:00
commit 8d5056d673
6 changed files with 54 additions and 0 deletions

9
README.md Normal file
View File

@ -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))

3
chatstart Executable file
View File

@ -0,0 +1,3 @@
#!/bin/rc
srv tcp!107.191.50.176!9997 chat
mount /srv/chat /n/chat

7
mdlink Executable file
View File

@ -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)'

2
t+ Executable file
View File

@ -0,0 +1,2 @@
#!/bin/rc
sed 's/^/ /'

2
t- Executable file
View File

@ -0,0 +1,2 @@
#!/bin/rc
sed 's/^ //'

31
wg Executable file
View File

@ -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