1
- *cursor-text-objects.txt* For Neovim >= 0.8.0 Last change: 2024 November 13
1
+ *cursor-text-objects.txt* For Neovim >= 0.8.0 Last change: 2024 November 19
2
2
3
3
==============================================================================
4
- Table of Contents *cursor-text-objects-table-of-contents*
5
-
6
- 1. A Neovim Plugin Template | cursor-text-objects-a-neovim-plugin-template |
7
- 2. Features | cursor-text-objects-features |
8
- 3. Using This Template | cursor-text-objects-using-this-template |
9
- 4. Installation | cursor-text-objects-installation |
10
- 5. Configuration | cursor-text-objects-configuration |
11
- - Lualine | cursor-text-objects-configuration-lualine |
12
- - Telescope | cursor-text-objects-configuration-telescope |
13
- 6. Commands | cursor-text-objects-commands |
14
- 7. Tests | cursor-text-objects-tests |
15
- - Initialization | cursor-text-objects-tests-initialization |
16
- - Running | cursor-text-objects-tests-running |
17
- 8. Tracking Updates | cursor-text-objects-tracking-updates |
18
- 9. Other Plugins | cursor-text-objects-other-plugins |
4
+ Table of Contents *cursor-text-objects-table-of-contents*
5
+
6
+ 1. cursor-text-objects.nvim | cursor-text-objects-cursor-text-objects.nvim |
7
+ 2. How To Use | cursor-text-objects-how-to-use |
8
+ - Summary | cursor-text-objects-how-to-use-summary |
9
+ - Details | cursor-text-objects-how-to-use-details |
10
+ 3. Installation | cursor-text-objects-installation |
11
+ 4. Tests | cursor-text-objects-tests |
12
+ - Initialization | cursor-text-objects-tests-initialization |
13
+ - Running | cursor-text-objects-tests-running |
14
+ 5. Tracking Updates | cursor-text-objects-tracking-updates |
15
+ 6. Other Plugins | cursor-text-objects-other-plugins |
19
16
20
17
==============================================================================
21
- 1. A Neovim Plugin Template *cursor-text-objects-a-neovim-plugin-template *
18
+ 1. cursor-text-objects.nvim *cursor-text-objects-cursor-text-objects.nvim *
22
19
23
20
--------------------------------------------------------------------------------
24
21
@@ -30,214 +27,96 @@ Table of Contents *cursor-text-objects-table-of-content
30
27
31
28
Social [RSS]
32
29
--------------------------------------------------------------------------------
33
- A template repository used to create Neovim plugins.
34
-
35
30
36
31
==============================================================================
37
- 2. Features *cursor-text-objects-features*
38
-
39
- - Follows nvim-best-practices <https://github.com/nvim-neorocks/nvim-best-practices >
40
- - Fast start-up (~1 ms)
41
- - Automated user documentation (using panvimdoc <https://github.com/kdheepak/panvimdoc >)
42
- - Automated API documentation (using mini.doc <https://github.com/echasnovski/mini.doc >)
43
- - Vimtags generation
44
- - Built-in Vim commands
45
- - A high quality command mode parser
46
- - Auto-completes your commands at any cursor position
47
- - LuaCATS <https://luals.github.io/wiki/annotations/ >annotations and type-hints, everywhere
48
- - Built-in logging to stdout / files
49
- - Unittests use the full power of native busted <https://github.com/lunarmodules/busted >
50
- - Automated testing matrix supports 6 Neovim/OS combinations
51
- - neovim: `[v0.10.0, stable, nightly]`
52
- - os: `[ubuntu-latest, macos-latest]`
53
- - 100% Lua
54
- - Uses Semantic Versioning <https://semver.org >
55
- - Integrations
56
- - lualine.nvim <https://github.com/nvim-lualine/lualine.nvim >
57
- - telescope.nvim <https://github.com/nvim-telescope/telescope.nvim >
58
- - `:checkhealth`
59
- - Github actions for:
60
- - StyLua <https://github.com/JohnnyMorganz/StyLua > - Auto-formats Lua code
61
- - llscheck <https://github.com/jeffzi/llscheck > - Checks for Lua type mismatches
62
- - luacheck <https://github.com/mpeterv/luacheck > - Checks for Lua code issues
63
- - luarocks <https://luarocks.org > auto-release (LUAROCKS_API_KEY secret <https://github.com/nvim-neorocks/sample-luarocks-plugin?tab=readme-ov-file#publishing-to-luarocks > configuration required)
64
- - mini.doc <https://github.com/echasnovski/mini.doc > - API documentation auto-generator
65
- - panvimdoc <https://github.com/kdheepak/panvimdoc > - User documentation auto-generator
66
- - urlchecker <https://github.com/urlstechie/urlchecker-action > - Checks for broken URL links
67
-
32
+ 2. How To Use *cursor-text-objects-how-to-use*
68
33
69
- ==============================================================================
70
- 3. Using This Template *cursor-text-objects-using-this-template*
71
34
72
- 2. Once you’re done, remove this section (the rest of this README.md file should be kept / customized to your needs)
35
+ SUMMARY *cursor-text-objects-how-to-use-summary*
73
36
37
+ In short, mappings like `dap` , which delete a whole paragraph, now can use
38
+ `d [ap ` which means "delete from the start of the paragraph to your current
39
+ cursor position" and `d ]ap ` means "delete from the current cursor position to
40
+ the end of the paragraph".
74
41
75
- ==============================================================================
76
- 4. Installation *cursor-text-objects-installation*
42
+ It works with any text operator or text object pair and integrates with
43
+ existing plugins.
77
44
78
- - lazy.nvim <https://github.com/folke/lazy.nvim >
79
-
80
- >lua
81
- {
82
- "ColinKennedy/cursor-text-objects.nvim",
83
- -- TODO: (you) - Make sure your first release matches v1.0.0 so it auto-releases!
84
- version = "v1.*",
85
- }
86
- <
87
45
46
+ DETAILS *cursor-text-objects-how-to-use-details*
88
47
89
- ==============================================================================
90
- 5. Configuration *cursor-text-objects-configuration*
48
+ For every text object and text operator that Vim has, you can now "include"
49
+ your cursor as a part of the command.
91
50
92
- (These are default values)
51
+ Here’s a practical example. Have you ever had a paragraph of text like this.
93
52
94
- - lazy.nvim <https://github.com/folke/lazy.nvim >
95
-
96
- >lua
97
- {
98
- "ColinKennedy/cursor-text-objects.nvim",
99
- config = function()
100
- vim.g.cursor_text_objects_configuration = {
101
- cmdparse = {
102
- auto_complete = { display = { help_flag = true } },
103
- },
104
- commands = {
105
- goodnight_moon = { read = { phrase = "A good book" } },
106
- hello_world = {
107
- say = { ["repeat"] = 1, style = "lowercase" },
108
- },
109
- },
110
- logging = {
111
- level = "info",
112
- use_console = false,
113
- use_file = false,
114
- },
115
- tools = {
116
- lualine = {
117
- arbitrary_thing = {
118
- color = "Visual",
119
- text = " Arbitrary Thing",
120
- },
121
- copy_logs = {
122
- color = "Comment",
123
- text = " Copy Logs",
124
- },
125
- goodnight_moon = {
126
- color = "Question",
127
- text = " Goodnight moon",
128
- },
129
- hello_world = {
130
- color = "Title",
131
- text = " Hello, World!",
132
- },
133
- },
134
- telescope = {
135
- goodnight_moon = {
136
- { "Foo Book", "Author A" },
137
- { "Bar Book Title", "John Doe" },
138
- { "Fizz Drink", "Some Name" },
139
- { "Buzz Bee", "Cool Person" },
140
- },
141
- hello_world = { "Hi there!", "Hello, Sailor!", "What's up, doc?" },
142
- },
143
- },
144
- }
145
- end
146
- }
147
- <
148
-
149
-
150
- LUALINE *cursor-text-objects-configuration-lualine*
151
-
152
-
153
- Note: You can customize lualine colors here or using
154
- `vim .g .cursor_text_objects_configuration` .
155
- lualine.nvim <https://github.com/nvim-lualine/lualine.nvim >
156
-
157
- >lua
158
- require("lualine").setup {
159
- sections = {
160
- lualine_y = {
161
- -- ... Your other configuration ...
162
- {
163
- "cursor_text_objects",
164
- -- NOTE: These will override default values
165
- -- display = {
166
- -- goodnight_moon = {color={fg="#FFFFFF"} , text="Custom message 1"}},
167
- -- hello_world = {color={fg="#333333"} , text="Custom message 2"},
168
- -- },
169
- },
170
- }
171
- }
172
- }
53
+ >
54
+ Some text with many lines. And something
55
+ that wraps multiple|cursor here| lines in a single sentence.
56
+ Lorem ipsum and all that.
57
+
58
+ More paragraph text
173
59
<
174
60
61
+ And you’d like delete just from your current `|cursor |` to the bottom of the
62
+ paragraph? You can’t use `dap` , that deletes the whole paragraph. With
63
+ cursor-text-objects.nvim, you can use `d ]ap ` which means "delete from the
64
+ current cursor position around the end of the paragraph". And you can delete to
65
+ the start of the paragraph with `d [ap ` . If you want to delete to the start of
66
+ the sentence, use `d [is ` .
175
67
176
- TELESCOPE *cursor-text-objects-configuration-telescope*
68
+ Again, **any text operator or text object** command that you can think of now
69
+ works with your cursor. Here’s more examples.
177
70
71
+ - `d [a }` - Delete around the start of a {}-pair to the cursor.
72
+ - `d ]a }` - Delete around the cursor to the end of a {}-pair.
73
+ - `gc[ip` - Comment from the start of the paragraph to the cursor.
74
+ - `gc]ip` - Comment from the cursor to the end of the paragraph.
75
+ - `gw[ip` - Format from the start of the paragraph to the cursor.
76
+ - `gw]ip` - Format from the cursor to the end of the paragraph.
77
+ - `v [ip` - Select from the start of the paragraph to the cursor.
78
+ - `v ]ip` - Select from the cursor to the end of the paragraph.
79
+ - `y [ib` - Yank inside start of a ()-pair to the cursor.
80
+ - `y ]ib` - Yank inside the cursor to the end of a ()-pair.
178
81
179
- Note: You can customize telescope colors here or using
180
- `vim .g .cursor_text_objects_configuration` .
181
- telescope.nvim <https://github.com/nvim-telescope/telescope.nvim >
82
+ It works with custom operators and objects too!
182
83
183
- >lua
184
- {
185
- "nvim-telescope/telescope.nvim",
186
- cmd = "Telescope",
187
- config = function()
188
- -- ... Your other configuration ...
189
- require("telescope").load_extension("cursor_text_objects")
190
- end,
191
- dependencies = {
192
- "ColinKennedy/cursor-text-objects.nvim",
193
- "nvim-lua/plenary.nvim",
194
- },
195
- version = "0.1.*",
196
- },
197
- <
84
+ Using nvim-treesitter-textobjects
85
+ <https://github.com/nvim-treesitter/nvim-treesitter-textobjects >
198
86
87
+ - `v ]ic ` - Select lines from the cursor to the end of a class.
88
+ - `v [ic ` - Select lines from the start of a class to the cursor.
89
+ - `v ]if ` - Select lines from the cursor to the end of a function.
90
+ - `v [if ` - Select lines from the start of a function to the cursor.
199
91
200
- COLORS ~
92
+ Using vim-textobj-indent < https://github.com/kana/vim-textobj-indent >
201
93
202
- This plugin provides two default highlights
94
+ - `c [ii` - Change from start of the indented-lines to the cursor.
95
+ - `c ]ii` - Change from the cursor to the end of the indented-lines.
203
96
204
- - `CursorTextObjectsTelescopeEntry`
205
- - `CursorTextObjectsTelescopeSecondary`
97
+ etc. etc. etc.
206
98
207
- Both come with default colors that should look nice. If you want to change
208
- them, here’s how:
209
-
210
- >lua
211
- vim.api.nvim_set_hl(0, "CursorTextObjectsTelescopeEntry", {link="Statement"} )
212
- vim.api.nvim_set_hl(0, "CursorTextObjectsTelescopeSecondary", {link="Question"} )
213
- <
99
+ Give your right-pinky a workout and install `cursor - text- objects.nvim` today!
214
100
215
101
216
102
==============================================================================
217
- 6. Commands *cursor-text-objects-commands *
103
+ 3. Installation *cursor-text-objects-installation *
218
104
219
- Here are some example commands:
105
+ - lazy.nvim < https://github.com/folke/lazy.nvim >
220
106
221
- >vim
222
- " A typical subcommand
223
- :CursorTextObjects hello-world say phrase "Hello, World!" " How are you?"
224
- :CursorTextObjects hello-world say phrase "Hello, World!" --repeat=2 --style=lowercase
225
-
226
- " An example of a flag this repeatable and 3 flags, -a, -b, -c, as one dash
227
- :CursorTextObjects arbitrary-thing -vvv -abc -f
228
-
229
- " Separate commands with completely separate, flexible APIs
230
- :CursorTextObjects goodnight-moon count-sheep 42
231
- :CursorTextObjects goodnight-moon read "a book"
232
- :CursorTextObjects goodnight-moon sleep -z -z -z
107
+ >lua
108
+ {
109
+ "ColinKennedy/cursor-text-objects.nvim",
110
+ version = "v1.*",
111
+ }
233
112
<
234
113
235
114
236
115
==============================================================================
237
- 7 . Tests *cursor-text-objects-tests*
116
+ 4 . Tests *cursor-text-objects-tests*
238
117
239
118
240
- INITIALIZATION *cursor-text-objects-tests-initialization*
119
+ INITIALIZATION *cursor-text-objects-tests-initialization*
241
120
242
121
Run this line once before calling any `busted` command
243
122
@@ -246,7 +125,7 @@ Run this line once before calling any `busted` command
246
125
<
247
126
248
127
249
- RUNNING *cursor-text-objects-tests-running*
128
+ RUNNING *cursor-text-objects-tests-running*
250
129
251
130
Run all tests
252
131
@@ -264,4 +143,27 @@ Run test based on tags
264
143
busted --helper spec/minimal_init.lua . --tags=simple
265
144
<
266
145
146
+
147
+ ==============================================================================
148
+ 5. Tracking Updates *cursor-text-objects-tracking-updates*
149
+
150
+ See doc/news.txt <doc/news.txt> for updates.
151
+
152
+ You can watch this plugin for changes by adding this URL to your RSS feed:
153
+
154
+ >
155
+ https://github.com/ColinKennedy/cursor-text-objects.nvim/commits/main/doc/news.txt.atom
156
+ <
157
+
158
+
159
+ ==============================================================================
160
+ 6. Other Plugins *cursor-text-objects-other-plugins*
161
+
162
+ This template is full of various features. But if your plugin is only meant to
163
+ be a simple plugin and you don’t want the bells and whistles that this
164
+ template provides, consider instead using nvim-cursor-text-object
165
+ <https://github.com/ellisonleao/nvim-plugin-template >
166
+
167
+ Generated by panvimdoc <https://github.com/kdheepak/panvimdoc >
168
+
267
169
vim:tw=78:ts=8:noet:ft=help:norl:
0 commit comments