Skip to content

Instantly share code, notes, and snippets.

@sedm0784
sedm0784 / chinese_new_year.rem
Last active July 2, 2026 13:32
Chinese New Year in Unix Remind
# Chinese New Year!
FSET chinese_sign(x) choose(1 + (x % 12), \
"Monkey 🐒", \
"Rooster 🐓", \
"Dog 🐕", \
"Pig 🐖", \
"Rat 🐀", \
"Ox 🐂", \
"Tiger 🐅", \
"Rabbit 🐇", \

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!

@sedm0784
sedm0784 / split-toggle.vim
Last active November 21, 2023 00:16
Split Toggle
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
@sedm0784
sedm0784 / _vim_auto_list.markdown
Last active March 28, 2025 20:04
Vim Automatic List Continuation

Vim Auto List Completion

This snippet makes Vim automatically continue/end lists in insert mode, similar to the way word processors do:

  • It automatically adds the bullet/number for the next list item when you press Return at the end of an existing item,
  • When you press Return on an empty list item, it removes the bullet/number, ending the list.

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

@sedm0784
sedm0784 / vim_find_section.vim
Last active August 29, 2015 13:56
Mappings for leaping between sections
# 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)
@sedm0784
sedm0784 / CapsLockCtrlEscape.ahk
Last active June 26, 2026 02:05
AutoHotkey script to map Caps Lock to Escape when it's pressed on its own and Ctrl when used in combination with another key, à la Steve Losh. Adapted from one that does something similar with the Ctrl Key on the Vim Tips Wiki (http://vim.wikia.com/wiki/Map_caps_lock_to_escape_in_Windows?oldid=32281). (Plus contribs from @randy909 & @mmikeww.)
g_LastCtrlKeyDownTime := 0
g_AbortSendEsc := false
g_ControlRepeatDetected := false
*CapsLock::
if (g_ControlRepeatDetected)
{
return
}
@sedm0784
sedm0784 / practical-ch3.lisp
Created August 12, 2011 14:29
Pratical: A Simple Database
(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'