How to use lua get neovim runtime pid?

  • i want to use lua get neovim runtime pid for count runtime cpu,mem

  • but how to use lua get neovim runtime pid?

Doesn’t the Lua interpreter run inside the Neovim process? So the PID of the Lua interpreter would be the PID of Neovim. You can get the PID of the current Neovim process using the Vim script function getpid (:h getpid()). You can call Vim script functions from Lua through the vim.fn table: vim.fn.getpid(). See :h vim.fn for details.

1 Like