Giter VIP home page Giter VIP logo

Comments (3)

KevinNitroG avatar KevinNitroG commented on July 19, 2024 1

Update
I have successfully configured it. The keys of telescope-gitmoji needs to be a callback function. Here is my present config

return {
  {
    "nvim-telescope/telescope.nvim",
    dependencies = {
      {
        "nvim-telescope/telescope-fzf-native.nvim",
        build = "make",
        config = function()
          require("telescope").load_extension("fzf")
        end,
      },
      {
        "nvim-telescope/telescope-file-browser.nvim",
        keys = {
          {
            "<leader>sf",
            function()
              local telescope = require("telescope")
              local function telescope_buffer_dir()
                return vim.fn.expand("%:p:h")
              end
              telescope.extensions.file_browser.file_browser({
                path = "%:p:h",
                cwd = telescope_buffer_dir(),
                respect_gitignore = false,
                hidden = true,
                grouped = true,
                previewer = true,
                initial_mode = "normal",
                layout_config = { height = 40 },
              })
            end,
            desc = "File Browser (hidden) (cwd)",
          },
        },
        config = function()
          require("telescope").load_extension("file_browser")
        end,
      },
      {
        "olacin/telescope-gitmoji.nvim",
        keys = {
          {
            "<leader>gm",
            function()
              require("telescope").extensions.gitmoji.gitmoji()
            end,
            mode = "n",
            desc = "telescope gitmoji",
          },
        },
        config = function()
          require("telescope").load_extension("gitmoji")
        end,
      },
    },
    keys = {
      {
        "<leader>fP",
        function()
          require("telescope.builtin").find_files({
            cwd = require("lazy.core.config").options.root,
          })
        end,
        desc = "Find Plugin File",
      },
      {
        "<leader>ff",
        function()
          local builtin = require("telescope.builtin")
          builtin.find_files({
            no_ignore = true,
            no_ignore_parent = true,
            hidden = true,
          })
        end,
        desc = "Find Files (hidden) (root dir)",
      },
      {
        "<leader>sg",
        function()
          local builtin = require("telescope.builtin")
          builtin.live_grep({
            additional_args = { "--hidden" },
          })
        end,
        desc = "Grep (hidden) (root dir)",
      },
    },
    opts = function(_, opts)
      local actions = require("telescope.actions")
      local fb_actions = require("telescope").extensions.file_browser.actions

      opts.defaults = vim.tbl_deep_extend("force", opts.defaults, {
        wrap_results = true,
        layout_strategy = "horizontal",
        layout_config = { prompt_position = "top" },
        sorting_strategy = "ascending",
        winblend = 0,
        mappings = {
          n = {},
        },
      })
      opts.pickers = {
        grep_string = {
          additional_args = { "--hidden" },
        },
        diagnostics = {
          theme = "ivy",
          initial_mode = "normal",
          layout_config = {
            preview_cutoff = 9999,
          },
        },
      }
      opts.extensions = {
        file_browser = {
          theme = "dropdown",
          -- disables netrw and use telescope-file-browser in its place
          hijack_netrw = true,
          mappings = {
            -- your custom insert mode mappings
            ["n"] = {
              -- your custom normal mode mappings
              ["N"] = fb_actions.create,
              ["h"] = fb_actions.goto_parent_dir,
              ["/"] = function()
                vim.cmd("startinsert")
              end,
              ["<C-u>"] = function(prompt_bufnr)
                for _ = 1, 10 do
                  actions.move_selection_previous(prompt_bufnr)
                end
              end,
              ["<C-d>"] = function(prompt_bufnr)
                for _ = 1, 10 do
                  actions.move_selection_next(prompt_bufnr)
                end
              end,
              ["<PageUp>"] = actions.preview_scrolling_up,
              ["<PageDown>"] = actions.preview_scrolling_down,
            },
          },
        },
      }
    end,
  },
}

Thank you πŸ₯° I will close this issue.

from telescope-gitmoji.nvim.

olacin avatar olacin commented on July 19, 2024

Hi there, you missed the registration of the plugin with Telescope.

My dotfiles are a bit rusty but there is a similar example with my other plugin, telescope-cc.

I believe you could make it work adding the config key like below:

config = function()
  require("telescope").load_extension("gitmoji")
end,

from telescope-gitmoji.nvim.

KevinNitroG avatar KevinNitroG commented on July 19, 2024

