Created
October 10, 2016 05:39
-
-
Save rwcarlsen/23bc16b57feeb82e0fb86cf681ee14bf to your computer and use it in GitHub Desktop.
start of acme script for opening complementary header/cc file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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