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

Added ability to keep the quickfix/location list window open #1361

Merged
merged 1 commit into from
Jul 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions autoload/go/list.vim
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ if !exists("g:go_list_type")
endif

" Window opens the list with the given height up to 10 lines maximum.
" Otherwise g:go_loclist_height is used. If no or zero height is given it
" closes the window
" Otherwise g:go_loclist_height is used.
"
" If no or zero height is given it closes the window by default.
" To prevent this, set g:go_list_autoclose = 0
function! go#list#Window(listtype, ...) abort
let l:listtype = go#list#Type(a:listtype)
" we don't use lwindow to close the location list as we need also the
Expand All @@ -13,10 +15,13 @@ function! go#list#Window(listtype, ...) abort
" location list increases/decreases, cwindow will not resize when a new
" updated height is passed. lopen in the other hand resizes the screen.
if !a:0 || a:1 == 0
if l:listtype == "locationlist"
lclose
else
cclose
let autoclose_window = get(g:, 'go_list_autoclose', 1)
if autoclose_window
Copy link
Owner

Choose a reason for hiding this comment

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

I think this should work as well:

if get(g:, 'go_list_autoclose', 1)
 ...
endif

no need to create the intermediate autoclose_window variable :)

if l:listtype == "locationlist"
lclose
else
cclose
endif
endif
return
endif
Expand Down
10 changes: 10 additions & 0 deletions doc/vim-go.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1419,6 +1419,16 @@ Supported values are "", "quickfix", and "locationlist". >

let g:go_list_type = ""
<

*'g:go_list_autoclose'*

Specifies whether the quickfix/location list should be closed automatically
in the absence of errors. The default value is 1.
If you prefer to keep a long running error window open, you can disable
this by setting the value to 0.
Copy link
Owner

Choose a reason for hiding this comment

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

I think people using Vim already know that setting to 0 means disabling. So the whole text should be actually just like the others in the form of:

Specifies whether the quickfix/location list should be closed automatically in
the absence of errors. If you prefer to keep a long running error window open,
you can disable this by using this setting. By default it's enabled.

>
let g:go_list_autoclose = 1
<
*'g:go_asmfmt_autosave'*

Use this option to auto |:AsmFmt| on save. By default it's disabled. >
Expand Down