Skip to content

Commit 649c806

Browse files
committed
Don't change jumplist
1 parent 09ee857 commit 649c806

File tree

3 files changed

+79
-14
lines changed

3 files changed

+79
-14
lines changed

lua/autoload.vim

Whitespace-only changes.

lua/qf.lua

+16-14
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ local function setup_autocmds(config)
9595
cmd('autocmd QuickFixCmdPost ' .. loc_post_commands() .. ' :lua require"qf".open("l", true)')
9696
end
9797

98-
-- if c.auto_open then
99-
-- cmd('autocmd QuickFixCmdPost ' .. qf_post_commands() .. ' :lua require"qf".open("c", true)')
100-
-- end
98+
if c.auto_open then
99+
cmd('autocmd QuickFixCmdPost ' .. qf_post_commands() .. ' :lua require"qf".open("c", true)')
100+
end
101101

102102
-- cmd('autocmd WinLeave * :lua require"qf".reopen_all()')
103103

@@ -106,6 +106,10 @@ local function setup_autocmds(config)
106106
cmd 'augroup END'
107107
end
108108

109+
local function istrue(val)
110+
return val == true or val == '1'
111+
end
112+
109113
function M.setup(config)
110114
config = config or {}
111115
M.config = vim.tbl_deep_extend('force', defaults, config)
@@ -115,7 +119,7 @@ function M.setup(config)
115119
end
116120

117121
local function printv(msg, verbose)
118-
if verbose ~= false then print(msg) end
122+
if istrue(verbose) ~= false then print(msg) end
119123
end
120124

121125
local function check_empty(list, num_items, verbose)
@@ -250,7 +254,6 @@ function M.on_ft(winid)
250254
bo.buflisted = false
251255
wo.number = opts.number
252256
wo.relativenumber = opts.relativenumber
253-
wo.winfixheight = true
254257

255258
if opts.auto_resize then
256259
cmd('resize ' .. get_height(list))
@@ -282,7 +285,7 @@ function M.resize(list, stay, num_items)
282285

283286
cmd(list .. "open " .. height )
284287

285-
if stay then
288+
if istrue(stay) then
286289
cmd "wincmd p"
287290
end
288291
end
@@ -319,10 +322,9 @@ function M.open(list, stay, verbose, num_items)
319322

320323
cmd(list .. 'open ' .. get_height(list, num_items))
321324

322-
if stay then
325+
if istrue(stay) then
323326
cmd "wincmd p"
324327
end
325-
326328
end
327329

328330
-- Close list
@@ -488,17 +490,17 @@ function M.follow(list, strategy, limit)
488490
clear_prompt()
489491
-- Select found entry
490492
if list == 'c' then
491-
cmd('cc ' .. i)
493+
cmd(':keepjumps cc ' .. i)
492494
else
493-
cmd('ll ' .. i)
495+
cmd(':keepjumps ll ' .. i)
494496
end
495497

496498
fn.setpos('.', pos)
497499
end
498500

499501
-- Wrapping version of [lc]next. Also takes into account valid entries.
500502
-- If wrap is nil or true, it will wrap around the list
501-
function M.next(list, verbose, wrap)
503+
function M.next(list, wrap, verbose)
502504
if wrap == nil then
503505
wrap = true
504506
end
@@ -517,7 +519,7 @@ end
517519

518520
-- Wrapping version of [lc]prev. Also takes into account valid entries.
519521
-- If wrap is nil or true, it will wrap around the list
520-
function M.prev(list, verbose, wrap)
522+
function M.prev(list, wrap, verbose)
521523
if wrap == nil then
522524
wrap = true
523525
end
@@ -563,7 +565,7 @@ end
563565

564566
-- Wrapping version of [lc]above
565567
-- Will switch buffer
566-
function M.above(list, verbose, wrap)
568+
function M.above(list, wrap, verbose)
567569
if wrap == nil then
568570
wrap = true
569571
end
@@ -605,7 +607,7 @@ end
605607

606608
-- Wrapping version of [lc]below
607609
-- Will switch buffer
608-
function M.below(list, verbose, wrap)
610+
function M.below(list, wrap, verbose)
609611
if wrap == nil then
610612
wrap = true
611613
end

plugin/qf.vim

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
" === QUICKFIX ===
2+
3+
" Opens the quickfix list
4+
command! -nargs=* Qopen lua require'qf'.open('c', <q-args>)
5+
" Qlose the quickfix list
6+
command! -nargs=* Qclose lua require'qf'.close('c', <q-args>)
7+
" Toggle the quickfix list
8+
command! -nargs=* Qtoggle lua require'qf'.close('c', <q-args>)
9+
" Qlear the contents of quickfix list
10+
command! -nargs=* Qclear lua require'qf'.clear('c', <q-args>)
11+
12+
" Move to the next item in quickfix list and wrap around.
13+
" Second argument denotes wrap>
14+
command! -nargs=* Qnext lua require'qf'.next('c', <q-args>)
15+
" Move to the previous item in quickfix list.
16+
" Second argument denotes wrap>
17+
command! -nargs=* Qprev lua require'qf'.prev('c', <q-args>)
18+
" Move to the previous item in quickfix list.
19+
" Second argument denotes wrap>
20+
command! -nargs=* Qabove lua require'qf'.above('c', <q-args>)
21+
" Move to the previous item in quickfix list.
22+
" Second argument denotes wrap>
23+
command! -nargs=* Qbelow lua require'qf'.below('c', <q-args>)
24+
25+
" Save the quickfix list
26+
command! -nargs=* Qsave lua require'qf'.save('c', <q-args>)
27+
" Load a saved quickfix list
28+
command! -nargs=* Qload lua require'qf'.load('c', <q-args>)
29+
" Set the item in quickfix list
30+
command! -nargs=* Qset lua require'qf'.below('c', <q-args>)
31+
32+
" === LOCATION ===
33+
34+
" Opens the quickfix list
35+
command! -nargs=* Lopen lua require'qf'.open('l', <q-args>)
36+
" Close the quickfix list
37+
command! -nargs=* Lclose lua require'qf'.close('l', <q-args>)
38+
" Toggle the quickfix list
39+
command! -nargs=* Ltoggle lua require'qf'.close('l', <q-args>)
40+
" Clear the contents of quickfix list
41+
command! -nargs=* Lclear lua require'qf'.clear('l', <q-args>)
42+
43+
" Move to the next item in quickfix list and wrap around.
44+
" Second argument denotes wrap>
45+
command! -nargs=* Lnext lua require'qf'.next('l', <q-args>)
46+
" Move to the previous item in quickfix list.
47+
" Second argument denotes wrap>
48+
command! -nargs=* Lprev lua require'qf'.prev('l', <q-args>)
49+
" Move to the previous item in quickfix list.
50+
" Second argument denotes wrap>
51+
command! -nargs=* Labove lua require'qf'.above('l', <q-args>)
52+
" Move to the previous item in quickfix list.
53+
" Second argument denotes wrap>
54+
command! -nargs=* Lbelow lua require'qf'.below('l', <q-args>)
55+
56+
" Save the quickfix list
57+
command! -nargs=* Lsave lua require'qf'.save('l', <q-args>)
58+
" Load a saved quickfix list
59+
command! -nargs=* Lload lua require'qf'.load('l', <q-args>)
60+
" Set the item in quickfix list
61+
command! -nargs=* Lset lua require'qf'.below('l', <q-args>)
62+
63+

0 commit comments

Comments
 (0)