preservim / nerdcommenter

Vim plugin for intensely nerdy commenting powers
Creative Commons Zero v1.0 Universal
4.97k stars 448 forks source link

Commenting sexily omits the next line in C files #404

Open adam8157 opened 4 years ago

adam8157 commented 4 years ago

test.c

comments <--- place your cursor at this line
void foo();

Comment the first line sexily, <Leader>cs, then the void foo(); line disappears.

alerque commented 4 years ago

I cannot replicate this. Are you sure you don't have something else going on? I copied your example exactly and it works fine for me. Have you tried for example disabling all other plugins?

adam8157 commented 4 years ago

Found it, the configuration triggers this is: set foldmethod=syntax

Could you please take a try?

alerque commented 4 years ago

Nope, foldmethod=syntax is the default for me anyway so that's already what I was testing with.

What version of VIM/Neovim are you using? Do you have any fold related plugins?

adam8157 commented 4 years ago

My minimal reproduced vimrc:

set nocompatible

set foldmethod=syntax

" Plugin manager
if empty(glob('~/.vim/autoload/plug.vim'))
        silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
                \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
        autocmd VimEnter * PlugInstall | source $MYVIMRC
endif

call plug#begin('~/.vim/bundle')

Plug 'scrooloose/nerdcommenter'

call plug#end()

:version

:version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Oct 23 2019 15:11:17)
macOS version
Included patches: 1-2200
Compiled by Homebrew
Huge version without GUI.  Features included (+) or not (-):
+acl               +cindent           +cursorshape       +file_in_path      +jumplist          +mksession         +mouse_xterm       +printer           -sound             +terminal          +virtualedit       -xim
+arabic            -clientserver      +dialog_con        +find_in_path      +keymap            +modify_fname      +multi_byte        +profile           +spell             +terminfo          +visual            -xpm
+autocmd           +clipboard         +diff              +float             +lambda            +mouse             +multi_lang        -python            +startuptime       +termresponse      +visualextra       -xsmp
+autochdir         +cmdline_compl     +digraphs          +folding           +langmap           -mouseshape        -mzscheme          +python3           +statusline        +textobjects       +viminfo           -xterm_clipboard
-autoservername    +cmdline_hist      -dnd               -footer            +libcall           +mouse_dec         +netbeans_intg     +quickfix          -sun_workshop      +textprop          +vreplace          -xterm_save
-balloon_eval      +cmdline_info      -ebcdic            +fork()            +linebreak         -mouse_gpm         +num64             +reltime           +syntax            +timers            +wildignore
+balloon_eval_term +comments          +emacs_tags        +gettext           +lispindent        -mouse_jsbterm     +packages          +rightleft         +tag_binary        +title             +wildmenu
-browse            +conceal           +eval              -hangul_input      +listcmds          +mouse_netterm     +path_extra        +ruby              -tag_old_static    -toolbar           +windows
++builtin_terms    +cryptv            +ex_extra          +iconv             +localmap          +mouse_sgr         +perl              +scrollbind        -tag_any_white     +user_commands     +writebackup
+byte_offset       +cscope            +extra_search      +insert_expand     +lua               -mouse_sysmouse    +persistent_undo   +signs             -tcl               +vartabs           -X11
+channel           +cursorbind        -farsi             +job               +menu              +mouse_urxvt       +postscript        +smartindent       +termguicolors     +vertsplit         -xfontset
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X -DMACOS_X_DARWIN  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: clang   -L. -fstack-protector-strong -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/readline/lib  -L/usr/local/lib -o vim        -lncurses -liconv -lintl -framework AppKit
-L/usr/local/opt/lua/lib -llua5.3 -mmacosx-version-min=10.14 -fstack-protector-strong -L/usr/local/lib  -L/usr/local/Cellar/perl/5.30.0/lib/perl5/5.30.0/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc  -L/usr/local/opt/python
/Frameworks/Python.framework/Versions/3.7/lib/python3.7/config-3.7m-darwin -lpython3.7m -framework CoreFoundation  -lruby.2.6
alerque commented 4 years ago

Confirmed. Also in Neovim.

Incidentally my problem reproducing this was I have this set by default:

let g:NERDCompactSexyComs = 1

As a temporary workaround, the sexy comments work if you start from visual mode, so Shift+V before your <leader>cs should get you there.

PRs welcome if anybody wants to tackle fixing this.