=p
from vim-unimpaired
Given file
function Scene:get(...)
local l = {}
for i, e in ipaires(self.nodelist) do
if (e:is(...)) then
l[#l +1] = e
end
end
return l
end
Yank word
function
with
yiw
Now the unnamed register containsfunction
(verify with:reg "
)Add one new blank line and leave insert mode with
oEsc or with vim-unimpaired ]-Spacej (does not enter insert mode)=p
from unimpaired does what you want.
This is more impressive if you insert several lines from a register. For example, yank full function with yG
in step 1 and then do steps 2 and 3.
Remark: filetype support for lua in vim
I tried to figure out if the default ftplugin for lua or a third party lua plugin provides dedicated lua motions to move the cursor reliably to the end of the function. Apparently, there is
However, it looks unmaintained. A maintained ftplugin for lua which does not provide, as far as I can see, lua dedicated motions is
Therefore, I am not too happy with lua support in vim. Useful tpope plugins with lua support are