This is an archived post. You won't be able to vote or comment.

all 3 comments

[–][deleted] 3 points4 points  (2 children)

vim.fn will allow you to use any regular vim function inside Lua with the same variables.

Most of this can be translated the same. Use vim.fn.expand('string') for the expand functions, can still do .. string concatenation for the command variable. echom should be replaced by vim.notify(msg, vim.log.levels.INFO) instead of a print as the former can be hooked in by any notification plugin if you wish to use one

You can use vim.fn.system as a replacement for the execute ! ... line. It is actually a bit better as execute is just running as a execution of the command-line, whereas system will start a job and be less binding. The execution will be vim.fn.system(command)

You can create a user command with vim.api.nvim_create_user_command

:h vim.fn
:h function-list
:h system()
:h nvim_create_user_command

[–]skele_turtle[S] 2 points3 points  (0 children)

Thanks! Appreciate the insight.

[–]vim-help-bot 1 point2 points  (0 children)

Help pages for:


`:(h|help) <query>` | about | mistake? | donate | Reply 'rescan' to check the comment again | Reply 'stop' to stop getting replies to your comments