cmp and autopairs
This commit is contained in:
@@ -1,3 +1,26 @@
|
||||
local npairs = require('nvim-autopairs')
|
||||
local M = {}
|
||||
|
||||
npairs.setup({})
|
||||
M = {
|
||||
disable_filetype = {
|
||||
"TelescopePrompt",
|
||||
"spectre_panel",
|
||||
"snacks_picker_input",
|
||||
},
|
||||
disable_in_macro = true,
|
||||
disable_in_visualblock = false,
|
||||
disable_in_replace_mode = true,
|
||||
ignored_next_char = [=[[%w%%%'%[%"%.%`%$]]=],
|
||||
enable_moveright = true,
|
||||
enable_afterquote = true,
|
||||
enable_check_bracket_line = true,
|
||||
enable_bracket_in_quote = true,
|
||||
enable_abbr = false,
|
||||
break_undo = true,
|
||||
check_ts = false,
|
||||
map_cr = true,
|
||||
map_bs = true,
|
||||
map_c_h = false,
|
||||
map_c_w = false,
|
||||
}
|
||||
|
||||
return M
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
local cmp_kinds = {
|
||||
Text = ' ',
|
||||
Method = ' ',
|
||||
Function = ' ',
|
||||
Constructor = ' ',
|
||||
Field = ' ',
|
||||
Variable = ' ',
|
||||
Class = ' ',
|
||||
Interface = ' ',
|
||||
Module = ' ',
|
||||
Property = ' ',
|
||||
Unit = ' ',
|
||||
Value = ' ',
|
||||
Enum = ' ',
|
||||
Keyword = ' ',
|
||||
Snippet = ' ',
|
||||
Color = ' ',
|
||||
File = ' ',
|
||||
Reference = ' ',
|
||||
Folder = ' ',
|
||||
EnumMember = ' ',
|
||||
Constant = ' ',
|
||||
Struct = ' ',
|
||||
Event = ' ',
|
||||
Operator = ' ',
|
||||
TypeParameter = ' ',
|
||||
}
|
||||
|
||||
local cmp = require('cmp')
|
||||
|
||||
cmp.setup({
|
||||
preselect = 'None',
|
||||
formatting = {
|
||||
fields = { 'kind', 'abbr' },
|
||||
format = function(_, vim_item)
|
||||
vim_item.kind = cmp_kinds[vim_item.kind] or ''
|
||||
return vim_item
|
||||
end,
|
||||
}
|
||||
})
|
||||
@@ -1,6 +1,7 @@
|
||||
local cmp = require "cmp"
|
||||
local cmp_lsp = require "cmp_nvim_lsp"
|
||||
local cmp_kinds = require("assets.icons").icons.kinds
|
||||
local cmp_autopairs = require "nvim-autopairs.completion.cmp"
|
||||
|
||||
local function flatten_to_array(t)
|
||||
local res = {}
|
||||
@@ -133,9 +134,22 @@ cmp.setup {
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-e>"] = cmp.mapping.close(),
|
||||
["<CR>"] = cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Insert,
|
||||
select = true,
|
||||
["<CR>"] = cmp.mapping {
|
||||
i = function(fallback)
|
||||
if cmp.visible() and cmp.get_active_entry() then
|
||||
cmp.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = false,
|
||||
}
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
s = cmp.mapping.confirm { select = true },
|
||||
c = cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
},
|
||||
},
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
@@ -165,6 +179,7 @@ cmp.setup {
|
||||
{ name = "nvim_lua" },
|
||||
},
|
||||
}
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||
|
||||
vim.diagnostic.config {
|
||||
virtual_text = false,
|
||||
|
||||
@@ -6,19 +6,19 @@ local function pick(light, dark)
|
||||
end
|
||||
|
||||
local c = {
|
||||
bg = "#161219",
|
||||
bg_alt = "#1E1A21",
|
||||
bg_mid = pick("#2D2830", "#221E25"),
|
||||
fg = "#E9E0EA",
|
||||
fg_muted = "#CEC3D3",
|
||||
bg = "#15130F",
|
||||
bg_alt = "#1D1B17",
|
||||
bg_mid = pick("#2C2A25", "#221F1A"),
|
||||
fg = "#E8E2DA",
|
||||
fg_muted = "#CEC6B5",
|
||||
fg_strong = pick("#15161A", "#F4F4F8"),
|
||||
|
||||
normal = "#894FBF",
|
||||
insert = "#543D68",
|
||||
visual = "#B2417A",
|
||||
normal = "#514209",
|
||||
insert = "#51482F",
|
||||
visual = "#35491F",
|
||||
replace = "#93000A",
|
||||
command = pick("#FFDCF2", "#A9A5D8"),
|
||||
inactive = "#1E1A21",
|
||||
command = pick("#FFE39D", "#AAAF6E"),
|
||||
inactive = "#1D1B17",
|
||||
|
||||
normal_fg = pick("#15161A", "#F4F4F8"),
|
||||
insert_fg = pick("#15161A", "#F4F4F8"),
|
||||
|
||||
+4
-4
@@ -19,10 +19,10 @@ vim.keymap.set("n", "<A-S-Left>", require("smart-splits").resize_left)
|
||||
vim.keymap.set("n", "<A-S-Down>", require("smart-splits").resize_down)
|
||||
vim.keymap.set("n", "<A-S-Up>", require("smart-splits").resize_up)
|
||||
vim.keymap.set("n", "<A-S-Right>", require("smart-splits").resize_right)
|
||||
vim.keymap.set("n", "<A-Left>", require("smart-splits").move_cursor_left)
|
||||
vim.keymap.set("n", "<A-Down>", require("smart-splits").move_cursor_down)
|
||||
vim.keymap.set("n", "<A-Up>", require("smart-splits").move_cursor_up)
|
||||
vim.keymap.set("n", "<A-Right>", require("smart-splits").move_cursor_right)
|
||||
-- vim.keymap.set("n", "<A-Left>", require("smart-splits").move_cursor_left)
|
||||
-- vim.keymap.set("n", "<A-Down>", require("smart-splits").move_cursor_down)
|
||||
-- vim.keymap.set("n", "<A-Up>", require("smart-splits").move_cursor_up)
|
||||
-- vim.keymap.set("n", "<A-Right>", require("smart-splits").move_cursor_right)
|
||||
|
||||
-- Explorer and Undotree
|
||||
map("n", "<leader>e", function()
|
||||
|
||||
@@ -70,13 +70,6 @@ return {
|
||||
"hiphish/rainbow-delimiters.nvim",
|
||||
enabled = false,
|
||||
},
|
||||
{
|
||||
"windwp/nvim-autopairs",
|
||||
event = "InsertEnter",
|
||||
config = function()
|
||||
require "config.autopairs"
|
||||
end,
|
||||
},
|
||||
{
|
||||
"tpope/vim-fugitive",
|
||||
},
|
||||
@@ -116,6 +109,13 @@ return {
|
||||
require "config.lazydev"
|
||||
end,
|
||||
},
|
||||
{
|
||||
"windwp/nvim-autopairs",
|
||||
enabled = true,
|
||||
event = "InsertEnter",
|
||||
config = true,
|
||||
opts = require "config.autopairs",
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
enabled = true,
|
||||
@@ -131,6 +131,7 @@ return {
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"j-hui/fidget.nvim",
|
||||
"b0o/schemastore.nvim",
|
||||
"windwp/nvim-autopairs",
|
||||
},
|
||||
config = function()
|
||||
require "config.lspconfig"
|
||||
@@ -288,7 +289,6 @@ return {
|
||||
},
|
||||
{
|
||||
"Zacharias-Brohn/zterm-navigator.nvim",
|
||||
enabled = false,
|
||||
config = function()
|
||||
require "config.zterm-navigator"
|
||||
end,
|
||||
|
||||
Reference in New Issue
Block a user