Skip to content

Commit 7e65325

Browse files
committed
Make quickfix title more informative in all cases
1 parent 65f115c commit 7e65325

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

autoload/qf.vim

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,13 @@ function! qf#OpenQuickfix()
121121
" get user-defined maximum height
122122
let max_height = get(g:, 'qf_max_height', 10) < 1 ? 10 : get(g:, 'qf_max_height', 10)
123123

124+
let qf_list_title = getqflist({ 'title': 1 })
124125
let qf_list = getqflist()
125126

126127
" shorten paths if applicable
127128
if get(g:, 'qf_shorten_path', 0) > 0
128-
call setqflist(qf#ShortenPathsInList(qf_list))
129+
call setqflist([], 'r', qf_list_title)
130+
call setqflist(qf#ShortenPathsInList(qf_list), 'a')
129131
endif
130132

131133
execute get(g:, "qf_auto_resize", 1) ? 'cclose|' . min([ max_height, len(qf_list) ]) . 'cwindow' : 'cclose|cwindow'
@@ -138,11 +140,13 @@ function! qf#OpenLoclist()
138140
" get user-defined maximum height
139141
let max_height = get(g:, 'qf_max_height', 10) < 1 ? 10 : get(g:, 'qf_max_height', 10)
140142

143+
let loc_list_title = getloclist(0, { 'title': 1 })
141144
let loc_list = getloclist(0)
142145

143146
" shorten paths if applicable
144147
if get(g:, 'qf_shorten_path', 0) > 0
145-
call setloclist(0, qf#ShortenPathsInList(loc_list))
148+
call setloclist(0, [], 'r', loc_list_title)
149+
call setloclist(0, qf#ShortenPathsInList(loc_list), 'a')
146150
endif
147151

148152
execute get(g:, "qf_auto_resize", 1) ? 'lclose|' . min([ max_height, len(loc_list) ]) . 'lwindow' : 'lclose|lwindow'

0 commit comments

Comments
 (0)