Skip to content

Instantly share code, notes, and snippets.

View linguini1's full-sized avatar
🛰️
Working on rocket avionics systems

Matteo Golin linguini1

🛰️
Working on rocket avionics systems
View GitHub Profile
@linguini1
linguini1 / fstring.lua
Last active September 6, 2023 12:35
Automatic f-string transformation for Neovim
-- Treesitter automatic Python format strings
vim.api.nvim_create_augroup("py-fstring", { clear = true })
vim.api.nvim_create_autocmd("InsertCharPre", {
pattern = { "*.py" },
group = "py-fstring",
--- @param opts AutoCmdCallbackOpts
--- @return nil
callback = function(opts)
-- Only run if f-string escape character is typed
if vim.v.char ~= "{" then return end