Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Play nicer with vim-qf #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Play nicer with vim-qf #45

wants to merge 1 commit into from

Conversation

qstrahl
Copy link

@qstrahl qstrahl commented Sep 10, 2019

After years of frustration, I finally looked into why vim-scriptease and vim-qf didn't seem to play together nicely (among other things, vim-qf automatically runs :[cl]window on QuickfixCmdPost). What I discovered is that two things needed to change before they would kiss and make up:

  1. :Vedit and pals needed to issue a doautocmd QuickFixCmdPost after calling setloclist
  2. The list entries produced by :Vedit and pals needed to have {"valid": 1}

To be quite honest, I have no idea why the entries were not considered valid; I wasn't able to find much :help on the subject. I was only able to get them considered valid by using the full filename as the entry text and then by explicitly setting "valid": 1. The absence of either of these changes seemed to prevent them from being considered valid in my testing.

I always thought it was weird that the filenames had the last few characters chopped off, anyway, so it was a welcome change for me, at least. If there's some sort of black magic at play that I don't fully understand, I'd love to hear about it.

@tpope
Copy link
Owner

tpope commented Sep 10, 2019

  1. :Vedit and pals needed to issue a doautocmd QuickFixCmdPost after calling setloclist

I'll accept the doautocmd, but scriptease.vim needs to run on versions of Vim older than <nomodeline>.

I was only able to get them considered valid by using the full filename as the entry text

This is such nonsense that I almost didn't bother testing it. But I did test it and it's wrong.

I always thought it was weird that the filenames had the last few characters chopped off, anyway, so it was a welcome change for me, at least. If there's some sort of black magic at play that I don't fully understand, I'd love to hear about it.

"Last few characters"? It chops off the relative portion and leaves the directory name as seen in 'runtimepath'.

@qstrahl
Copy link
Author

qstrahl commented Sep 10, 2019

This is such nonsense that I almost didn't bother testing it. But I did test it and it's wrong.

"Last few characters"? It chops off the relative portion and leaves the directory name as seen in 'runtimepath'.

That's... a surprise. Two surprises. Something must be very wrong with my environment. I guess I'll drop the nomodeline from the one commit, drop the other commits for now, and let you know if I can definitively narrow down the other issues to some weird case in scriptease.

@qstrahl
Copy link
Author

qstrahl commented Sep 10, 2019

@tpope There; should be just the doautocmd change now, minus the <nomodeline>

@tpope
Copy link
Owner

tpope commented Sep 10, 2019

Now that I think about it ... let's keep <nomodeline> but wrap the each doau in a if v:version >= 704. So we get reduced functionality on old Vim versions but it still works. I think that's a better tradeoff than triggering modelines on new versions.

If you're getting weird results with that truncation, one thing to rule out is symlinks in your 'runtimepath'.

@qstrahl
Copy link
Author

qstrahl commented Sep 10, 2019 via email

@tpope
Copy link
Owner

tpope commented Sep 10, 2019

Unclear. Try to pinpoint how exactly it causes it to fail.

@qstrahl
Copy link
Author

qstrahl commented Sep 10, 2019 via email

@tpope
Copy link
Owner

tpope commented Sep 10, 2019

If you want to do it right, the incantation in Projectionist is the way to go.

I don't understand how vim-qf would know to use :lopen and not :copen since Vedit isn't a standard command name.

@qstrahl
Copy link
Author

qstrahl commented Sep 10, 2019 via email

@tpope
Copy link
Owner

tpope commented Sep 17, 2019

Looks like you're doing an equality check, which means if you run the same quickfix command twice in a row, the second time, it will open the location list rather the quickfix list. What a confusing bug!

I don't think there is a robust solution to this other than to look at the command in expand('<amatch>'). Checking for a leading l works for built-ins. I'd rather our autocommand match this somehow rather than provide the unhelpful Vedit.

(Fugitive currently uses Ggrep and Glgrep events. I could see renaming these to look like grep-fugitive and lgrep-fugitive.)

tpope added a commit to tpope/vim-fugitive that referenced this pull request Sep 26, 2019
tpope added a commit that referenced this pull request Nov 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants