Skip to content

Instantly share code, notes, and snippets.

@ismasan
Created June 4, 2024 17:25
Show Gist options
  • Save ismasan/69d6137b4b74c396f12608a8cef553c2 to your computer and use it in GitHub Desktop.
Save ismasan/69d6137b4b74c396f12608a8cef553c2 to your computer and use it in GitHub Desktop.
NeoVim: run Rubocop on buffer save
" Run Rubocop on save
" Requires vim.o.xrc = true in NeoVim config
lua << EOF
vim.api.nvim_create_autocmd("BufWritePost", {
pattern = "*",
callback = function()
local file = vim.fn.expand('%:p')
vim.fn.system('your-command ' .. file)
end,
})
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment