blink stuff
This commit is contained in:
@ -1,3 +1,3 @@
|
||||
{
|
||||
"lazy.nvim": { "branch": "main", "commit": "7e6c863bc7563efbdd757a310d17ebc95166cef3" }
|
||||
"lazy.nvim": { "branch": "main", "commit": "d8f26efd456190241afd1b0f5235fe6fdba13d4a" }
|
||||
}
|
||||
|
@ -2,115 +2,145 @@ local use_google = require("utils").use_google
|
||||
local flags = require("utils").flags
|
||||
|
||||
return {
|
||||
{
|
||||
"saghen/blink.compat",
|
||||
-- use the latest release, via version = '*', if you also use the latest release for blink.cmp
|
||||
version = "*",
|
||||
-- lazy.nvim will automatically load the plugin when it's required by blink.cmp
|
||||
lazy = true,
|
||||
-- make sure to set opts so that lazy.nvim calls blink.compat's setup
|
||||
opts = {
|
||||
impersonate_nvim_cmp = use_google(), -- only cider needs this
|
||||
},
|
||||
cond = not use_google(),
|
||||
},
|
||||
{
|
||||
"saghen/blink.cmp",
|
||||
lazy = false, -- lazy loading handled internally
|
||||
cond = flags.blink,
|
||||
dependencies = {
|
||||
"Exafunction/codeium.nvim",
|
||||
"mikavilpas/blink-ripgrep.nvim",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
-- "FelipeLema/cmp-async-path",
|
||||
"chrisgrieser/cmp-nerdfont",
|
||||
"hrsh7th/cmp-emoji",
|
||||
"rafamadriz/friendly-snippets", -- optional: provides snippets for the snippet source
|
||||
},
|
||||
version = "v0.*", -- use a release tag to download pre-built binaries
|
||||
-- build = 'cargo build --release',
|
||||
{
|
||||
"saghen/blink.compat",
|
||||
-- use the latest release, via version = '*', if you also use the latest release for blink.cmp
|
||||
version = "*",
|
||||
-- lazy.nvim will automatically load the plugin when it's required by blink.cmp
|
||||
lazy = true,
|
||||
-- make sure to set opts so that lazy.nvim calls blink.compat's setup
|
||||
opts = {
|
||||
impersonate_nvim_cmp = use_google(), -- only cider needs this
|
||||
},
|
||||
cond = not use_google(),
|
||||
},
|
||||
{
|
||||
"saghen/blink.cmp",
|
||||
lazy = false, -- lazy loading handled internally
|
||||
cond = flags.blink,
|
||||
dependencies = {
|
||||
"Exafunction/codeium.nvim",
|
||||
"mikavilpas/blink-ripgrep.nvim",
|
||||
"chrisgrieser/cmp-nerdfont",
|
||||
"hrsh7th/cmp-emoji",
|
||||
"rafamadriz/friendly-snippets", -- optional: provides snippets for the snippet source
|
||||
},
|
||||
version = "v0.*", -- use a release tag to download pre-built binaries
|
||||
-- build = 'cargo build --release',
|
||||
|
||||
---@module 'blink.cmp'
|
||||
---@type blink.cmp.Config
|
||||
opts = {
|
||||
keymap = {
|
||||
["<C-space>"] = { "show", "show_documentation", "hide_documentation" },
|
||||
["<C-e>"] = { "hide", "fallback" },
|
||||
["<CR>"] = { "accept", "fallback" },
|
||||
---@module 'blink.cmp'
|
||||
---@type blink.cmp.Config
|
||||
opts = {
|
||||
keymap = {
|
||||
["<C-space>"] = { "show", "show_documentation", "hide_documentation" },
|
||||
["<C-e>"] = { "hide", "fallback" },
|
||||
["<CR>"] = { "accept", "fallback" },
|
||||
|
||||
["<Tab>"] = { "select_next", "snippet_forward", "accept", "fallback" },
|
||||
["<S-Tab>"] = { "select_prev", "snippet_backward", "fallback" },
|
||||
["<Tab>"] = { "select_next", "snippet_forward", "accept", "fallback" },
|
||||
["<S-Tab>"] = { "select_prev", "snippet_backward", "fallback" },
|
||||
|
||||
["<Up>"] = { "select_prev", "fallback" },
|
||||
["<Down>"] = { "select_next", "fallback" },
|
||||
["<Up>"] = { "select_prev", "fallback" },
|
||||
["<Down>"] = { "select_next", "fallback" },
|
||||
|
||||
["<S-Up>"] = { "scroll_documentation_up", "fallback" },
|
||||
["<S-Down>"] = { "scroll_documentation_down", "fallback" },
|
||||
},
|
||||
sources = {
|
||||
default = function(ctx)
|
||||
local providerToEnable = {
|
||||
"lsp",
|
||||
"path",
|
||||
"crates",
|
||||
"snippets",
|
||||
"ripgrep",
|
||||
"emoji",
|
||||
"nerdfont",
|
||||
"buffer",
|
||||
}
|
||||
if use_google() then
|
||||
table.insert(providerToEnable, "nvim_ciderlsp")
|
||||
table.insert(providerToEnable, "buganizer")
|
||||
else
|
||||
table.insert(providerToEnable, "codeium")
|
||||
end
|
||||
vim.notify("BOOOOOOP")
|
||||
vim.notify(vim.inspect(providerToEnable))
|
||||
return providerToEnable
|
||||
end,
|
||||
},
|
||||
providers = {
|
||||
-- dont show LuaLS require statements when lazydev has items
|
||||
lsp = { fallback_for = { "lazydev" } },
|
||||
lazydev = { name = "LazyDev", module = "lazydev.integrations.blink" },
|
||||
ripgrep = {
|
||||
module = "blink-ripgrep",
|
||||
name = "Ripgrep",
|
||||
-- the options below are optional, some default values are shown
|
||||
---@module "blink-ripgrep"
|
||||
---@type blink-ripgrep.Options
|
||||
opts = {
|
||||
prefix_min_len = 3,
|
||||
context_size = 5,
|
||||
max_filesize = "1M",
|
||||
additional_rg_options = {},
|
||||
},
|
||||
},
|
||||
nvim_ciderlsp = {
|
||||
name = "nvim_ciderlsp",
|
||||
module = "blink.compat.source",
|
||||
},
|
||||
buganizer = {
|
||||
name = "nvim_buganizer",
|
||||
module = "blink.compat.source",
|
||||
},
|
||||
codeium = {
|
||||
name = "codeium",
|
||||
module = "blink.compat.source",
|
||||
},
|
||||
},
|
||||
-- experimental signature help support
|
||||
signature = { enabled = true },
|
||||
completion = {
|
||||
trigger = {
|
||||
show_on_x_blocked_trigger_characters = { "'", '"', "(", "{" },
|
||||
},
|
||||
},
|
||||
},
|
||||
["<S-Up>"] = { "scroll_documentation_up", "fallback" },
|
||||
["<S-Down>"] = { "scroll_documentation_down", "fallback" },
|
||||
},
|
||||
sources = {
|
||||
default = function(ctx)
|
||||
local providerToEnable = {
|
||||
"lsp",
|
||||
"path",
|
||||
"snippets",
|
||||
"ripgrep",
|
||||
"emoji",
|
||||
"nerdfont",
|
||||
"buffer",
|
||||
}
|
||||
if use_google() then
|
||||
table.insert(providerToEnable, "nvim_ciderlsp")
|
||||
table.insert(providerToEnable, "buganizer")
|
||||
else
|
||||
table.insert(providerToEnable, "codeium")
|
||||
end
|
||||
return providerToEnable
|
||||
end,
|
||||
providers = {
|
||||
-- dont show LuaLS require statements when lazydev has items
|
||||
lazydev = { name = "LazyDev", module = "lazydev.integrations.blink", fallbacks = { "lsp" } },
|
||||
ripgrep = {
|
||||
module = "blink-ripgrep",
|
||||
name = "Ripgrep",
|
||||
-- the options below are optional, some default values are shown
|
||||
---@module "blink-ripgrep"
|
||||
---@type blink-ripgrep.Options
|
||||
opts = {
|
||||
prefix_min_len = 3,
|
||||
context_size = 5,
|
||||
max_filesize = "1M",
|
||||
additional_rg_options = {},
|
||||
},
|
||||
},
|
||||
nvim_ciderlsp = {
|
||||
name = "nvim_ciderlsp",
|
||||
module = "blink.compat.source",
|
||||
},
|
||||
buganizer = {
|
||||
name = "nvim_buganizer",
|
||||
module = "blink.compat.source",
|
||||
},
|
||||
codeium = {
|
||||
name = "codeium",
|
||||
module = "blink.compat.source",
|
||||
},
|
||||
emoji = {
|
||||
name = "emoji",
|
||||
module = "blink.compat.source",
|
||||
},
|
||||
nerdfont = {
|
||||
name = "nerdfont",
|
||||
module = "blink.compat.source",
|
||||
},
|
||||
},
|
||||
},
|
||||
-- experimental signature help support
|
||||
signature = { enabled = true },
|
||||
completion = {
|
||||
menu = {
|
||||
draw = {
|
||||
components = {
|
||||
kind_icon = {
|
||||
ellipsis = false,
|
||||
text = function(ctx)
|
||||
local kind_icon, _, _ = require("mini.icons").get("lsp", ctx.kind)
|
||||
return kind_icon
|
||||
end,
|
||||
-- Optionally, you may also use the highlights from mini.icons
|
||||
highlight = function(ctx)
|
||||
local _, hl, _ = require("mini.icons").get("lsp", ctx.kind)
|
||||
return hl
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
list = {
|
||||
selection = {
|
||||
preselect = function(ctx)
|
||||
return ctx.mode ~= "cmdline"
|
||||
end,
|
||||
auto_insert = function(ctx)
|
||||
return ctx.mode ~= "cmdline"
|
||||
end,
|
||||
},
|
||||
},
|
||||
trigger = {
|
||||
show_on_x_blocked_trigger_characters = { "'", '"', "(", "{" },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- allows extending the providers array elsewhere in your config
|
||||
-- without having to redefine it
|
||||
opts_extend = { "sources.default" },
|
||||
},
|
||||
-- allows extending the providers array elsewhere in your config
|
||||
-- without having to redefine it
|
||||
opts_extend = { "sources.default" },
|
||||
},
|
||||
}
|
||||
|
@ -1,192 +1,192 @@
|
||||
local use_google = require("utils").use_google
|
||||
local use_google = require("utils").use_googlecmp
|
||||
local flags = require("utils").flags
|
||||
|
||||
return {
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = { "InsertEnter", "CmdlineEnter" },
|
||||
cond = use_google(),
|
||||
dependencies = {
|
||||
"Exafunction/codeium.nvim",
|
||||
"FelipeLema/cmp-async-path",
|
||||
"amarakon/nvim-cmp-buffer-lines",
|
||||
"chrisgrieser/cmp-nerdfont",
|
||||
"dmitmel/cmp-cmdline-history",
|
||||
"f3fora/cmp-spell",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-calc",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"hrsh7th/cmp-emoji",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-nvim-lsp-document-symbol",
|
||||
-- "hrsh7th/cmp-nvim-lsp-signature-help",
|
||||
"hrsh7th/cmp-nvim-lua",
|
||||
"lukas-reineke/cmp-under-comparator",
|
||||
"onsails/lspkind.nvim",
|
||||
"ray-x/cmp-treesitter",
|
||||
},
|
||||
config = function()
|
||||
vim.opt.shortmess:append("c")
|
||||
vim.opt.completeopt = { "menu", "menuone", "noselect" }
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = { "InsertEnter", "CmdlineEnter" },
|
||||
cond = not flags.blink,
|
||||
dependencies = {
|
||||
"Exafunction/codeium.nvim",
|
||||
"FelipeLema/cmp-async-path",
|
||||
"amarakon/nvim-cmp-buffer-lines",
|
||||
"chrisgrieser/cmp-nerdfont",
|
||||
"dmitmel/cmp-cmdline-history",
|
||||
"f3fora/cmp-spell",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-calc",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"hrsh7th/cmp-emoji",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-nvim-lsp-document-symbol",
|
||||
-- "hrsh7th/cmp-nvim-lsp-signature-help",
|
||||
"hrsh7th/cmp-nvim-lua",
|
||||
"lukas-reineke/cmp-under-comparator",
|
||||
"onsails/lspkind.nvim",
|
||||
"ray-x/cmp-treesitter",
|
||||
},
|
||||
config = function()
|
||||
vim.opt.shortmess:append("c")
|
||||
vim.opt.completeopt = { "menu", "menuone", "noselect" }
|
||||
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
|
||||
local compare = cmp.config.compare
|
||||
local compare = cmp.config.compare
|
||||
|
||||
local conditionalSources = {}
|
||||
local conditionalSources = {}
|
||||
|
||||
if use_google() then
|
||||
table.insert(conditionalSources, { name = "nvim_ciderlsp", priority = 8 })
|
||||
table.insert(conditionalSources, { name = "buganizer", option = { notifications_enabled = true } })
|
||||
else
|
||||
table.insert(conditionalSources, { name = "codeium", priority = 8 })
|
||||
end
|
||||
if use_google() then
|
||||
table.insert(conditionalSources, { name = "nvim_ciderlsp", priority = 8 })
|
||||
table.insert(conditionalSources, { name = "buganizer", option = { notifications_enabled = true } })
|
||||
else
|
||||
table.insert(conditionalSources, { name = "codeium", priority = 8 })
|
||||
end
|
||||
|
||||
local lspkind = require("lspkind")
|
||||
lspkind.init()
|
||||
local lspkind = require("lspkind")
|
||||
lspkind.init()
|
||||
|
||||
cmp.setup.filetype("txt", {
|
||||
enabled = false,
|
||||
})
|
||||
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline({ "/", "?" }, {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "treesitter" },
|
||||
{ name = "buffer" },
|
||||
}),
|
||||
})
|
||||
cmp.setup.filetype("txt", {
|
||||
enabled = false,
|
||||
})
|
||||
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline({ "/", "?" }, {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "treesitter" },
|
||||
{ name = "buffer" },
|
||||
}),
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline(":", {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
-- { name = "nvim_lsp_signature_help", priority = 9 },
|
||||
{ name = "async_path" },
|
||||
{ name = "cmdline", option = { ignore_cmds = { "edit", "write", "tabedit" } } },
|
||||
}),
|
||||
})
|
||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline(":", {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
-- { name = "nvim_lsp_signature_help", priority = 9 },
|
||||
{ name = "async_path" },
|
||||
{ name = "cmdline", option = { ignore_cmds = { "edit", "write", "tabedit" } } },
|
||||
}),
|
||||
})
|
||||
|
||||
cmp.setup({
|
||||
preselect = cmp.PreselectMode.None,
|
||||
performance = {
|
||||
-- debounce = 60,
|
||||
-- throttle = 30,
|
||||
fetching_timeout = 300,
|
||||
-- confirm_resolve_timeout = 80,
|
||||
-- async_budget = 1,
|
||||
-- max_view_entries = 200,
|
||||
},
|
||||
sources = cmp.config.sources(
|
||||
require("utils").TableConcat(conditionalSources, {
|
||||
-- { name = "nvim_lsp_signature_help", priority = 9 },
|
||||
-- Conditional sources injected here.
|
||||
{ name = "luasnip", priority = 7 },
|
||||
{ name = "nvim_lsp", priority = 6 },
|
||||
{ name = "async_path" },
|
||||
{ name = "crates" },
|
||||
{ name = "calc" },
|
||||
}),
|
||||
{ -- symbols/icons group
|
||||
{ name = "nerdfont" },
|
||||
{ name = "emoji" },
|
||||
},
|
||||
{ -- fallback
|
||||
{ name = "treesitter" },
|
||||
{ name = "buffer" },
|
||||
}
|
||||
),
|
||||
cmp.setup({
|
||||
preselect = cmp.PreselectMode.None,
|
||||
performance = {
|
||||
-- debounce = 60,
|
||||
-- throttle = 30,
|
||||
fetching_timeout = 300,
|
||||
-- confirm_resolve_timeout = 80,
|
||||
-- async_budget = 1,
|
||||
-- max_view_entries = 200,
|
||||
},
|
||||
sources = cmp.config.sources(
|
||||
require("utils").TableConcat(conditionalSources, {
|
||||
-- { name = "nvim_lsp_signature_help", priority = 9 },
|
||||
-- Conditional sources injected here.
|
||||
{ name = "luasnip", priority = 7 },
|
||||
{ name = "nvim_lsp", priority = 6 },
|
||||
{ name = "async_path" },
|
||||
{ name = "crates" },
|
||||
{ name = "calc" },
|
||||
}),
|
||||
{ -- symbols/icons group
|
||||
{ name = "nerdfont" },
|
||||
{ name = "emoji" },
|
||||
},
|
||||
{ -- fallback
|
||||
{ name = "treesitter" },
|
||||
{ name = "buffer" },
|
||||
}
|
||||
),
|
||||
|
||||
sorting = {
|
||||
comparators = {
|
||||
-- compare.score_offset, -- not good at all
|
||||
compare.priority,
|
||||
compare.score, -- based on : score = score + ((#sources - (source_index - 1)) * sorting.priority_weight)
|
||||
compare.recently_used,
|
||||
compare.offset,
|
||||
compare.order,
|
||||
-- compare.exact,
|
||||
compare.kind,
|
||||
-- compare.length, -- useless
|
||||
},
|
||||
},
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
menu = {
|
||||
async_path = " path",
|
||||
buffer = " Buf",
|
||||
cmdline = " cmd",
|
||||
codeium = " Codeium",
|
||||
crates = " rust",
|
||||
luasnip = " snip",
|
||||
buganizer = " Buganizer",
|
||||
nerdfont = " nerdfont",
|
||||
nvim_ciderlsp = " Cider",
|
||||
nvim_lsp_signature_help = "",
|
||||
nvim_lsp = " LSP",
|
||||
nvim_lua = " lua",
|
||||
treesitter = " ts",
|
||||
},
|
||||
}),
|
||||
},
|
||||
sorting = {
|
||||
comparators = {
|
||||
-- compare.score_offset, -- not good at all
|
||||
compare.priority,
|
||||
compare.score, -- based on : score = score + ((#sources - (source_index - 1)) * sorting.priority_weight)
|
||||
compare.recently_used,
|
||||
compare.offset,
|
||||
compare.order,
|
||||
-- compare.exact,
|
||||
compare.kind,
|
||||
-- compare.length, -- useless
|
||||
},
|
||||
},
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
menu = {
|
||||
async_path = " path",
|
||||
buffer = " Buf",
|
||||
cmdline = " cmd",
|
||||
codeium = " Codeium",
|
||||
crates = " rust",
|
||||
luasnip = " snip",
|
||||
buganizer = " Buganizer",
|
||||
nerdfont = " nerdfont",
|
||||
nvim_ciderlsp = " Cider",
|
||||
nvim_lsp_signature_help = "",
|
||||
nvim_lsp = " LSP",
|
||||
nvim_lua = " lua",
|
||||
treesitter = " ts",
|
||||
},
|
||||
}),
|
||||
},
|
||||
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
|
||||
mapping = {
|
||||
["<S-Up>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<S-Down>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-e>"] = cmp.mapping.close(),
|
||||
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
|
||||
["<CR>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
if luasnip.expandable() then
|
||||
luasnip.expand()
|
||||
else
|
||||
cmp.confirm({
|
||||
select = true,
|
||||
})
|
||||
end
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
mapping = {
|
||||
["<S-Up>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<S-Down>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-e>"] = cmp.mapping.close(),
|
||||
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
|
||||
["<CR>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
if luasnip.expandable() then
|
||||
luasnip.expand()
|
||||
else
|
||||
cmp.confirm({
|
||||
select = true,
|
||||
})
|
||||
end
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
|
||||
["<Up>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
else
|
||||
fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
|
||||
end
|
||||
end),
|
||||
["<Up>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
else
|
||||
fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
|
||||
end
|
||||
end),
|
||||
|
||||
["<Down>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
else
|
||||
fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
|
||||
end
|
||||
end),
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
["<Down>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
else
|
||||
fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
|
||||
end
|
||||
end),
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
@ -73,45 +73,6 @@ return {
|
||||
})
|
||||
-- Run gofmt + goimports on save
|
||||
|
||||
<<<<<<< HEAD
|
||||
local format_sync_grp = vim.api.nvim_create_augroup("goimports", {})
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
pattern = "*.go",
|
||||
callback = function()
|
||||
require("go.format").goimports()
|
||||
end,
|
||||
group = format_sync_grp,
|
||||
})
|
||||
end,
|
||||
ft = { "go", "gomod" },
|
||||
build = ':lua require("go.install").update_all_sync()', -- if you need to install/update all binaries
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
"hrsh7th/nvim-cmp",
|
||||
"nvim-lua/lsp-status.nvim",
|
||||
"VonHeikemen/lsp-zero.nvim",
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>F", ":lua vim.lsp.buf.format()<CR>" },
|
||||
{ "<leader>rn", ":lua vim.lsp.buf.rename()<CR>" },
|
||||
{ "L", ":lua vim.lsp.buf.hover()<CR>" },
|
||||
{ "gr", ":Telescope lsp_references<CR>" },
|
||||
{ "gd", ":lua vim.lsp.buf.definition()<CR>" },
|
||||
-- { "gd", "<cmd>Telescope lsp_definitions<CR>" },
|
||||
{ "gD", ":tab split | lua vim.lsp.buf.definition()<CR>" },
|
||||
{ "gi", ":lua vim.lsp.buf.implementation()<CR>" },
|
||||
{ "gI", ":lua vim.lsp.buf.implementation()<CR>" },
|
||||
{ "gR", ":lua vim.lsp.buf.references()<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>", mode = "i" },
|
||||
},
|
||||
config = function()
|
||||
local lsp_status = require("lsp-status")
|
||||
lsp_status.register_progress()
|
||||
=======
|
||||
local format_sync_grp = vim.api.nvim_create_augroup("goimports", {})
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
pattern = "*.go",
|
||||
@ -149,7 +110,6 @@ return {
|
||||
config = function()
|
||||
local lsp_status = require("lsp-status")
|
||||
lsp_status.register_progress()
|
||||
>>>>>>> cc84d4d (i dont even know)
|
||||
|
||||
local capabilities = flags.blink
|
||||
and require("blink.cmp").get_lsp_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
|
@ -1,100 +1,100 @@
|
||||
local M = {
|
||||
use_google_cache = nil,
|
||||
flags = {},
|
||||
use_google_cache = nil,
|
||||
flags = { blink = true },
|
||||
}
|
||||
|
||||
function M.exec(command, args)
|
||||
local Job = require("plenary.job")
|
||||
local job = Job:new({
|
||||
command = command,
|
||||
args = args,
|
||||
})
|
||||
job:sync()
|
||||
job:wait()
|
||||
return job:result()
|
||||
local Job = require("plenary.job")
|
||||
local job = Job:new({
|
||||
command = command,
|
||||
args = args,
|
||||
})
|
||||
job:sync()
|
||||
job:wait()
|
||||
return job:result()
|
||||
end
|
||||
|
||||
function M.map(mode, lhs, rhs, opts)
|
||||
local options = { noremap = true }
|
||||
if opts then
|
||||
options = vim.tbl_extend("force", options, opts)
|
||||
end
|
||||
-- vim.api.nvim_set_keymap(mode, lhs, rhs, options)
|
||||
vim.keymap.set(mode, lhs, rhs, options)
|
||||
local options = { noremap = true }
|
||||
if opts then
|
||||
options = vim.tbl_extend("force", options, opts)
|
||||
end
|
||||
-- vim.api.nvim_set_keymap(mode, lhs, rhs, options)
|
||||
vim.keymap.set(mode, lhs, rhs, options)
|
||||
end
|
||||
|
||||
function M.use_google()
|
||||
if M.use_google_cache == nil then
|
||||
M.use_google_cache = M.file_exists(os.getenv("HOME") .. "/use_google")
|
||||
end
|
||||
return M.use_google_cache
|
||||
if M.use_google_cache == nil then
|
||||
M.use_google_cache = M.file_exists(os.getenv("HOME") .. "/use_google")
|
||||
end
|
||||
return M.use_google_cache
|
||||
end
|
||||
|
||||
function M.file_exists(name)
|
||||
local f = io.open(name, "r")
|
||||
if f ~= nil then
|
||||
io.close(f)
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
local f = io.open(name, "r")
|
||||
if f ~= nil then
|
||||
io.close(f)
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function M.dump(o)
|
||||
if type(o) == "table" then
|
||||
local s = "{ "
|
||||
for k, v in pairs(o) do
|
||||
if type(k) ~= "number" then
|
||||
k = '"' .. k .. '"'
|
||||
end
|
||||
s = s .. "[" .. k .. "] = " .. M.dump(v) .. ","
|
||||
end
|
||||
return s .. "} "
|
||||
else
|
||||
return tostring(o)
|
||||
end
|
||||
if type(o) == "table" then
|
||||
local s = "{ "
|
||||
for k, v in pairs(o) do
|
||||
if type(k) ~= "number" then
|
||||
k = '"' .. k .. '"'
|
||||
end
|
||||
s = s .. "[" .. k .. "] = " .. M.dump(v) .. ","
|
||||
end
|
||||
return s .. "} "
|
||||
else
|
||||
return tostring(o)
|
||||
end
|
||||
end
|
||||
|
||||
function M.tprint(tbl, indent)
|
||||
if not indent then
|
||||
indent = 0
|
||||
end
|
||||
local toprint = string.rep(" ", indent) .. "{\r\n"
|
||||
indent = indent + 2
|
||||
for k, v in pairs(tbl) do
|
||||
toprint = toprint .. string.rep(" ", indent)
|
||||
if type(k) == "number" then
|
||||
toprint = toprint .. "[" .. k .. "] = "
|
||||
elseif type(k) == "string" then
|
||||
toprint = toprint .. k .. "= "
|
||||
end
|
||||
if type(v) == "number" then
|
||||
toprint = toprint .. v .. ",\r\n"
|
||||
elseif type(v) == "string" then
|
||||
toprint = toprint .. '"' .. v .. '",\r\n'
|
||||
elseif type(v) == "table" then
|
||||
toprint = toprint .. M.tprint(v, indent + 2) .. ",\r\n"
|
||||
else
|
||||
toprint = toprint .. '"' .. tostring(v) .. '",\r\n'
|
||||
end
|
||||
end
|
||||
toprint = toprint .. string.rep(" ", indent - 2) .. "}"
|
||||
return toprint
|
||||
if not indent then
|
||||
indent = 0
|
||||
end
|
||||
local toprint = string.rep(" ", indent) .. "{\r\n"
|
||||
indent = indent + 2
|
||||
for k, v in pairs(tbl) do
|
||||
toprint = toprint .. string.rep(" ", indent)
|
||||
if type(k) == "number" then
|
||||
toprint = toprint .. "[" .. k .. "] = "
|
||||
elseif type(k) == "string" then
|
||||
toprint = toprint .. k .. "= "
|
||||
end
|
||||
if type(v) == "number" then
|
||||
toprint = toprint .. v .. ",\r\n"
|
||||
elseif type(v) == "string" then
|
||||
toprint = toprint .. '"' .. v .. '",\r\n'
|
||||
elseif type(v) == "table" then
|
||||
toprint = toprint .. M.tprint(v, indent + 2) .. ",\r\n"
|
||||
else
|
||||
toprint = toprint .. '"' .. tostring(v) .. '",\r\n'
|
||||
end
|
||||
end
|
||||
toprint = toprint .. string.rep(" ", indent - 2) .. "}"
|
||||
return toprint
|
||||
end
|
||||
|
||||
function M.log(message)
|
||||
local log_file_path = vim.fn.expand("$HOME/nvim.log")
|
||||
local log_file = io.open(log_file_path, "a")
|
||||
io.output(log_file)
|
||||
io.write(message .. "\n")
|
||||
io.close(log_file)
|
||||
local log_file_path = vim.fn.expand("$HOME/nvim.log")
|
||||
local log_file = io.open(log_file_path, "a")
|
||||
io.output(log_file)
|
||||
io.write(message .. "\n")
|
||||
io.close(log_file)
|
||||
end
|
||||
|
||||
function M.TableConcat(t1, t2)
|
||||
for i = 1, #t2 do
|
||||
t1[#t1 + 1] = t2[i]
|
||||
end
|
||||
return t1
|
||||
for i = 1, #t2 do
|
||||
t1[#t1 + 1] = t2[i]
|
||||
end
|
||||
return t1
|
||||
end
|
||||
|
||||
return M
|
||||
|
Reference in New Issue
Block a user