1

I am trying to find out the word count in selected text in neovim. For some reason, g_ctrl-g works perfectly fine in normal mode, but when I try it in visual mode after selecting some text, nothing happens. I have confirmed that the key combo has not been remapped to anything else.

I don't know how to diagnose the problem. My config is heavily modified now but I based it on https://github.com/nvim-lua/kickstart.nvim.

Any suggestions would be appreciated.

4
  • It should work :-) At least it works on my end. Maybe the result is overridden by some message. I would try :set cmdheight=2. What is the result of :verbose vmap g<C-g>? Does it work when you start Neovim with nvim -u NONE -i NONE or with nvim --clean? Commented Jul 17 at 17:53
  • Ah you got it. Setting the cmdheight to 2 shows it above -- VISUAL --. With nvim --clean it shows briefly instead of -- VISUAL -- without modifying the cmdheight. I assume this is because of some plugin?
    – K G
    Commented Jul 17 at 20:26
  • 1
    @KG it's likely a plugin is the culprit (triggering a redraw or something, possibly). See How to debug my vimrc. Even with showmode on in Vim, v_g_CTRL-G stays for several seconds for me
    – D. Ben Knoble
    Commented Jul 17 at 20:43
  • Ok I figured out that the issue is with which-key. Upgrading it seems to have solved it.
    – K G
    Commented Jul 18 at 8:33

1 Answer 1

1

The message could be hidden by the --VISUAL‐- message.

To avoid it you could give more room to the message area with:

set cmdheight=2
4
  • 1
    Yes that is indeed the problem. Would you know how to make it work without increasing thecmdheight?
    – K G
    Commented Jul 17 at 23:38
  • If a plugin triggers a redraw <C-l> the message is gone forever :-|. I believe there is nothing to do :-| Commented Jul 18 at 6:04
  • 1
    Ok I figured out that the issue is with which-key. Upgrading it seems to have solved it.
    – K G
    Commented Jul 18 at 8:33
  • 1
    Thanks for the feedback! Welcome to Vim :-) Commented Jul 18 at 8:57

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.