Skip to content

don't change focus to the quicklist#122

Merged
mitermayer merged 1 commit intoprettier:masterfrom
docwhat:pr/no-focus-quickfix
Mar 25, 2018
Merged

don't change focus to the quicklist#122
mitermayer merged 1 commit intoprettier:masterfrom
docwhat:pr/no-focus-quickfix

Conversation

@docwhat
Copy link
Copy Markdown
Contributor

@docwhat docwhat commented Mar 21, 2018

By default setqflist focuses the quicklist, which is annoying.

This restores the cursor position after calling setqflist.

@mitermayer
Copy link
Copy Markdown
Member

Hi @docwhat,

Thanks for submitting this PR, I on the other hand like the auto focus on the quicklist and see it as a good feature, a lot of the times i want to go straight to the place where things are broken so that i can fix it.

I also agree that other people may prefer the behaviour your described above, I wonder if we should make this configurable. What are your thoughts around it ?

thank you a lot for submitting this by the way, just want to make sure we can find a solution that can work well for everyone

@docwhat
Copy link
Copy Markdown
Contributor Author

docwhat commented Mar 21, 2018

Configurable sounds good.

Add an option to restore the cursor's window & position after calling `setqflist()`.
@mitermayer
Copy link
Copy Markdown
Member

mitermayer commented Mar 25, 2018

If you can add configuration for this and keep the normal defaults I will then be able to merge this PR. To add a new configuration you need to:

  1. edit ./plugin/prettier.vim and a a new line like:
let g:prettier#quickfix_auto_focus = get(g:, 'prettier#quickfix_auto_focus', 1)
  1. edit ./autoload/prettier.vim and wrap your changes on a conditional check based on that variable being defined

  2. Update README.md and ./doc/prettier.txt with this new configuration


Onc ethe above is done I will manually check on all supported vim versions and if all is good will merge it!

Once again thank you for the PR !

@docwhat
Copy link
Copy Markdown
Contributor Author

docwhat commented Mar 25, 2018

I’m confused. I did that last night. Do you want me to change the name of the variable?

@mitermayer
Copy link
Copy Markdown
Member

Hi @docwhat,

Sorry I probably commented on a cached page, it was not updated when I saw!

This is awesome! Will test this out and merge it as soon as I get home! Thank you for your contributions !!

Copy link
Copy Markdown
Member

@mitermayer mitermayer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tested this and it all seemed to work just fine with the exception of the flag being inverted, will merge this and fix this on a following commit

Comment thread autoload/prettier.vim
let l:winnr = winnr()
call setqflist(l:errors, 'r')
botright copen
if !g:prettier#no_focus_quicklist
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this line instead be ?

if g:prettier#no_focus_quicklist

@docwhat
Copy link
Copy Markdown
Contributor Author

docwhat commented Mar 25, 2018

winnr is harmless. Only wincmd needs to be checked. `

@docwhat docwhat deleted the pr/no-focus-quickfix branch April 14, 2018 00:43
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.

2 participants