When I prefix the J ("join") command with a count, Vim is joining one fewer line than I expect. For example, with the cursor at the first column, first line of the following,


if I type JJJJ (four J's), I get (as expected):

one two three four five

But if instead I type 4J, I get:

one two three four

It looks like J=1J=2J, 3J=JJ, 4J=JJJ, and so on. Is this the expected behavior?

2 Answers 2


After further research and office discussion, I realize this is indeed the expected behavior. According to the vim help:

J    Join [count] lines, with a minimum of two lines.

I've always thought [count][command] was literally another way to type [command] repeated [count] times. Turns out commands are free to interpret [count] as they like, and J takes it to mean the number of lines that will be joined; this explains why 1J and 2J have the same effect.


It is the described behaviour.

:help J states

Join [count] lines, with a minimum of two lines

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.