Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/flatcap/vim-deleteto

⚙ Vim Plugin - Trim the beginning of lines
https://github.com/flatcap/vim-deleteto

align delete plugin script vim

Last synced: about 5 hours ago
JSON representation

⚙ Vim Plugin - Trim the beginning of lines

Awesome Lists containing this project

README

        

# 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](https://github.com/tpope/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:

```viml
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

## See also

- [flatcap.org](https://flatcap.org)
- [GitHub](https://github.com/flatcap/vim-deleteto)