aboutsummaryrefslogtreecommitdiffstats
path: root/lua/alpha
diff options
context:
space:
mode:
authorAriel D'Alessandro <dalessandro.ariel@gmail.com>2022-02-06 20:19:25 +0100
committerAriel D'Alessandro <dalessandro.ariel@gmail.com>2022-02-06 20:19:25 +0100
commitb416d6607ee74141b4e47d4193ef043379819bc2 (patch)
tree2500039b23c52479946a1cade46ae692f825e97f /lua/alpha
parenta1fe0db005e7e633a5270d19b617f7a02de667db (diff)
downloadnvim-conf-b416d6607ee74141b4e47d4193ef043379819bc2.tar.gz
nvim-conf-b416d6607ee74141b4e47d4193ef043379819bc2.zip
Remove projectionist to it's own package
Diffstat (limited to 'lua/alpha')
-rw-r--r--lua/alpha/telescope.lua3
-rw-r--r--lua/alpha/telescope_projectionist.lua109
2 files changed, 2 insertions, 110 deletions
diff --git a/lua/alpha/telescope.lua b/lua/alpha/telescope.lua
index 0033e7a..10ff769 100644
--- a/lua/alpha/telescope.lua
+++ b/lua/alpha/telescope.lua
@@ -54,7 +54,6 @@ M.branches = function()
end
M.laravel_artisan = require('alpha.telescope_laravel').artisan
-M.project_find = require('alpha.telescope_projectionist').find
M.grep_string = function ()
vim.ui.input("Grep for > ", function (input)
@@ -65,4 +64,6 @@ M.grep_string = function ()
end)
end
+telescope.load_extension("projectionist")
+
return M
diff --git a/lua/alpha/telescope_projectionist.lua b/lua/alpha/telescope_projectionist.lua
deleted file mode 100644
index 53ea75c..0000000
--- a/lua/alpha/telescope_projectionist.lua
+++ /dev/null
@@ -1,109 +0,0 @@
-local pickers = require "telescope.pickers"
-local finders = require "telescope.finders"
-local previewers = require "telescope.previewers"
-local utils = require "telescope.utils"
-local actions = require "telescope.actions"
-local action_state = require "telescope.actions.state"
-
-local conf = require("telescope.config").values
-
-local M = {}
-
-local function getNavCmds()
- return vim.call("projectionist#navigation_commands")
-end
-
-local function getPaths(type)
- return getNavCmds()[type]
-end
-
-M.find = function (opts)
- opts = opts or {}
- opts.path_display = utils.get_default(opts.path_display, "hidden")
- opts.ignore_filename = utils.get_default(opts.ignore_filename, true)
- opts.include_extensions = utils.get_default(opts.include_extensions, false)
-
- local results = {}
-
- for type, _ in pairs(getNavCmds()) do
- table.insert(results, {
- filename = type,
- text = type,
- })
- end
-
- -- print(vim.inspect(results))
-
- pickers.new(opts, {
- promt_title = type,
- finder = finders.new_table {
- results = results,
- entry_maker = function(entry)
- return {
- value = entry,
- text = entry.text,
- display = entry.text,
- ordinal = entry.text,
- filename = entry.filename,
- }
- end,
- },
- sorter = conf.generic_sorter(opts),
- attach_mappings = function(prompt_bufnr)
- actions.select_default:replace(function()
- local selection = action_state.get_selected_entry()
- if selection == nil then
- print "[telescope] Nothing currently selected"
- return
- end
-
- actions._close(prompt_bufnr, true)
- M.findByType(selection.value.filename, opts)
- end)
-
- return true
- end,
- }):find()
-
-end
-
-M.findByType = function(type, opts)
- opts = opts or {}
- opts.path_display = utils.get_default(opts.path_display, "hidden")
- opts.ignore_filename = utils.get_default(opts.ignore_filename, true)
- opts.include_extensions = utils.get_default(opts.include_extensions, false)
-
- local paths = getPaths(type)
- local results = {}
-
- for _, location in pairs(paths) do
- local path = location[1] .. '/' .. location[2]
- local findings = vim.call("projectionist#glob", path:gsub('*', '**/*'))
- for _, find in ipairs(findings) do
- table.insert(results, {
- filename = find,
- text = find,
- })
- end
- end
- -- print(vim.inspect(results))
- pickers.new(opts, {
- promt_title = type,
- finder = finders.new_table {
- results = results,
- entry_maker = function(entry)
- return {
- value = entry,
- text = entry.text,
- display = entry.text,
- ordinal = entry.text,
- filename = entry.filename,
- }
- end,
- },
- previewer = previewers.builtin.new(opts),
- sorter = conf.generic_sorter(opts),
- }):find()
-end
-
-return M