Open davidmaxwaterman opened 2 years ago
Hey @davidmaxwaterman, I never new about the %
key for jumping matchpairs, but I just tried it on the Rakefile and it seems to work fine for me.
https://user-images.githubusercontent.com/1223008/199633105-27b31813-6658-4c62-bcf6-65a960f7ca24.mov
Here are the versions I tried it on.
maximum-awesome on master
❯ vi -version
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Sep 30 2022 03:10:57)
Garbage after option argument: "-version"
More info with: "vim -h"
maximum-awesome on master
❯ vim -version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Mar 8 2021 07:21:32)
Garbage after option argument: "-version"
More info with: "vim -h"
Ah, so it is supposed to work...that's good to know at least. You video, I think, shows it working, as you say. I normally use % to jump between the beginning/end of blocks in code, so I had to try it on function params too...and it doesn't work.
So, I'm wondering how to debug this further.
One thing I noticed with your video is that it appear to be the terminal version rather than the GUI version....and, indeed, if I just invoke using vim
on the cli, % does actually work....so it is just the gui version....hrm, in the gui version, in my code, it doesn't work....but if I open a new tab, and try there, it does work.
So, it's not even just a difference between the cli/gui, but something to do with the actual files I'm editing....
Yes, so if I :n tmp.js
, then insert:
(
)
{
}
and try to jump between those two...it doesn't work. [EDIT - I should add that this test also applies in the terminal, so totally nothing to do with vim/mvim]
So, something to do with javascript files?
What to try next?
[EDIT] I added a video of my own, showing it working in tmp.txt but not tmp.js https://user-images.githubusercontent.com/975698/199706743-091520ac-fd8d-42d2-9abd-175699f664a3.mp4
I had a suggestion from:
https://www.reddit.com/r/vim/comments/y7x4to/comment/iv1xd97/?context=3
that suggested it was a mapping, and :set map
does seem to show some suspects that might be the culprit:
o % * v:<C-U>call <SNR>80_Match_wrapper('',1,'o') <CR>
v % * :<C-U>call <SNR>80_Match_wrapper('',1,'v') <CR>m'gv``
n % * :<C-U>call <SNR>80_Match_wrapper('',1,'n') <CR>
Another observation that came out of that experiment is that the '%' key does actually work the very first time...but not subsequent times.
I wonder if there's any way I can further investigate this issue to move towards a fix. Suggestions welcome.
Any more thoughts on this? I find that ']}' and '[{' are good enough, but I do miss '%'.
Unfortunately, I don't know what's causing it, nor can I reproduce it. ☹️
Oh, I didn't realise that. You mean % works for you even on a js file?
Ah, sorry I missed that. 🤦🏼
Yep, I reproduced it on a JavaScript file. 👍🏼
I'm wondering if there's something wrong with JSHint. I went to open React's dangerfile.js as an example, and I got this error.
"dangerfile.js" 267L, 7915B
Error detected while processing BufEnter Autocommands for "<buffer=1>"..function <S
NR>106_JSHint:
line 41:
could not invoke JSHint:
/Users/sal/Development/maximum-awesome/vim/bundle/jshint.vim/ftplugin/javascript/js
hint/runner.js:78^@ puts( [error.line - offset, error.character, error.reason]
.join(':') );^@ ^^@^@TypeError: puts is not a function^@ at ReadStream.<ano
nymous> (/Users/sal/Development/maximum-awesome/vim/bundle/jshint.vim/ftplugin/java
script/jshint/runner.js:78:7)^@ at ReadStream.emit (node:events:390:28)^@ at
endReadableNT (node:internal/streams/readable:1343:12)^@ at processTicksAndRejec
tions (node:internal/process/task_queues:83:21)^@
line 84:
E927: Invalid action: ''
Press ENTER or type command to continue
Look like commenting out wookiehangover/jshint.vim
fixes that.
diff --git a/vimrc.bundles b/vimrc.bundles
index 104b587..f2eb343 100644
--- a/vimrc.bundles
+++ b/vimrc.bundles
@@ -19,7 +19,7 @@ Plugin 'tomtom/tlib_vim'
Plugin 'nathanaelkane/vim-indent-guides'
Plugin 'nono/vim-handlebars'
Plugin 'pangloss/vim-javascript'
-Plugin 'wookiehangover/jshint.vim'
+" Plugin 'wookiehangover/jshint.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'scrooloose/syntastic'
Plugin 'slim-template/vim-slim'
With that I can now use %
exactly once as you described!
Oddly enough, in my ~/.vimrc.bundles file, that line is already commented out....as is the syntastic line.
I was curious how you managed to get that error output. I tried running vim -D tmp.js
and it complains about line 6 in /opt/homebrew/Cellar/macvim/9.0.472_1/MacVim.app/Contents/Resources/vim/vimrc
, which is set nocompatible
.
Any thoughts?
Any more thoughts on this?
Unfortunately, I don't. I tried debugging this earlier and ran out of patience with it. Because it seems minor (to me), I haven't been able to push myself to work on this in my free time. I know this isn't the answer you're hoping for, but I wanted to give you an update.
LOL, indeed, fair enough.
I have ~recently switched to Mac from Linux and was looking for a config that 'just works' and so I picked this setup.
After having used it for some time, I'm finding that the '%' key doesn't work...it's supposed to do 'matchpairs' - ie if it is on a '[' it should jump to the matching ']'.
If I 'set matchpairs' is shows
matchpairs=(:),{:},[:]
which looks correct.Am I missing something special in maximum-awesome that means '%' isn't the same as regular vi?