6 years ago
The normal command J
and gJ
are normally used to join lines with and without any space between the joined lines, but the cursor moves to the joining point. Using this map the cursor keeps its position. (Pay attention to the lowercase letters in the map instead of uppercase ones)
nnoremap <Leader>j :join<cr> nnoremap <Leader>gj :join!<cr>