1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
|
# quicker.nvim
Improved UI and workflow for the Neovim quickfix
<!-- TOC -->
- [Requirements](#requirements)
- [Features](#features)
- [Installation](#installation)
- [Setup](#setup)
- [Options](#options)
- [Highlights](#highlights)
- [API](#api)
- [Other Plugins](#other-plugins)
<!-- /TOC -->
## Requirements
- Neovim 0.10+
## Features
- **Improved styling** - including syntax highlighting of grep results.
- **Show context lines** - easily view lines above and below the quickfix results.
- **Editable buffer** - make changes across your whole project by editing the quickfix buffer and `:w`.
- **API helpers** - some helper methods for common tasks, such as toggling the quickfix.
**Improved styling** (colorscheme: [Duskfox](https://github.com/EdenEast/nightfox.nvim/)) \
Before \
<img width="695" alt="Screenshot 2024-07-30 at 6 03 39 PM" src="https://github.com/user-attachments/assets/8faa4790-8a7a-4d05-882e-c4e8e7653b00">
After \
<img width="686" alt="Screenshot 2024-07-30 at 2 05 49 PM" src="https://github.com/user-attachments/assets/90cf87dd-83ec-4967-88aa-5ffe3e1e6623">
**Context lines** around the results \
<img width="816" alt="Screenshot 2024-07-30 at 2 06 17 PM" src="https://github.com/user-attachments/assets/844445c9-328f-4f18-91d9-b32d32d3ef39">
**Editing the quickfix** to apply changes across multiple files
https://github.com/user-attachments/assets/5065ac4d-ec24-49d1-a95d-232344b17484
## Installation
quicker.nvim supports all the usual plugin managers
<details>
<summary>lazy.nvim</summary>
```lua
{
'stevearc/quicker.nvim',
event = "FileType qf",
---@module "quicker"
---@type quicker.SetupOptions
opts = {},
}
```
</details>
<details>
<summary>Packer</summary>
```lua
require("packer").startup(function()
use({
"stevearc/quicker.nvim",
config = function()
require("quicker").setup()
end,
})
end)
```
</details>
<details>
<summary>Paq</summary>
```lua
require("paq")({
{ "stevearc/quicker.nvim" },
})
```
</details>
<details>
<summary>vim-plug</summary>
```vim
Plug 'stevearc/quicker.nvim'
```
</details>
<details>
<summary>dein</summary>
```vim
call dein#add('stevearc/quicker.nvim')
```
</details>
<details>
<summary>Pathogen</summary>
```sh
git clone --depth=1 https://github.com/stevearc/quicker.nvim.git ~/.vim/bundle/
```
</details>
<details>
<summary>Neovim native package</summary>
```sh
git clone --depth=1 https://github.com/stevearc/quicker.nvim.git \
"${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/pack/quicker/start/quicker.nvim
```
</details>
## Setup
You will need to call `setup()` for quicker to start working
```lua
require("quicker").setup()
```
It's not required to pass in any options, but you may wish to to set some keymaps.
```lua
vim.keymap.set("n", "<leader>q", function()
require("quicker").toggle()
end, {
desc = "Toggle quickfix",
})
vim.keymap.set("n", "<leader>l", function()
require("quicker").toggle({ loclist = true })
end, {
desc = "Toggle loclist",
})
require("quicker").setup({
keys = {
{
">",
function()
require("quicker").expand({ before = 2, after = 2, add_to_existing = true })
end,
desc = "Expand quickfix context",
},
{
"<",
function()
require("quicker").collapse()
end,
desc = "Collapse quickfix context",
},
},
})
```
## Options
A complete list of all configuration options
<!-- OPTIONS -->
```lua
require("quicker").setup({
-- Local options to set for quickfix
opts = {
buflisted = false,
number = false,
relativenumber = false,
signcolumn = "auto",
winfixheight = true,
wrap = false,
},
-- Set to false to disable the default options in `opts`
use_default_opts = true,
-- Keymaps to set for the quickfix buffer
keys = {
-- { ">", "<cmd>lua require('quicker').expand()<CR>", desc = "Expand quickfix content" },
},
-- Callback function to run any custom logic or keymaps for the quickfix buffer
on_qf = function(bufnr) end,
edit = {
-- Enable editing the quickfix like a normal buffer
enabled = true,
-- Set to true to write buffers after applying edits.
-- Set to "unmodified" to only write unmodified buffers.
autosave = "unmodified",
},
-- Keep the cursor to the right of the filename and lnum columns
constrain_cursor = true,
highlight = {
-- Use treesitter highlighting
treesitter = true,
-- Use LSP semantic token highlighting
lsp = true,
-- Load the referenced buffers to apply more accurate highlights (may be slow)
load_buffers = true,
},
follow = {
-- When quickfix window is open, scroll to closest item to the cursor
enabled = false,
},
-- Map of quickfix item type to icon
type_icons = {
E = " ",
W = " ",
I = " ",
N = " ",
H = " ",
},
-- Border characters
borders = {
vert = "┃",
-- Strong headers separate results from different files
strong_header = "━",
strong_cross = "╋",
strong_end = "┫",
-- Soft headers separate results within the same file
soft_header = "╌",
soft_cross = "╂",
soft_end = "┨",
},
-- How to trim the leading whitespace from results. Can be 'all', 'common', or false
trim_leading_whitespace = "common",
-- Maximum width of the filename column
max_filename_width = function()
return math.floor(math.min(95, vim.o.columns / 2))
end,
-- How far the header should extend to the right
header_length = function(type, start_col)
return vim.o.columns - start_col
end,
})
```
<!-- /OPTIONS -->
## Highlights
These are the highlight groups that are used to style the quickfix buffer. You can set these
highlight groups yourself or use `:help winhighlight` in the setup `opts` option to override them
for just the quickfix window.
- `QuickFixHeaderHard` - Used for the header that divides results from different files
- `QuickFixHeaderSoft` - Used for the header that divides results within the same file
- `Delimiter` - Used for the divider between filename, line number, and text
- `QuickFixLineNr` - Used for the line number
- `QuickFixFilename` - Used for the filename
- `QuickFixFilenameInvalid` - Used for the filename when `valid = 0`
- `DiagnosticSign*` - Used for the signs that display the quickfix error type
## API
<!-- API -->
### expand(opts)
`expand(opts)` \
Expand the context around the quickfix results.
| Param | Type | Desc |
| ---------------- | ------------------------- | -------------------------------------------------------------- |
| opts | `nil\|quicker.ExpandOpts` | |
| >before | `nil\|integer` | Number of lines of context to show before the line (default 2) |
| >after | `nil\|integer` | Number of lines of context to show after the line (default 2) |
| >add_to_existing | `nil\|boolean` | |
| >loclist_win | `nil\|integer` | |
**Note:**
<pre>
If there are multiple quickfix items for the same line of a file, only the first
one will remain after calling expand().
</pre>
### collapse()
`collapse()` \
Collapse the context around quickfix results, leaving only the `valid` items.
### toggle_expand(opts)
`toggle_expand(opts)` \
Toggle the expanded context around the quickfix results.
| Param | Type | Desc |
| ---------------- | ------------------------- | -------------------------------------------------------------- |
| opts | `nil\|quicker.ExpandOpts` | |
| >before | `nil\|integer` | Number of lines of context to show before the line (default 2) |
| >after | `nil\|integer` | Number of lines of context to show after the line (default 2) |
| >add_to_existing | `nil\|boolean` | |
| >loclist_win | `nil\|integer` | |
### refresh(loclist_win, opts)
`refresh(loclist_win, opts)` \
Update the quickfix list with the current buffer text for each item.
| Param | Type | Desc |
| ----------------- | -------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| loclist_win | `nil\|integer` | |
| opts | `nil\|quicker.RefreshOpts` | |
| >keep_diagnostics | `nil\|boolean` | If a line has a diagnostic type, keep the original text and display it as virtual text after refreshing from source. |
### is_open(loclist_win)
`is_open(loclist_win)`
| Param | Type | Desc |
| ----------- | -------------- | ---------------------------------------------------------------------- |
| loclist_win | `nil\|integer` | Check if loclist is open for the given window. If nil, check quickfix. |
### toggle(opts)
`toggle(opts)` \
Toggle the quickfix or loclist window.
| Param | Type | Desc |
| -------------- | -------------------------- | ----------------------------------------------------------------------------------- |
| opts | `nil\|quicker.OpenOpts` | |
| >loclist | `nil\|boolean` | Toggle the loclist instead of the quickfix list |
| >focus | `nil\|boolean` | Focus the quickfix window after toggling (default false) |
| >height | `nil\|integer` | Height of the quickfix window when opened. Defaults to number of items in the list. |
| >min_height | `nil\|integer` | Minimum height of the quickfix window. Default 4. |
| >max_height | `nil\|integer` | Maximum height of the quickfix window. Default 10. |
| >open_cmd_mods | `nil\|quicker.OpenCmdMods` | A table of modifiers for the quickfix or loclist open commands. |
### open(opts)
`open(opts)` \
Open the quickfix or loclist window.
| Param | Type | Desc |
| -------------- | -------------------------- | ----------------------------------------------------------------------------------- |
| opts | `nil\|quicker.OpenOpts` | |
| >loclist | `nil\|boolean` | Toggle the loclist instead of the quickfix list |
| >focus | `nil\|boolean` | Focus the quickfix window after toggling (default false) |
| >height | `nil\|integer` | Height of the quickfix window when opened. Defaults to number of items in the list. |
| >min_height | `nil\|integer` | Minimum height of the quickfix window. Default 4. |
| >max_height | `nil\|integer` | Maximum height of the quickfix window. Default 10. |
| >open_cmd_mods | `nil\|quicker.OpenCmdMods` | A table of modifiers for the quickfix or loclist open commands. |
### close(opts)
`close(opts)` \
Close the quickfix or loclist window.
| Param | Type | Desc |
| -------- | ------------------------ | ---------------------------------------------- |
| opts | `nil\|quicker.CloseOpts` | |
| >loclist | `nil\|boolean` | Close the loclist instead of the quickfix list |
<!-- /API -->
## Other Plugins
In general quicker.nvim should play nice with other quickfix plugins (🟢), except if they change the
format of the quickfix buffer. Quicker.nvim relies on owning the `:help quickfixtextfunc` for the
other features to function, so some other plugins you may need to disable or not use parts of their
functionality (🟡). Some plugins have features that completely conflict with quicker.nvim (🔴).
- 🟢 [nvim-bqf](https://github.com/kevinhwang91/nvim-bqf) - Another bundle of several improvements including a floating preview window and fzf integration.
- 🟢 [vim-qf](https://github.com/romainl/vim-qf) - Adds some useful mappings and default behaviors.
- 🟡 [trouble.nvim](https://github.com/folke/trouble.nvim) - A custom UI for displaying quickfix and many other lists. Does not conflict with quicker.nvim, but instead presents an alternative way to manage and view the quickfix.
- 🟡 [listish.nvim](https://github.com/arsham/listish.nvim) - Provides utilities for adding items to the quickfix and theming (which conflicts with quicker.nvim).
- 🔴 [quickfix-reflector.vim](https://github.com/stefandtw/quickfix-reflector.vim) - Also provides an "editable quickfix". I used this for many years and would recommend it.
- 🔴 [replacer.nvim](https://github.com/gabrielpoca/replacer.nvim) - Another "editable quickfix" plugin.
|