[vim/vim] add an option to setting the default statusline of quickfix (#4662)

38 views
Skip to first unread message

itchyny

unread,
Jul 13, 2019, 12:02:35 AM7/13/19
to vim/vim, Subscribed

I think setting the statusline in default ftplugin causes many problems.

  • User's statusline configuration is overwritten unexpectedly in quickfix/location windows.
  • There's FileType event to overwrite the statusline of the ftplugin but this is dirty and introduce some processing time that would be unnecessary if the default ftplugin did not modify the statusline.
  • ftplugin/qf.vim is the only default ftplugin which modifies the statusline.

This is a patch to introduce a global flag to enable the statusline in the ftplugin. What do you think @llorens @chrisbra?

Related comment: #4278 (comment).


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/4662

Commit Summary

  • add an option to setting the default statusline of quickfix

File Changes

Patch Links:


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub

Bram Moolenaar

unread,
Jul 13, 2019, 10:39:53 AM7/13/19
to vim/vim, Subscribed

> I think setting the statusline in default ftplugin causes many problems.
>
> - User's statusline configuration is overwritten unexpectedly in
> quickfix/location windows.
> - There's FileType event to overwrite the statusline of the ftplugin

> but this is dirty and introduce some processing time that would be
> unnecessary if the default ftplugin did not modify the statusline.
> - ftplugin/qf.vim is the only default ftplugin which modifies the

> statusline.
>
> This is a patch to introduce a global flag to enable the statusline in
> the ftplugin. What do you think @llorens @chrisbra?
>
> Related comment: https://github.com/vim/vim/issues/4278#issuecomment-489654979.

I don't really see a problem. Showing the command in the statusline by
default would be what most people want. If you don't want it, use the
standard way to overrule: Define your own plugin and set b:did_ftplugin
so that the default plugin doesn't do anything.

--
Time flies like an arrow.
Fruit flies like a banana.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Christian Brabandt

unread,
Jul 14, 2019, 9:46:33 AM7/14/19
to vim/vim, Subscribed

I second this PR, because the default qf filetype makes life nice statusline plugins unnecessarily harder than it actually should be.

Bram Moolenaar

unread,
Jul 14, 2019, 9:57:28 AM7/14/19
to vim...@googlegroups.com, Christian Brabandt

Christian wrote:

> I second this PR, because the default qf filetype makes life nice
> statusline plugins unnecessarily harder than it actually should be.

So the problem happens when a custom statusline is defined, by a plugin
or otherwise. Then the best solution is to have the custom statusline
by default, but make it easy to disable it. That would mean checking
for a variable to disable the quickfix statusline.

--
If cars evolved at the same rate as computers have, they'd cost five euro,
run for a year on a couple of liters of petrol, and explode once a day.

Christian Brabandt

unread,
Jul 14, 2019, 11:53:13 AM7/14/19
to vim...@googlegroups.com

On So, 14 Jul 2019, Bram Moolenaar wrote:

>
> Christian wrote:
>
> > I second this PR, because the default qf filetype makes life nice
> > statusline plugins unnecessarily harder than it actually should be.
>
> So the problem happens when a custom statusline is defined, by a plugin
> or otherwise. Then the best solution is to have the custom statusline
> by default, but make it easy to disable it. That would mean checking
> for a variable to disable the quickfix statusline.

That's what the proposed PR does, isn't it? (However, it needs a
documentation update). Or should we check if the default global stl
setting is empty and only then set the local stl option? However I don't
think this would help most users.

Best,
Christian
--
Wer nicht schon in der Arbeit Genugtuung findet, der wird nie zur
Zufriedenheit gelangen.
-- Peter Rosegger

Bram Moolenaar

unread,
Jul 14, 2019, 2:42:47 PM7/14/19
to vim...@googlegroups.com, Christian Brabandt

Christian wrote:

> > > I second this PR, because the default qf filetype makes life nice
> > > statusline plugins unnecessarily harder than it actually should be.
> >
> > So the problem happens when a custom statusline is defined, by a plugin
> > or otherwise. Then the best solution is to have the custom statusline
> > by default, but make it easy to disable it. That would mean checking
> > for a variable to disable the quickfix statusline.
>
> That's what the proposed PR does, isn't it? (However, it needs a
> documentation update). Or should we check if the default global stl
> setting is empty and only then set the local stl option? However I don't
> think this would help most users.

This PR does it the other way around, thus changing the default.

It should be something like

if !get(g:, 'qf_disable_statusline')

--
An indication you must be a manager:
You believe you never have any problems in your life, just
"issues" and "improvement opportunities".

Christian Brabandt

unread,
Jul 14, 2019, 2:50:59 PM7/14/19
to vim...@googlegroups.com

On So, 14 Jul 2019, Bram Moolenaar wrote:

> This PR does it the other way around, thus changing the default.
>
> It should be something like
>
> if !get(g:, 'qf_disable_statusline')


right, let me comment in the PR so itchny can adjust.

Best,
Christian
--
Der Handelnde ist immer gewissenlos; es hat niemand Gewissen als
der Betrachtende.
-- Goethe, Maximen und Reflektionen, Nr. 378

Christian Brabandt

unread,
Jul 14, 2019, 2:58:21 PM7/14/19
to vim/vim, Subscribed

@chrisbra commented on this pull request.


In runtime/ftplugin/qf.vim:

> @@ -10,7 +10,9 @@ endif
 " Don't load another plugin for this buffer
 let b:did_ftplugin = 1
 
-let b:undo_ftplugin = "set stl<"
+if get(g:, 'qf_default_statusline')

Please revert the condition, so that the default does not change:

if !get(g:, 'qf_disable_statusline')

Also, please add a short paragraph at syntax.txt describing the variable :h ft-qf-syntax.

itchyny

unread,
Jul 15, 2019, 8:19:42 AM7/15/19
to vim/vim, Push

@itchyny pushed 2 commits.

  • 2a375f2 flip the flag for quickfix statusline
  • 15bbe64 add document for quickfix syntax


You are receiving this because you are subscribed to this thread.

View it on GitHub

itchyny

unread,
Jul 15, 2019, 8:30:26 AM7/15/19
to vim/vim, Subscribed

@itchyny commented on this pull request.


In runtime/ftplugin/qf.vim:

> @@ -10,7 +10,9 @@ endif
 " Don't load another plugin for this buffer
 let b:did_ftplugin = 1
 
-let b:undo_ftplugin = "set stl<"
+if get(g:, 'qf_default_statusline')

Thank you for comment, I updated the patch.

Codecov

unread,
Jul 15, 2019, 8:41:32 AM7/15/19
to vim/vim, Subscribed

Codecov Report

Merging #4662 into master will increase coverage by 4.46%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@

##           master    #4662      +/-   ##

==========================================

+ Coverage   76.88%   81.35%   +4.46%     

==========================================

  Files         111      114       +3     

  Lines      144307   145122     +815     

==========================================

+ Hits       110956   118059    +7103     

+ Misses      33351    27063    -6288
Impacted Files Coverage Δ
src/profiler.c 92.69% <0%> (ø)
src/testing.c 89.97% <0%> (ø)
src/highlight.c 78.11% <0%> (ø)
src/xxd/xxd.c 74.79% <0%> (+0.07%) ⬆️
src/libvterm/t/harness.c 88.59% <0%> (+0.47%) ⬆️
src/if_tcl.c 86.42% <0%> (+0.54%) ⬆️
src/if_ruby.c 91.23% <0%> (+0.87%) ⬆️
src/if_lua.c 88.19% <0%> (+1.04%) ⬆️
src/if_py_both.h 76.78% <0%> (+1.16%) ⬆️
src/regexp_nfa.c 91.76% <0%> (+1.24%) ⬆️
... and 100 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4e63f94...15bbe64. Read the comment docs.


You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub, or mute the thread.

Bram Moolenaar

unread,
Jul 15, 2019, 3:47:25 PM7/15/19
to vim/vim, Subscribed

I'll include it. But put the docs with the filetype docs, not the syntax docs.

Bram Moolenaar

unread,
Jul 15, 2019, 3:47:26 PM7/15/19
to vim/vim, Subscribed

Closed #4662.

Reply all
Reply to author
Forward
0 new messages