chore: fix formatting
This commit is contained in:
@@ -6,18 +6,19 @@ return {
|
||||
dependencies = {
|
||||
"python3",
|
||||
},
|
||||
py_module_deps = {
|
||||
"venv",
|
||||
},
|
||||
mason = {
|
||||
name = "python-lsp-server",
|
||||
post_install = {
|
||||
{
|
||||
command = "./venv/bin/pip",
|
||||
-- command = "sh",
|
||||
args = {
|
||||
"install",
|
||||
"python-lsp-black",
|
||||
"python-lsp-isort",
|
||||
-- "install",
|
||||
-- "python-lsp-black",
|
||||
-- "python-lsp-isort",
|
||||
"--version",
|
||||
-- "-c",
|
||||
-- "./venv/bin/pip --version",
|
||||
},
|
||||
},
|
||||
-- {
|
||||
|
||||
+27
-32
@@ -6,30 +6,33 @@ local function has_words_before()
|
||||
unpack = unpack or table.unpack
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return col ~= 0
|
||||
and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]
|
||||
and vim.api
|
||||
.nvim_buf_get_lines(0, line - 1, line, true)[1]
|
||||
:sub(col, col)
|
||||
:match(word_pattern) ~= nil
|
||||
:match(word_pattern)
|
||||
~= nil
|
||||
end
|
||||
|
||||
local function has_words_after()
|
||||
unpack = unpack or table.unpack
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return col ~= 0
|
||||
and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]
|
||||
and vim.api
|
||||
.nvim_buf_get_lines(0, line - 1, line, true)[1]
|
||||
:sub(col + 1, col + 1)
|
||||
:match(word_pattern) ~= nil
|
||||
:match(word_pattern)
|
||||
~= nil
|
||||
end
|
||||
|
||||
local function setup()
|
||||
local module_name = "plugins.config.cmp"
|
||||
local utils = require("utils")
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
local lspkind = utils.try_require("lspkind", module_name)
|
||||
local lspkind = utils.try_require("lspkind")
|
||||
|
||||
local opt = {
|
||||
preselect = cmp.PreselectMode.None,
|
||||
completion = { keyword_length = 0, },
|
||||
completion = { keyword_length = 0 },
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
@@ -61,7 +64,7 @@ local function setup()
|
||||
}),
|
||||
["<C-y>"] = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, })
|
||||
cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace })
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
@@ -97,47 +100,39 @@ local function setup()
|
||||
end,
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lsp", },
|
||||
{ name = "nvim_lsp" },
|
||||
-- { name = "luasnip", },
|
||||
{ name = "orgmode", },
|
||||
{ name = "path", },
|
||||
{ name = "orgmode" },
|
||||
{ name = "path" },
|
||||
},
|
||||
}
|
||||
|
||||
utils.try_require("moonfly", module_name, function (_)
|
||||
if utils.try_require("moonfly") then
|
||||
local winhighlight = {
|
||||
winhighlight =
|
||||
"Normal:NormalFloat,FloatBorder:FloatBorder,CursorLine:PmenuSel",
|
||||
winhighlight = "Normal:NormalFloat,FloatBorder:FloatBorder,CursorLine:PmenuSel",
|
||||
}
|
||||
opt.window = {
|
||||
completion = cmp.config.window.bordered(winhighlight),
|
||||
documentation = cmp.config.window.bordered(winhighlight),
|
||||
}
|
||||
end)
|
||||
end
|
||||
|
||||
cmp.setup(opt)
|
||||
|
||||
cmp.setup.cmdline(
|
||||
"/",
|
||||
{
|
||||
cmp.setup.cmdline("/", {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = { { name = "buffer", }, },
|
||||
}
|
||||
)
|
||||
sources = { { name = "buffer" } },
|
||||
})
|
||||
|
||||
cmp.setup.cmdline(
|
||||
":",
|
||||
{
|
||||
cmp.setup.cmdline(":", {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources(
|
||||
{ { name = "path", }, },
|
||||
{ {
|
||||
sources = cmp.config.sources({ { name = "path" } }, {
|
||||
{
|
||||
name = "cmdline",
|
||||
option = { ignore_cmds = { "Man", "!", }, },
|
||||
}, }
|
||||
),
|
||||
}
|
||||
)
|
||||
option = { ignore_cmds = { "Man", "!" } },
|
||||
},
|
||||
}),
|
||||
})
|
||||
end
|
||||
|
||||
return setup
|
||||
|
||||
Reference in New Issue
Block a user