I think you need to remove the =
from the rhs
of your first mapping, because it indents the current line, and moves your cursor in the process.
Here's what happens when you hit df(
at the moment:
dt(
deletes until next open parenthesis
me
sets the mark e
on the open parenthesis
%
moves the cursor onto the closing parenthesis
x
deletes the closing parenthesis
`e
moves the cursor back to the open parenthesis
x
deletes the opening parenthesis
=:silent! ...<cr>
makes your mapping repeatable, and indents the current line
In normal mode, =
is an operator which filters the lines in a text-object or in a text covered by a motion, through an external program or an internal formatting function (see :h =
for more detail), to set their level of indentation.
Here, :silent! ...<cr>
is interpreted by =
as a motion. But, it doesn't move the cursor, so =
operates on the lines between the current line (position before :silent! ...<cr>
), and the current line (position after :silent! ...<cr>
).
In the question you linked, =
wasn't the normal operator, but a character passed as an argument to the r
command. It was used to replace each character inside the visual selection.
I don't think you need the `e
in the rhs
of your second mapping either:
nno <silent> <plug>Map_df( dt(me%x`ex:sil! call repeat#set("\<plug>Map_df(", v:count)<cr>
nmap df( <plug>Map_df(
If you don't want to clobber the e
mark, you could use '
instead:
nno <silent> <plug>Map_df( dt(m'%x``x:sil! call repeat#set("\<plug>Map_df(", v:count)<cr>
nmap df( <plug>Map_df(