Skip to content

Commit

Permalink
Merge pull request #20 from Cassin01/update
Browse files Browse the repository at this point in the history
doc: add input
  • Loading branch information
Cassin01 authored Feb 15, 2023
2 parents 9b52e6b + 30de612 commit 19a9e97
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ test-ci: deps test

# generates the documentation.
documentation:
nvim --headless --noplugin -u ./scripts/minimal_init.lua -c "lua require('mini.doc').generate()" -c "qa!"
nvim --headless --noplugin -u ./scripts/minimal_init.lua -c "lua require('mini.doc').generate(require(\"wf.mini\").setup)" -c "qa!"

# installs deps before running the documentation generation, useful for the CI.
documentation-ci: deps documentation
Expand Down
1 change: 1 addition & 0 deletions doc/tags
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
select() wf.txt /*select()*
which_key() wf.txt /*which_key()*
14 changes: 10 additions & 4 deletions doc/wf.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
==============================================================================
------------------------------------------------------------------------------
*which_key()*
`which_key`({opts})
Parameters~
{opts} `(optional)` `(table)`


==============================================================================
------------------------------------------------------------------------------
*select()*
`select`({items}, {opts}, {on_choice})
Define your wf setup.

Parameters~
{items} items
{the} options for wf
{on_choice} A callback that will be carried
{opts} the options for wf
{on_choice} a callback that will be carried
Usage~
`require("wf").select(items, opts, on_choice)`

Expand Down
35 changes: 35 additions & 0 deletions lua/wf/mini.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
local H = {}

-- Default documentation targets ----------------------------------------------
H.input = function()
-- Search in current and recursively in other directories for files with
-- 'lua' extension
local res = {}
for _, dir_glob in ipairs({ ".", "lua/**", "after/**", "colors/**", "lua/builtin/**" }) do
local files = vim.fn.globpath(dir_glob, "*.lua", false, true)

-- Use full paths
files = vim.tbl_map(function(x)
return vim.fn.fnamemodify(x, ":p")
end, files)

-- Put 'init.lua' first among files from same directory
table.sort(files, function(a, b)
if vim.fn.fnamemodify(a, ":h") == vim.fn.fnamemodify(b, ":h") then
if vim.fn.fnamemodify(a, ":t") == "init.lua" then
return true
end
if vim.fn.fnamemodify(b, ":t") == "init.lua" then
return false
end
end

return a < b
end)
table.insert(res, files)
end

return vim.tbl_flatten(res)
end

return H
10 changes: 0 additions & 10 deletions plugin/wf.lua

This file was deleted.

0 comments on commit 19a9e97

Please sign in to comment.