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

Fix g:qf_shorten_path behaviour #133

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
14 changes: 6 additions & 8 deletions autoload/qf.vim
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,12 @@ function! qf#OpenQuickfix()
" get user-defined maximum height
let max_height = get(g:, 'qf_max_height', 10) < 1 ? 10 : get(g:, 'qf_max_height', 10)

let qf_list_title = getqflist({ 'title': 1 })
let qf_list_title = getqflist({ 'title': 1 }).title
let qf_list = getqflist()

" shorten paths if applicable
if get(g:, 'qf_shorten_path', 0) > 0
call setqflist([], 'r', qf_list_title)
call setqflist(qf#ShortenPathsInList(qf_list), 'a')
if get(g:, 'qf_shorten_path', 1) > 0
call setqflist([], 'r', { 'title': qf_list_title, 'items': qf#ShortenPathsInList(qf_list) })
endif

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

let loc_list_title = getloclist(0, { 'title': 1 })
let loc_list_title = getloclist(0, { 'title': 1 }).title
let loc_list = getloclist(0)

" shorten paths if applicable
if get(g:, 'qf_shorten_path', 0) > 0
call setloclist(0, [], 'r', loc_list_title)
call setloclist(0, qf#ShortenPathsInList(loc_list), 'a')
if get(g:, 'qf_shorten_path', 1) > 0
call setloclist(0, [], 'r', { 'title': loc_list_title, 'items': qf#ShortenPathsInList(loc_list) })
endif

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