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