first neovim config - improvements and splitting up needed
This commit is contained in:
parent
fc56f9f612
commit
c28de2b97c
1 changed files with 111 additions and 0 deletions
|
@ -1 +1,112 @@
|
||||||
|
vim.opt.number = true
|
||||||
|
vim.opt.expandtab = true
|
||||||
|
vim.opt.number = true
|
||||||
|
vim.opt.tabstop = 2
|
||||||
|
vim.opt.softtabstop = 2
|
||||||
|
vim.opt.shiftwidth = 2
|
||||||
|
vim.opt.title = true
|
||||||
|
vim.opt.whichwrap = "<,>,[,]"
|
||||||
|
|
||||||
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
|
if not vim.loop.fs_stat(lazypath) then
|
||||||
|
vim.fn.system({
|
||||||
|
"git",
|
||||||
|
"clone",
|
||||||
|
"--filter=blob:none",
|
||||||
|
"https://github.com/folke/lazy.nvim.git",
|
||||||
|
"--branch=stable", -- latest stable release
|
||||||
|
lazypath,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
|
local plugins = {
|
||||||
|
{ "catppuccin/nvim", name = "catppuccin", priority = 1000 },
|
||||||
|
{ "rebelot/kanagawa.nvim", name = "kanagawa", priority = 1000 },
|
||||||
|
{
|
||||||
|
"nvim-telescope/telescope.nvim", tag = "0.1.6",
|
||||||
|
dependencies = { "nvim-lua/plenary.nvim" }
|
||||||
|
},
|
||||||
|
{ "nvim-treesitter/nvim-treesitter", build = ":TSUpdate" },
|
||||||
|
{ "williamboman/mason.nvim" },
|
||||||
|
{ "williamboman/mason-lspconfig.nvim" },
|
||||||
|
{ "neovim/nvim-lspconfig" },
|
||||||
|
{ "hrsh7th/cmp-nvim-lsp" },
|
||||||
|
{
|
||||||
|
"L3MON4D3/LuaSnip",
|
||||||
|
dependencies = {
|
||||||
|
"saadparwaiz1/cmp_luasnip",
|
||||||
|
"rafamadriz/friendly-snippets",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ "hrsh7th/nvim-cmp" },
|
||||||
|
}
|
||||||
|
local opts = {}
|
||||||
|
|
||||||
|
require("lazy").setup(plugins, opts)
|
||||||
|
|
||||||
|
--vim.cmd.colorscheme "catppuccin"
|
||||||
|
vim.cmd.colorscheme "kanagawa"
|
||||||
|
local builtin = require("telescope.builtin")
|
||||||
|
|
||||||
|
local configs = require("nvim-treesitter.configs")
|
||||||
|
|
||||||
|
configs.setup({
|
||||||
|
ensure_installed = { "asm", "c", "javascript", "latex", "lua", "matlab", "meson", "sql", "toml", "typescript", "vue" },
|
||||||
|
highlight = { enable = true },
|
||||||
|
indent = { enable = true }
|
||||||
|
})
|
||||||
|
|
||||||
|
require("mason").setup()
|
||||||
|
require("mason-lspconfig").setup({
|
||||||
|
ensure_installed = { "clangd", "texlab", "lua_ls", "matlab_ls", "mesonlsp", "sqlls", "tsserver", "volar" }
|
||||||
|
})
|
||||||
|
|
||||||
|
local lspconfig = require("lspconfig")
|
||||||
|
|
||||||
|
lspconfig.clangd.setup({
|
||||||
|
cmd = { "clangd", "-header-insertion=never" },
|
||||||
|
})
|
||||||
|
lspconfig.lua_ls.setup({})
|
||||||
|
lspconfig.matlab_ls.setup({})
|
||||||
|
lspconfig.mesonlsp.setup({})
|
||||||
|
lspconfig.sqlls.setup({})
|
||||||
|
lspconfig.texlab.setup({})
|
||||||
|
lspconfig.tsserver.setup({})
|
||||||
|
lspconfig.volar.setup({})
|
||||||
|
|
||||||
|
local cmp = require("cmp")
|
||||||
|
require("luasnip.loaders.from_vscode").lazy_load()
|
||||||
|
|
||||||
|
cmp.setup({
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
require("luasnip").lsp_expand(args.body)
|
||||||
|
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 }),
|
||||||
|
}),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = "nvim_lsp" },
|
||||||
|
{ name = "luasnip" }, -- For luasnip users.
|
||||||
|
}, {
|
||||||
|
{ name = "buffer" },
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.keymap.set("n", "T", function() vim.lsp.buf.definition() end, {})
|
||||||
|
vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, {})
|
||||||
|
vim.keymap.set("n", "J", function() vim.lsp.buf.type_definition() end, {})
|
||||||
|
vim.keymap.set("n", "C", function() vim.lsp.buf.code_action() end, {})
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<C-p>", builtin.find_files, {})
|
||||||
|
vim.keymap.set("n", "<C-f>", builtin.live_grep, {})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue