1

I'm sorry, I'm noob in vim but how to comment with tcomment_vim? Here the debug info and some videos.

TCOMMENT: &ft = javascript => javascript
TCOMMENT: stx = jsString => javascriptString
TCOMMENT: ct  = {'rxmid': '', 'rxend': '', 'commentstring': '// %s', 'commentstring_rx': '\%%(// %s\|/* %s */\)', 'mode': '', 'filetype': 'javascript', 'replacements': {'*/': {'subst': '|)}>#', 'guard_rx': '^\s*/\?\*'}, '/*': {'subst': '#<{(|', 'guard_rx': '^\s*/\?\*'}}, 'rxbeg': '\*\+'}

Videos showing use of gcc on insert mode.

But if I use, :TComment on the vim-command-terminal it works like charm. Only the shortcut, I can't use it.

And the last one, what is {motion} on the documentation of tcomment? gc{motion}

Note : - I install it using vim-plug

Update

:map gc result :

x  gc            <Plug>TComment_gc
n  gcb           <Plug>TComment_gcb                                                                                                                                                                      
n  gcc           <Plug>TComment_gcc
n  gc9c          <Plug>TComment_gc9c
n  gc9           <Plug>TComment_gc9
n  gc8c          <Plug>TComment_gc8c
n  gc8           <Plug>TComment_gc8
n  gc7c          <Plug>TComment_gc7c
n  gc7           <Plug>TComment_gc7
n  gc6c          <Plug>TComment_gc6c
n  gc6           <Plug>TComment_gc6
n  gc5c          <Plug>TComment_gc5c
n  gc5           <Plug>TComment_gc5
n  gc4c          <Plug>TComment_gc4c
n  gc4           <Plug>TComment_gc4
n  gc3c          <Plug>TComment_gc3c
n  gc3           <Plug>TComment_gc3
n  gc2c          <Plug>TComment_gc2c
n  gc2           <Plug>TComment_gc2
n  gc1c          <Plug>TComment_gc1c
n  gc1           <Plug>TComment_gc1
n  gc            <Plug>TComment_gc
6
  • If you run :map gc, what does Vim show you? Does gc_ work (with an underscore)? How about gcj?
    – filbranden
    May 24 '20 at 0:28
  • @filbranden Updated add map gc, gc_ move the cursor to start of line, gcj move the cursor 1 line to bottom, I think there are a problem with my gc May 24 '20 at 0:59
  • Does gcc work in the first character of the line? Like ^gcc?
    – filbranden
    May 24 '20 at 1:10
  • @filbranden Nope it's also not working. I wonder why I tried other commenter too but fail github.com/tpope/vim-commentary, here a full list of my Nvim config if you wonder github.com/mandaputtra/dotfiles/tree/master/nvim May 24 '20 at 2:16
  • I'll recommend How do I debug my vimrc file? to see if you can narrow down why this isn't working... I was going to recommend trying tpope's vim-commentary, but looks like you've done that already... It might be something related to the gc prefix, though looking at your vimrc or maps you listed, I can't really tell what it might be...
    – filbranden
    May 24 '20 at 4:17
1

Turns out that set timeoutlen=100 on my .vimrc configuration file was the culprit it makes prefix gc can't be used for now I'm not sure enough why, and I don't know why. Maybe because I don't type fast enough.

Edit :

To make clear here turns out that removing set timeoutlen actually make my vim_which_key open later that I could make some key combination with gc. So I remove set timeoutlen and its working altough the vim_which_key will open up after 1 second waiting, not a big deal, but I love commenting with keystroke then using vim_which_key

2
  • I have set timeoutlen=1000 ttimeoutlen=0, can you please elaborate why timeoutlen was the culprit? May 24 '20 at 10:18
  • github.com/mandaputtra/dotfiles/commit/… I still don't know yet. But for now my vim_which_key plugins are nt working because I remove the set timeoutlen. I think it because I copy pasta another vim person .vimrc. SO i don't know what when wrong. May 24 '20 at 17:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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