Skip to content

⚙ Vim Plugin - Trim the beginning of lines

License

Notifications You must be signed in to change notification settings

flatcap/vim-deleteto

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 

Repository files navigation

deleteto.vim

Introduction

DeleteTo reads a character from the user, then deletes from the beginning of the line up to and including that character.

If you have a tab delimited file, "dU" will delete the first column of data.

See the Workflow section, below, to see what that means.

To improve this plugin, I recommend installing Tim Pope's vim-repeat plugin.

Workflow

Imagine you're working with a list of files:

./deleteto/plugin/deleteto.vim
./deleteto/README.md
./keyword/plugin/keyword.vim
./keyword/README.md

but you'd like a tidier list without the "./" at the beginning. Type: dU/

deleteto/plugin/deleteto.vim
deleteto/README.md
keyword/plugin/keyword.vim
keyword/README.md

Type dU/ again

plugin/deleteto.vim
README.md
plugin/keyword.vim
README.md

Mappings

By default, DeleteTo creates four mappings:

Type To work on Calls
dU All lines <Plug>DeleteToA
duu This line <Plug>DeleteToL
du{motion} Motion-defined <Plug>DeleteToM
{visual}du Visual region <Plug>DeleteToV

You can disable the default mappings with:

let g:deleteto_create_mappings = 0

Command

The DeleteTo command has the form

:[range]DeleteTo CHAR [COUNT]

Examples

The delimiter will commonly be forward slash, space, comma or tab. However, DeleteTo will work with any character.

Type this Works on Delete up to this character
dU/ Whole file First /
3dU, Whole file Third ,
4duu/ One line Fourth /
vip2du<tab> Visual - paragraph Second <tab>
du9j, Motion - 10 lines First ,
:DeleteTo / Whole file First /
:1,20DeleteTo / Lines 1-20 First /
:DeleteTo , 4 Whole file Fourth ,
:argdo DeleteTo / 2 All args, all lines Second /
:bufdo DeleteTo | All buffers, all lines First |

License

Copyright © Richard Russon (flatcap). Distributed under the GPLv3 http://fsf.org/

See also