Closed KevinNitroG closed 7 months ago
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,
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.
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 πΆβπ«οΈ
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.
Hi π₯° I just don't know how to use your plugin with Lazy.nvim It said that fail to load the plugin
Here is my Lazy.nvim plugin field to setup gitmoji plugin.
Thank you.