Fork me on GitHub
#vim
<
2023-03-04
>
mars0i05:03:30

In my setup, gqi" and gwi" do nothing, but other similar commands, such as gqip, do work. This is true both in nvim 0.7.2 and in vim 8.2.3455 and 9.0. I thought it might have something to do with an option in my startup files, but if I turn them off completely, the problem continues. Any suggestions about what/how to investigate? (In case it matters, this is on MacOS 12. I haven't tested as systematically on MacOS 13, but I believe that the problem is the same there.)

mars0i06:03:51

Also nvim 0.8.3.

tomd09:03:16

I've tested on mac and linux, vim and nvim, but can't replicate. First, do vi" and make sure that text object actually works before doing gq . If it still doesn't work, do :set formatexpr? and :set formatprog? to make sure those aren't set to something which is failing. If they are, you'll need to investigate the expression/program causing the problem. Or set to default value with :set formatexpr& etc. and see if that works.

mars0i18:03:02

Thanks @tomd. That's very helpful. tl;dr: Please scroll down to my last reply. When I type vi", it seems to ignore the i and whatever is the next character, leaving vim/nvim in Visual mode, responding to motion commands or Esc only after that first character after i. Or rather, the character after i causes an error bell. (Didn't notice that at first because I have my terminal set to visual bell.) The same thing happens with va. I'm using a visual bell, and didn't notice that I'm getting a bell from the character after i or a. For example, vijj So there is something special that's happening with the i or a in vi and va, but it's nonfunctional, since the next character doesn't do anything. formatexpr and formatprg seem to be empty, but I gather that the problem comes before that step. This is even if I rename config files so that I'm just running out-of-the-box vim or nvim.

mars0i18:03:35

As an experiment I tried vi"j with vim -V9foo.log textfile.txt to try to see what is happening with the character after vi. I don't know how to read this log file, but I'm guessing that the relevant part is contained in these lines:

Executing BufWinEnter Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing BufEnter Autocommands for "*"
autocommand sil call s:LocalBrowse(expand("<amatch>"))

Executing VimEnter Autocommands for "*"
autocommand sil call s:VimEnter(expand("<amatch>"))

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()
-- VISUAL --
Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()
Nothing there looks like an error, to me, but the bell is being rung.

mars0i18:03:57

OK, this is interesting. When I open foo.log or .viminfo in vim or nvim, vi" works! But it doesn't work in my txt file, or clj files.

mars0i19:03:00

Um, maybe I have created confusion by me misunderstanding what the i" is supposed to do. Oops! vi" and gqi" do work for me if the quotation marks are on one line. If that is what they are supposed to do, then I am not having a problem getting gqi" and gwi" to work. (But that's not what I need. I want to reformat docstrings that already are broken across multiple lines. So I'll try a different strategy from the suggestions in the earlier thread.)

Leaf Garland21:03:04

the i" motion does only work on one line, but many people will have installed plugins to extend that to multiple lines. I use https://github.com/wellle/targets.vim

2
tomd21:03:05

Thanks @U02EP7NKPAL I had forgotten about that. Sorry for the confusion @U4HSMRQQJ - I do most of my vimming in Emacs' evil mode which also enables multiline i" . The examples I tested in vim and nvim were single line. Glad it's now resolved

mars0i22:03:46

Thanks @U02EP7NKPAL. Excellent. I thought I'd need to code up a little script myself, but I'd rather use something off the shelf that someone else has made. It's less likely to interfere with something I install at some future date than my own code would--because only I use it. No problem @tomd --and quite understandable, of course. You set me on the right path.

ribelo13:03:17

Is there any magical way to highlight parentheses before the cursor without using any plugins? Unfortunately, vim-matchup has broken.

sheluchin16:03:16

Isn't this just covered by the standard matchparen?

mars0i18:03:02

Thanks @tomd. That's very helpful. tl;dr: Please scroll down to my last reply. When I type vi", it seems to ignore the i and whatever is the next character, leaving vim/nvim in Visual mode, responding to motion commands or Esc only after that first character after i. Or rather, the character after i causes an error bell. (Didn't notice that at first because I have my terminal set to visual bell.) The same thing happens with va. I'm using a visual bell, and didn't notice that I'm getting a bell from the character after i or a. For example, vijj So there is something special that's happening with the i or a in vi and va, but it's nonfunctional, since the next character doesn't do anything. formatexpr and formatprg seem to be empty, but I gather that the problem comes before that step. This is even if I rename config files so that I'm just running out-of-the-box vim or nvim.