rework cmp, dap and some refactoring
This commit is contained in:
parent
3246e55fd0
commit
3922b7b713
15 changed files with 264 additions and 165 deletions
|
@ -1,7 +1,7 @@
|
|||
-- vim.loader.enable()
|
||||
require('config.options')
|
||||
require('lazy-init')
|
||||
require('config.autocmds')
|
||||
require('config.filetypes')
|
||||
require('config.keymaps')
|
||||
require('funcs').set_title()
|
||||
vim.loader.enable()
|
||||
require("config.options")
|
||||
require("lazy-init")
|
||||
require("config.autocmds")
|
||||
require("config.filetypes")
|
||||
require("funcs").set_title()
|
||||
require("funcs").set_maps(require("config.keymaps").maps)
|
||||
|
|
|
@ -40,41 +40,41 @@ return {
|
|||
Untracked = "",
|
||||
ChangeDelete = "",
|
||||
Truncate = "",
|
||||
-- kind = {
|
||||
-- Array = "",
|
||||
-- Boolean = "",
|
||||
-- Class = "",
|
||||
-- Color = "",
|
||||
-- Constant = "",
|
||||
-- Constructor = "",
|
||||
-- Enum = "",
|
||||
-- EnumMember = "",
|
||||
-- Event = "",
|
||||
-- Field = "",
|
||||
-- File = "",
|
||||
-- Folder = "",
|
||||
-- Function = "",
|
||||
-- Interface = "",
|
||||
-- Key = "",
|
||||
-- Keyword = "",
|
||||
-- Method = "",
|
||||
-- Module = "",
|
||||
-- Namespace = "",
|
||||
-- Null = "",
|
||||
-- Number = "",
|
||||
-- Object = "",
|
||||
-- Operator = "",
|
||||
-- Package = "",
|
||||
-- Property = "",
|
||||
-- Reference = "",
|
||||
-- Snippet = "",
|
||||
-- String = "",
|
||||
-- Struct = "",
|
||||
-- Text = "",
|
||||
-- TypeParameter = "",
|
||||
-- Unit = "",
|
||||
-- Value = "",
|
||||
-- Variable = "",
|
||||
-- },
|
||||
lspkind = {
|
||||
Array = "",
|
||||
Boolean = "⊨",
|
||||
Class = "",
|
||||
Color = "",
|
||||
Constant = "",
|
||||
Constructor = "",
|
||||
Enum = "",
|
||||
EnumMember = "",
|
||||
Event = "",
|
||||
Field = "",
|
||||
File = "",
|
||||
Folder = "",
|
||||
Function = "",
|
||||
Interface = "",
|
||||
Key = "",
|
||||
Keyword = "",
|
||||
Method = "",
|
||||
Module = "",
|
||||
Namespace = "",
|
||||
Null = "",
|
||||
Number = "",
|
||||
Object = "",
|
||||
Operator = "",
|
||||
Package = "",
|
||||
Property = "",
|
||||
Reference = "",
|
||||
Snippet = "",
|
||||
String = "",
|
||||
Struct = "",
|
||||
Text = "",
|
||||
TypeParameter = "",
|
||||
Unit = "",
|
||||
Value = "",
|
||||
Variable = "",
|
||||
},
|
||||
-- progress = { "", "", "", "", "", "", "", "", "", "", "", "", "" },
|
||||
}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
local M = {}
|
||||
local f = require("funcs")
|
||||
local icons = require("config.icons")
|
||||
|
||||
local maps = f.empty_map_table()
|
||||
local sections = {
|
||||
|
||||
M.sections = {
|
||||
p = { desc = icons.Package .. " Packages" },
|
||||
b = { desc = icons.Buffer .. " Buffers" },
|
||||
bs = { desc = "Sort Buffers" },
|
||||
|
@ -11,6 +13,7 @@ local sections = {
|
|||
f = { desc = icons.Search .. " Find" },
|
||||
l = { desc = icons.Code .. " LSP" },
|
||||
t = { desc = icons.Console .. " Terminal" },
|
||||
u = { desc = icons.Gear .. " Utility" }
|
||||
}
|
||||
|
||||
-- Standard --
|
||||
|
@ -21,10 +24,10 @@ maps.n["<Leader>c"] = { "<Cmd>conf q<CR>", desc = "Quit" }
|
|||
maps.n["<Leader>C"] = { "<Cmd>conf qa<CR>", desc = "Quit all" }
|
||||
maps.n["<Leader>n"] = { "<Cmd>ene<CR>", desc = "New buffer" }
|
||||
maps.n["<Leader>h"] = { "<Cmd>noh<CR>", desc = "Clear highlight" }
|
||||
maps.n["<C-s>"] = { "<cmd>w!<cr>", desc = "Force write buffer" }
|
||||
maps.n["<C-q>"] = { "<cmd>qa!<cr>", desc = "Force quit all" }
|
||||
maps.n["|"] = { "<cmd>vsplit<cr>", desc = "Vertical split" }
|
||||
maps.n["\\"] = { "<cmd>split<cr>", desc = "Horizontal split" }
|
||||
maps.n["<C-s>"] = { "<Cmd>w!<cr>", desc = "Force write buffer" }
|
||||
maps.n["<C-q>"] = { "<Cmd>qa!<cr>", desc = "Force quit all" }
|
||||
maps.n["|"] = { "<Cmd>vsplit<cr>", desc = "Vertical split" }
|
||||
maps.n["\\"] = { "<Cmd>split<cr>", desc = "Horizontal split" }
|
||||
maps.v["<"] = { "<gv", desc = "Unindent line" }
|
||||
maps.v[">"] = { ">gv", desc = "Indent line" }
|
||||
maps.n["<Leader>q"] = { f.buf_close, desc = "Close buffer" }
|
||||
|
@ -32,22 +35,28 @@ maps.n["<C-b>"] = { "<C-a>" }
|
|||
maps.n["<C-f>"] = { "<Nop>" }
|
||||
maps.i["<C-h>"] = { "<C-W>" }
|
||||
|
||||
-- Utility --
|
||||
if f.is_available then
|
||||
maps.n["<Leader>u"] = M.sections.u
|
||||
maps.n["<Leader>uc"] = { "<Cmd>ColorizerToggle<CR>", desc = "Toggle colorizer" }
|
||||
end
|
||||
|
||||
-- Window Navigation --
|
||||
maps.n["<C-h>"] = { "<C-w>h", desc = "Move to left split" }
|
||||
maps.n["<C-j>"] = { "<C-w>j", desc = "Move to below split" }
|
||||
maps.n["<C-k>"] = { "<C-w>k", desc = "Move to above split" }
|
||||
maps.n["<C-l>"] = { "<C-w>l", desc = "Move to right split" }
|
||||
maps.n["<C-Up>"] = { "<cmd>resize -2<CR>", desc = "Resize split up" }
|
||||
maps.n["<C-Down>"] = { "<cmd>resize +2<CR>", desc = "Resize split down" }
|
||||
maps.n["<C-Left>"] = { "<cmd>vertical resize -2<CR>", desc = "Resize split left" }
|
||||
maps.n["<C-Right>"] = { "<cmd>vertical resize +2<CR>", desc = "Resize split right" }
|
||||
maps.t["<C-h>"] = { "<cmd>wincmd h<cr>", desc = "Terminal left window navigation" }
|
||||
maps.t["<C-j>"] = { "<cmd>wincmd j<cr>", desc = "Terminal down window navigation" }
|
||||
maps.t["<C-k>"] = { "<cmd>wincmd k<cr>", desc = "Terminal up window navigation" }
|
||||
maps.t["<C-l>"] = { "<cmd>wincmd l<cr>", desc = "Terminal right window navigation" }
|
||||
maps.n["<C-Up>"] = { "<Cmd>resize -2<CR>", desc = "Resize split up" }
|
||||
maps.n["<C-Down>"] = { "<Cmd>resize +2<CR>", desc = "Resize split down" }
|
||||
maps.n["<C-Left>"] = { "<Cmd>vertical resize -2<CR>", desc = "Resize split left" }
|
||||
maps.n["<C-Right>"] = { "<Cmd>vertical resize +2<CR>", desc = "Resize split right" }
|
||||
maps.t["<C-h>"] = { "<Cmd>wincmd h<cr>", desc = "Terminal left window navigation" }
|
||||
maps.t["<C-j>"] = { "<Cmd>wincmd j<cr>", desc = "Terminal down window navigation" }
|
||||
maps.t["<C-k>"] = { "<Cmd>wincmd k<cr>", desc = "Terminal up window navigation" }
|
||||
maps.t["<C-l>"] = { "<Cmd>wincmd l<cr>", desc = "Terminal right window navigation" }
|
||||
|
||||
-- Plugin Manager --
|
||||
maps.n["<Leader>p"] = sections.p
|
||||
maps.n["<Leader>p"] = M.sections.p
|
||||
maps.n["<Leader>ph"] = { function() require("lazy").home() end, desc = "Home" }
|
||||
maps.n["<Leader>pi"] = { function() require("lazy").install() end, desc = "Install" }
|
||||
maps.n["<Leader>pu"] = { function() require("lazy").update() end, desc = "Update" }
|
||||
|
@ -65,7 +74,7 @@ if f.is_available("bufferline.nvim") then
|
|||
maps.n["<S-h>"] = { function() require("bufferline").cycle(-1) end, desc = "Switch to previous buffer" }
|
||||
maps.n["<A-l>"] = { function() require("bufferline").move(1) end, desc = "Move buffer to next" }
|
||||
maps.n["<A-h>"] = { function() require("bufferline").move(-1) end, desc = "Move buffer to previous" }
|
||||
maps.n["<Leader>b"] = sections.b
|
||||
maps.n["<Leader>b"] = M.sections.b
|
||||
maps.n["<Leader>bc"] = { function() require("bufferline").close_others() end, desc = "Close other buffers" }
|
||||
maps.n["<Leader>bl"] = {
|
||||
function() require("bufferline").close_in_direction("left") end,
|
||||
|
@ -75,7 +84,7 @@ if f.is_available("bufferline.nvim") then
|
|||
function() require("bufferline").close_in_direction("right") end,
|
||||
desc = "Close righthand buffers"
|
||||
}
|
||||
maps.n["<Leader>bs"] = sections.bs
|
||||
maps.n["<Leader>bs"] = M.sections.bs
|
||||
maps.n["<Leader>bse"] = { function() require("bufferline").sort_by("extension") end, desc = "By extension" }
|
||||
maps.n["<Leader>bsd"] = { function() require("bufferline").sort_by("directory") end, desc = "By directory" }
|
||||
maps.n["<Leader>bsr"] = {
|
||||
|
@ -91,13 +100,13 @@ if f.is_available("Comment.nvim") then
|
|||
desc = "Toggle comment line",
|
||||
}
|
||||
maps.v["<Leader>/"] = {
|
||||
"<esc><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<cr>",
|
||||
"<esc><Cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<cr>",
|
||||
desc = "Toggle comment for selection",
|
||||
}
|
||||
end
|
||||
|
||||
if f.is_available("gitsigns.nvim") then
|
||||
maps.n["<Leader>g"] = sections.g
|
||||
maps.n["<Leader>g"] = M.sections.g
|
||||
maps.n["]g"] = { function() require("gitsigns").next_hunk() end, desc = "Next Git hunk" }
|
||||
maps.n["[g"] = { function() require("gitsigns").prev_hunk() end, desc = "Previous Git hunk" }
|
||||
maps.n["<Leader>gl"] = { function() require("gitsigns").blame_line() end, desc = "View Git blame" }
|
||||
|
@ -116,17 +125,17 @@ if f.is_available("lf.nvim") then
|
|||
end
|
||||
|
||||
if f.is_available("mason.nvim") then
|
||||
maps.n["<Leader>pm"] = { "<cmd>Mason<cr>", desc = "Mason" }
|
||||
maps.n["<Leader>pm"] = { "<Cmd>Mason<cr>", desc = "Mason" }
|
||||
end
|
||||
|
||||
if f.is_available "aerial.nvim" then
|
||||
maps.n["<leader>l"] = sections.l
|
||||
maps.n["<leader>l"] = M.sections.l
|
||||
maps.n["<leader>lS"] = { function() require("aerial").toggle() end, desc = "Symbols outline" }
|
||||
end
|
||||
|
||||
if f.is_available("telescope.nvim") then
|
||||
maps.n["<Leader>f"] = sections.f
|
||||
maps.n["<Leader>g"] = sections.g
|
||||
maps.n["<Leader>f"] = M.sections.f
|
||||
maps.n["<Leader>g"] = M.sections.g
|
||||
maps.n["<Leader>gb"] = {
|
||||
function() require("telescope.builtin").git_branches { use_file_path = true } end,
|
||||
desc = "Git branches"
|
||||
|
@ -172,7 +181,7 @@ if f.is_available("telescope.nvim") then
|
|||
end,
|
||||
desc = "Find words in all files",
|
||||
}
|
||||
maps.n["<Leader>l"] = sections.l
|
||||
maps.n["<Leader>l"] = M.sections.l
|
||||
maps.n["<Leader>ls"] = {
|
||||
function()
|
||||
local aerial_avail, _ = pcall(require, "aerial")
|
||||
|
@ -187,9 +196,9 @@ if f.is_available("telescope.nvim") then
|
|||
end
|
||||
|
||||
if f.is_available("toggleterm.nvim") then
|
||||
maps.n["<leader>t"] = sections.t
|
||||
maps.n["<leader>t"] = M.sections.t
|
||||
if vim.fn.executable "lazygit" == 1 then
|
||||
maps.n["<leader>g"] = sections.g
|
||||
maps.n["<leader>g"] = M.sections.g
|
||||
maps.n["<leader>gg"] = {
|
||||
function()
|
||||
local worktree = f.file_worktree()
|
||||
|
@ -213,10 +222,10 @@ if f.is_available("toggleterm.nvim") then
|
|||
end
|
||||
local python = vim.fn.executable "python" == 1 and "python" or vim.fn.executable "python3" == 1 and "python3"
|
||||
if python then maps.n["<leader>tp"] = { function() f.toggle_term_cmd(python) end, desc = "ToggleTerm python" } end
|
||||
maps.n["<leader>tf"] = { "<cmd>ToggleTerm direction=float<cr>", desc = "ToggleTerm float" }
|
||||
maps.n["<leader>th"] = { "<cmd>ToggleTerm size=10 direction=horizontal<cr>", desc = "ToggleTerm horizontal split" }
|
||||
maps.n["<leader>tv"] = { "<cmd>ToggleTerm size=80 direction=vertical<cr>", desc = "ToggleTerm vertical split" }
|
||||
maps.n["<F7>"] = { "<cmd>ToggleTerm<cr>", desc = "Toggle terminal" }
|
||||
maps.n["<leader>tf"] = { "<Cmd>ToggleTerm direction=float<cr>", desc = "ToggleTerm float" }
|
||||
maps.n["<leader>th"] = { "<Cmd>ToggleTerm size=10 direction=horizontal<cr>", desc = "ToggleTerm horizontal split" }
|
||||
maps.n["<leader>tv"] = { "<Cmd>ToggleTerm size=80 direction=vertical<cr>", desc = "ToggleTerm vertical split" }
|
||||
maps.n["<F7>"] = { "<Cmd>ToggleTerm<cr>", desc = "Toggle terminal" }
|
||||
maps.t["<F7>"] = maps.n["<F7>"]
|
||||
-- TODO: Patch st: https://st.suckless.org/patches/fix_keyboard_input/
|
||||
-- maps.n["<C-'>"] = maps.n["<F7>"]
|
||||
|
@ -231,8 +240,8 @@ if f.is_available "nvim-dap" then
|
|||
if condition then require("dap").set_breakpoint(condition) end
|
||||
end)
|
||||
end
|
||||
maps.n["<leader>d"] = sections.d
|
||||
maps.v["<leader>d"] = sections.d
|
||||
maps.n["<leader>d"] = M.sections.d
|
||||
maps.v["<leader>d"] = M.sections.d
|
||||
maps.n["<F5>"] = { function() require("dap").continue() end, desc = "Debugger: Start" }
|
||||
maps.n["<S-F5>"] = { function() require("dap").terminate() end, desc = "Debugger: Stop" }
|
||||
maps.n["<S-F9>"] = { conditional_breakpoint, desc = "Debugger: Conditional Breakpoint" }
|
||||
|
@ -279,4 +288,6 @@ if f.is_available "nvim-ufo" then
|
|||
maps.n["zp"] = { function() require("ufo").peekFoldedLinesUnderCursor() end, desc = "Peek fold" }
|
||||
end
|
||||
|
||||
f.set_mappings(maps)
|
||||
M.maps = maps
|
||||
|
||||
return M
|
||||
|
|
|
@ -155,7 +155,7 @@ function M.which_key_register()
|
|||
end
|
||||
end
|
||||
|
||||
function M.set_mappings(map_table, base)
|
||||
function M.set_maps(map_table, base)
|
||||
base = base or {}
|
||||
for mode, maps in pairs(map_table) do
|
||||
for keymap, options in pairs(maps) do
|
||||
|
@ -250,7 +250,7 @@ function M.lsp_on_attach(client, bufnr)
|
|||
function() vim.lsp.codelens.run() end,
|
||||
desc = "Run CodeLens",
|
||||
}
|
||||
lsp_mappings.n["<Leader>u"] = { desc = " " .. icons.Gear .. " Utility" }
|
||||
lsp_mappings.n["<Leader>u"] = { desc = icons.Gear .. " Utility" }
|
||||
lsp_mappings.n["<leader>uL"] = {
|
||||
function() vim.lsp.codelens.clear() end,
|
||||
desc = "Toggle CodeLens"
|
||||
|
@ -309,7 +309,7 @@ function M.lsp_on_attach(client, bufnr)
|
|||
-- TODO: Check this on 0.10.0 release
|
||||
if client.supports_method "textDocument/semanticTokens/full" and vim.lsp.semantic_tokens then
|
||||
vim.b[bufnr].semantic_tokens_enabled = true
|
||||
lsp_mappings.n["<Leader>u"] = { desc = " " .. icons.Gear .. " Utility" }
|
||||
lsp_mappings.n["<Leader>u"] = { desc = icons.Gear .. " Utility" }
|
||||
lsp_mappings.n["<leader>uY"] = {
|
||||
function()
|
||||
vim.b[bufnr].semantic_tokens_enabled = not vim.b[bufnr].semantic_tokens_enabled
|
||||
|
@ -382,7 +382,7 @@ function M.lsp_on_attach(client, bufnr)
|
|||
-- TODO: Check this on 0.10.0 release
|
||||
if vim.lsp.inlay_hint then
|
||||
if vim.b.inlay_hints_enabled then vim.lsp.inlay_hint.enable(bufnr, true) end
|
||||
lsp_mappings.n["<Leader>u"] = { desc = " " .. icons.Gear .. " Utility" }
|
||||
lsp_mappings.n["<Leader>u"] = { desc = icons.Gear .. " Utility" }
|
||||
lsp_mappings.n["<leader>uH"] = {
|
||||
function()
|
||||
vim.b[bufnr].inlay_hints_enabled = not vim.b[bufnr].inlay_hints_enabled
|
||||
|
@ -435,11 +435,11 @@ function M.lsp_on_attach(client, bufnr)
|
|||
end
|
||||
|
||||
if not vim.tbl_isempty(lsp_mappings.v) then
|
||||
if lsp_mappings.v["<leader>l"] then lsp_mappings.v["<leader>l"] = { desc = " " .. icons.Code .. " LSP" } end
|
||||
if lsp_mappings.v["<leader>u"] then lsp_mappings.v["<leader>u"] = { desc = " " .. icons.Code .. " LSP" } end
|
||||
if lsp_mappings.v["<leader>l"] then lsp_mappings.v["<leader>l"] = { desc = icons.Code .. " LSP" } end
|
||||
if lsp_mappings.v["<leader>u"] then lsp_mappings.v["<leader>u"] = { desc = icons.Code .. " LSP" } end
|
||||
end
|
||||
|
||||
M.set_mappings(lsp_mappings, { buffer = bufnr })
|
||||
M.set_maps(lsp_mappings, { buffer = bufnr })
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
104
.config/nvim/lua/plugins/cmp/cmp.lua
Normal file
104
.config/nvim/lua/plugins/cmp/cmp.lua
Normal file
|
@ -0,0 +1,104 @@
|
|||
local M = { "hrsh7th/nvim-cmp" }
|
||||
|
||||
M.dependencies = {
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
}
|
||||
|
||||
M.event = "InsertEnter"
|
||||
|
||||
M.opts = function()
|
||||
local cmp = require "cmp"
|
||||
local snip_status_ok, luasnip = pcall(require, "luasnip")
|
||||
local lspkind_status_ok, lspkind = pcall(require, "lspkind")
|
||||
if not snip_status_ok then return end
|
||||
|
||||
local border_opts = {
|
||||
border = "rounded",
|
||||
winhighlight = "Normal:NormalFloat,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None",
|
||||
}
|
||||
|
||||
local function has_words_before()
|
||||
local line, col = (unpack or table.unpack)(vim.api.nvim_win_get_cursor(0))
|
||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match "%s" == nil
|
||||
end
|
||||
|
||||
return {
|
||||
enabled = function()
|
||||
local dap_prompt = require("funcs").is_available "cmp-dap" -- add interoperability with cmp-dap
|
||||
and vim.tbl_contains(
|
||||
{ "dap-repl", "dapui_watches", "dapui_hover" },
|
||||
vim.api.nvim_get_option_value("filetype", { buf = 0 })
|
||||
)
|
||||
if vim.api.nvim_get_option_value("buftype", { buf = 0 }) == "prompt" and not dap_prompt then return false end
|
||||
return vim.g.cmp_enabled
|
||||
end,
|
||||
preselect = cmp.PreselectMode.None,
|
||||
formatting = {
|
||||
fields = { "kind", "abbr", "menu" },
|
||||
format = lspkind_status_ok and lspkind.cmp_format(require("funcs").plugin_opts "lspkind.nvim") or nil,
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args) luasnip.lsp_expand(args.body) end,
|
||||
},
|
||||
duplicates = {
|
||||
nvim_lsp = 1,
|
||||
luasnip = 1,
|
||||
cmp_tabnine = 1,
|
||||
buffer = 1,
|
||||
path = 1,
|
||||
},
|
||||
confirm_opts = {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = false,
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(border_opts),
|
||||
documentation = cmp.config.window.bordered(border_opts),
|
||||
},
|
||||
mapping = {
|
||||
["<Up>"] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Select },
|
||||
["<Down>"] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Select },
|
||||
["<C-p>"] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Insert },
|
||||
["<C-n>"] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Insert },
|
||||
["<C-k>"] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Insert },
|
||||
["<C-j>"] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Insert },
|
||||
["<C-u>"] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }),
|
||||
["<C-d>"] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }),
|
||||
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
|
||||
["<C-y>"] = cmp.config.disable,
|
||||
["<C-e>"] = cmp.mapping { i = cmp.mapping.abort(), c = cmp.mapping.close() },
|
||||
["<CR>"] = cmp.mapping.confirm { select = false },
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_locally_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
},
|
||||
sources = cmp.config.sources {
|
||||
{ name = "nvim_lsp", priority = 1000 },
|
||||
{ name = "luasnip", priority = 750 },
|
||||
{ name = "buffer", priority = 500 },
|
||||
{ name = "path", priority = 250 },
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
4
.config/nvim/lua/plugins/cmp/init.lua
Normal file
4
.config/nvim/lua/plugins/cmp/init.lua
Normal file
|
@ -0,0 +1,4 @@
|
|||
return {
|
||||
-- require('plugins.cmp.cmp'),
|
||||
-- require('plugins.cmp.luasnip'),
|
||||
}
|
20
.config/nvim/lua/plugins/cmp/luasnip.lua
Normal file
20
.config/nvim/lua/plugins/cmp/luasnip.lua
Normal file
|
@ -0,0 +1,20 @@
|
|||
local M = { "L3MON4D3/LuaSnip" }
|
||||
|
||||
M.lazy = true
|
||||
|
||||
M.build = "make install_jsregexp"
|
||||
|
||||
M.dependencies = { "rafamadriz/friendly-snippets" }
|
||||
|
||||
M.opts = {
|
||||
history = true,
|
||||
delete_check_events = "TextChanged",
|
||||
region_check_events = "CursorMoved",
|
||||
}
|
||||
|
||||
M.config = function(_, opts)
|
||||
require("luasnip").config.setup(opts)
|
||||
vim.tbl_map(function(type) require("luasnip.loaders.from_" .. type).lazy_load() end, { "vscode", "snipmate", "lua" })
|
||||
end
|
||||
|
||||
return M
|
|
@ -1,20 +1,17 @@
|
|||
local M = { "rcarriga/nvim-dap-ui" }
|
||||
|
||||
local opts = {}
|
||||
M.dependencies = { "nvim-dap" }
|
||||
|
||||
M.config = function()
|
||||
local dap = require("dap")
|
||||
local dapui = require("dapui")
|
||||
M.opts = {
|
||||
floating = { border = "rounded" },
|
||||
}
|
||||
|
||||
M.config = function(_, opts)
|
||||
local dap, dapui = require "dap", require "dapui"
|
||||
dap.listeners.after.event_initialized["dapui_config"] = function() dapui.open() end
|
||||
dap.listeners.before.event_terminated["dapui_config"] = function() dapui.close() end
|
||||
dap.listeners.before.event_exited["dapui_config"] = function() dapui.close() end
|
||||
dapui.setup(opts)
|
||||
dap.listeners.after.event_initialized["dapui_config"] = function()
|
||||
dapui.open({})
|
||||
end
|
||||
dap.listeners.before.event_terminated["dapui_config"] = function()
|
||||
dapui.close({})
|
||||
end
|
||||
dap.listeners.before.event_exited["dapui_config"] = function()
|
||||
dapui.close({})
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
@ -1,24 +1,5 @@
|
|||
local M = { "mfussenegger/nvim-dap" }
|
||||
|
||||
M.dependencies = {
|
||||
"mason-nvim-dap.nvim",
|
||||
"nvim-dap-ui",
|
||||
}
|
||||
|
||||
M.event = { "BufReadPost", "BufNewFile" }
|
||||
|
||||
M.config = function()
|
||||
local icons = require('config.icons')
|
||||
vim.api.nvim_set_hl(0, "DapStoppedLine", { default = true, link = "Visual" })
|
||||
vim.fn.sign_define(
|
||||
"DapBreakpoint",
|
||||
{
|
||||
text = icons.Bug,
|
||||
texthl = "DiagnosticSignError",
|
||||
linehl = "",
|
||||
numhl = "",
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
local M = { "jay-babu/mason-nvim-dap.nvim" }
|
||||
|
||||
M.opts = {
|
||||
-- ensure_installed = {},
|
||||
-- handlers = {},
|
||||
}
|
||||
M.dependencies = { "nvim-dap" }
|
||||
|
||||
M.cmd = { "DapInstall", "DapUninstall" }
|
||||
|
||||
M.opts = { handlers = {} }
|
||||
|
||||
return M
|
||||
|
|
11
.config/nvim/lua/plugins/dap/nvim-cmp.lua
Normal file
11
.config/nvim/lua/plugins/dap/nvim-cmp.lua
Normal file
|
@ -0,0 +1,11 @@
|
|||
local M = { "rcarriga/cmp-dap" }
|
||||
|
||||
M.dependencies = { "nvim-dap" }
|
||||
|
||||
M.config = function()
|
||||
require("cmp").setup.filetype({ "dap-repl", "dapui_watches", "dapui_hover" }, {
|
||||
sources = {
|
||||
{ name = "dap" },
|
||||
},
|
||||
})
|
||||
end
|
|
@ -1,7 +1,7 @@
|
|||
local M = { "norcalli/nvim-colorizer.lua" }
|
||||
local M = { "NvChad/nvim-colorizer.lua" }
|
||||
|
||||
M.event = { "BufReadPost", "BufNewFile" }
|
||||
M.cmd = { "ColorizerToggle", "ColorizerAttachToBuffer", "ColorizerDetachFromBuffer", "ColorizerReloadAllBuffers" }
|
||||
|
||||
M.opts = { '*' }
|
||||
M.opts = { user_default_options = { names = false } }
|
||||
|
||||
return M
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
local M = { "RRethy/vim-illuminate" }
|
||||
|
||||
M.event = { "BufReadPost", "BufNewFile" }
|
||||
|
||||
local opts = {
|
||||
providers = {
|
||||
"lsp",
|
||||
"treesitter",
|
||||
"regex",
|
||||
},
|
||||
delay = 200,
|
||||
filetypes_denylist = {
|
||||
"dirvish",
|
||||
"fugitive",
|
||||
"alpha",
|
||||
"NvimTree",
|
||||
"packer",
|
||||
"neogitstatus",
|
||||
"Trouble",
|
||||
"lir",
|
||||
"Outline",
|
||||
"spectre_panel",
|
||||
"toggleterm",
|
||||
"DressingSelect",
|
||||
"TelescopePrompt",
|
||||
},
|
||||
filetypes_allowlist = {},
|
||||
modes_denylist = {},
|
||||
modes_allowlist = {},
|
||||
providers_regex_syntax_denylist = {},
|
||||
providers_regex_syntax_allowlist = {},
|
||||
under_cursor = true,
|
||||
}
|
||||
|
||||
M.init = function()
|
||||
vim.g.Illuminate_ftblacklist = { 'alpha', 'NvimTree' }
|
||||
end
|
||||
|
||||
M.config = function()
|
||||
require('illuminate').configure(opts)
|
||||
end
|
||||
|
||||
return M
|
|
@ -9,7 +9,6 @@ return {
|
|||
require('plugins.misc.colorizer'),
|
||||
require('plugins.misc.comment'),
|
||||
require('plugins.misc.gitsigns'),
|
||||
-- require('plugins.misc.illuminate'),
|
||||
require('plugins.misc.indent-blankline'),
|
||||
require('plugins.misc.lf'),
|
||||
require('plugins.misc.lualine'),
|
||||
|
@ -24,4 +23,5 @@ return {
|
|||
require('plugins.misc.vimtex'),
|
||||
require('plugins.misc.which-key'),
|
||||
require('plugins.misc.wiki'),
|
||||
require('plugins.misc.lspkind'),
|
||||
}
|
||||
|
|
15
.config/nvim/lua/plugins/misc/lspkind.lua
Normal file
15
.config/nvim/lua/plugins/misc/lspkind.lua
Normal file
|
@ -0,0 +1,15 @@
|
|||
local M = { "onsails/lspkind.nvim" }
|
||||
|
||||
M.lazy = true
|
||||
|
||||
M.opts = {
|
||||
mode = "symbol",
|
||||
symbol_map = require("config.icons").lspkind,
|
||||
menu = {},
|
||||
}
|
||||
|
||||
M.config = function(plugin, opts)
|
||||
plugin.init(opts)
|
||||
end
|
||||
|
||||
return M
|
Loading…
Add table
Reference in a new issue