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:
parent
8eecbb115e
commit
611c361951
6 changed files with 206 additions and 45 deletions
|
|
@ -1 +1,43 @@
|
|||
return {}
|
||||
local function switch_between_header_and_source(bufnr)
|
||||
local util = require("lspconfig/util")
|
||||
bufnr = util.validate_bufnr(bufnr)
|
||||
local clangd_client = util.get_active_client_by_name(bufnr, "clangd")
|
||||
local params = { uri = vim.uri_from_bufnr(bufnr) }
|
||||
-- invert this with an early return
|
||||
if not clangd_client then
|
||||
print "method textDocument/switchSourceHeader is not supported by any servers active on the current buffer"
|
||||
return
|
||||
end
|
||||
|
||||
clangd_client.request("textDocument/switchSourceHeader", params, function(err, result)
|
||||
if err then
|
||||
error(tostring(err))
|
||||
end
|
||||
if not result then
|
||||
print("Corresponding file cannot be determined")
|
||||
return
|
||||
end
|
||||
vim.api.nvim_command("drop " .. vim.uri_to_fname(result))
|
||||
end, bufnr)
|
||||
end
|
||||
|
||||
local M = {
|
||||
commands = {
|
||||
ClangdSwitchSourceHeader = {
|
||||
function()
|
||||
switch_between_header_and_source(0)
|
||||
end,
|
||||
description = "Switch between source/header",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
function M.post_setup()
|
||||
require("utils").add_keymaps({
|
||||
n = {
|
||||
["<leader>ko"] = { cmd = ":ClangdSwitchSourceHeader<CR>" }
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
|||
|
|
@ -1 +1,3 @@
|
|||
return {}
|
||||
return {
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,11 +13,11 @@ return {
|
|||
hide_keyword = true,
|
||||
ignore_patterns = nil,
|
||||
show_file = true,
|
||||
folder_level = 3,
|
||||
folder_level = 2,
|
||||
color_mode = true,
|
||||
dely = 300,
|
||||
show_nodes = true,
|
||||
max_nodes = 3,
|
||||
max_nodes = 2,
|
||||
},
|
||||
implement = {
|
||||
enable = false,
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ return {
|
|||
-- Create a new table which contains the non-lsp setups for Mason (linters, formatters, etc)
|
||||
local mason_installs = vim.list_extend({
|
||||
"clang-format",
|
||||
--"cmakelang",
|
||||
--"luaformater",
|
||||
"cmakelang",
|
||||
-- "luaformater",
|
||||
}, server_names)
|
||||
|
||||
require("mason").setup()
|
||||
|
|
@ -38,7 +38,13 @@ return {
|
|||
for _, server_name in ipairs(server_names) do
|
||||
local server = lspconfig[server_name]
|
||||
if server then
|
||||
server.setup(require("language_servers/" .. server_name))
|
||||
local server_table = require("language_servers/" .. server_name)
|
||||
server.setup(server_table)
|
||||
|
||||
-- Run the post_setup function if it exists
|
||||
if server_table.post_setup then
|
||||
server_table.post_setup()
|
||||
end
|
||||
else
|
||||
error("LSP server not found: " .. server_name)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -32,34 +32,34 @@ return {
|
|||
---@param highlights Highlights
|
||||
---@param colors ColorScheme
|
||||
on_highlights = function(highlights, colors)
|
||||
local prompt = "#2d3149"
|
||||
highlights.TelescopeNormal = {
|
||||
bg = colors.bg_dark,
|
||||
fg = colors.fg_dark,
|
||||
}
|
||||
highlights.TelescopeBorder = {
|
||||
bg = colors.bg_dark,
|
||||
fg = colors.bg_dark,
|
||||
}
|
||||
highlights.TelescopePromptNormal = {
|
||||
bg = prompt,
|
||||
}
|
||||
highlights.TelescopePromptBorder = {
|
||||
bg = prompt,
|
||||
fg = prompt,
|
||||
}
|
||||
highlights.TelescopePromptTitle = {
|
||||
bg = prompt,
|
||||
fg = prompt,
|
||||
}
|
||||
highlights.TelescopePreviewTitle = {
|
||||
bg = colors.bg_dark,
|
||||
fg = colors.bg_dark,
|
||||
}
|
||||
highlights.TelescopeResultsTitle = {
|
||||
bg = colors.bg_dark,
|
||||
fg = colors.bg_dark,
|
||||
}
|
||||
-- local prompt = "#2d3149"
|
||||
-- highlights.TelescopeNormal = {
|
||||
-- bg = colors.bg_dark,
|
||||
-- fg = colors.fg_dark,
|
||||
-- }
|
||||
-- highlights.TelescopeBorder = {
|
||||
-- bg = colors.bg_dark,
|
||||
-- fg = colors.bg_dark,
|
||||
-- }
|
||||
-- highlights.TelescopePromptNormal = {
|
||||
-- bg = prompt,
|
||||
-- }
|
||||
-- highlights.TelescopePromptBorder = {
|
||||
-- bg = prompt,
|
||||
-- fg = prompt,
|
||||
-- }
|
||||
-- highlights.TelescopePromptTitle = {
|
||||
-- bg = prompt,
|
||||
-- fg = prompt,
|
||||
-- }
|
||||
-- highlights.TelescopePreviewTitle = {
|
||||
-- bg = colors.bg_dark,
|
||||
-- fg = colors.bg_dark,
|
||||
-- }
|
||||
-- highlights.TelescopeResultsTitle = {
|
||||
-- bg = colors.bg_dark,
|
||||
-- fg = colors.bg_dark,
|
||||
-- }
|
||||
end,
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue