Skip to content

Instantly share code, notes, and snippets.

@SalahEddineGhamri
Created December 16, 2025 15:01
Show Gist options
  • Select an option

  • Save SalahEddineGhamri/1d48b48c5dadfed628284bbf6ea8264f to your computer and use it in GitHub Desktop.

Select an option

Save SalahEddineGhamri/1d48b48c5dadfed628284bbf6ea8264f to your computer and use it in GitHub Desktop.
How to create a custom command in neovim
-- Define your function
local function my_function()
print("Hello from my function!")
-- Your code here
end
-- Create a user command
vim.api.nvim_create_user_command('MyCommand', my_function, {})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment