Skip to content

Instantly share code, notes, and snippets.

View pkutaj's full-sized avatar

pavol kutaj pkutaj

View GitHub Profile
@pkutaj
pkutaj / tmp6ty_kass.txt
Created March 23, 2026 07:40
How to Eliminate Swap File Conflicts in Neovim Multi Tab Workflows snippet
:help swap-file
Vim stores the things you changed in a swap file.
Using the original file you started from plus the swap file
you can mostly recover your work.
@pkutaj
pkutaj / tmpphyb7sn6.txt
Created March 23, 2026 07:40
How to Eliminate Swap File Conflicts in Neovim Multi Tab Workflows snippet
:help undo-persistence
When unloading a buffer Vim normally destroys the tree of undos
created for that buffer. By setting the 'undofile' option,
Vim will automatically save your undo history when you write a file
and restore undo history when you edit the file again.
@pkutaj
pkutaj / tmplet0piuv.md
Created March 23, 2026 07:40
How to Eliminate Swap File Conflicts in Neovim Multi Tab Workflows snippet
Swap file Undo file
Protects against Crash (unsaved keystrokes) Wanting to undo after reopening
Causes E325 conflicts Yes No
Needs git as safety net Not if working correctly Yes, for crash-level recovery
Persists across sessions No (deleted on close) Yes
@pkutaj
pkutaj / tmpb90i3kw3.lua
Created March 23, 2026 07:40
How to Eliminate Swap File Conflicts in Neovim Multi Tab Workflows snippet
-- in init.lua or options.lua
vim.opt.swapfile = false
-- compensate with persistent undo
vim.opt.undofile = true
vim.opt.undodir = vim.fn.stdpath("state") .. "/undo"
@pkutaj
pkutaj / tmpe7cbo9cf.lua
Created March 23, 2026 07:40
How to Eliminate Swap File Conflicts in Neovim Multi Tab Workflows snippet
vim.api.nvim_create_autocmd("SwapExists", {
pattern = "*",
callback = function()
vim.v.swapchoice = "e" -- always edit the disk version
end,
})
@pkutaj
pkutaj / tmpw2_27tsn.sh
Created March 23, 2026 07:40
How to Eliminate Swap File Conflicts in Neovim Multi Tab Workflows snippet
# preview what would be deleted
ls ~/.local/state/nvim/swap/
# remove all stale swap files
rm -f ~/.local/state/nvim/swap/*.swp
@pkutaj
pkutaj / tmplu6o_6uf.c
Created March 23, 2026 06:59
Explaining Forward Declaration in C as a Type Signature snippet
// This fails — node_t is not defined yet when used on line 3
typedef struct Node {
int value;
node_t *next; // error: unknown type name 'node_t'
} node_t;
@pkutaj
pkutaj / tmpfrq1nzu6.c
Created March 23, 2026 06:59
Explaining Forward Declaration in C as a Type Signature snippet
typedef struct Node node_t; // forward declaration
typedef struct Node {
int value;
node_t *next; // now the compiler knows node_t
} node_t;
@pkutaj
pkutaj / tmpoc4clgbh.txt
Created March 23, 2026 06:59
Explaining Forward Declaration in C as a Type Signature snippet
1. Signature ← this is the forward declaration equivalent
2. Purpose
3. Stub
4. Examples/Tests
5. Template
6. Code the body
@pkutaj
pkutaj / tmphldrj0q_.sh
Created March 22, 2026 15:55
how to access claude code from iphone with ttyd snippet
brew install ttyd