Questions tagged [operator-pending-mode]
For questions about operator-pending mode, which is the mode after triggering an operator but before specifying a motion or text-object to operate on.
16 questions
1 vote
1 answer
126 views
Disable displaying pending operators in statusline
I'm using Vim 9.1.1550 which I've updated today (my package manager compiled/packaged it Jul 15 2025). Since this update, Vim now displays pending operators on the bottom right by default. What is the ...
0 votes
2 answers
69 views
Usage of opfunc and g@: is there a simple way to save/restore option?
I read the example in :h map-operator which does the job but it is very convoluted. I am wondering if there is a simpler way to save/restore options before/after having set 'opfunc' and run g@. My ...
1 vote
1 answer
146 views
Setting change/visual marks with empty inner motion in custom text objects
This has been discussed on Vim’s issue tracker. By default for the default builtin motions where the 'indside' of a text object is empty - such as double quote (say we have the following text "&...
0 votes
1 answer
48 views
Why do text objects move the cursor to the end in Visual mode, but in the beginning in Operator-pending mode?
As far as I can tell, selection in Visual mode using most text objects results in the cursor being placed at the end of the text object region, whether that's linewise or characterwise. However, using ...
1 vote
0 answers
87 views
How to programmatically input a motion in operator-pending mode without switching to normal mode?
I need to programmatically input a motion in operation-pending mode, kinda like using :normal!, but without switching modes, so the operator still takes effect. Context I'm writing a script that ...
1 vote
1 answer
77 views
Make operator that doesn't change gv
I'm trying to redefine my inner and outer line text objects so that they don't change gv. First I had onoremap <silent> il :<C-u>normal! $v^<CR> I changed it based on Using visual ...
3 votes
1 answer
482 views
Recursive map to <leader> not working
I have a german keyboard and \ is hard to reach, so I added the following line to my config: map ß \ This works fine for simple leader commands, and I did not have to change my leader command in case ...
3 votes
1 answer
217 views
Is g@ useful outside of VimL scripting, i.e. when editing? (Instead of vim-repeat)
I read on an old none commentable reddit that Tpope no longer uses his vim-repeat plugin, and instead uses g@. I have used g@ in plugins, and unstand you set opfunc first, then g@{motion} will run ...
1 vote
1 answer
113 views
How to test whether the cursor is at the end of a line in a mapping?
I would like to test in an operator-pending mapping whether the cursor is on the last position of the line. I currently have this, but it does not work: onoremap <expr> i$ col('.') == col('$') ?...
1 vote
1 answer
188 views
How to ignore or silence errors in operator-pending mappings?
The following operator-depending mapping works great for me, onoremap <silent> a$ :<C-U>normal! hEF$v,<CR> except when it is issued at the very beginning of a line. What happens is ...
4 votes
1 answer
735 views
Creating custom text objects via omap - How to run functions after the motion
I've done extensive reading including :h omap-info and Vim the hardway operator pending mode, this part is espcially good: A good way to keep the multiple ways of creating operator-pending mappings ...
3 votes
1 answer
164 views
custom mapping to make dge consistent with dw, de, and db?
Situation Recently I was investigating the behaviour of word motions in vim and to me it seems like ge is grossly inconsistent with the other 3. Here is an example with ^ showing the cursor: word1 ...
5 votes
5 answers
2k views
Delete text between two $ symbols in gvim
I understand that we can use da{ to delete a whole {} block in vim. I am wondering if there is a corresponding version with { replaced by $ (similarly for di{) as this would be very useful for people ...
2 votes
1 answer
87 views
What is the purpose of the short cursor in command mode?
If I'm in command mode with default vim and I press the right angle key, the cursor switches from the normal block to a short version. What is the function of this? (Sometimes it seems related to ...
2 votes
1 answer
337 views
Visual/Operator-pending autocommand?
Last week, I turned off 'number' and have been using only 'relativenumber', plus a line/column count in my status line. I don't really look at line numbers that much. But now I've had a radical idea. ...