simplify google
This commit is contained in:
@ -1,76 +0,0 @@
|
|||||||
local use_google = require("utils").use_google
|
|
||||||
local M = {}
|
|
||||||
|
|
||||||
function M.setup(capabilities)
|
|
||||||
if use_google() then
|
|
||||||
local lspconfig = require("lspconfig")
|
|
||||||
local configs = require("lspconfig.configs")
|
|
||||||
configs.ciderlsp = {
|
|
||||||
default_config = {
|
|
||||||
-- offset_encoding = "utf-16",
|
|
||||||
cmd = {
|
|
||||||
"/google/bin/releases/cider/ciderlsp/ciderlsp",
|
|
||||||
"--tooltag=nvim-lsp",
|
|
||||||
"--forward_sync_responses",
|
|
||||||
-- "--debug_relay",
|
|
||||||
},
|
|
||||||
filetypes = {
|
|
||||||
"c",
|
|
||||||
"cpp",
|
|
||||||
"java",
|
|
||||||
"kotlin",
|
|
||||||
"objc",
|
|
||||||
"proto",
|
|
||||||
"textproto",
|
|
||||||
"go",
|
|
||||||
"python",
|
|
||||||
"bzl",
|
|
||||||
"typescript",
|
|
||||||
},
|
|
||||||
root_dir = require("lspconfig").util.root_pattern(".citc"),
|
|
||||||
settings = {},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
local my_on_attach = function(client, bufnr)
|
|
||||||
require("lualine").refresh()
|
|
||||||
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
|
||||||
if vim.lsp.formatexpr then -- Neovim v0.6.0+ only.
|
|
||||||
vim.api.nvim_buf_set_option(bufnr, "formatexpr", "v:lua.vim.lsp.formatexpr")
|
|
||||||
end
|
|
||||||
if vim.lsp.tagfunc then
|
|
||||||
vim.api.nvim_buf_set_option(bufnr, "tagfunc", "v:lua.vim.lsp.tagfunc")
|
|
||||||
end
|
|
||||||
|
|
||||||
local lsp_status = require("lsp-status")
|
|
||||||
lsp_status.on_attach(client)
|
|
||||||
end
|
|
||||||
|
|
||||||
local cider_on_attach = function(client, bufnr)
|
|
||||||
my_on_attach(client, bufnr)
|
|
||||||
vim.b["is_cider_lsp_attached"] = "no"
|
|
||||||
end
|
|
||||||
|
|
||||||
local cider_lsp_handlers = {}
|
|
||||||
-- cider_lsp_handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
|
|
||||||
-- focusable = false,
|
|
||||||
-- })
|
|
||||||
|
|
||||||
cider_lsp_handlers["$/syncResponse"] = function(_, result, ctx)
|
|
||||||
local first_fire = vim.b["is_cider_lsp_attached"] == "no"
|
|
||||||
vim.b["is_cider_lsp_attached"] = "yes"
|
|
||||||
if first_fire then
|
|
||||||
vim.notify("CiderLSP attached")
|
|
||||||
require("lualine").refresh()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
lspconfig.ciderlsp.setup({
|
|
||||||
capabilities = capabilities,
|
|
||||||
on_attach = cider_on_attach,
|
|
||||||
handlers = cider_lsp_handlers,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
@ -1,18 +1,18 @@
|
|||||||
local use_google = require("utils").use_google
|
local use_google = require("utils").use_google
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"sindrets/diffview.nvim",
|
"sindrets/diffview.nvim",
|
||||||
--{ "mizlan/iswap.nvim", event = "VeryLazy" },
|
--{ "mizlan/iswap.nvim", event = "VeryLazy" },
|
||||||
{ "folke/todo-comments.nvim", dependencies = { "nvim-lua/plenary.nvim" } },
|
{ "folke/todo-comments.nvim", dependencies = { "nvim-lua/plenary.nvim" } },
|
||||||
{
|
{
|
||||||
"folke/flash.nvim",
|
"folke/flash.nvim",
|
||||||
event = "VeryLazy",
|
event = "VeryLazy",
|
||||||
---@type Flash.Config
|
---@type Flash.Config
|
||||||
opts = {
|
opts = {
|
||||||
jump = {
|
jump = {
|
||||||
nohlsearch = true,
|
nohlsearch = true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
-- stylua: ignore
|
-- stylua: ignore
|
||||||
keys = {
|
keys = {
|
||||||
{ "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" },
|
{ "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" },
|
||||||
@ -21,156 +21,146 @@ return {
|
|||||||
{ "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" },
|
{ "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" },
|
||||||
{ "<c-s>", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" },
|
{ "<c-s>", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"MagicDuck/grug-far.nvim",
|
"MagicDuck/grug-far.nvim",
|
||||||
config = function()
|
config = function()
|
||||||
vim.g.maplocalleader = ","
|
vim.g.maplocalleader = ","
|
||||||
require("grug-far").setup({
|
require("grug-far").setup({
|
||||||
-- search and replace engines configuration
|
-- search and replace engines configuration
|
||||||
engines = {
|
engines = {
|
||||||
-- see https://github.com/BurntSushi/ripgrep
|
-- see https://github.com/BurntSushi/ripgrep
|
||||||
ripgrep = {
|
ripgrep = {
|
||||||
-- ripgrep executable to use, can be a different path if you need to configure
|
-- ripgrep executable to use, can be a different path if you need to configure
|
||||||
path = "rg",
|
path = "rg",
|
||||||
-- extraArgs = "-.",
|
-- extraArgs = "-.",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"shellRaining/hlchunk.nvim",
|
"shellRaining/hlchunk.nvim",
|
||||||
event = { "BufReadPre", "BufNewFile" },
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
opts = {
|
opts = {
|
||||||
line_num = { enable = true },
|
line_num = { enable = true },
|
||||||
chunk = {
|
chunk = {
|
||||||
enable = true,
|
enable = true,
|
||||||
priority = 15,
|
priority = 15,
|
||||||
style = {
|
style = {
|
||||||
{ fg = "#393d4c" },
|
{ fg = "#393d4c" },
|
||||||
},
|
},
|
||||||
chars = {
|
chars = {
|
||||||
horizontal_line = "─",
|
horizontal_line = "─",
|
||||||
-- vertical_line = "│",
|
-- vertical_line = "│",
|
||||||
vertical_line = "┊",
|
vertical_line = "┊",
|
||||||
left_top = "╭",
|
left_top = "╭",
|
||||||
left_bottom = "╰",
|
left_bottom = "╰",
|
||||||
right_arrow = ">",
|
right_arrow = ">",
|
||||||
},
|
},
|
||||||
use_treesitter = true,
|
use_treesitter = true,
|
||||||
textobject = "",
|
textobject = "",
|
||||||
max_file_size = 1024 * 1024,
|
max_file_size = 1024 * 1024,
|
||||||
error_sign = true,
|
error_sign = true,
|
||||||
-- animation related
|
-- animation related
|
||||||
duration = 0,
|
duration = 0,
|
||||||
delay = 0,
|
delay = 0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
"RRethy/vim-illuminate",
|
||||||
"Bekaboo/dropbar.nvim",
|
"kdheepak/lazygit.nvim",
|
||||||
-- optional, but required for fuzzy finder support
|
"flwyd/vim-conjoin",
|
||||||
dependencies = {
|
"rafcamlet/nvim-luapad",
|
||||||
"nvim-telescope/telescope-fzf-native.nvim",
|
"vim-scripts/vcscommand.vim",
|
||||||
},
|
"AndrewRadev/tagalong.vim",
|
||||||
config = function()
|
"AndrewRadev/yankwin.vim",
|
||||||
vim.ui.select = require("dropbar.utils.menu").select
|
{ "squk/gdrama-syntax.vim", ft = "gdrama" },
|
||||||
end,
|
{ "nvim-lua/plenary.nvim", lazy = false },
|
||||||
},
|
{ "squk/java-syntax.vim", ft = "java" },
|
||||||
"RRethy/vim-illuminate",
|
{ "udalov/kotlin-vim", event = "VeryLazy", ft = "kotlin" },
|
||||||
"kdheepak/lazygit.nvim",
|
{ "andymass/vim-matchup", event = "VimEnter" },
|
||||||
"flwyd/vim-conjoin",
|
{ "jghauser/mkdir.nvim", event = "BufWritePre" },
|
||||||
"rafcamlet/nvim-luapad",
|
{
|
||||||
"vim-scripts/vcscommand.vim",
|
"rmagatti/auto-session",
|
||||||
"AndrewRadev/tagalong.vim",
|
dependencies = {
|
||||||
"AndrewRadev/yankwin.vim",
|
"nvim-telescope/telescope.nvim", -- Only needed if you want to use session lens
|
||||||
{ "squk/gdrama-syntax.vim", ft = "gdrama" },
|
},
|
||||||
{ "nvim-lua/plenary.nvim", lazy = false },
|
config = function()
|
||||||
{ "squk/java-syntax.vim", ft = "java" },
|
require("auto-session").setup({
|
||||||
{ "udalov/kotlin-vim", event = "VeryLazy", ft = "kotlin" },
|
auto_session_suppress_dirs = { "~/", "~/Projects", "~/Downloads", "/" },
|
||||||
-- { "andymass/vim-matchup", event = "VimEnter" },
|
args_allow_single_directory = false,
|
||||||
{ "jghauser/mkdir.nvim", event = "BufWritePre" },
|
bypass_save_filetypes = { "netrw" },
|
||||||
{
|
})
|
||||||
"rmagatti/auto-session",
|
end,
|
||||||
dependencies = {
|
},
|
||||||
"nvim-telescope/telescope.nvim", -- Only needed if you want to use session lens
|
"tpope/vim-abolish",
|
||||||
},
|
{
|
||||||
config = function()
|
"johmsalas/text-case.nvim",
|
||||||
require("auto-session").setup({
|
dependencies = { "nvim-telescope/telescope.nvim" },
|
||||||
auto_session_suppress_dirs = { "~/", "~/Projects", "~/Downloads", "/" },
|
config = function()
|
||||||
args_allow_single_directory = false,
|
require("textcase").setup({})
|
||||||
bypass_save_filetypes = { "netrw" },
|
require("telescope").load_extension("textcase")
|
||||||
})
|
end,
|
||||||
end,
|
cmd = {
|
||||||
},
|
"Subs",
|
||||||
"tpope/vim-abolish",
|
},
|
||||||
{
|
|
||||||
"johmsalas/text-case.nvim",
|
|
||||||
dependencies = { "nvim-telescope/telescope.nvim" },
|
|
||||||
config = function()
|
|
||||||
require("textcase").setup({})
|
|
||||||
require("telescope").load_extension("textcase")
|
|
||||||
end,
|
|
||||||
cmd = {
|
|
||||||
"Subs",
|
|
||||||
},
|
|
||||||
-- stylua: ignore
|
-- stylua: ignore
|
||||||
keys = {
|
keys = {
|
||||||
{ "<leader>tc", "<cmd>TextCaseOpenTelescope<CR>", mode = { "n", "v" }, desc = "Telescope" },
|
{ "<leader>tc", "<cmd>TextCaseOpenTelescope<CR>", mode = { "n", "v" }, desc = "Telescope" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"NvChad/nvim-colorizer.lua",
|
"NvChad/nvim-colorizer.lua",
|
||||||
ft = "lua",
|
ft = "lua",
|
||||||
config = function()
|
config = function()
|
||||||
require("colorizer").setup()
|
require("colorizer").setup()
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
||||||
"andweeb/presence.nvim",
|
"andweeb/presence.nvim",
|
||||||
cond = not use_google(),
|
cond = not use_google(),
|
||||||
config = function()
|
config = function()
|
||||||
require("presence").setup({
|
require("presence").setup({
|
||||||
main_image = "file",
|
main_image = "file",
|
||||||
show_time = false,
|
show_time = false,
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ntpeters/vim-better-whitespace",
|
"ntpeters/vim-better-whitespace",
|
||||||
config = function()
|
config = function()
|
||||||
vim.g.better_whitespace_filetypes_blacklist = { "dashboard" }
|
vim.g.better_whitespace_filetypes_blacklist = { "dashboard" }
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"mbbill/undotree",
|
"mbbill/undotree",
|
||||||
cmd = "UndotreeToggle",
|
cmd = "UndotreeToggle",
|
||||||
config = function()
|
config = function()
|
||||||
vim.g.undotree_SetFocusWhenToggle = 1
|
vim.g.undotree_SetFocusWhenToggle = 1
|
||||||
end,
|
end,
|
||||||
-- stylua: ignore
|
-- stylua: ignore
|
||||||
keys = { { "<leader>ut", ":UndotreeToggle<CR>" } },
|
keys = { { "<leader>ut", ":UndotreeToggle<CR>" } },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"stevearc/aerial.nvim",
|
"stevearc/aerial.nvim",
|
||||||
opts = {},
|
opts = {},
|
||||||
cmd = { "AerialToggle", "AerialOn" },
|
cmd = { "AerialToggle", "AerialOn" },
|
||||||
-- stylua: ignore
|
-- stylua: ignore
|
||||||
keys = { { "<leader>so", ":AerialToggle<CR>", desc = "[S]symbols [O]utline" } },
|
keys = { { "<leader>so", ":AerialToggle<CR>", desc = "[S]symbols [O]utline" } },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"andrewferrier/debugprint.nvim",
|
"andrewferrier/debugprint.nvim",
|
||||||
opts = {},
|
opts = {},
|
||||||
-- Dependency only needed for NeoVim 0.8
|
-- Dependency only needed for NeoVim 0.8
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
},
|
},
|
||||||
-- Remove the following line to use development versions,
|
-- Remove the following line to use development versions,
|
||||||
-- not just the formal releases
|
-- not just the formal releases
|
||||||
version = "*",
|
version = "*",
|
||||||
-- stylua: ignore
|
-- stylua: ignore
|
||||||
keys = {
|
keys = {
|
||||||
{ "<leader>dp", ":lua require('debugprint').debugprint()<cr>", desc = "Debug print" },
|
{ "<leader>dp", ":lua require('debugprint').debugprint()<cr>", desc = "Debug print" },
|
||||||
@ -178,5 +168,5 @@ return {
|
|||||||
{ "<leader>dq", ":lua require('debugprint').debugprint({variable = true})<cr>", desc = "Debug print" },
|
{ "<leader>dq", ":lua require('debugprint').debugprint({variable = true})<cr>", desc = "Debug print" },
|
||||||
{ "<leader>dQ", ":lua require('debugprint').debugprint({variable = true, above = true})<cr>", desc = "Debug print", },
|
{ "<leader>dQ", ":lua require('debugprint').debugprint({variable = true, above = true})<cr>", desc = "Debug print", },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -1,71 +1,72 @@
|
|||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"akinsho/bufferline.nvim",
|
"akinsho/bufferline.nvim",
|
||||||
version = "*",
|
version = "*",
|
||||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
cond = false,
|
||||||
opts = {
|
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||||
options = {
|
opts = {
|
||||||
hover = {
|
options = {
|
||||||
enabled = true,
|
hover = {
|
||||||
delay = 200,
|
enabled = true,
|
||||||
reveal = { "close" },
|
delay = 200,
|
||||||
},
|
reveal = { "close" },
|
||||||
indicator = {
|
},
|
||||||
-- icon = "▎", -- this should be omitted if indicator style is not 'icon'
|
indicator = {
|
||||||
style = "icon", -- | 'underline' | 'none',
|
-- icon = "▎", -- this should be omitted if indicator style is not 'icon'
|
||||||
},
|
style = "icon", -- | 'underline' | 'none',
|
||||||
offsets = {
|
},
|
||||||
{
|
offsets = {
|
||||||
filetype = "NvimTree",
|
{
|
||||||
text = "File Explorer",
|
filetype = "NvimTree",
|
||||||
highlight = "Directory",
|
text = "File Explorer",
|
||||||
separator = true, -- use a "true" to enable the default, or set your own character
|
highlight = "Directory",
|
||||||
},
|
separator = true, -- use a "true" to enable the default, or set your own character
|
||||||
},
|
},
|
||||||
mode = "tabs",
|
},
|
||||||
diagnostics = "nvim_lsp",
|
-- mode = "tabs",
|
||||||
diagnostics_indicator = function(count, level, diagnostics_dict, context)
|
diagnostics = "nvim_lsp",
|
||||||
local symbols = { error = " ", warning = " ", info = " ", hint = " " }
|
diagnostics_indicator = function(count, level, diagnostics_dict, context)
|
||||||
local icon = symbols[level] or level
|
local symbols = { error = " ", warning = " ", info = " ", hint = " " }
|
||||||
return "" .. icon .. count
|
local icon = symbols[level] or level
|
||||||
end,
|
return "" .. icon .. count
|
||||||
max_name_length = 30,
|
end,
|
||||||
truncate_name = false,
|
max_name_length = 30,
|
||||||
show_close_icon = false,
|
truncate_name = false,
|
||||||
show_buffer_close_icons = false,
|
show_close_icon = false,
|
||||||
-- groups = {
|
show_buffer_close_icons = false,
|
||||||
-- options = {
|
groups = {
|
||||||
-- toggle_hidden_on_enter = true, -- when you re-enter a hidden group this options re-opens that group so the buffer is visible
|
options = {
|
||||||
-- },
|
toggle_hidden_on_enter = true, -- when you re-enter a hidden group this options re-opens that group so the buffer is visible
|
||||||
-- items = {
|
},
|
||||||
-- {
|
items = {
|
||||||
-- name = "Tests", -- Mandatory
|
{
|
||||||
-- highlight = { sp = "lightblue" }, -- Optional
|
name = "Tests", -- Mandatory
|
||||||
-- priority = 2, -- determines where it will appear relative to other groups (Optional)
|
highlight = { sp = "lightblue" }, -- Optional
|
||||||
-- icon = " ", -- Optional
|
priority = 2, -- determines where it will appear relative to other groups (Optional)
|
||||||
-- matcher = function(buf) -- Mandatory
|
icon = " ", -- Optional
|
||||||
-- return buf.path:match("%_test.cc$") or buf.path:match("%Test.java$")
|
matcher = function(buf) -- Mandatory
|
||||||
-- end,
|
return buf.path:match("%_test.cc$") or buf.path:match("%Test.java$")
|
||||||
-- },
|
end,
|
||||||
-- {
|
},
|
||||||
-- name = "Docs",
|
{
|
||||||
-- highlight = { sp = "lightgreen" },
|
name = "Docs",
|
||||||
-- auto_close = false, -- whether or not close this group if it doesn't contain the current buffer
|
highlight = { sp = "lightgreen" },
|
||||||
-- matcher = function(buf)
|
auto_close = false, -- whether or not close this group if it doesn't contain the current buffer
|
||||||
-- return buf.path:match("%.md$") or buf.path:match("%.txt$")
|
matcher = function(buf)
|
||||||
-- end,
|
return buf.path:match("%.md$") or buf.path:match("%.txt$")
|
||||||
-- },
|
end,
|
||||||
-- {
|
},
|
||||||
-- name = "Lua",
|
{
|
||||||
-- highlight = { sp = "lightblue" },
|
name = "Lua",
|
||||||
-- auto_close = false, -- whether or not close this group if it doesn't contain the current buffer
|
highlight = { sp = "lightblue" },
|
||||||
-- matcher = function(buf)
|
auto_close = false, -- whether or not close this group if it doesn't contain the current buffer
|
||||||
-- return buf.path:match("%.lua$")
|
matcher = function(buf)
|
||||||
-- end,
|
return buf.path:match("%.lua$")
|
||||||
-- },
|
end,
|
||||||
-- },
|
},
|
||||||
-- },
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
@ -2,135 +2,148 @@ local use_google = require("utils").use_google
|
|||||||
local flags = require("utils").flags
|
local flags = require("utils").flags
|
||||||
|
|
||||||
return {
|
return {
|
||||||
-- {
|
-- {
|
||||||
-- "ray-x/lsp_signature.nvim",
|
-- "ray-x/lsp_signature.nvim",
|
||||||
-- event = "VeryLazy",
|
-- event = "VeryLazy",
|
||||||
-- opts = {
|
-- opts = {
|
||||||
-- floating_window = true,
|
-- floating_window = true,
|
||||||
-- hint_prefix = " ",
|
-- hint_prefix = " ",
|
||||||
-- },
|
-- },
|
||||||
-- config = function(_, opts)
|
-- config = function(_, opts)
|
||||||
-- require("lsp_signature").setup(opts)
|
-- require("lsp_signature").setup(opts)
|
||||||
-- end,
|
-- end,
|
||||||
-- },
|
-- },
|
||||||
{
|
{
|
||||||
"kosayoda/nvim-lightbulb",
|
"kosayoda/nvim-lightbulb",
|
||||||
commit = "1cae7b7153ae98dcf1b11173a443ac1b6d8e3d49",
|
commit = "1cae7b7153ae98dcf1b11173a443ac1b6d8e3d49",
|
||||||
event = { "LspAttach" },
|
event = { "LspAttach" },
|
||||||
opts = {
|
opts = {
|
||||||
autocmd = { enabled = true },
|
autocmd = { enabled = true },
|
||||||
virtual_text = {
|
virtual_text = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
text = " ",
|
text = " ",
|
||||||
hl = "DiagnosticWarn",
|
hl = "DiagnosticWarn",
|
||||||
},
|
},
|
||||||
sign = { enabled = false },
|
sign = { enabled = false },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"L3MON4D3/LuaSnip",
|
"L3MON4D3/LuaSnip",
|
||||||
build = "make install_jsregexp",
|
build = "make install_jsregexp",
|
||||||
config = function()
|
config = function()
|
||||||
require("luasnip.loaders.from_vscode").lazy_load()
|
require("luasnip.loaders.from_vscode").lazy_load()
|
||||||
end,
|
end,
|
||||||
dependencies = { "rafamadriz/friendly-snippets" },
|
dependencies = { "rafamadriz/friendly-snippets" },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"hinell/lsp-timeout.nvim",
|
"hinell/lsp-timeout.nvim",
|
||||||
event = { "LspAttach" },
|
event = { "LspAttach" },
|
||||||
dependencies = { "neovim/nvim-lspconfig" },
|
dependencies = { "neovim/nvim-lspconfig" },
|
||||||
-- cond = not use_google(),
|
-- cond = not use_google(),
|
||||||
config = function()
|
config = function()
|
||||||
vim.g.lspTimeoutConfig = {
|
vim.g.lspTimeoutConfig = {
|
||||||
filetypes = {
|
filetypes = {
|
||||||
ignore = { -- filetypes to ignore; empty by default
|
ignore = { -- filetypes to ignore; empty by default
|
||||||
"gdscript",
|
"gdscript",
|
||||||
"rust",
|
"rust",
|
||||||
}, -- for these filetypes
|
}, -- for these filetypes
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ray-x/go.nvim",
|
"ray-x/go.nvim",
|
||||||
dependencies = { -- optional packages
|
dependencies = { -- optional packages
|
||||||
"ray-x/guihua.lua",
|
"ray-x/guihua.lua",
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
},
|
},
|
||||||
-- cond = not use_google(),
|
-- cond = not use_google(),
|
||||||
config = function()
|
config = function()
|
||||||
local capabilities = flags.blink
|
local capabilities = flags.blink
|
||||||
and require("blink.cmp").get_lsp_capabilities(vim.lsp.protocol.make_client_capabilities())
|
and require("blink.cmp").get_lsp_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||||
or require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
or require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||||
capabilities.offsetEncoding = { "utf-16" }
|
capabilities.offsetEncoding = { "utf-16" }
|
||||||
require("go").setup({
|
require("go").setup({
|
||||||
lsp_cfg = { capabilities = capabilities },
|
lsp_cfg = { capabilities = capabilities },
|
||||||
lsp_keymaps = false,
|
lsp_keymaps = false,
|
||||||
lsp_inlay_hints = {
|
lsp_inlay_hints = {
|
||||||
enable = not use_google(), -- doesn't work with ciderlsp
|
enable = not use_google(), -- doesn't work with ciderlsp
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
-- Run gofmt + goimports on save
|
-- Run gofmt + goimports on save
|
||||||
|
|
||||||
local format_sync_grp = vim.api.nvim_create_augroup("goimports", {})
|
local format_sync_grp = vim.api.nvim_create_augroup("goimports", {})
|
||||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||||
pattern = "*.go",
|
pattern = "*.go",
|
||||||
callback = function()
|
callback = function()
|
||||||
require("go.format").goimports()
|
require("go.format").goimports()
|
||||||
end,
|
end,
|
||||||
group = format_sync_grp,
|
group = format_sync_grp,
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
ft = { "go", "gomod" },
|
ft = { "go", "gomod" },
|
||||||
build = ':lua require("go.install").update_all_sync()', -- if you need to install/update all binaries
|
build = ':lua require("go.install").update_all_sync()', -- if you need to install/update all binaries
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"hrsh7th/nvim-cmp",
|
"hrsh7th/nvim-cmp",
|
||||||
"saghen/blink.cmp",
|
"saghen/blink.cmp",
|
||||||
"saghen/blink.compat",
|
"saghen/blink.compat",
|
||||||
"nvim-lua/lsp-status.nvim",
|
"nvim-lua/lsp-status.nvim",
|
||||||
"VonHeikemen/lsp-zero.nvim",
|
"VonHeikemen/lsp-zero.nvim",
|
||||||
},
|
},
|
||||||
keys = {
|
keys = {
|
||||||
{ "<leader>F", ":lua vim.lsp.buf.format()<CR>" },
|
{ "<leader>F", ":lua vim.lsp.buf.format()<CR>" },
|
||||||
{ "<leader>rn", ":lua vim.lsp.buf.rename()<CR>" },
|
{ "<leader>rn", ":lua vim.lsp.buf.rename()<CR>" },
|
||||||
{ "L", ":lua vim.lsp.buf.hover()<CR>" },
|
{ "L", ":lua vim.lsp.buf.hover()<CR>" },
|
||||||
{ "gr", ":Telescope lsp_references<CR>" },
|
{ "gr", ":Telescope lsp_references<CR>" },
|
||||||
{ "gd", ":lua vim.lsp.buf.definition()<CR>" },
|
{ "gd", ":lua vim.lsp.buf.definition()<CR>" },
|
||||||
-- { "gd", "<cmd>Telescope lsp_definitions<CR>" },
|
-- { "gd", "<cmd>Telescope lsp_definitions<CR>" },
|
||||||
{ "gD", ":tab split | lua vim.lsp.buf.definition()<CR>" },
|
{ "gD", ":tab split | lua vim.lsp.buf.definition()<CR>" },
|
||||||
{ "gi", ":lua vim.lsp.buf.implementation()<CR>" },
|
{ "gi", ":lua vim.lsp.buf.implementation()<CR>" },
|
||||||
{ "gI", ":lua vim.lsp.buf.implementation()<CR>" },
|
{ "gI", ":lua vim.lsp.buf.implementation()<CR>" },
|
||||||
{ "gR", ":lua vim.lsp.buf.references()<CR>" },
|
{ "gR", ":lua vim.lsp.buf.references()<CR>" },
|
||||||
{ "gt", ":lua vim.lsp.buf.type_definition()<CR>" },
|
{ "gt", ":lua vim.lsp.buf.type_definition()<CR>" },
|
||||||
{ "<C-g>", ":lua vim.lsp.buf.signature_help()<CR>" },
|
{ "<C-g>", ":lua vim.lsp.buf.signature_help()<CR>" },
|
||||||
{ "<C-g>", ":lua vim.lsp.buf.signature_help()<CR>", mode = "i" },
|
{ "<C-g>", ":lua vim.lsp.buf.signature_help()<CR>", mode = "i" },
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
local lsp_status = require("lsp-status")
|
local lsp_status = require("lsp-status")
|
||||||
lsp_status.register_progress()
|
lsp_status.register_progress()
|
||||||
|
|
||||||
local capabilities = flags.blink
|
local capabilities = flags.blink
|
||||||
and require("blink.cmp").get_lsp_capabilities(vim.lsp.protocol.make_client_capabilities())
|
and require("blink.cmp").get_lsp_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||||
or require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
or require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||||
capabilities = vim.tbl_extend("keep", capabilities or {}, lsp_status.capabilities)
|
capabilities = vim.tbl_extend("keep", capabilities or {}, lsp_status.capabilities)
|
||||||
capabilities.offsetEncoding = { "utf-16" }
|
capabilities.offsetEncoding = { "utf-16" }
|
||||||
|
|
||||||
local lspconfig = require("lspconfig")
|
local lspconfig = require("lspconfig")
|
||||||
local configs = require("lspconfig.configs")
|
local configs = require("lspconfig.configs")
|
||||||
require("config.lsp-google").setup(capabilities)
|
|
||||||
|
|
||||||
-- Godot
|
local nvim_lspconfig = require("lspconfig")
|
||||||
lspconfig.gdscript.setup({
|
local lsp_configs = require("lspconfig.configs")
|
||||||
-- flags = {
|
|
||||||
-- debounce_text_changes = 2000, -- Wait 5 seconds before sending didChange
|
lsp_configs.ciderlsp = {
|
||||||
-- },
|
default_config = {
|
||||||
})
|
cmd = { '/google/bin/releases/cider/ciderlsp/ciderlsp', '--tooltag=nvim-lsp', '--noforward_sync_responses' },
|
||||||
vim.cmd([[autocmd FileType gdscript setlocal commentstring=#\ %s]])
|
filetypes = { "c", "cpp", "java", "kotlin", "objc", "proto", "textproto", "go", "python", "bzl", "typescript" },
|
||||||
vim.cmd([[autocmd FileType gdscript setlocal autoindent noexpandtab tabstop=4 shiftwidth=4]])
|
offset_encoding = 'utf-8',
|
||||||
end,
|
root_dir = nvim_lspconfig.util.root_pattern('.citc'),
|
||||||
},
|
settings = {},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nvim_lspconfig.ciderlsp.setup {}
|
||||||
|
-- Godot
|
||||||
|
lspconfig.gdscript.setup({
|
||||||
|
-- flags = {
|
||||||
|
-- debounce_text_changes = 2000, -- Wait 5 seconds before sending didChange
|
||||||
|
-- },
|
||||||
|
})
|
||||||
|
vim.cmd([[autocmd FileType gdscript setlocal commentstring=#\ %s]])
|
||||||
|
vim.cmd([[autocmd FileType gdscript setlocal autoindent noexpandtab tabstop=4 shiftwidth=4]])
|
||||||
|
end,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
@ -1,84 +1,41 @@
|
|||||||
local split = function(inputstr, sep)
|
|
||||||
local t = {}
|
|
||||||
for str in string.gmatch(inputstr, "([^" .. sep .. "]+)") do
|
|
||||||
table.insert(t, str)
|
|
||||||
end
|
|
||||||
return t
|
|
||||||
end
|
|
||||||
local function getCitc()
|
|
||||||
local fname = vim.api.nvim_buf_get_name(0)
|
|
||||||
if string.find(fname, "/google/src/cloud/", 1, true) then
|
|
||||||
local parts = split(fname, "/")
|
|
||||||
return parts[5]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local function isCiderLspAttached()
|
|
||||||
if vim.b["is_cider_lsp_attached"] then
|
|
||||||
if vim.b["is_cider_lsp_attached"] == "yes" then
|
|
||||||
return "✓"
|
|
||||||
else
|
|
||||||
return "x"
|
|
||||||
end
|
|
||||||
else
|
|
||||||
return ""
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function getLightbulb()
|
|
||||||
return require("nvim-lightbulb").get_status_text()
|
|
||||||
end
|
|
||||||
|
|
||||||
local function getLGTMs()
|
|
||||||
local comments = require("google.comments")
|
|
||||||
local tracker = require("google.comments.tracker")
|
|
||||||
local dump = require("utils").dump
|
|
||||||
|
|
||||||
print(dump(tracker.get_all_comments()))
|
|
||||||
local lgtm = comments.get_lgtms()
|
|
||||||
local appr = comments.get_approvals()
|
|
||||||
print("lgtms" .. dump(lgtm))
|
|
||||||
print("approvals" .. dump(appr))
|
|
||||||
return "LGTM:" .. table.concat(lgtm, ",") .. " Approval:" .. table.concat(appr, ",")
|
|
||||||
end
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"nvim-lualine/lualine.nvim",
|
"nvim-lualine/lualine.nvim",
|
||||||
lazy = false,
|
lazy = false,
|
||||||
config = function()
|
config = function()
|
||||||
local lsp_status = require("lsp-status")
|
local lsp_status = require("lsp-status")
|
||||||
|
|
||||||
require("lualine").setup({
|
require("lualine").setup({
|
||||||
options = {
|
options = {
|
||||||
theme = "auto",
|
theme = "auto",
|
||||||
globalstatus = false,
|
globalstatus = false,
|
||||||
refresh = {
|
refresh = {
|
||||||
statusline = 1000,
|
statusline = 100,
|
||||||
-- tabline = 1000,
|
tabline = 100,
|
||||||
winbar = 1000,
|
winbar = 100,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
sections = {
|
sections = {
|
||||||
lualine_a = { "mode" },
|
lualine_a = { "mode" },
|
||||||
lualine_b = { "branch", "diff", getCitc, isCiderLspAttached },
|
lualine_b = { "branch", "diff" },
|
||||||
lualine_c = {
|
lualine_c = {
|
||||||
getLightbulb,
|
require("nvim-lightbulb").get_status_text,
|
||||||
{
|
{
|
||||||
"filename",
|
"filename",
|
||||||
path = 4, -- 0 = just filename, 1 = relative path, 2 = absolute path
|
path = 4, -- 0 = just filename, 1 = relative path, 2 = absolute path
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
lualine_x = {
|
lualine_x = {
|
||||||
"",
|
"",
|
||||||
{
|
{
|
||||||
"diagnostics",
|
"diagnostics",
|
||||||
sources = { "nvim_lsp" },
|
sources = { "nvim_lsp" },
|
||||||
symbols = { error = " ", warn = " ", info = " ", hint = " " },
|
symbols = { error = " ", warn = " ", info = " ", hint = " " },
|
||||||
},
|
},
|
||||||
"filetype",
|
"filetype",
|
||||||
},
|
},
|
||||||
lualine_y = { "progress" },
|
lualine_y = { "progress" },
|
||||||
lualine_z = { "location" },
|
lualine_z = { "location" },
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
@ -3,43 +3,44 @@ local exec = require("utils").exec
|
|||||||
local TableConcat = require("utils").TableConcat
|
local TableConcat = require("utils").TableConcat
|
||||||
|
|
||||||
_G.find_files = function(search_dirs)
|
_G.find_files = function(search_dirs)
|
||||||
require("telescope.builtin").find_files({ search_dirs = search_dirs })
|
require("telescope.builtin").find_files({ search_dirs = search_dirs })
|
||||||
end
|
end
|
||||||
-- Helper functions to fetch the current scope and set `search_dirs`
|
-- Helper functions to fetch the current scope and set `search_dirs`
|
||||||
_G.find_dotfiles = function() end
|
_G.find_dotfiles = function() end
|
||||||
|
|
||||||
_G.search_cwd = function()
|
_G.search_cwd = function()
|
||||||
local builtin = require("telescope.builtin")
|
local builtin = require("telescope.builtin")
|
||||||
local utils = require("telescope.utils")
|
local utils = require("telescope.utils")
|
||||||
builtin.find_files({ cwd = utils.buffer_dir() })
|
builtin.find_files({ cwd = utils.buffer_dir() })
|
||||||
end
|
end
|
||||||
|
|
||||||
_G.live_grep = function(search_dirs)
|
_G.live_grep = function(search_dirs)
|
||||||
require("telescope.builtin").live_grep({
|
require("telescope.builtin").live_grep({
|
||||||
search_dirs = search_dirs,
|
search_dirs = search_dirs,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
_G.live_grep_cword = function(search_dirs)
|
_G.live_grep_cword = function(search_dirs)
|
||||||
require("telescope.builtin").live_grep({ search_dirs = search_dirs })
|
require("telescope.builtin").live_grep({ search_dirs = search_dirs })
|
||||||
end
|
end
|
||||||
|
|
||||||
local function exe(cmd)
|
local function exe(cmd)
|
||||||
return vim.split(vim.fn.system(cmd), "\n")
|
return vim.split(vim.fn.system(cmd), "\n")
|
||||||
end
|
end
|
||||||
|
|
||||||
function fig_modified()
|
function fig_modified()
|
||||||
return exe("hg pstatus -ma -n --no-status --template= | sort")
|
return exe("hg pstatus -ma -n --no-status --template= | sort")
|
||||||
end
|
end
|
||||||
|
|
||||||
function fig_all_modified()
|
function fig_all_modified()
|
||||||
return exe("hg status -ma -n --rev p4base --no-status --template= | sort")
|
return exe("hg status -ma -n --rev p4base --no-status --template= | sort")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- stylua: ignore
|
-- stylua: ignore
|
||||||
local keys = {
|
local keys = {
|
||||||
-- { "<leader>e", ":lua search_cwd()<CR>", desc = "Find Files in Buffer Directory" },
|
-- { "<leader>e", ":lua search_cwd()<CR>", desc = "Find Files in Buffer Directory" },
|
||||||
{ "<leader>ts", require('telescope.builtin').live_grep },
|
{ "<leader>ts", require('telescope.builtin').live_grep },
|
||||||
|
{ "<leader>tb", ":Telescope buffers<CR>" },
|
||||||
{ "<leader>TS", function() require('telescope.builtin').live_grep { default_text = vim.fn.expand("<cword>") } end, },
|
{ "<leader>TS", function() require('telescope.builtin').live_grep { default_text = vim.fn.expand("<cword>") } end, },
|
||||||
{
|
{
|
||||||
"<leader>t.",
|
"<leader>t.",
|
||||||
@ -61,8 +62,8 @@ local keys = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if use_google() then
|
if use_google() then
|
||||||
local find_files = require("telescope.builtin").find_files
|
local find_files = require("telescope.builtin").find_files
|
||||||
local cs_query = require("telescope").extensions.codesearch.find_query
|
local cs_query = require("telescope").extensions.codesearch.find_query
|
||||||
-- stylua: ignore
|
-- stylua: ignore
|
||||||
TableConcat(keys, {
|
TableConcat(keys, {
|
||||||
{ "<leader>tm", function() find_files({ search_dirs = fig_modified() }) end, desc = "list modified Fig files." },
|
{ "<leader>tm", function() find_files({ search_dirs = fig_modified() }) end, desc = "list modified Fig files." },
|
||||||
@ -77,144 +78,144 @@ if use_google() then
|
|||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"aznhe21/actions-preview.nvim",
|
"aznhe21/actions-preview.nvim",
|
||||||
config = function()
|
config = function()
|
||||||
require("actions-preview").setup({
|
require("actions-preview").setup({
|
||||||
telescope = {
|
telescope = {
|
||||||
sorting_strategy = "ascending",
|
sorting_strategy = "ascending",
|
||||||
layout_strategy = "vertical",
|
layout_strategy = "vertical",
|
||||||
layout_config = {
|
layout_config = {
|
||||||
width = 0.8,
|
width = 0.8,
|
||||||
height = 0.9,
|
height = 0.9,
|
||||||
prompt_position = "top",
|
prompt_position = "top",
|
||||||
preview_cutoff = 20,
|
preview_cutoff = 20,
|
||||||
preview_height = function(_, _, max_lines)
|
preview_height = function(_, _, max_lines)
|
||||||
return max_lines - 15
|
return max_lines - 15
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
keys = {
|
keys = {
|
||||||
{ "?", "<cmd>lua require('actions-preview').code_actions()<cr>" },
|
{ "?", "<cmd>lua require('actions-preview').code_actions()<cr>" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"smartpde/telescope-recent-files",
|
"smartpde/telescope-recent-files",
|
||||||
config = function()
|
config = function()
|
||||||
require("telescope").load_extension("recent_files")
|
require("telescope").load_extension("recent_files")
|
||||||
end,
|
end,
|
||||||
keys = {
|
keys = {
|
||||||
{ "<leader>to", [[<cmd>lua require('telescope').extensions.recent_files.pick()<CR>]] },
|
{ "<leader>to", [[<cmd>lua require('telescope').extensions.recent_files.pick()<CR>]] },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"piersolenski/telescope-import.nvim",
|
"piersolenski/telescope-import.nvim",
|
||||||
dependencies = "nvim-telescope/telescope.nvim",
|
dependencies = "nvim-telescope/telescope.nvim",
|
||||||
config = function()
|
config = function()
|
||||||
require("telescope").load_extension("import")
|
require("telescope").load_extension("import")
|
||||||
end,
|
end,
|
||||||
keys = function()
|
keys = function()
|
||||||
if not use_google() then
|
if not use_google() then
|
||||||
return {
|
return {
|
||||||
{ "<leader>i", ":Telescope import<CR>" },
|
{ "<leader>i", ":Telescope import<CR>" },
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"nvim-telescope/telescope.nvim",
|
"nvim-telescope/telescope.nvim",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"mfussenegger/nvim-dap",
|
"mfussenegger/nvim-dap",
|
||||||
"smartpde/telescope-recent-files",
|
"smartpde/telescope-recent-files",
|
||||||
"rcarriga/nvim-dap-ui",
|
"rcarriga/nvim-dap-ui",
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
require("telescope").setup({
|
require("telescope").setup({
|
||||||
defaults = {
|
defaults = {
|
||||||
-- The vertical layout strategy is good to handle long paths like those in
|
-- The vertical layout strategy is good to handle long paths like those in
|
||||||
-- google3 repos because you have nearly the full screen to display a file path.
|
-- google3 repos because you have nearly the full screen to display a file path.
|
||||||
-- The caveat is that the preview area is smaller.
|
-- The caveat is that the preview area is smaller.
|
||||||
layout_strategy = "vertical",
|
layout_strategy = "vertical",
|
||||||
-- Common paths in google3 repos are collapsed following the example of Cider
|
-- Common paths in google3 repos are collapsed following the example of Cider
|
||||||
-- It is nice to keep this as a user config rather than part of
|
-- It is nice to keep this as a user config rather than part of
|
||||||
-- telescope-codesearch because it can be reused by other telescope pickers.
|
-- telescope-codesearch because it can be reused by other telescope pickers.
|
||||||
path_display = function(opts, path)
|
path_display = function(opts, path)
|
||||||
-- Do common substitutions
|
-- Do common substitutions
|
||||||
path = path:gsub("^/google/src/cloud/[^/]+/[^/]+/google3/", "google3/", 1)
|
path = path:gsub("^/google/src/cloud/[^/]+/[^/]+/google3/", "google3/", 1)
|
||||||
path = path:gsub("^google3/java/com/google/", "//j/c/g/", 1)
|
path = path:gsub("^google3/java/com/google/", "//j/c/g/", 1)
|
||||||
path = path:gsub("^google3/javatests/com/google/", "//jt/c/g/", 1)
|
path = path:gsub("^google3/javatests/com/google/", "//jt/c/g/", 1)
|
||||||
path = path:gsub("^google3/third_party/", "//3p/", 1)
|
path = path:gsub("^google3/third_party/", "//3p/", 1)
|
||||||
path = path:gsub("^google3/", "//", 1)
|
path = path:gsub("^google3/", "//", 1)
|
||||||
|
|
||||||
-- Do truncation. This allows us to combine our custom display formatter
|
-- Do truncation. This allows us to combine our custom display formatter
|
||||||
-- with the built-in truncation.
|
-- with the built-in truncation.
|
||||||
-- `truncate` handler in transform_path memoizes computed truncation length in opts.__length.
|
-- `truncate` handler in transform_path memoizes computed truncation length in opts.__length.
|
||||||
-- Here we are manually propagating this value between new_opts and opts.
|
-- Here we are manually propagating this value between new_opts and opts.
|
||||||
-- We can make this cleaner and more complicated using metatables :)
|
-- We can make this cleaner and more complicated using metatables :)
|
||||||
local new_opts = {
|
local new_opts = {
|
||||||
path_display = {
|
path_display = {
|
||||||
truncate = true,
|
truncate = true,
|
||||||
},
|
},
|
||||||
__length = opts.__length,
|
__length = opts.__length,
|
||||||
}
|
}
|
||||||
path = require("telescope.utils").transform_path(new_opts, path)
|
path = require("telescope.utils").transform_path(new_opts, path)
|
||||||
opts.__length = new_opts.__length
|
opts.__length = new_opts.__length
|
||||||
return path
|
return path
|
||||||
end,
|
end,
|
||||||
mappings = {
|
mappings = {
|
||||||
n = {
|
n = {
|
||||||
["<C-c>"] = "close",
|
["<C-c>"] = "close",
|
||||||
["<Esc>"] = "close",
|
["<Esc>"] = "close",
|
||||||
},
|
},
|
||||||
i = {
|
i = {
|
||||||
-- ["<cr>"] = function(bufnr)
|
-- ["<cr>"] = function(bufnr)
|
||||||
-- require("telescope.actions.set").edit(bufnr, "tab drop")
|
-- require("telescope.actions.set").edit(bufnr, "tab drop")
|
||||||
-- end,
|
-- end,
|
||||||
["<C-c>"] = "close",
|
["<C-c>"] = "close",
|
||||||
["<Esc>"] = "close",
|
["<Esc>"] = "close",
|
||||||
["<S-Down>"] = "cycle_history_next",
|
["<S-Down>"] = "cycle_history_next",
|
||||||
["<S-Up>"] = "cycle_history_prev",
|
["<S-Up>"] = "cycle_history_prev",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
extensions = {
|
extensions = {
|
||||||
codesearch = {
|
codesearch = {
|
||||||
experimental = true, -- enable results from google3/experimental
|
experimental = true, -- enable results from google3/experimental
|
||||||
},
|
},
|
||||||
recent_files = {
|
recent_files = {
|
||||||
-- This function rewrites all file paths to the current workspace.
|
-- This function rewrites all file paths to the current workspace.
|
||||||
-- For example, if w2 is the current workspace, then
|
-- For example, if w2 is the current workspace, then
|
||||||
-- /google/.../w1/google3/my_file.cc becomes /google/.../w2/google3/my_file.cc,
|
-- /google/.../w1/google3/my_file.cc becomes /google/.../w2/google3/my_file.cc,
|
||||||
transform_file_path = function(path)
|
transform_file_path = function(path)
|
||||||
local neocitc = require("neocitc")
|
local neocitc = require("neocitc")
|
||||||
local path_func = neocitc.path_in_current_workspace_or_head
|
local path_func = neocitc.path_in_current_workspace_or_head
|
||||||
or neocitc.path_in_current_workspace
|
or neocitc.path_in_current_workspace
|
||||||
return path_func(path)
|
return path_func(path)
|
||||||
end,
|
end,
|
||||||
-- This is a useful option to speed up Telescope by avoiding the check
|
-- This is a useful option to speed up Telescope by avoiding the check
|
||||||
-- for file existence.
|
-- for file existence.
|
||||||
stat_files = false,
|
stat_files = false,
|
||||||
-- Ignore common patterns that can show up from other google plugins
|
-- Ignore common patterns that can show up from other google plugins
|
||||||
ignore_patterns = {
|
ignore_patterns = {
|
||||||
"/%.git/COMMIT_EDITING$",
|
"/%.git/COMMIT_EDITING$",
|
||||||
"/%.git/COMMIT_EDITMSG$",
|
"/%.git/COMMIT_EDITMSG$",
|
||||||
"/%.git/MERGE_MSG$",
|
"/%.git/MERGE_MSG$",
|
||||||
"^/tmp/%.pipertmp-",
|
"^/tmp/%.pipertmp-",
|
||||||
"/Related_Files$",
|
"/Related_Files$",
|
||||||
"^term:",
|
"^term:",
|
||||||
";#toggleterm#",
|
";#toggleterm#",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
persisted = {},
|
persisted = {},
|
||||||
import = {
|
import = {
|
||||||
-- Add imports to the top of the file keeping the cursor in place
|
-- Add imports to the top of the file keeping the cursor in place
|
||||||
insert_at_top = true,
|
insert_at_top = true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
keys = keys,
|
keys = keys,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user