Terminal Question
I think the answers are in here! http://tldp.org/HOWTO/Text-Terminal-HOWTO.html
| # Chinese New Year! | |
| FSET chinese_sign(x) choose(1 + (x % 12), \ | |
| "Monkey 🐒", \ | |
| "Rooster 🐓", \ | |
| "Dog 🐕", \ | |
| "Pig 🐖", \ | |
| "Rat 🐀", \ | |
| "Ox 🐂", \ | |
| "Tiger 🐅", \ | |
| "Rabbit 🐇", \ |
Terminal Question
I think the answers are in here! http://tldp.org/HOWTO/Text-Terminal-HOWTO.html
I'm seeing how far I can get through Advent of Code using only Vim's editing commands. No Vimscript, variables, or function calls allowed! (Use of the expression register is also STRICTLY limited. I employed it to do adding in some early solutions, but anything more complex is a no-no.)
Solutions are notated using the standard notation used in Vim mappings and documentation. Ctrl-A is notated as <C-A>, Escape as <Esc>, Return as <CR>, etc.
But if a line starts with a colon, then it's an entire ex command: press Enter at the end of the line.
Otherwise, linebreaks aren't meaningful: they're just inserted at places that felt "natural" to me.
Note that I'm well aware the same techniques could be streamlined considerably: my intention with these is — hard as this may be to believe — to aim for clarity over efficiency. I'm not golfing here!
| nnoremap <Leader>s <Cmd>call SplitToggle()<CR> | |
| command SplitToggle call SplitToggle() | |
| function! SplitToggle() abort | |
| " Check if there's already a split | |
| if !exists('s:split_id') | |
| " Create the split | |
| vsplit | |
| " Move to the new window | |
| wincmd p |
| #!/bin/sh | |
| while read -r line; do | |
| tmux send-keys -t1 "$line" C-M | |
| done |
This snippet makes Vim automatically continue/end lists in insert mode, similar to the way word processors do:
It supports ordered lists with markers like 1. and unordered lists with - markers (because those are the markers I use.)
(It's particularly useful when using an iOS keyboard where punctuation and numerals are slow to access.)
| # An edited version of the code for searching for PlaceHolders (^K) from here: | |
| # http://vim.wikia.com/wiki/User:Tlgrok/Form_Feeds_and_Vertical_Tabs | |
| function! <SID>FindSection (forward) | |
| let l:place_holder = nr2char(12) "form feed | |
| let l:flags="W" | |
| if (!a:forward) | |
| let l:flags.="b" | |
| endif | |
| let l:match=search(l:place_holder, l:flags) |
| g_LastCtrlKeyDownTime := 0 | |
| g_AbortSendEsc := false | |
| g_ControlRepeatDetected := false | |
| *CapsLock:: | |
| if (g_ControlRepeatDetected) | |
| { | |
| return | |
| } |
| (defun make-cd (title artist rating ripped) | |
| (list :title title :artist artist :rating rating :ripped ripped)) | |
| (defvar *db* nil) | |
| (defun add-record (cd) (push cd *db*)) | |
| (defun dump-db () | |
| (dolist (cd *db*) | |
| (format t "~{~a:~10t~a~%~}~%" cd))) |
| require 'formula' | |
| class Tads2Compiler <Formula | |
| url 'http://www.tads.org/frobtads/frobtads-t2compiler-0.13.tar.gz' | |
| md5 '12caf94d9c1e646ae04b44da0df83a30' | |
| end | |
| class Tads3Compiler <Formula | |
| url 'http://www.tads.org/frobtads/frobtads-t3compiler-0.13.tar.gz' | |
| md5 '231d359f389be3d28e8134a2b832dd70' |