Update everything, improve autocomplete and snippets.
This commit is contained in:
37
lua/dan/completion.lua
Normal file
37
lua/dan/completion.lua
Normal file
@@ -0,0 +1,37 @@
|
||||
-- vim.opt.completeopt = { "menu", "menuone", "noselect" }
|
||||
-- vim.opt.shortmess:append "c"
|
||||
|
||||
local lspkind = require "lspkind"
|
||||
lspkind.init {}
|
||||
|
||||
local cmp = require "cmp"
|
||||
|
||||
cmp.setup {
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "cody" },
|
||||
{ name = "path" },
|
||||
{ name = "buffer" },
|
||||
},
|
||||
mapping = {
|
||||
["<C-n>"] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Insert },
|
||||
["<C-p>"] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Insert },
|
||||
["<C-y>"] = cmp.mapping(
|
||||
cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Insert,
|
||||
select = true,
|
||||
},
|
||||
{ "i", "c" }
|
||||
),
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
-- Enable luasnip to handle snippet expansion for nvim-cmp
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
vim.snippet.expand(args.body)
|
||||
end,
|
||||
},
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
vim.g.mapleader = " "
|
||||
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
|
||||
vim.keymap.set("n", "<leader>gg", vim.cmd.LazyGit)
|
||||
vim.keymap.set("n", "<leader>nt", function()
|
||||
vim.cmd("tabnew")
|
||||
end)
|
||||
vim.cmd("set expandtab")
|
||||
vim.cmd("set tabstop=2")
|
||||
vim.cmd("set softtabstop=2")
|
||||
@@ -13,7 +16,7 @@ vim.cmd("set rnu")
|
||||
vim.cmd("set number relativenumber")
|
||||
vim.cmd("set nu rnu")
|
||||
vim.api.nvim_set_option("clipboard","unnamed")
|
||||
vim.api.nvim_create_user_command("DiagnosticToggle", function()
|
||||
vim.api.nvim_create_user_command("DiagnosticsToggle", function()
|
||||
local config = vim.diagnostic.config
|
||||
local vt = config().virtual_text
|
||||
config {
|
||||
|
||||
@@ -1,44 +1,18 @@
|
||||
return {
|
||||
{
|
||||
"hrsh7th/cmp-nvim-lsp"
|
||||
},
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
dependencies = {
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"rafamadriz/friendly-snippets"
|
||||
}
|
||||
},
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
lazy = false,
|
||||
priority = 100,
|
||||
dependencies = {
|
||||
"onsails/lspkind.nvim",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-buffer",
|
||||
{ "L3MON4D3/LuaSnip", build = "make install_jsregexp" },
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
},
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
||||
end,
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
-- { name = 'nvim_lsp' },
|
||||
-- { name = 'vsnip' }, -- For vsnip users.
|
||||
{ name = 'luasnip' }, -- For luasnip users.
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
})
|
||||
require "dan.completion"
|
||||
end
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,36 +1,35 @@
|
||||
return {
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
config = function()
|
||||
require("mason").setup()
|
||||
end
|
||||
},
|
||||
{
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
config = function()
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = { "lua_ls", "phpactor", "rust_analyzer" }
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
config = function()
|
||||
require("mason").setup()
|
||||
end,
|
||||
},
|
||||
{
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
config = function()
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = { "lua_ls", "phpactor", "rust_analyzer" },
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
config = function()
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
local lspconfig = require("lspconfig")
|
||||
lspconfig.lua_ls.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
config = function()
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
local lspconfig = require("lspconfig")
|
||||
lspconfig.lua_ls.setup({
|
||||
capabilities = capabilities
|
||||
lspconfig.phpactor.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
lspconfig.phpactor.setup({
|
||||
capabilities = capabilities
|
||||
lspconfig.rust_analyzer.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
lspconfig.rust_analyzer.setup({
|
||||
capabilities = capabilities
|
||||
})
|
||||
vim.keymap.set("n", 'K', vim.lsp.buf.hover, {})
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, {})
|
||||
vim.keymap.set({ 'n' }, '<leader>ca', vim.lsp.buf.code_action, {})
|
||||
|
||||
end
|
||||
}
|
||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, {})
|
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, {})
|
||||
vim.keymap.set({ "n" }, "<leader>ca", vim.lsp.buf.code_action, {})
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
1
lua/plugins/strudel.lua
Normal file
1
lua/plugins/strudel.lua
Normal file
@@ -0,0 +1 @@
|
||||
return {}
|
||||
@@ -4,10 +4,10 @@ return {
|
||||
config = function()
|
||||
local configs = require("nvim-treesitter.configs")
|
||||
configs.setup({
|
||||
ensure_installed = { "php", "lua", "vim", "javascript", "html", "yaml", "twig" },
|
||||
ensure_installed = { "php", "lua", "vim", "javascript", "html", "yaml", "twig", "vimdoc", "markdown", "markdown_inline" },
|
||||
sync_install = false,
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
indent = { enable = true },
|
||||
})
|
||||
end
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user