diff options
| author | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2022-02-06 20:19:25 +0100 |
|---|---|---|
| committer | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2022-02-06 20:19:25 +0100 |
| commit | b416d6607ee74141b4e47d4193ef043379819bc2 (patch) | |
| tree | 2500039b23c52479946a1cade46ae692f825e97f | |
| parent | a1fe0db005e7e633a5270d19b617f7a02de667db (diff) | |
| download | nvim-conf-b416d6607ee74141b4e47d4193ef043379819bc2.tar.gz nvim-conf-b416d6607ee74141b4e47d4193ef043379819bc2.zip | |
Remove projectionist to it's own package
| -rw-r--r-- | init.vim | 2 | ||||
| -rw-r--r-- | lua/alpha/telescope.lua | 3 | ||||
| -rw-r--r-- | lua/alpha/telescope_projectionist.lua | 109 | ||||
| -rw-r--r-- | lua/plugins.lua | 3 | ||||
| -rw-r--r-- | plugin/telescope.vim | 2 |
5 files changed, 8 insertions, 111 deletions
@@ -67,5 +67,7 @@ nnoremap <expr> <leader>dp ":saveas " . expand('%') let g:laravel_artisan = 'sail artisan' let test#php#pest#executable = 'sail debug test' +let $NO_TTY = 1 + " Has to be the last line for the .nvimrc per project set secure 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 diff --git a/lua/plugins.lua b/lua/plugins.lua index 0847128..31a3aad 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -132,4 +132,7 @@ return require('packer').startup(function(use) use { 'nicwest/vim-http', opt = true, cmd = {'Http'}} use { 'vimwiki/vimwiki', opt = true, cmd = {'VimwikiIndex'}} + + -- Local plugins can be included + use '~/code/neovim/telescope-projectionist.nvim' end) diff --git a/plugin/telescope.vim b/plugin/telescope.vim index 6412faf..f97687f 100644 --- a/plugin/telescope.vim +++ b/plugin/telescope.vim @@ -19,5 +19,5 @@ nnoremap <leader>ps :lua require('alpha.telescope').grep_string()<CR> nnoremap <leader>pp :lua require('alpha.telescope').project_files()<CR> nnoremap <leader>pa :lua require('alpha.telescope').laravel_artisan()<CR> nnoremap <leader>gc :lua require('alpha.telescope').branches()<CR> -nnoremap <leader>fp :lua require('alpha.telescope').project_find()<CR> +nnoremap <leader>fp :Telescope projectionist<CR> nnoremap <leader>rc :lua require('alpha.telescope').search_config()<CR> |