Change telescope to dropdown, telescope now uses select_drow action, remove the hide telescope borders in tokyonight, change visible dirs and tokens in lspsaga lualine status, clangd header/source toggle now also uses drop over edit

This commit is contained in:
Martin Larsson 2024-01-29 01:44:58 +01:00
parent 8eecbb115e
commit 611c361951
6 changed files with 206 additions and 45 deletions

View file

@ -5,37 +5,148 @@ return {
"nvim-telescope/telescope-fzf-native.nvim",
},
config = function()
require("telescope").setup({ })
local actions = require("telescope.actions")
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 = {
{ '', '', '', '', '', '', '', ''},
prompt = {"", "", " ", "", '', '', "", ""},
results = {"", "", "", "", "", "", "", ""},
preview = { '', '', '', '', '', '', '', ''},
}
})
require("utils").add_keymaps({
n = {
-- File search
["<leader>to"] = {
cmd = ":Telescope find_files <CR>",
cmd = function()
dropdown_theme.prompt_prefix = "Files>"
dropdown_theme.previewer = false
dropdown_theme.find_command = nil
require("telescope.builtin").find_files(dropdown_theme)
end,
},
["<leader>tf"] = {
cmd = ":Telescope current_buffer_fuzzy_find<CR>",
cmd = function()
dropdown_theme.prompt_prefix = "Find>"
dropdown_theme.previewer = true
dropdown_theme.find_command = nil
require("telescope.builtin").current_buffer_fuzzy_find(dropdown_theme)
end,
},
["<leader>ta"] = {
cmd = ":Telescope live_grep find_command=rg,--ignore-file,.gitignore,--exclude,*.git,--exclude,*.svn,--exclude,*.vs,--exclude,*.idea<CR>",
-- cmd = ":lua require('telescope.builtin').live_grep({find_command=rg,--ignore-file,.gitignore,--exclude,*.git,--exclude,*.svn,--exclude,*.vs,--exclude,*.idea}) <CR>",
cmd = function()
dropdown_theme.prompt_prefix = "Grep>"
dropdown_theme.previewer = true
dropdown_theme.find_command = {
find_command = "rg",
"--ignore-file",
".gitignore",
"--exclude",
"*.git",
"--exclude",
"*.svn",
"--exclude",
"*.vs",
"--exclude",
"*.idea",
}
require("telescope.builtin").live_grep(dropdown_theme)
end,
},
-- Git
["<leader>gc"] = {
cmd = "<cmd> Telescope git_commits <CR>",
["<leader>gl"] = {
cmd = function()
dropdown_theme.prompt_prefix = "Log>"
dropdown_theme.previewer = true
dropdown_theme.find_command = nil
require("telescope.builtin").git_commits(dropdown_theme)
end,
},
["<leader>gs"] = {
cmd = "<cmd> Telescope git_status <CR>",
cmd = function()
dropdown_theme.prompt_prefix = "Status>"
dropdown_theme.previewer = true
dropdown_theme.find_command = nil
require("telescope.builtin").git_status(dropdown_theme)
end,
},
["<leader>gh"] = {
cmd = "<cmd> Telescope git_bcommits <CR>",
cmd = function()
dropdown_theme.prompt_prefix = "History>"
dropdown_theme.previewer = true
dropdown_theme.find_command = nil
require("telescope.builtin").git_bcommits(dropdown_theme)
end,
},
["<leader>gb"] = {
cmd = "<cmd> Telescope git_branches <CR>",
cmd = function()
dropdown_theme.prompt_prefix = "Branches>"
dropdown_theme.previewer = true
dropdown_theme.find_command = nil
require("telescope.builtin").git_branches(dropdown_theme)
end,
},
-- Misc
["<leader>tb"] = {
cmd = "<cmd> Telescope marks <CR>",
cmd = function()
dropdown_theme.prompt_prefix = "Marks>"
dropdown_theme.previewer = true
dropdown_theme.find_command = nil
require("telescope.builtin").marks(dropdown_theme)
end,
}
}
})