Created
December 16, 2025 15:02
-
-
Save SalahEddineGhamri/25f8c6872725470f1f5a23b74bfd79c5 to your computer and use it in GitHub Desktop.
custom command in neovim with arguments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local function greet_function(opts) | |
| local name = opts.args or "World" | |
| print("Hello, " .. name .. "!") | |
| end | |
| vim.api.nvim_create_user_command('Greet', greet_function, { | |
| nargs = '?', -- Optional argument | |
| desc = "Greet someone" -- Description for :help | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment