sponsor Vim development Vim logo Vim Book Ad

cutlass.vim : Adds a 'cut' operation separate from 'delete'

 script karma  Rating 0/0, Downloaded by 547  Comments, bugs, improvements  Vim wiki

created by
Steve Vermeulen
 
script type
utility
 
description
See git repo for latest updates:  https://github.com/svermeulen/vim-cutlass

INTRODUCTION                                    'cutlass'

Cutlass overrides the delete operations to actually just delete and not affect the current yank.

It achieves this by overriding the following keys to always use the black hole register:  'c', 'cc', 'C', 's', 'S', 'd', 'dd', 'D', 'x', 'X'.  Note that if you have already mapped these keys to something else (like we do below with x) then it will not change it again.

After including this plugin, all of these operations will simply delete and not cut.  However, you will still want to have a key for 'cut', which you can add by including the following to your .vimrc:

    nnoremap m d
    xnoremap m d

    nnoremap mm dd
    nnoremap M D

'm' here can be thought of as 'move'.  Note that you will be shadowing the 'add mark' 'm' key if you go with this binding

Or you might want to use the 'x' key instead:

    nnoremap x d
    xnoremap x d

    nnoremap xx dd
    nnoremap X D

And then use 'dl' instead of 'x' every time you want to delete a single character.  You might also consider using 's' with vim-subversive (https://github.com/svermeulen/vim-subversive) and then using 'cl' as a replacement in the same way.

See this article (http://vimcasts.org/blog/2013/11/registers-the-good-the-bad-and-the-ugly-parts/) for why we would want to do all this.  You might also consider installing vim-yoink (https://github.com/svermeulen/vim-yoink) which contains other clipboard related improvements mentioned in this article.

Based off of vim-easyclip (https://github.com/svermeulen/vim-easyclip) and also Drew Neil's ideas (https://github.com/nelstrom/vim-cutlass) (as well as the name)
 
install details
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
vim-cutlass.zip 1.0 2019-01-05 7.0 Steve Vermeulen Initial upload
ip used for rating: 142.132.191.50

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github