Skip to content

Instantly share code, notes, and snippets.

View rlychrisg's full-sized avatar

Chris G rlychrisg

View GitHub Profile
@rlychrisg
rlychrisg / mcmode.lua
Created October 1, 2026 09:20
some clever multicursor functions for neovim
-- --------------------------------
-- apply cursor to matching pattern (without touching the search register)
-- --------------------------------
--
-- to use this, visually select some text with visual or line mode, enter a
-- vim regex string, and a cursor will be placed on all matches. upon exiting,
-- the cursors will enter follow mode.
-- this *should* work with and without ui plugins like dressing or snacks input
@rlychrisg
rlychrisg / keybinds.lua
Last active September 12, 2026 20:32
improved f/t motions in neovim
-- here are some functions to traverse lines while using f/t motions in nvim. the reason
-- i have written them is because i can't get improved-ft to work. it's a little messy
-- because my lua is a bit rusty.
-- NOTE this intentionally doesn't do change/delete (eg dt<char>). the reason for this
-- is because i am hitting enough accidental keybinds as it is, and if i want to do
-- delete actions across lines then there are millions of LSP/treesitter binds that
-- would probably do the job better. so dt<char> will work as normal.
-- INSTRUCTIONS
@rlychrisg
rlychrisg / smartbdelete.lua
Last active July 19, 2025 02:23
smart closing of nvim buffers, quits if current buffer is last and asks for confirmation if buffer has unsaved changes
-- this probably isn't the most efficient way of doing this
-- but i'm quite happy with it so i want to share it.
-- function to check whether current buffer is modified
local function modcheck()
local current_buf = vim.api.nvim_get_current_buf()
if vim.api.nvim_buf_get_option(current_buf, 'modified') then
return true
else
@rlychrisg
rlychrisg / tmux_panefocus.sh
Created June 25, 2025 18:37
quickly cycle between last pane across all windows of a session. also add a little flash when changing focus to a new pane.
#!/bin/bash
## about
# this does two things 1) provides a visual indicator when moving between panes
# 2) cleverly cycles between the previous pane on all windows across the session.
# NOTE this script does echo out every single tmux focus switch to a file in /tmp/
# so unless you turn your machine off every night you'll want to find some way of
# dealing with that.