Fix telescope highlights and refactor the entire thing quite a bit. It

now looks as it should, and also uses the edge tool highlights. Finally,
added an edge tool border highlight group!
This commit is contained in:
Martin Larsson 2024-06-30 18:06:08 +02:00
parent 35aa0beaa1
commit 77eab724c6
2 changed files with 51 additions and 97 deletions

View file

@ -1,7 +1,8 @@
local function add_new_custom_highlights() local function add_new_custom_highlights()
local colors = require("catppuccin.palettes.macchiato"); local colors = require("catppuccin.palettes.macchiato");
local highlights = { local highlights = {
{ name = "EdgeTool", config = { bg = colors.mantle, fg = colors.text } }, { name = "EdgeTool", config = { bg = colors.mantle, fg = colors.text } },
{ name = "EdgeToolBorder", config = { bg = colors.mantle, fg = colors.lavender } },
} }
for _, highlight in ipairs(highlights) do for _, highlight in ipairs(highlights) do
@ -32,9 +33,9 @@ return {
mason = true, mason = true,
semantic_tokens = true, semantic_tokens = true,
treesitter_context = true, treesitter_context = true,
-- telescope = { -- This doesn't seem to be compatible when running the custom dropdown theme telescope = { -- This doesn't seem to be compatible when running the custom dropdown theme
-- enable = true enable = true
-- }, },
cmp = true, cmp = true,
dap_ui = true, dap_ui = true,
dap = true, dap = true,
@ -55,6 +56,16 @@ return {
Pmenu = { link = "EdgeTool" }, Pmenu = { link = "EdgeTool" },
PmenuSel = { bg = colors.overlay0 }, PmenuSel = { bg = colors.overlay0 },
-- Telescope
TelescopeNormal = { link = "EdgeTool" },
TelescopeBorder = { link = "EdgeToolBorder" },
TelescopePromptNormal = { link = "EdgeTool" },
TelescopePromptBorder = { link = "EdgeToolBorder" },
TelescopeResultsNormal = { link = "EdgeTool" },
TelescopeResultsBorder = { link = "EdgeToolBorder" },
TelescopePreviewNormal = { link = "EdgeTool" },
TelescopePreviewBorder = { link = "EdgeToolBorder" },
} }
end end
}) })

View file

@ -5,116 +5,59 @@ return {
"nvim-telescope/telescope-fzf-native.nvim", "nvim-telescope/telescope-fzf-native.nvim",
}, },
config = function() config = function()
local actions = require("telescope.actions") local dropdown = require("telescope.themes").get_dropdown({
require("telescope").setup({
pickers = {
buffers = {
mappings = {
i = {
["<CR>"] = actions.select_drop,
},
n = {
["<CR>"] = actions.select_drop,
}
}
},
find_files = {
mappings = {
i = {
["<CR>"] = actions.select_drop,
},
n = {
["<CR>"] = actions.select_drop,
}
}
},
git_files = {
mappings = {
i = {
["<CR>"] = actions.select_drop,
},
n = {
["<CR>"] = actions.select_drop,
}
}
},
old_files = {
mappings = {
i = {
["<CR>"] = actions.select_drop,
},
n = {
["<CR>"] = actions.select_drop,
}
}
},
}
})
require("telescope").load_extension("fzf")
local dropdown_theme = require('telescope.themes').get_dropdown({
-- results_height = 50,
width = 0.2,
winblend = 20,
prompt_title = "",
borderchars = { borderchars = {
{ "", "", "", "", "", "", "", "" }, prompt = { "", "", "", "", "", "", "", "" },
prompt = { "", "", "", "", "", "", "", "" }, results = { "", "", "", "", "", "", "", "" },
results = { "", "", "", "", "", "", "", "" }, preview = { "", "", "", "", "", "", "", "" },
preview = { "", "", "", "", "", "", "", "" }, },
} prompt_title = "",
winblend = 20
}) })
require("telescope").setup({
extensions = {
fzf = {
fuzzy = true,
override_generic_sorter = false,
override_file_sorter = true,
case_mode = "smart_case",
},
},
})
require("telescope").load_extension("fzf")
local builtin = require("telescope.builtin") local builtin = require("telescope.builtin")
require("utils").add_keymaps({ require("utils").add_keymaps({
n = { n = {
-- File search
["<leader>to"] = { ["<leader>to"] = {
cmd = function() cmd = function()
dropdown_theme.prompt_prefix = "Files>" builtin.find_files(vim.tbl_extend("force", dropdown, {
dropdown_theme.previewer = false prompt_prefix = "Files> ",
dropdown_theme.find_command = nil previewer = false,
builtin.find_files(dropdown_theme) }))
end, end
}, },
["<leader>tf"] = { ["<leader>tf"] = {
cmd = function() cmd = function()
dropdown_theme.prompt_prefix = "Find>" builtin.current_buffer_fuzzy_find(vim.tbl_extend("force", dropdown, {
dropdown_theme.previewer = true prompt_prefix = "Find> "
dropdown_theme.find_command = nil }))
builtin.current_buffer_fuzzy_find(dropdown_theme) end
end,
}, },
["<leader>ta"] = { ["<leader>ta"] = {
-- cmd = ":lua require('telescope.builtin').live_grep({find_command=rg,--ignore-file,.gitignore,--exclude,*.git,--exclude,*.svn,--exclude,*.vs,--exclude,*.idea}) <CR>",
cmd = function() cmd = function()
dropdown_theme.prompt_prefix = "Grep>" builtin.live_grep(vim.tbl_extend("force", dropdown, {
dropdown_theme.previewer = true prompt_prefix = "Grep> "
dropdown_theme.find_command = { }))
find_command = "rg", end
"--ignore-file",
".gitignore",
"--exclude",
"*.git",
"--exclude",
"*.svn",
"--exclude",
"*.vs",
"--exclude",
"*.idea",
}
builtin.live_grep(dropdown_theme)
end,
}, },
-- Misc
["<leader>tb"] = { ["<leader>tb"] = {
cmd = function() cmd = function()
dropdown_theme.prompt_prefix = "Marks>" builtin.marks(vim.tbl_extend("force", dropdown, {
dropdown_theme.previewer = true prompt_prefix = "Marks> "
dropdown_theme.find_command = nil }))
builtin.marks(dropdown_theme) end
end,
} }
} }
}) })