Skip to content

Instantly share code, notes, and snippets.

View telemachus's full-sized avatar

Peter Aronoff telemachus

  • New York City
  • 17:42 (UTC -05:00)
View GitHub Profile
@OXY2DEV
OXY2DEV / CMD.md
Last active January 23, 2026 11:16

🔰 A beginners guide to create custom cmdline

showcase

Ever wanted to know how noice creates the cmdline or wanted your own one?

No one? Guess it's just me 🥲.

Anyway, this post is a simple tutorial for creating a basic cmdline in neovim.

@MariaSolOs
MariaSolOs / builtin-compl.lua
Last active January 21, 2026 05:17
Built-in completion + snippet Neovim setup
---Utility for keymap creation.
---@param lhs string
---@param rhs string|function
---@param opts string|table
---@param mode? string|string[]
local function keymap(lhs, rhs, opts, mode)
opts = type(opts) == 'string' and { desc = opts }
or vim.tbl_extend('error', opts --[[@as table]], { buffer = bufnr })
mode = mode or 'n'
vim.keymap.set(mode, lhs, rhs, opts)
@pushcx
pushcx / alacritty.toml
Last active October 16, 2025 14:59
a very plain vim colorscheme
[colors.selection]
background = "#859900"
text = "CellBackground"
[colors.vi_mode_cursor]
cursor = "#859900"
text = "CellBackground"
[cursor]
@kitlabcode
kitlabcode / example_test.go
Created April 27, 2023 01:01
Setup and teardown unit test in go.
package main
import (
"log"
"testing"
)
func doubleMe(x float64) float64 {
return x * 2
}
@kylechui
kylechui / dot-repeating.md
Last active January 15, 2026 23:28
A basic overview of how to manage dot-repeating in your Neovim plugin, as well as manipulate it to "force" what action is repeated.

Adding dot-repeat to your Neovim plugin

In Neovim, the . character repeats "the most recent action"; however, this is not always respected by plugin actions. Here we will explore how to build dot-repeat support directly into your plugin, bypassing the requirement of dependencies like repeat.vim.

The Basics

When some buffer-modifying action is performed, Neovim implicitly remembers the operator (e.g. d), motion (e.g. iw), and some other miscellaneous information. When the dot-repeat command is called, Neovim repeats that operator-motion combination. For example, if we type ci"text<Esc>, then we replace the inner contents of some double quotes with text, i.e. "hello world""text". Dot-repeating from here will do the same, i.e. "more samples""text".

Using operatorfunc

A metatable in Lua defines various extraneous behaviors for a table when indexed, modified, interacted with, etc. They are Lua's core metaprogramming feature; most well known for being useful to emulate classes much like an OOP language.

Any table (and userdata) may be assigned a metatable. You can define a metatable for a table as such:

-- Our sample table
local tab = {}
-- Our metatable
local metatable = {
 -- This table is then what holds the metamethods or metafields
package main
import (
"fmt"
)
func fib(n int) int {
fibs := make(map[int]int, n+1)
fibs[0] = 0
fibs[1] = 1
@countvajhula
countvajhula / vim-normal-grammar.md
Last active January 20, 2026 11:58
A Grammar for Vim's Normal Mode

A Grammar for Vim's Normal Mode

A rough attempt at characterizing Vim's Normal Mode grammar that I made while writing this Vim series. See the bibliography there for more context.

Notation: | means or, [] means optional, * means zero or more, <> means literal class (e.g. <number> could expand to 1, 2, etc.), ... means there are more instances not enumerated here (these would need to be fleshed out to get a complete grammar).

It could be interesting to use a grammar like this one to organize an interactive Vim cheatsheet.

normal-command = motion-form

| verb-phrase

ZSH CheatSheet

This is a cheat sheet for how to perform various actions to ZSH, which can be tricky to find on the web as the syntax is not intuitive and it is generally not very well-documented.

Strings

Description Syntax
Get the length of a string ${#VARNAME}
Get a single character ${VARNAME[index]}
@rgl
rgl / http-server-shutdown.go
Created December 23, 2020 07:02
go http server with graceful shutdown
package main
import (
"context"
"flag"
"log"
"net/http"
"os"
"os/signal"
"time"