Skip to content

Commit

Permalink
Merge pull request #104 from ofseed/main
Browse files Browse the repository at this point in the history
Expose `toggle_follow`
  • Loading branch information
lucc authored Sep 15, 2024
2 parents da3bbf0 + 2d5ce24 commit 929a90d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lua/nvimpager/pager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ local util = require("nvimpager/util")
local ansi2highlight = require("nvimpager/ansi2highlight")

local follow_timer = nil
local function toggle_follow()
function nvimpager.toggle_follow()
if follow_timer ~= nil then
vim.fn.timer_pause(follow_timer, nvimpager.follow)
nvimpager.follow = not nvimpager.follow
Expand Down Expand Up @@ -42,7 +42,7 @@ local function set_maps()
map('<Down>', '<C-E>')
map('k', '<C-Y>')
map('j', '<C-E>')
map('F', toggle_follow)
map('F', nvimpager.toggle_follow)
end

--- Setup function for the VimEnter autocmd.
Expand All @@ -69,7 +69,7 @@ local function pager_mode()
if nvimpager.follow then
-- turn follow mode of so that we can use the init logic in toggle_follow
nvimpager.follow = false
toggle_follow()
nvimpager.toggle_follow()
end
end

Expand Down
2 changes: 2 additions & 0 deletions nvimpager.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ The following mappings are defined by default:
files. It is modeled after the *F* command in *less*(1) or the *-f* option
of *tail*(1)

You can remap the lua function `nvimpager.toggle_follow` if you disabled the
default keymappings

# EXAMPLES

Expand Down

0 comments on commit 929a90d

Please sign in to comment.