Skip to content

Instantly share code, notes, and snippets.

@rwcarlsen
Created October 10, 2016 05:39
Show Gist options
  • Select an option

  • Save rwcarlsen/23bc16b57feeb82e0fb86cf681ee14bf to your computer and use it in GitHub Desktop.

Select an option

Save rwcarlsen/23bc16b57feeb82e0fb86cf681ee14bf to your computer and use it in GitHub Desktop.
start of acme script for opening complementary header/cc file.
#!/bin/bash
function findh {
filename=$(basename "$1")
extension="${filename##*.}"
name="${filename%.*}"
dir=$2
echo $(cat <(find $dir | grep "$name"'\.\(c\|cc\|C\|cpp\|h\|H\|hpp\)$') <(echo $filename) | sort | uniq -u | head -n1)
}
pair=$(findh $samfile .)
if [[ -z $pair ]]; then
pair=$(findh $samfile ..)
fi
if [[ -z $pair ]]; then
pair=$(findh $samfile ../..)
fi
if [[ -z $pair ]]; then
pair=$(findh $samfile ../../..)
fi
pair
echo -n "1,$" | 9p write acme/$winid/addr
echo "Selected whole contents for overwriting with 'write'"
9p read acme/$winid/body | peg-markdown --to=$format | 9p write acme/new/body
echo "Wrote the html-markdowned version to a new buffer"
last=$(9p ls acme | sort -g | tail -n 1)
echo "Get last created buffer"
echo -n "clean" | 9p write acme/$last/ctl
echo -n "0,0" | 9p write acme/$last/addr
echo -n "dot=addr" | 9p write acme/$last/ctl
echo -n "show" | 9p write acme/$last/ctl
echo "Moved to beginning"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment