Skip to content

Commit

Permalink
Use Neovim module require when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
rbong committed Aug 17, 2024
1 parent 1d925ac commit aee1b2e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
10 changes: 2 additions & 8 deletions autoload/flog/graph/nvim.vim
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
function! flog#graph#nvim#Get(git_cmd) abort
let l:state = flog#state#GetBufState()

let l:graph_lib = flog#lua#GetLibPath('graph.lua')
exec 'luafile ' . fnameescape(l:graph_lib)

return v:lua.flog_get_graph(
return v:lua.require('flog/graph').get_graph(
\ v:false,
\ v:true,
\ v:true,
Expand All @@ -25,10 +22,7 @@ endfunction
function! flog#graph#nvim#Update(graph) abort
let l:state = flog#state#GetBufState()

let l:graph_lib = flog#lua#GetLibPath('graph.lua')
exec 'luafile ' . fnameescape(l:graph_lib)

return v:lua.flog_update_graph(
return v:lua.require('flog/graph').update_graph(
\ v:true,
\ l:state.opts.default_collapsed ? v:true : v:false,
\ a:graph,
Expand Down
12 changes: 8 additions & 4 deletions lua/flog/graph.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
-- This script parses git log output and produces the commit graph
-- It is optimized for speed, not brevity or readability

local function flog_get_graph(
local M = {}

function M.get_graph(
enable_vim,
enable_nvim,
enable_porcelain,
Expand Down Expand Up @@ -816,7 +818,7 @@ local function flog_get_graph(
end
end

local function flog_update_graph(
function M.update_graph(
enable_nvim,
default_collapsed,
graph,
Expand Down Expand Up @@ -911,5 +913,7 @@ local function flog_update_graph(
end
end

_G.flog_get_graph = flog_get_graph
_G.flog_update_graph = flog_update_graph
_G.flog_get_graph = M.get_graph
_G.flog_update_graph = M.update_graph

return M

0 comments on commit aee1b2e

Please sign in to comment.