Skip to content

Option to duplicate + comment #84

Closed

Description

@jeetsukumaran

Very often I like to duplicate a block of code and comment out a copy.

For example,

for i in range(2, 20:
     print(i)
# for i in range(2, 20:
#     print(i)
for i in range(2, 20:
     print(i)

Right now, I have to repeat a motion twice -- once to yank and once to comment out. And then of course I have to hit p to paste in the duplicate. It gets more complicated if I have to avoid clobbering my default register.

It would be nice to have this all rolled into one motion (that takes care of saving/restoring the registers).
Eg., gC" (or gyetc.) will behave just likegc`` but will paste a copy of the uncommented code next to the commented one.

Is it possible to support this?

Activity

  1. gegoune commented on Dec 5, 2021

    @gegoune

    Duplicate #70.

  2. added
    duplicateThis issue or pull request already exists
    on Dec 6, 2021
  3. numToStr commented on Dec 6, 2021

    @numToStr
    Owner

    @jeetsukumaran This was already requested earlier. You should also follow #73 where I gave an example of how to achieve this :)

  4. jeetsukumaran commented on Dec 6, 2021

    @jeetsukumaran
    Author

    Thanks! Will do. And thanks for this plugin :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions