Skip to content

Commit 604cb11

Browse files
committed
delimiters 1.2.0
Add question mark Rebrand as delimiters.vim
1 parent cb64da7 commit 604cb11

File tree

4 files changed

+312
-110
lines changed

4 files changed

+312
-110
lines changed

README.md

Lines changed: 98 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
# :sunrise_over_mountains: vim-textobj-symbols
1+
# :sunrise_over_mountains: vim-textobj-delimiters
22

3-
This plugin adds various symbols as surrounding text-objects.
3+
This plugin adds various symbols as delimiting text-objects.
44

55
Table of Contents
66
-----------------
77
1. [Installation](#installation)
8-
2. [Usage](#usage)
8+
2. [Symbols](#symbols)
9+
3. [Usage](#usage)
910

1011
## Installation
1112

@@ -22,27 +23,27 @@ support:
2223
mkdir ~/.vim/pack/plugin/start/vim-textobj-user
2324
git clone https://github.com/kana/vim-textobj-user.git ~/.vim/pack/plugin/start/vim-textobj-user
2425

25-
mkdir ~/.vim/pack/plugin/start/vim-textobj-symbols
26-
git clone https://github.com/EvanQuan/vim-textobj-symbols.git ~/.vim/pack/plugin/start/vim-textobj-symbols
26+
mkdir ~/.vim/pack/plugin/start/vim-textobj-delimiters
27+
git clone https://github.com/EvanQuan/vim-textobj-delimiters.git ~/.vim/pack/plugin/start/vim-textobj-delimiters
2728
```
2829

2930
#### [Vim-Plug](https://github.com/junegunn/vim-plug)
3031

3132
1. Add `Plug 'kana/vim-textobj-user'` to your `vimrc` file.
32-
2. Add `Plug 'EvanQuan/vim-textobj-symbols'` to your `vimrc` file.
33+
2. Add `Plug 'EvanQuan/vim-textobj-delimiters'` to your `vimrc` file.
3334
3. Reload your `vimrc` or restart.
3435
4. Run `:PlugInstall`
3536

3637
#### [Vundle](https://github.com/VundleVim/Vundle.vim)
3738

3839
1. Add `Plugin 'kana/vim-textobj-user'` to your `vimrc` file.
39-
2. Add `Plugin 'EvanQuan/vim-textobj-symbols'` to your `vimrc` file.
40+
2. Add `Plugin 'EvanQuan/vim-textobj-delimiters'` to your `vimrc` file.
4041
3. Reload your `vimrc` or restart.
4142
4. Run `:BundleInstall`
4243

4344
#### [NeoBundle](https://github.com/Shougo/neobundle.vim)
4445

45-
1. Add `NeoBundle 'EvanQuan/vim-textobj-symbols'` to your `vimrc` file.
46+
1. Add `NeoBundle 'EvanQuan/vim-textobj-delimiters'` to your `vimrc` file.
4647
2. Add `NeoBundle 'kana/vim-textobj-user'` to your `vimrc` file.
4748
3. Reload your `vimrc` or restart.
4849
4. Run `:NeoUpdate`
@@ -52,15 +53,68 @@ git clone https://github.com/EvanQuan/vim-textobj-symbols.git ~/.vim/pack/plugin
5253
```bash
5354
git clone https://github.com/kana/vim-textobj-user.git ~/.vim/bundle/vim-textobj-user
5455

55-
git clone https://github.com/EvanQuan/vim-textobj-symbols.git ~/.vim/bundle/vim-textobj-symbols
56+
git clone https://github.com/EvanQuan/vim-textobj-delimiters.git ~/.vim/bundle/vim-textobj-delimiters
5657
```
5758

59+
## Symbols
60+
61+
The following symbols are now recognized as block delimiters, marking the
62+
start and end of a region of text:
63+
64+
| Symbol | Name |
65+
|:------:|:---------------:|
66+
| * | asterisk |
67+
| \ | backslash |
68+
| $ | dollar sign |
69+
| - | minus sign/dash |
70+
| % | percent sign |
71+
| | | pipe |
72+
| + | plus sign |
73+
| ? | question mark |
74+
| / | slash |
75+
| _ | underscore |
76+
5877
## Usage
5978

60-
**TODO elaborate on other text objects**
79+
Similar to how quotes, parentheses, and brackets amongst other block
80+
delimiters can mark the start and end of a region of text and can have edited
81+
with the 'c' (change), 'd' (delete), 'v' (visual) and 'y' (yank) operators,
82+
vim-textobj-delimiters provides several new text-objects which are triggered
83+
by `a` and `i` motions. While there may be any number of uses for these
84+
delimiters, here are some examples for where they may be used.
85+
86+
#### Asterisks
87+
88+
Selections of text surrounded by asterisks (\*) is fairly common in markdown
89+
files, marking `*italicized*` or `**bold**` text.
90+
91+
#### Backslash
92+
93+
In Windows-style path names, directories are `separated\with\backslashes`.
94+
95+
#### Dollar Sign
96+
97+
In LaTeX files, inline math mode is delimited with `$single dollar signs$`,
98+
while `$$double dollar signs$$` delimits display math mode.
99+
100+
#### Minus Sign/Dash
101+
102+
Languages like Lisp and css often use kebab case variable names, which
103+
`separate-words-with-dashes`. In webiste URLs, text of certain directories or
104+
titles are often in kebab case as well.
105+
106+
#### Percent Sign
107+
108+
In some web templates, language boundaries are
109+
110+
```
111+
<% surrounded with template delimiters such as this %>
112+
```
113+
114+
#### Pipe
61115

62-
The **textobj-symbols** plugin provides two new text-objects which are triggered
63-
by `a|` and `i|` respectively.
116+
Hot-links in Vim help documentation and markdown tables delimit text with
117+
pipe characters.
64118

65119
For example, suppose you have the following markdown table:
66120

@@ -87,3 +141,35 @@ If you want to delete the hot-link, you can do the following (cursor position
87141
marked by \*):
88142

89143
`|bad*tag|` and type `da|`, which will delete the hot-link.
144+
145+
#### Plus Sign
146+
147+
In mathematical expressions or string concatenation, certain text may
148+
incidentally be delimited with plus signs such as:
149+
150+
```
151+
a = 4 + 457 + 12
152+
153+
message = "Hello" + "there" + "General" + "Kenobi"
154+
```
155+
156+
Admittedly, there does not seem to be much use to this as the quote and
157+
word text objects can achieve the same thing.
158+
159+
#### Question Mark
160+
161+
In XML, processing instructions are
162+
```
163+
<? delimited with question marks ?>
164+
```
165+
166+
#### Slash
167+
168+
In website URLs and Unix-style path names, directories are
169+
`separated/with/slashes`.
170+
171+
#### Underscore
172+
173+
Languages like C, Python, and Ruby often use snake case variable names, which
174+
`separate_words_with_underscores`. In website URLs, text of certain
175+
directories or titles are often in snake case as well.

doc/textobj-delimiters.txt

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
*textobj-delimiters.txt* For Vim version 8.1 Last change: 2018 December 24
2+
3+
_____ _ _____ _ _ ~
4+
|_ _| | | | _ | | (_) ~
5+
| | _____ _| |_| | | | |__ _ ~
6+
| |/ _ \ \/ / __| | | | '_ \| | ~
7+
| | __/> <| |_\ \_/ / |_) | | ~
8+
\_/\___/_/\_\\__|\___/|_.__/| | ~
9+
______ _ _ _ _ _/ | ~
10+
| _ \ | (_) (_) | |__/ ~
11+
| | | |___| |_ _ __ ___ _| |_ ___ _ __ ___ ~
12+
| | | / _ \ | | '_ ` _ \| | __/ _ \ '__/ __| ~
13+
| |/ / __/ | | | | | | | | || __/ | \__ \ ~
14+
|___/ \___|_|_|_| |_| |_|_|\__\___|_| |___/ ~
15+
16+
17+
A Vim plugin that adds various symbols as ~
18+
delimiting text objects. ~
19+
20+
Reference Manual ~
21+
22+
==============================================================================
23+
CONTENTS *textobj-delimiters-contents*
24+
25+
1. Intro................................|textobj-delimiters-intro|
26+
2. Symbols..............................|textobj-delimiters-symbols|
27+
3. Usage................................|textobj-delimiters-usage|
28+
3.1 Asterisks.......................|textobj-delimiters-asterisks|
29+
3.2 Backslash.......................|textobj-delimiters-backslash|
30+
3.3 Dollar Sign.....................|textobj-delimiters-dollar|
31+
3.4 Minus Sign/Dash.................|textobj-delimiters-minus|
32+
3.5 Percent Sign....................|textobj-delimiters-percent|
33+
3.6 Pipe............................|textobj-delimiters-pipe|
34+
3.7 Plus Sign.......................|textobj-delimiters-plus|
35+
3.8 Question Mark...................|textobj-delimiters-question|
36+
3.9 Slash...........................|textobj-delimiters-slash|
37+
3.10 Underscore.....................|textobj-delimiters-underscore|
38+
4. About................................|textobj-delimiters-about|
39+
40+
==============================================================================
41+
1. Intro *textobj-delimiters-intro*
42+
43+
TODO
44+
==============================================================================
45+
2. Symbols *textobj-delimiters-symbols*
46+
47+
The following symbols are now recognized as block delimiters, marking the
48+
start and end of a region of text: >
49+
50+
* asterisk
51+
\ backslash
52+
$ dollar sign
53+
- minus sign/dash
54+
% percent sign
55+
| pipe
56+
+ plus sign
57+
? question mark
58+
/ slash
59+
_ underscore
60+
<
61+
==============================================================================
62+
3. Usage *textobj-delimiters-usage*
63+
64+
Similar to how quotes, parentheses, and brackets amongst other block
65+
delimiters can mark the start and end of a region of text and can have edited
66+
with the 'c' (change), 'd' (delete), 'v' (visual) and 'y' (yank) operators,
67+
vim-textobj-delimiters provides several new |text-objects| which are triggered
68+
by `a` and `i` motions. While there may be any number of uses for these
69+
delimiters, here are some examples for where they may be used.
70+
71+
------------------------------------------------------------------------------
72+
3.1 Asterisks *textobj-delimiters-asterisks*
73+
74+
Selections of text surrounded by asterisks (*) is fairly common in markdown
75+
files, marking `*italicized*` or `**bold**` text.
76+
77+
------------------------------------------------------------------------------
78+
3.2 Backslash *textobj-delimiters-backslash*
79+
80+
In Windows-style path names, directories are `separated\with\backslashes`.
81+
82+
------------------------------------------------------------------------------
83+
3.3 Dollar Sign *textobj-delimiters-dollar*
84+
85+
In LaTeX files, inline math mode is delimited with `$single dollar signs$`,
86+
while `$$double dollar signs$$` delimits display math mode.
87+
88+
------------------------------------------------------------------------------
89+
3.4 Minus Sign/Dash *textobj-delimiters-minus*
90+
91+
Languages like Lisp and css often use kebab case variable names, which
92+
`separate-words-with-dashes`. In webiste URLs, text of certain directories or
93+
titles are often in kebab case as well.
94+
95+
------------------------------------------------------------------------------
96+
3.5 Percent Sign *textobj-delimiters-percent*
97+
98+
In some web templates, language boundaries are >
99+
100+
<% surrounded with template delimiters such as this %>
101+
<
102+
------------------------------------------------------------------------------
103+
3.6 Pipe *textobj-delimiters-pipe*
104+
105+
Hot-links in Vim help documentation and markdown tables delimit text with
106+
pipe characters.
107+
108+
For example, suppose you have the following markdown table: >
109+
110+
| Cats | Dogs |
111+
|:------------:|:--------:|
112+
| Mr. Whiskers | Snuffles |
113+
| Oscar | Bella |
114+
<
115+
If you want to change 'Mr. Whiskers' to 'Tigger', you can do the following
116+
(cursor position marked by *):
117+
118+
`| Mr. Wh*iskers |` and type `ci|` to get `|*|`, where you can make your
119+
replacement `| Tigger |` .
120+
121+
Another example is if you are writing Vim help documentation and have
122+
a hot-link, which is a word surrounded with pipes as such: >
123+
124+
|bad tag|
125+
<
126+
If you want to delete the hot-link, you can do the following (cursor position
127+
marked by *):
128+
129+
`|bad*tag|` and type `da|`, which will delete the hot-link.
130+
131+
132+
------------------------------------------------------------------------------
133+
3.7 Plus Sign *textobj-delimiters-plus*
134+
135+
In mathematical expressions or string concatenation, certain text may
136+
incidentally be delimited with plus signs such as: >
137+
138+
a = 4 + 457 + 12
139+
140+
message = "Hello" + "there" + "General" + "Kenobi"
141+
<
142+
Admittedly, there does not seem to be much use to this as the quote and
143+
word text objects can achieve the same thing.
144+
145+
------------------------------------------------------------------------------
146+
3.8 Question Mark *textobj-delimiters-question*
147+
148+
In XML, processing instructions are >
149+
150+
<? delimited with question marks ?>
151+
<
152+
------------------------------------------------------------------------------
153+
3.9 Slash *textobj-delimiters-slash*
154+
155+
In website URLs and Unix-style path names, directories are
156+
`separated/with/slashes`.
157+
158+
------------------------------------------------------------------------------
159+
3.10 Underscore *textobj-delimiters-underscore*
160+
161+
Languages like C, Python, and Ruby often use snake case variable names, which
162+
`separate_words_with_underscores`. In website URLs, text of certain
163+
directories or titles are often in snake case as well.
164+
165+
==============================================================================
166+
4. About *textobj-delimiters-about*
167+
168+
You can find the most updated version of the plugin from:
169+
170+
http://github.com/EvanQuan/vim-textobj-delimiters
171+
172+
vim:tw=78:ts=8:ft=help:norl:

0 commit comments

Comments
 (0)