Hi there, you missed the registration of the plugin with Telescope.

My dotfiles are a bit rusty but there is a similar example with my other plugin, telescope-cc.

I believe you could make it work adding the config key like below:

config = function()
  require("telescope").load_extension("gitmoji")
end,

Sorry, I think I couldn't make it run with your above suggestion 🫠
This is my current telescope config, make telescope-gitmoji as a dependency and require it to load in the config of telescope. Other stuff is not related but I just want to show my full config now.

return {
  {
    "nvim-telescope/telescope.nvim",
    dependencies = {
      {
        "nvim-telescope/telescope-fzf-native.nvim",
        build = "make",
      },
      "nvim-telescope/telescope-file-browser.nvim",
      {
        "olacin/telescope-gitmoji.nvim",
        keys = {
          "<leader>gm",
          require("telescope").extensions.gitmoji.gitmoji,
          mode = "n",
          desc = "telescope gitmoji",
        },
      },
    },
    keys = {
      {
        "<leader>fP",
        function()
          require("telescope.builtin").find_files({
            cwd = require("lazy.core.config").options.root,
          })
        end,
        desc = "Find Plugin File",
      },
      {
        "<leader>ff",
        function()
          local builtin = require("telescope.builtin")
          builtin.find_files({
            no_ignore = true,
            no_ignore_parent = true,
            hidden = true,
          })
        end,
        desc = "Find Files (hidden) (root dir)",
      },
      {
        "<leader>sf",
        function()
          local telescope = require("telescope")
          local function telescope_buffer_dir()
            return vim.fn.expand("%:p:h")
          end
          telescope.extensions.file_browser.file_browser({
            path = "%:p:h",
            cwd = telescope_buffer_dir(),
            respect_gitignore = false,
            hidden = true,
            grouped = true,
            previewer = true,
            initial_mode = "normal",
            layout_config = { height = 40 },
          })
        end,
        desc = "File Browser (hidden) (cwd)",
      },
      {
        "<leader>sg",
        function()
          local builtin = require("telescope.builtin")
          builtin.live_grep({
            additional_args = { "--hidden" },
          })
        end,
        desc = "Grep (hidden) (root dir)",
      },
    },
    opts = function(_, opts)
      local actions = require("telescope.actions")
      local fb_actions = require("telescope").extensions.file_browser.actions

      opts.defaults = vim.tbl_deep_extend("force", opts.defaults, {
        wrap_results = true,
        layout_strategy = "horizontal",
        layout_config = { prompt_position = "top" },
        sorting_strategy = "ascending",
        winblend = 0,
        mappings = {
          n = {},
        },
      })
      opts.pickers = {
        grep_string = {
          additional_args = { "--hidden" },
        },
        diagnostics = {
          theme = "ivy",
          initial_mode = "normal",
          layout_config = {
            preview_cutoff = 9999,
          },
        },
      }
      opts.extensions = {
        file_browser = {
          theme = "dropdown",
          hijack_netrw = true,
          mappings = {
            ["n"] = {
              ["N"] = fb_actions.create,
              ["h"] = fb_actions.goto_parent_dir,
              ["/"] = function()
                vim.cmd("startinsert")
              end,
              ["<C-u>"] = function(prompt_bufnr)
                for _ = 1, 10 do
                  actions.move_selection_previous(prompt_bufnr)
                end
              end,
              ["<C-d>"] = function(prompt_bufnr)
                for _ = 1, 10 do
                  actions.move_selection_next(prompt_bufnr)
                end
              end,
              ["<PageUp>"] = actions.preview_scrolling_up,
              ["<PageDown>"] = actions.preview_scrolling_down,
            },
          },
        },
      }
    end,
    config = function(_, opts)
      require("telescope").setup(opts)
      require("telescope").load_extension("fzf")
      require("telescope").load_extension("file_browser")
      require("telescope").load_extension("gitmoji")
    end,
  },
}

Seem that it does not matter to require telescope plugin to load extension in telescope config nor telescope-gitmoji config. Because I still face the same issue.
image

Or maybe it doesn't work because I'm using Windows? πŸ˜Άβ€πŸŒ«οΈ


Sorry for my bad English :)) I'm just a newbie to Neovim, so there would be some silly questions from me πŸ˜Άβ€πŸŒ«οΈ

from telescope-gitmoji.nvim.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.