Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Preprocess modules_dir to ensure successful module loading on Windows #50

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lua/core/pack.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ pack.__index = pack

function pack:load_modules_packages()
local modules_dir = self.helper.path_join(self.config_path, 'lua', 'modules')
modules_dir = vim.fs.normalize(modules_dir)
self.repos = {}

local list = vim.fs.find('package.lua', { path = modules_dir, type = 'file', limit = 10 })
Expand Down
2 changes: 1 addition & 1 deletion lua/keymap/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ nmap({
{ '<Leader>pu', cmd('Lazy update'), opts(noremap, silent) },
{ '<Leader>pi', cmd('Lazy install'), opts(noremap, silent) },
-- dashboard
{ '<Leader>n', cmd('DashboardNewFile'), opts(noremap, silent) },
{ '<Leader>n', cmd('lua require(\'dashboard\'):new_file()'), opts(noremap, silent) },
{ '<Leader>ss', cmd('SessionSave'), opts(noremap, silent) },
{ '<Leader>sl', cmd('SessionLoad'), opts(noremap, silent) },
-- nvimtree
Expand Down
1 change: 1 addition & 0 deletions lua/modules/tools/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ function config.telescope()
},
})
require('telescope').load_extension('fzy_native')
require('telescope').load_extension('nvim_user_config')
end

return config
7 changes: 7 additions & 0 deletions lua/modules/tools/package.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,10 @@ package({
require('hlsearch').setup()
end,
})

package({
'nvimdev/dbsession.nvim',
cmd = { 'SessionSave', 'SessionLoad', 'SessionDelete' },
opts = true,
})

12 changes: 3 additions & 9 deletions lua/modules/ui/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,10 @@ function config.dashboard()
key = 'f',
},
{
desc = ' Apps',
group = 'DiagnosticHint',
action = 'Telescope app',
key = 'a',
},
{
desc = ' dotfiles',
desc = ' config',
group = 'Number',
action = 'Telescope dotfiles',
key = 'd',
action = 'Telescope nvim_user_config',
key = 'c',
},
},
},
Expand Down
36 changes: 36 additions & 0 deletions lua/telescope/_extensions/nvim_user_config.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
local telescope = require('telescope')
local finders = require('telescope.finders')
local pickers = require('telescope.pickers')
local make_entry = require('telescope.make_entry')
local conf = require('telescope.config').values

local config_path = vim.fn.stdpath('config')

local config_file_list = function()
local list = {}
local p = io.popen('rg --files --ignore .git ' .. config_path)
for file in p:lines() do
table.insert(list, file)
end
return list
end

local nvim_user_config = function(opts)
opts = opts or {}
local results = config_file_list()

pickers
.new(opts, {
prompt_title = 'find in nvim user config files',
results_title = 'Nvim User Configs',
finder = finders.new_table({
results = results,
entry_maker = make_entry.gen_from_file(opts),
}),
previewer = conf.file_previewer(opts),
sorter = conf.file_sorter(opts),
})
:find()
end

return telescope.register_extension({ exports = { nvim_user_config = nvim_user_config } })