Skip to main content
deleted 80 characters in body
Source Link
Hotschke
  • 4.9k
  • 26
  • 38

=p from vim-unimpaired

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
  1. Yank word function with
    yiw
    Now the unnamed register contains function (verify with :reg "yiw)

  2. =p from unimpaired inserts with reindentation after the current line.

  3. Fix missing blank line with [-Space (also only with vim-unimpaired)

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.

=p from vim-unimpaired

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
  1. Yank word function with
    yiw
    Now the unnamed register contains function (verify with :reg ")

  2. =p from unimpaired inserts with reindentation after the current line.

  3. Fix missing blank line with [-Space (also only with vim-unimpaired)

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.

=p from vim-unimpaired

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
  1. Yank word function with yiw

  2. =p from unimpaired inserts with reindentation after the current line.

  3. Fix missing blank line with [-Space (also only with vim-unimpaired)

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.

deleted 14 characters in body
Source Link
Hotschke
  • 4.9k
  • 26
  • 38

=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
  1. Yank word function with
    yiw
    Now the unnamed register contains function (verify with :reg ")

  2. Add one new=p from unimpaired inserts with reindentation after the current line.

  3. Fix missing blank line and leave insert mode with
    oEsc or with vim-unimpaired ][-Spacej (does not enter insert modealso only with vim-unimpaired)

  4. =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.

=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
  1. Yank word function with
    yiw
    Now the unnamed register contains function (verify with :reg ")

  2. Add one new blank line and leave insert mode with
    oEsc or with vim-unimpaired ]-Spacej (does not enter insert mode)

  3. =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.

=p from vim-unimpaired

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
  1. Yank word function with
    yiw
    Now the unnamed register contains function (verify with :reg ")

  2. =p from unimpaired inserts with reindentation after the current line.

  3. Fix missing blank line with [-Space (also only with vim-unimpaired)

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.

deleted 724 characters in body
Source Link
Hotschke
  • 4.9k
  • 26
  • 38

=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
  1. Yank word function with
    yiw
    Now the unnamed register contains function (verify with :reg ")

  2. Add one new blank line and leave insert mode with
    oEsc or with vim-unimpaired ]-Spacej (does not enter insert mode)

  3. =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

=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
  1. Yank word function with
    yiw
    Now the unnamed register contains function (verify with :reg ")

  2. Add one new blank line and leave insert mode with
    oEsc or with vim-unimpaired ]-Spacej (does not enter insert mode)

  3. =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

=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
  1. Yank word function with
    yiw
    Now the unnamed register contains function (verify with :reg ")

  2. Add one new blank line and leave insert mode with
    oEsc or with vim-unimpaired ]-Spacej (does not enter insert mode)

  3. =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.

[Edit removed during grace period]
Source Link
Hotschke
  • 4.9k
  • 26
  • 38
Loading
edited body
Source Link
Hotschke
  • 4.9k
  • 26
  • 38
Loading
added 724 characters in body
Source Link
Hotschke
  • 4.9k
  • 26
  • 38
Loading
Source Link
Hotschke
  • 4.9k
  • 26
  • 38
Loading