diff --git a/autoload/nerdcommenter.vim b/autoload/nerdcommenter.vim index fa9848d..4fc67b9 100644 --- a/autoload/nerdcommenter.vim +++ b/autoload/nerdcommenter.vim @@ -1429,12 +1429,13 @@ function! s:PlaceDelimitersAndInsBetween() abort " Otherwise, use 'i'. let insert = col('.') > strlen(getline('.')) ? 'a' : 'i' " 2. Insert comment delimiters. - " 3. Move the cursor to the left of the closing delimiter. + " 3. Move the cursor to the left of the closing delimiter, without + " breaking undo sequence. " 4. Enter insert normal mode again without changing the cursor position. " This ensures that returning to the insert mode after finishing the " script execution does not move the cursor. - " ( 1 ) ( 2 ) ( 3 ) ( 4 ) - execute 'normal!' insert . left . right . repeat("\", strchars(right)) . "\\" + " ( 1 ) ( 2 ) ( 3 ) ( 4 ) + execute 'normal!' insert . left . right . repeat("\U\", strchars(right)) . "\\" endfunction " Function: s:RemoveDelimiters(left, right, line)