Add the :cbefore and :cafter quickfix commands#4340
Add the :cbefore and :cafter quickfix commands#4340yegappan wants to merge 1 commit intovim:masterfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4340 +/- ##
==========================================
+ Coverage 80.1% 80.13% +0.03%
==========================================
Files 108 108
Lines 142192 142226 +34
==========================================
+ Hits 113906 113976 +70
+ Misses 28286 28250 -36
Continue to review full report at Codecov.
|
|
Right now, |
|
Hi,
On Sun, Feb 9, 2020 at 4:47 AM lacygoill ***@***.***>
wrote:
Right now, :cafter fails if the cursor is right on the last entry in a
buffer (E553 is raised). Would it be possible to make :0cafter and
:0cbefore succeed in that case? That is, they would accept an entry at
the current cursor position.
What happens if the cursor is not on a line with a quickfix entry? In that
case does this behave like :cafter or :1cafter or the cursor doesn't move?
How are you planning to use this?
- Yegappan
|
|
Hi, and thank you for commenting.
So, if the cursor is not on a line with a quickfix entry:
When
I've always wanted a command which would move to the next entry in the quickfix list, taking into account the current cursor position. That is, moving to the next entry relative to the current cursor position if one exists in the current buffer, otherwise to the next entry in the quickfix list. The closest builtin command is But it doesn't always work as I would expect when the cursor is after the last entry in the buffer. Consider this experiment: If I execute One solution is to run The purpose of This works as I would expect most of the time:
But there is one exception where something unexpected happen:
You can check this with the previous experiment: If you run this command: You still jump to I'm working on a workaround. It can be boiled down to this: It works, but it makes the code much more complex, and it's slow. I can notice the slowness, because I can repeat some of my custom mappings by pressing To fix this, I need a timer-based guard to prevent the function from being re-invoked uselessly too many times in a short period of time: If This is much simpler, and probably more reliable. I've also considered the possibility of moving the cursor 1 character backward before running Besides, moving the cursor may change the view, which I guess (?) is not an issue if |
Problem: Cannot navigate to errors before/after the cursor.
Solution: Add the :cbefore and :cafter commands. (Yegappan Lakshmanan,
closes vim/vim#4340)
vim/vim@cf6a55c
Problem: Cannot navigate to errors before/after the cursor.
Solution: Add the :cbefore and :cafter commands. (Yegappan Lakshmanan,
closes vim/vim#4340)
vim/vim@cf6a55c
Problem: Cannot navigate to errors before/after the cursor.
Solution: Add the :cbefore and :cafter commands. (Yegappan Lakshmanan,
closes vim/vim#4340)
vim/vim@cf6a55c
Add the :cbefore and :cafter commands to jump to the quickfix entries
before and after the current cursor location in the current buffer.