├── README.md ├── acme-colors.md ├── bin ├── 9term ├── Clear ├── acme ├── c+ ├── c- ├── gg ├── i+ ├── i- └── sam ├── lib ├── plumbing └── profile └── vim └── colors └── acme.vim /README.md: -------------------------------------------------------------------------------- 1 | # acme-setup 2 | 3 | A collection of scripts and commands and notes-to-self on my Acme text editor setup. 4 | 5 | Add ./bin/ to $PATH (eg. via ~/.profile): 6 | 7 | export PATH=/bin/:$PATH 8 | 9 | To see the viable system fonts (if one does not love the Bigelow & Holme's): 10 | 11 | % fontsrv -p . 12 | 13 | Symlink ./{plumbing, profile} to ~/lib/{plumbing, profile}: 14 | 15 | % mkdir -p ~/lib && ln -s ./plumbing ~/lib/plumbing && ln -s ./profile ~/lib/profile 16 | 17 | Watch Russ Cox's excellent A Tour of Acme (https://research.swtch.com/acme) to get a glimpse at what Acme can do. 18 | 19 | Answer (in the words of Rob Pike): "Uhm... everything." 20 | 21 | 22 | ## Requirements 23 | 24 | Acme, obviously. Get it from the 9fans as part of plan9port at https://github.com/9fans along with some good go tools (editinacme in particular). 25 | 26 | ## My patched Acme 27 | 28 | I'm using a forked version of plan9port, where I've made some changes to the acme source. I might break that out into just an acme clone, but for now it's easier for me to do fresh installs directly from the fork... 29 | 30 | My fork: https://github.com/prodhe/plan9port 31 | 32 | The changes: https://github.com/9fans/plan9port/compare/master...prodhe:master 33 | 34 | Every now and then I merge from upstream to keep it up to date. 35 | 36 | ## VIM colors 37 | 38 | `./vim/colors/acme.vim` is an acme colorscheme for vim. 39 | -------------------------------------------------------------------------------- /acme-colors.md: -------------------------------------------------------------------------------- 1 | # Acme colors 2 | 3 | These are the colors used in the Acme text editor by Rob Pike. 4 | 5 | I like them. 6 | 7 | ## Text cols 8 | 9 | * Background, yellow (1/3: pale yellow / white): #ffffea 10 | * Selected btn 1, dark yellow: #eeee9e 11 | * Border, dark yellow green: #99994C 12 | * Text, black: #000000 13 | 14 | 15 | ## Tag cols 16 | 17 | * Background, blue (1/3: pale blue green / white): #eaffff 18 | * Selected btn 1, pale grey green: #9EEEEE 19 | * Border, purple blue: #8888CC 20 | * Text, black: #000000 21 | 22 | 23 | ## Column buttons (top left drag and re-size corner) 24 | 25 | * Default, purple blue: #8888cc 26 | * Modified, medium blue: #000099 27 | 28 | 29 | ## Mouse button selects 30 | 31 | * Btn 2 32 | * Selected, dark red-ish: #aa0000 33 | * Text, white: #ffffff 34 | * Btn 3 35 | * Selected, dark green-ish: #006600 36 | * Text, white: #ffffff 37 | 38 | 39 | --- 40 | 41 | 42 | ## Source code 43 | 44 | The mixing of the background colors is explained in the man page of allocimage(3): 45 | 46 | Allocimagemix is used to allocate background colors. On 8-bit color- 47 | mapped displays, it returns a 2A2 replicated image with one pixel col- 48 | ored the color one and the other three with three. (This simulates a 49 | wider range of tones than can be represented by a single pixel value on 50 | a color-mapped display.) On true color displays, it returns a 1A1 51 | replicated image whose pixel is the result of mixing the two colors in 52 | a one to three ratio. 53 | 54 | This yields the following: 55 | 56 | tagcols[BACK] = allocimagemix(display, DPalebluegreen, DWhite); /* #EAFFFF */ 57 | textcols[BACK] = allocimagemix(display, DPaleyellow, DWhite); /* #FFFFEA */ 58 | 59 | I haven't really looked at how the mixing is done, but by the look of it, it's sort of "let us mix and meet half-way (or at ratio 1:3)". The result is pretty darn close for a true color display mix. 60 | 61 | 62 | ### plan9port/src/cmd/acme/acme.c:/^iconinit/ 63 | 64 | /* Blue */ 65 | tagcols[BACK] = allocimagemix(display, DPalebluegreen, DWhite); 66 | tagcols[HIGH] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DPalegreygreen); 67 | tagcols[BORD] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DPurpleblue); 68 | tagcols[TEXT] = display->black; 69 | tagcols[HTEXT] = display->black; 70 | 71 | /* Yellow */ 72 | textcols[BACK] = allocimagemix(display, DPaleyellow, DWhite); 73 | textcols[HIGH] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DDarkyellow); 74 | textcols[BORD] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DYellowgreen); 75 | textcols[TEXT] = display->black; 76 | textcols[HTEXT] = display->black; 77 | 78 | [...] 79 | 80 | button = allocimage(display, r, screen->chan, 0, DNofill); 81 | draw(button, r, tagcols[BACK], nil, r.min); 82 | r.max.x -= ButtonBorder; 83 | border(button, r, ButtonBorder, tagcols[BORD], ZP); 84 | 85 | r = button->r; 86 | modbutton = allocimage(display, r, screen->chan, 0, DNofill); 87 | draw(modbutton, r, tagcols[BACK], nil, r.min); 88 | r.max.x -= ButtonBorder; 89 | border(modbutton, r, ButtonBorder, tagcols[BORD], ZP); 90 | r = insetrect(r, ButtonBorder); 91 | tmp = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DMedblue); 92 | draw(modbutton, r, tmp, nil, ZP); 93 | freeimage(tmp); 94 | 95 | r = button->r; 96 | colbutton = allocimage(display, r, screen->chan, 0, DPurpleblue); 97 | 98 | but2col = allocimage(display, r, screen->chan, 1, 0xAA0000FF); 99 | but3col = allocimage(display, r, screen->chan, 1, 0x006600FF); 100 | 101 | 102 | ### plan9port/include/draw.h:31,59 103 | 104 | #define DOpaque 0xFFFFFFFF 105 | #define DTransparent 0x00000000 /* only useful for allocimage memfillcolor */ 106 | #define DBlack 0x000000FF 107 | #define DWhite 0xFFFFFFFF 108 | #define DRed 0xFF0000FF 109 | #define DGreen 0x00FF00FF 110 | #define DBlue 0x0000FFFF 111 | #define DCyan 0x00FFFFFF 112 | #define DMagenta 0xFF00FFFF 113 | #define DYellow 0xFFFF00FF 114 | #define DPaleyellow 0xFFFFAAFF 115 | #define DDarkyellow 0xEEEE9EFF 116 | #define DDarkgreen 0x448844FF 117 | #define DPalegreen 0xAAFFAAFF 118 | #define DMedgreen 0x88CC88FF 119 | #define DDarkblue 0x000055FF 120 | #define DPalebluegreen 0xAAFFFFFF 121 | #define DPaleblue 0x0000BBFF 122 | #define DBluegreen 0x008888FF 123 | #define DGreygreen 0x55AAAAFF 124 | #define DPalegreygreen 0x9EEEEEFF 125 | #define DYellowgreen 0x99994CFF 126 | #define DMedblue 0x000099FF 127 | #define DGreyblue 0x005DBBFF 128 | #define DPalegreyblue 0x4993DDFF 129 | #define DPurpleblue 0x8888CCFF 130 | 131 | #define DNotacolor 0xFFFFFF00 132 | #define DNofill DNotacolor 133 | -------------------------------------------------------------------------------- /bin/9term: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env rc 2 | 3 | SHELL='rc' 4 | 5 | exec $PLAN9/bin/9term rc -l & 6 | -------------------------------------------------------------------------------- /bin/Clear: -------------------------------------------------------------------------------- 1 | #!/usr/local/plan9/bin/rc 2 | # You could also write a bash script, the shell isn't important 3 | 4 | # acme sets "winid" in the environment to identify the window a command was run in, this just aborts if running in a different context 5 | [ -n $winid ] || exit 1 6 | 7 | # The "," addresses all text in the window, as normal 8 | echo -n , | 9p write acme/$winid/addr 9 | 10 | # Replace the addressed text with nothing 11 | echo -n | 9p write acme/$winid/data 12 | -------------------------------------------------------------------------------- /bin/acme: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env rc 2 | 3 | # Always isolate acme in a separate namespace. Plumbing outside of acme will not affect this instance. 4 | #NAMESPACE=`{9 mktemp -d} 5 | 6 | # Run only one instance of plumber. 7 | p=`{pgrep plumber} 8 | if (~ $#p 0) plumber 9 | 10 | TERM=dumb 11 | SHELL=rc 12 | PAGER='col -b' 13 | GIT_EDITOR=editinacme 14 | fn cd { builtin cd $1 && awd $sysname } 15 | 16 | tabstop=4 17 | font=/usr/local/plan9/font/lucsans/unicode.8.font,/mnt/font/GoMono/16a/font 18 | lfont=/usr/local/plan9/font/lucm/unicode.9.font,/mnt/font/GoMono/16a/font 19 | #font=/mnt/font/FiraCode-Regular/15a/font 20 | #font=/mnt/font/GillSans/18a/font 21 | #font=/mnt/font/LucidaGrande/16a/font 22 | #font=/mnt/font/GoMono/16a/font 23 | #font=/mnt/font/Menlo-Regular/12a/font 24 | #lfont=/mnt/font/Menlo-Regular/17a/font 25 | #lfont=/mnt/font/GoMono/16a/font 26 | 27 | exec $PLAN9/bin/acme -a -f $font -F $lfont $* & 28 | -------------------------------------------------------------------------------- /bin/c+: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ -z $1 ]; then 4 | sign="//" 5 | else 6 | sign=$1 7 | fi 8 | 9 | #sed "s|.*|$sign &|" 10 | ssam "x,^,i,$sign" 11 | 12 | -------------------------------------------------------------------------------- /bin/c-: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ -z $1 ]; then 4 | sign="//" 5 | else 6 | sign=$1 7 | fi 8 | 9 | #sed "s|^$sign \(.*\)|\1|" 10 | ssam "x,[ ]*$sign ?,x,$sign ?,d" 11 | 12 | -------------------------------------------------------------------------------- /bin/gg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | git grep -n $* 4 | -------------------------------------------------------------------------------- /bin/i+: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ -z $1 ]; then 4 | char=" " 5 | else 6 | char=$1 7 | fi 8 | 9 | sed "s|.*|$char&|" 10 | 11 | -------------------------------------------------------------------------------- /bin/i-: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ -z $1 ]; then 4 | char=" " 5 | else 6 | char=$1 7 | fi 8 | 9 | sed "s|^$char\(.*\)|\1|" 10 | 11 | -------------------------------------------------------------------------------- /bin/sam: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env rc 2 | 3 | font=/lib/font/bit/lucsans/euro.8.font 4 | tabstop=4 5 | 6 | exec $PLAN9/bin/sam -a $* 7 | -------------------------------------------------------------------------------- /lib/plumbing: -------------------------------------------------------------------------------- 1 | # to update: [cat $HOME/lib/plumbing | 9p write plumb/rules] 2 | 3 | editor = acme 4 | include basic 5 | 6 | # git 7 | type is text 8 | data matches '[0-9a-f]*[a-f][0-9a-f]*' 9 | data matches '([0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]+)' 10 | plumb start rc -c 'cd '$wdir'; cd `{git rev-parse --show-toplevel} && [ -d .git ] && git show '$1' |plumb -i -d edit -a ''action=showdata filename=+git:'$1''' 11 | -------------------------------------------------------------------------------- /lib/profile: -------------------------------------------------------------------------------- 1 | PAGER='col -b' 2 | tabstop=4 3 | ps1=' % ' 4 | 5 | # not working 6 | #fn setprompt { 7 | # prompt=(`{pwd}^$ps1) 8 | #} 9 | #fn cd { builtin cd $1 && setprompt } 10 | # 11 | #prompt=(`{pwd}^$ps1) 12 | -------------------------------------------------------------------------------- /vim/colors/acme.vim: -------------------------------------------------------------------------------- 1 | hi clear 2 | 3 | let g:colors_name = "acme" 4 | 5 | let s:white = "#ffffff" 6 | let s:black = "#000000" 7 | let s:pale_yellow = "#ffffea" 8 | let s:dark_yellow = "#eeee9e" 9 | let s:dark_green = "#99994c" 10 | let s:pale_blue = "#eaffff" 11 | let s:cyan = "#9eeeee" 12 | let s:purple = "#8888cc" 13 | let s:blue = "#000099" 14 | let s:red = "#aa0000" 15 | let s:green = "#006600" 16 | 17 | exe 'hi! Normal guibg='.s:pale_yellow.' guifg='.s:black.' ctermbg=230 ctermfg=232 ' 18 | exe 'hi! NonText guibg=bg guifg='.s:red.' ctermbg=bg ctermfg=232' 19 | exe 'hi! StatusLine guibg='.s:purple.' guifg='.s:white.' gui=NONE ctermbg=159 ctermfg=232 cterm=NONE' 20 | exe 'hi! StatusLineNC guibg='.s:pale_blue.' guifg='.s:black.' gui=NONE ctermbg=194 ctermfg=232 cterm=NONE' 21 | exe 'hi! WildMenu guibg='.s:black.' guifg='.s:pale_blue.' gui=NONE ctermbg=black ctermfg=159 cterm=NONE' 22 | exe 'hi! VertSplit guibg='.s:pale_yellow.' guifg='.s:dark_green.' gui=NONE ctermbg=bg ctermfg=232 cterm=NONE' 23 | exe 'hi! Folded guibg='.s:dark_green.' guifg=fg gui=italic ctermbg=187 ctermfg=fg cterm=italic' 24 | exe 'hi! FoldColumn guibg='.s:dark_green.' guifg=fg ctermbg=229 ctermfg=fg' 25 | exe 'hi! SignColumn guibg='.s:dark_green.' guifg=fg ctermbg=229 ctermfg=fg' 26 | exe 'hi! Conceal guibg=bg guifg=fg gui=NONE ctermbg=bg ctermfg=fg cterm=NONE' 27 | exe 'hi! LineNr guibg=bg guifg='.s:dark_green.' gui=italic ctermbg=bg ctermfg=239' 28 | exe 'hi! Visual guibg='.s:dark_yellow.' guifg=fg ctermbg=fg ctermfg=bg' 29 | exe 'hi! CursorLine guibg='.s:dark_yellow.' guifg=fg ctermbg=230 ctermfg=fg' 30 | exe 'hi! CursorLineNR guibg=bg guifg='.s:dark_green.' ctermbg=230 ctermfg=fg' 31 | exe 'hi! Cursor guibg='.s:dark_green.' guifg=fg ctermbg=230 ctermfg=fg' 32 | exe 'hi! MatchParen guibg='.s:green.' guifg='.s:white.' ctermbg=230 ctermfg=fg' 33 | exe 'hi! Search guibg='.s:green.' guifg='.s:white.' ctermbg=230 ctermfg=fg' 34 | exe 'hi! ErrorMsg guibg='.s:red.' guifg='.s:white.' ctermbg=230 ctermfg=fg' 35 | 36 | exe 'hi! Pmenu guibg='.s:dark_yellow.' guifg='.s:black.' ctermbg=230 ctermfg=fg' 37 | exe 'hi! PmenuSel guibg='.s:green.' guifg='.s:white.' ctermbg=230 ctermfg=fg' 38 | exe 'hi! PmenuSbar guibg='.s:dark_green.' guifg='.s:black.' ctermbg=230 ctermfg=fg' 39 | exe 'hi! PmenuThumb guibg='.s:dark_yellow.' guifg='.s:black.' ctermbg=230 ctermfg=fg' 40 | 41 | exe 'hi! TabLineFill guibg='.s:pale_blue.' guifg='.s:pale_blue.' gui=NONE ctermbg=230 ctermfg=fg cterm=NONE' 42 | exe 'hi! TabLine guibg='.s:pale_blue.' guifg='.s:black.' gui=NONE ctermbg=230 ctermfg=fg' 43 | exe 'hi! TabLineSel guibg='.s:purple.' guifg='.s:white.' gui=NONE ctermbg=230 ctermfg=fg cterm=NONE' 44 | 45 | " Syntax 46 | exe 'hi! Comment guibg=bg guifg='.s:dark_green.' gui=NONE ctermbg=bg ctermfg=236 cterm=NONE' 47 | exe 'hi! Todo guibg=bg guifg='.s:dark_green.' gui=NONE ctermbg=bg ctermfg=236 cterm=NONE' 48 | 49 | exe 'hi! Statement guibg=bg guifg=fg gui=NONE ctermbg=bg ctermfg=fg cterm=NONE' 50 | exe 'hi! Identifier guibg=bg guifg=fg gui=NONE ctermbg=bg ctermfg=fg cterm=NONE' 51 | exe 'hi! Type guibg=bg guifg=fg gui=NONE ctermbg=bg ctermfg=fg cterm=NONE' 52 | exe 'hi! PreProc guibg=bg guifg=fg gui=NONE ctermbg=bg ctermfg=fg cterm=NONE' 53 | exe 'hi! Constant guibg=bg guifg=fg gui=NONE ctermbg=bg ctermfg=fg cterm=NONE' 54 | exe 'hi! Special guibg=bg guifg=fg gui=NONE ctermbg=bg ctermfg=fg cterm=NONE' 55 | exe 'hi! SpecialKey guibg=bg guifg=fg gui=NONE ctermbg=bg ctermfg=fg cterm=NONE' 56 | exe 'hi! Directory guibg=bg guifg=fg gui=NONE ctermbg=bg ctermfg=fg cterm=NONE' 57 | exe 'hi! Error guibg='.s:red.' guifg='.s:white.' gui=NONE ctermbg=230 ctermfg=fg' 58 | 59 | exe 'hi! link Title TabLineSel' 60 | exe 'hi! link MoreMsg Comment' 61 | exe 'hi! link Question Comment' 62 | 63 | " vim 64 | hi link vimFunction Identifier 65 | 66 | --------------------------------------------------------------------------------