added illuminate, flutter tools, comment, headlines, barbecue; improved
cmp
This commit is contained in:
61
after/plugin/cmp.lua
Normal file
61
after/plugin/cmp.lua
Normal file
@@ -0,0 +1,61 @@
|
||||
local cmp = require("cmp")
|
||||
local lspkind = require("lspkind")
|
||||
|
||||
local cmp_select = { behavior = cmp.SelectBehavior.Select }
|
||||
local border = { "┌", "─", "┐", "│", "┘", "─", "└", "│" }
|
||||
local winhighlight = "Normal:CmpPmenu,FloatBorder:CmpPmenuBorder,CursorLine:PmenuSel,Search:None"
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "path" },
|
||||
{ name = "nvim_lsp_signature_help" },
|
||||
{ name = "nvim_lua" },
|
||||
{ name = "luasnip", keyword_length = 2 },
|
||||
{ name = "buffer", keyword_length = 3 },
|
||||
},
|
||||
view = {
|
||||
entries = "custom",
|
||||
},
|
||||
completion = {
|
||||
completeopt = "menuone,noselect,preview",
|
||||
docs_initially_visible = true,
|
||||
},
|
||||
window = {
|
||||
documentation = {
|
||||
border = border,
|
||||
winhighlight = winhighlight,
|
||||
},
|
||||
completion = {
|
||||
border = border,
|
||||
winhighlight = winhighlight,
|
||||
},
|
||||
},
|
||||
|
||||
formatting = {
|
||||
fields = { "kind", "abbr", "menu" },
|
||||
format = function(entry, vim_item)
|
||||
local kind = lspkind.cmp_format({ mode = "symbol_text", maxwidth = 50 })(entry, vim_item)
|
||||
local strings = vim.split(kind.kind, "%s", { trimempty = true })
|
||||
kind.kind = " " .. (strings[1] or "") .. " "
|
||||
kind.menu = " (" .. (strings[2] or "") .. ")"
|
||||
|
||||
return kind
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-p>"] = cmp.mapping.select_prev_item(cmp_select),
|
||||
["<C-n>"] = cmp.mapping.select_next_item(cmp_select),
|
||||
["<C-k>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-j>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-y>"] = cmp.mapping.confirm({ select = true }),
|
||||
["<C-g>"] = cmp.mapping.complete(),
|
||||
["<Tab>"] = nil,
|
||||
["<S-Tab>"] = nil,
|
||||
}),
|
||||
})
|
||||
@@ -1,17 +1,20 @@
|
||||
function Color(color)
|
||||
color = color or "catppuccin-mocha"
|
||||
vim.cmd.colorscheme(color)
|
||||
local catppuccin_colors = require('catppuccin.palettes').get_palette('mocha')
|
||||
|
||||
vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
|
||||
vim.api.nvim_set_hl(0, "NormalNC", { bg = "none" })
|
||||
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
|
||||
vim.api.nvim_set_hl(0, "StatusLine", { bg = "none" })
|
||||
-- If Vim thinks StatusLine and StatusLineNC are the same it overrides these settings
|
||||
vim.api.nvim_set_hl(0, "StatusLineNC", { ctermbg = 0, bg = "none" })
|
||||
vim.api.nvim_set_hl(0, "CursorLine", { link = "Visual" })
|
||||
vim.api.nvim_set_hl(0, "Pmenu", { link = "Normal" })
|
||||
vim.api.nvim_set_hl(0, "PmenuSel", { link = "Visual" })
|
||||
vim.api.nvim_set_hl(0, "PmenuSbar", { link = "Normal" })
|
||||
color = color or "catppuccin-mocha"
|
||||
vim.cmd.colorscheme(color)
|
||||
|
||||
vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
|
||||
vim.api.nvim_set_hl(0, "NormalNC", { bg = "none" })
|
||||
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
|
||||
vim.api.nvim_set_hl(0, "StatusLine", { bg = "none" })
|
||||
-- If Vim thinks StatusLine and StatusLineNC are the same it overrides these settings
|
||||
vim.api.nvim_set_hl(0, "StatusLineNC", { ctermbg = 0, bg = "none" })
|
||||
vim.api.nvim_set_hl(0, "CursorLine", { link = "Visual" })
|
||||
vim.api.nvim_set_hl(0, "Pmenu", { link = "Normal" })
|
||||
vim.api.nvim_set_hl(0, "PmenuSel", { link = "Visual" })
|
||||
vim.api.nvim_set_hl(0, "PmenuSbar", { link = "Normal" })
|
||||
vim.api.nvim_set_hl(0, "CmpPmenuBorder", { fg = catppuccin_colors.surface2 })
|
||||
end
|
||||
|
||||
Color()
|
||||
|
||||
@@ -6,6 +6,7 @@ conform.setup({
|
||||
cs = { "csharpier" },
|
||||
javascript = { { "prettierd", "prettier" } },
|
||||
rust = { "rustfmt" },
|
||||
dart = { "dart_format" }
|
||||
},
|
||||
})
|
||||
|
||||
@@ -18,5 +19,7 @@ conform.formatters.rustfmt = {
|
||||
}
|
||||
|
||||
vim.keymap.set("n", "<leader>f", function()
|
||||
conform.format({ bufnr = vim.lsp.bufnr })
|
||||
if not conform.format({ bufnr = vim.lsp.bufnr }) then
|
||||
vim.lsp.buf.format()
|
||||
end
|
||||
end)
|
||||
|
||||
1
after/plugin/flutter-tools.lua
Normal file
1
after/plugin/flutter-tools.lua
Normal file
@@ -0,0 +1 @@
|
||||
require("flutter-tools").setup({})
|
||||
@@ -4,10 +4,9 @@ local harpoon = require("harpoon")
|
||||
harpoon:setup()
|
||||
-- REQUIRED
|
||||
|
||||
vim.keymap.set("n", "<leader>a", function() harpoon:list():append() end)
|
||||
vim.keymap.set("n", "<leader>a", function() harpoon:list():add() end)
|
||||
vim.keymap.set("n", "<C-e>", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end)
|
||||
|
||||
vim.keymap.set("n", "<leader>1", function() harpoon:list():select(1) end)
|
||||
vim.keymap.set("n", "<leader>2", function() harpoon:list():select(2) end)
|
||||
vim.keymap.set("n", "<leader>3", function() harpoon:list():select(3) end)
|
||||
vim.keymap.set("n", "<leader>4", function() harpoon:list():select(4) end)
|
||||
for i = 1, 9, 1 do
|
||||
vim.keymap.set("n", string.format("<leader>%s", i), function() harpoon:list():select(i) end)
|
||||
end
|
||||
|
||||
@@ -1,146 +1,111 @@
|
||||
local cmp = require('cmp')
|
||||
local default_capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
local default_capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
local capabilities = vim.tbl_deep_extend(
|
||||
'force',
|
||||
{},
|
||||
vim.lsp.protocol.make_client_capabilities(),
|
||||
default_capabilities
|
||||
)
|
||||
local lsp_default_capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
|
||||
require('mason').setup({})
|
||||
require('mason-lspconfig').setup({
|
||||
ensure_installed = { 'tsserver', 'rust_analyzer' },
|
||||
handlers = {
|
||||
function(server_name)
|
||||
require('lspconfig')[server_name].setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
end,
|
||||
['lua_ls'] = function()
|
||||
local lspconfig = require('lspconfig')
|
||||
lspconfig.lua_ls.setup {
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { 'vim' }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
}
|
||||
local capabilities = vim.tbl_deep_extend("force", {}, lsp_default_capabilities, default_capabilities)
|
||||
|
||||
require("mason").setup({})
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = { "tsserver", "rust_analyzer" },
|
||||
handlers = {
|
||||
function(server_name)
|
||||
require("lspconfig")[server_name].setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
["lua_ls"] = function()
|
||||
local lspconfig = require("lspconfig")
|
||||
lspconfig.lua_ls.setup({
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
require('lspconfig').yamlls.setup({
|
||||
on_attach = function(client, bufnr)
|
||||
client.resolved_capabilities.document_formatting = true
|
||||
end,
|
||||
settings = {
|
||||
yaml = {
|
||||
customTags = { '!enemy', '!delay', '!composite' },
|
||||
validate = false,
|
||||
format = {
|
||||
enable = true
|
||||
}
|
||||
}
|
||||
}
|
||||
require("lspconfig").yamlls.setup({
|
||||
on_attach = function(client, bufnr)
|
||||
client.resolved_capabilities.document_formatting = true
|
||||
end,
|
||||
settings = {
|
||||
yaml = {
|
||||
customTags = { "!enemy", "!delay", "!composite" },
|
||||
validate = false,
|
||||
format = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
require('lspconfig').tsserver.setup {
|
||||
settings = {
|
||||
typescript = {
|
||||
preferences = {
|
||||
quoteStype = 'single'
|
||||
}
|
||||
},
|
||||
javascript = {
|
||||
preferences = {
|
||||
quoteStyle = 'single'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
local cmp_select = { behavior = cmp.SelectBehavior.Select }
|
||||
|
||||
local lspkind = require('lspkind')
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end
|
||||
},
|
||||
sources = {
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'path' },
|
||||
{ name = 'nvim_lsp_signature_help' },
|
||||
{ name = 'nvim_lua' },
|
||||
{ name = 'luasnip', keyword_length = 2 },
|
||||
{ name = 'buffer', keyword_length = 3 },
|
||||
},
|
||||
view = {
|
||||
entries = 'native',
|
||||
},
|
||||
completion = {
|
||||
completeopt = 'menuone,noselect,preview',
|
||||
docs_initially_visible = true
|
||||
},
|
||||
window = {
|
||||
documentation = cmp.config.window.bordered()
|
||||
},
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
mode = 'symbol_text',
|
||||
menu = ({
|
||||
buffer = '[Buffer]',
|
||||
nvim_lsp = '[LSP]',
|
||||
nvim_lua = '[Lua]',
|
||||
luasnip = '[LuaSnip]'
|
||||
})
|
||||
})
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
|
||||
['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
|
||||
['<C-y>'] = cmp.mapping.confirm({ select = true }),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<Tab>'] = nil,
|
||||
['<S-Tab>'] = nil
|
||||
}),
|
||||
require("lspconfig").tsserver.setup({
|
||||
settings = {
|
||||
typescript = {
|
||||
preferences = {
|
||||
quoteStype = "single",
|
||||
},
|
||||
},
|
||||
javascript = {
|
||||
preferences = {
|
||||
quoteStyle = "single",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
callback = function(args)
|
||||
local bufnr = args.buf
|
||||
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
callback = function(args)
|
||||
local bufnr = args.buf
|
||||
local opts = { buffer = bufnr, remap = false }
|
||||
|
||||
local opts = { buffer = bufnr, remap = false }
|
||||
|
||||
vim.keymap.set('n', 'gd', function() vim.lsp.buf.definition() end, opts)
|
||||
vim.keymap.set('n', 'K', function() vim.lsp.buf.hover() end, opts)
|
||||
vim.keymap.set('n', '<leader>vws', function() vim.lsp.buf.workspace_symbol() end, opts)
|
||||
vim.keymap.set('n', '<leader>vd', function() vim.diagnostic.open_float() end, opts)
|
||||
vim.keymap.set('n', '[d', function() vim.diagnostic.goto_next() end, opts)
|
||||
vim.keymap.set('n', ']d', function() vim.diagnostic.goto_prev() end, opts)
|
||||
vim.keymap.set('n', '<leader>vca', function() vim.lsp.buf.code_action() end, opts)
|
||||
vim.keymap.set('n', '<leader>vrr', function() vim.lsp.buf.references() end, opts)
|
||||
vim.keymap.set('n', '<leader>vrn', function() vim.lsp.buf.rename() end, opts)
|
||||
vim.keymap.set('i', '<C-h>', function() vim.lsp.buf.signature_help() end, opts)
|
||||
end,
|
||||
vim.keymap.set("n", "gd", function()
|
||||
vim.lsp.buf.definition()
|
||||
end, opts)
|
||||
vim.keymap.set("n", "K", function()
|
||||
vim.lsp.buf.hover()
|
||||
end, opts)
|
||||
vim.keymap.set("n", "<leader>vws", function()
|
||||
vim.lsp.buf.workspace_symbol()
|
||||
end, opts)
|
||||
vim.keymap.set("n", "<leader>vd", function()
|
||||
vim.diagnostic.open_float()
|
||||
end, opts)
|
||||
vim.keymap.set("n", "[d", function()
|
||||
vim.diagnostic.goto_next()
|
||||
end, opts)
|
||||
vim.keymap.set("n", "]d", function()
|
||||
vim.diagnostic.goto_prev()
|
||||
end, opts)
|
||||
vim.keymap.set("n", "<leader>vca", function()
|
||||
vim.lsp.buf.code_action()
|
||||
end, opts)
|
||||
vim.keymap.set("n", "<leader>vrr", function()
|
||||
vim.lsp.buf.references()
|
||||
end, opts)
|
||||
vim.keymap.set("n", "<leader>vrn", function()
|
||||
vim.lsp.buf.rename()
|
||||
end, opts)
|
||||
vim.keymap.set("i", "<C-h>", function()
|
||||
vim.lsp.buf.signature_help()
|
||||
end, opts)
|
||||
end,
|
||||
})
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_text = true,
|
||||
update_in_insert = true,
|
||||
float = {
|
||||
focusable = false,
|
||||
style = 'minimal',
|
||||
border = 'rounded',
|
||||
source = 'always',
|
||||
header = '',
|
||||
prefix = ''
|
||||
}
|
||||
virtual_text = true,
|
||||
update_in_insert = true,
|
||||
float = {
|
||||
focusable = false,
|
||||
style = "minimal",
|
||||
border = "rounded",
|
||||
source = "always",
|
||||
header = "",
|
||||
prefix = "",
|
||||
},
|
||||
})
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
local builtin = require('telescope.builtin')
|
||||
vim.keymap.set("n", "<leader>pf", builtin.find_files, {})
|
||||
vim.keymap.set("n", "<C-p>", builtin.git_files, {})
|
||||
vim.keymap.set('n', '<leader>pf', builtin.find_files, {})
|
||||
vim.keymap.set('n', '<C-p>', builtin.git_files, {})
|
||||
vim.keymap.set('n', '<leader>pt', ':TodoTelescope<CR>')
|
||||
vim.keymap.set("n", "<leader>ps", function()
|
||||
local status, result = pcall(function() return vim.fn.input("Grep > ") end)
|
||||
vim.keymap.set('n', '<leader>ps', function()
|
||||
local status, result = pcall(function() return vim.fn.input('Grep > ') end)
|
||||
--
|
||||
-- prevent keyboard interrupt error
|
||||
if not status then
|
||||
@@ -13,4 +13,6 @@ vim.keymap.set("n", "<leader>ps", function()
|
||||
builtin.grep_string({ search = result });
|
||||
end)
|
||||
|
||||
vim.api.nvim_set_hl(0, "TelescopeSelection", { link = "Visual" })
|
||||
vim.keymap.set('n', '<C-b>', ':Telescope buffers<CR>');
|
||||
|
||||
vim.api.nvim_set_hl(0, 'TelescopeSelection', { link = 'Visual' })
|
||||
|
||||
Reference in New Issue
Block a user