sponsor Vim development Vim logo Vim Book Ad

delete.py : Makes the delete key remove 'softtabspace' characters, similar to backspace

 script karma  Rating 15/7, Downloaded by 976  Comments, bugs, improvements  Vim wiki

created by
Alexander Rødseth
 
script type
indent
 
description
I usually edit Python code that has a lot of whitespace indenting.
The backspace key works nicely, and I'm able to delete indents,
but I'm unable to do so with the <Del> key.
I've searched the web, searched the scripts and tips, asked on the vim mailing list,
asked on IRC and read a lot of documentation.
In the end, I found it easier to write a Python script that gave me the desired behaviour.
So, here it is. It works for me.
 
install details
(for *nix)
Note that you need Python-support compiled in to your Vim.
(On Debian, just apt-get install vim-python)
Save the script to your .vim/indent folder.
Add these two lines to your .vimrc:
inoremap <silent> <Del> <ESC>:pyfile ~/.vim/indent/delete.py<CR>i
nnoremap <silent> <Del> :pyfile ~/.vim/indent/delete.py<CR>
 

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
delete.py 0.4 2004-07-29 6.0 Alexander Rødseth Fixed a bug that made it unable to delete lines when there was only a single character left.
delete.py 0.3 2004-07-29 6.0 Alexander Rødseth Made deletion of characters at the end of the line move the cursor one to the left, in order to avoid leaving the cursor at an nonexistant character.
delete.py 0.2 2004-07-29 6.0 Alexander Rødseth Initial upload
ip used for rating: 3.144.202.167

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