Skip to content

Commit

Permalink
Merge pull request #41 from Cassin01/update
Browse files Browse the repository at this point in the history
  • Loading branch information
Cassin01 authored Feb 27, 2023
2 parents badb9b1 + 7534539 commit cc93628
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 27 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(require(\"wf.mini\").setup)" -c "qa!"
nvim --headless --noplugin -u ./scripts/minimal_init.lua -c "lua require('mini.doc').generate(require(\"wf.mini\").input())" -c "qa!"

# installs deps before running the documentation generation, useful for the CI.
documentation-ci: deps documentation
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,10 @@ vim.keymap.set(

-- Buffer
vim.keymap.set(
"n",
"<Space>wbu",
buffer({}),
{noremap = true, silent= true, desc = "[wf.nvim] buffer"}
"n",
"<Space>wbu",
buffer({}),
{noremap = true, silent= true, desc = "[wf.nvim] buffer"}
)

-- Which Key
Expand Down
9 changes: 5 additions & 4 deletions doc/tags
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
bookmark() wf.txt /*bookmark()*
buffer() wf.txt /*buffer()*
register() wf.txt /*register()*
builtin.bookmark wf.txt /*builtin.bookmark*
builtin.buffer wf.txt /*builtin.buffer*
builtin.register wf.txt /*builtin.register*
builtin.which_key wf.txt /*builtin.which_key*
select() wf.txt /*select()*
which_key() wf.txt /*which_key()*
wf.nvim wf.txt /*wf.nvim*
36 changes: 20 additions & 16 deletions doc/wf.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
==============================================================================
------------------------------------------------------------------------------
*bookmark()*
*wf.nvim*
A modern which-key for neovim

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


==============================================================================
------------------------------------------------------------------------------
*builtin.bookmark*
`bookmark`({bookmark_dirs}, {opts})
Parameters~
{bookmark_dirs} `(table)`
Expand All @@ -9,38 +25,26 @@ Parameters~

==============================================================================
------------------------------------------------------------------------------
*buffer()*
*builtin.buffer*
`buffer`({opts})
Parameters~
{opts} `(optional)` `(table)`


==============================================================================
------------------------------------------------------------------------------
*register()*
*builtin.register*
`register`({opts})
Parameters~
{opts} `(optional)` `(table)`


==============================================================================
------------------------------------------------------------------------------
*which_key()*
*builtin.which_key*
`which_key`({opts})
Parameters~
{opts} `(optional)` `(table)`


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


vim:tw=78:ts=8:noet:ft=help:norl:
1 change: 1 addition & 0 deletions lua/wf/builtin/bookmark.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ end

local ok, devicon = pcall(require_deviocon)

---@tag builtin.bookmark
---@param bookmark_dirs table
---@param opts? table
local function bookmark(bookmark_dirs, opts)
Expand Down
1 change: 1 addition & 0 deletions lua/wf/builtin/buffer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ local function get_active_buffers()
return res, bs
end

---@tag builtin.buffer
---@param opts? table
local function buffer(opts)
local function _buffer()
Expand Down
1 change: 1 addition & 0 deletions lua/wf/builtin/register.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ local types = {
[""] = "u",
}

---@tag builtin.register
---@param opts? table
local function register(opts)
local function _register()
Expand Down
1 change: 1 addition & 0 deletions lua/wf/builtin/which_key.lua
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ local function feedkeys(lhs, count, caller, noremap)
end
end

---@tag builtin.which_key
---@param opts? table
local function which_key(opts)
local core = function()
Expand Down
6 changes: 6 additions & 0 deletions lua/wf/init.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-- MIT License Copyright (c) 2022 Cassin01

-- Documentation ==============================================================
--- A modern which-key for neovim
---@tag wf.nvim

local util = require("wf.util")
local au = util.au
local rt = util.rt
Expand Down
6 changes: 4 additions & 2 deletions lua/wf/mini.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ 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
for _, dir_glob in ipairs({ ".", "lua/**", "after/**", "colors/**" }) do
local files = vim.fn.globpath(dir_glob, "*.lua", false, true)

-- Use full paths
Expand All @@ -22,9 +22,11 @@ H.input = function()
if vim.fn.fnamemodify(b, ":t") == "init.lua" then
return false
end
return a < b
else
return vim.fn.fnamemodify(a, ":h") < vim.fn.fnamemodify(b, ":h")
end

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

0 comments on commit cc93628

Please sign in to comment.