All plugins written to lazy instead of packer

This commit is contained in:
2024-09-11 13:38:12 +02:00
parent 51dfa68847
commit bedfd083b7
9 changed files with 209 additions and 104 deletions

View File

@@ -8,4 +8,11 @@ end
vim.keymap.set("n", "<leader>c", function() ColorMyPencils() end)
ColorMyPencils()
return {
"romainl/vim-dichromatic",
name = "dichromatic",
lazy = false,
config = function()
ColorMyPencils()
end
}

View File

@@ -1,9 +1,15 @@
local mark = require("harpoon.mark")
local ui = require("harpoon.ui")
return {
"theprimeagen/harpoon",
vim.keymap.set("n", "<leader>a", mark.add_file)
vim.keymap.set("n", "<C-e>", ui.toggle_quick_menu)
vim.keymap.set("n", "<leader>1", function() ui.nav_file(1) end)
vim.keymap.set("n", "<leader>2", function() ui.nav_file(2) end)
vim.keymap.set("n", "<leader>3", function() ui.nav_file(3) end)
vim.keymap.set("n", "<leader>4", function() ui.nav_file(4) end)
config = function()
local mark = require("harpoon.mark")
local ui = require("harpoon.ui")
vim.keymap.set("n", "<leader>a", mark.add_file)
vim.keymap.set("n", "<C-e>", ui.toggle_quick_menu)
vim.keymap.set("n", "<leader>1", function() ui.nav_file(1) end)
vim.keymap.set("n", "<leader>2", function() ui.nav_file(2) end)
vim.keymap.set("n", "<leader>3", function() ui.nav_file(3) end)
vim.keymap.set("n", "<leader>4", function() ui.nav_file(4) end)
end
}

View File

@@ -7,26 +7,3 @@ return {
}
}
return {
{
"nvim-telescope/telescope.nvim",
tag = "0.1.6",
requires = {
{ "nvim-lua/plenary.nvim" } }
},
{ "romainl/vim-dichromatic", config = function() vim.cmd('colorscheme dichromatic') end },
{
"nvim-treesitter/nvim-treesitter",
build = function()
require("nvim-treesitter.install").update({ with_sync = true })()
end
},
"nvim-treesitter/playground",
"theprimeagen/harpoon",
"mbbill/undotree",
"tpope/vim-fugitive",
{ 'VonHeikemen/lsp-zero.nvim', branch = 'v4.x' },
{ 'neovim/nvim-lspconfig' },
{ 'hrsh7th/cmp-nvim-lsp' },
{ 'hrsh7th/nvim-cmp' },
}

View File

@@ -1,46 +1,107 @@
local lsp = require('lsp-zero').preset({})
lsp.ensure_installed({
'lua_ls', -- Lua
'rust_analyzer', -- rust
'texlab', -- LaTeX
'clangd', -- C/C++
'jedi_language_server', -- Python
'html', -- HTML
'ocamllsp', -- OCaml
})
-- Fix undefined global 'vim'
lsp.configure('lua_ls', {
cmd = { 'lua-language-server' },
settings = {
Lua = {
runtime = {
version = 'LuaJIT',
path = vim.split(package.path, ';'),
},
diagnostics = {
globals = { 'vim' },
},
workspace = {
library = {
[vim.fn.expand('$VIMRUNTIME/lua')] = true,
[vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true,
},
},
},
return {
{
"VonHeikemen/lsp-zero.nvim",
branch = "v4.x",
lazy = true,
config = false,
},
{
"williamboman/mason.nvim",
lazy = false,
config = true,
},
})
lsp.on_attach(function(_, bufnr)
lsp.default_keymaps({ buffer = bufnr })
end)
-- Autocompletion
{
"hrsh7th/nvim-cmp",
event = "InsertEnter",
dependencies = {
{ "L3MON4D3/LuaSnip" },
},
config = function()
local cmp = require('cmp')
lsp.set_sign_icons({
error = '',
warn = '',
hint = '',
info = '»'
})
cmp.setup({
sources = {
{ name = "nvim_lsp" },
},
mapping = cmp.mapping.preset.insert({
['<C-Space>'] = cmp.mapping.complete(),
}),
snippet = {
expand = function(args)
vim.snippet.expand(args.body)
end,
},
})
end
},
lsp.setup()
-- LSP
{
"neovim/nvim-lspconfig",
cmd = { 'LspInfo', 'LspInstall', 'LspStart' },
event = { 'BufReadPre', 'BufNewFile' },
dependencies = {
{ "hrsh7th/cmp-nvim-lsp" },
{ "williamboman/mason.nvim" },
{ "williamboman/mason-lspconfig.nvim" },
},
config = function()
local lsp_zero = require('lsp-zero')
-- lsp_attach is where you enable features that only work
-- if there is a language server active in the file
local lsp_attach = function(client, bufnr)
local opts = { buffer = bufnr }
vim.keymap.set('n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>', opts)
vim.keymap.set('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<cr>', opts)
vim.keymap.set('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<cr>', opts)
vim.keymap.set('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<cr>', opts)
vim.keymap.set('n', 'go', '<cmd>lua vim.lsp.buf.type_definition()<cr>', opts)
vim.keymap.set('n', 'gr', '<cmd>lua vim.lsp.buf.references()<cr>', opts)
vim.keymap.set('n', 'gs', '<cmd>lua vim.lsp.buf.signature_help()<cr>', opts)
vim.keymap.set('n', '<F2>', '<cmd>lua vim.lsp.buf.rename()<cr>', opts)
vim.keymap.set({ 'n', 'x' }, '<F3>', '<cmd>lua vim.lsp.buf.format({async = true})<cr>', opts)
vim.keymap.set('n', '<F4>', '<cmd>lua vim.lsp.buf.code_action()<cr>', opts)
end
lsp_zero.extend_lspconfig({
sign_text = true,
lsp_attach = lsp_attach,
capabilities = require('cmp_nvim_lsp').default_capabilities()
})
require('mason-lspconfig').setup({
ensure_installed = {},
handlers = {
function(server_name)
require('lspconfig')[server_name].setup({})
end,
lua_ls = function()
require('lspconfig').lua_ls.setup({
settings = {
Lua = {
runtime = {
version = 'LuaJIT',
path = vim.split(package.path, ';'),
},
diagnostics = {
globals = { 'vim' },
},
workspace = {
library = {
[vim.fn.expand('$VIMRUNTIME/lua')] = true,
[vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true,
},
},
},
},
})
end,
}
})
end
}
}

View File

@@ -1,6 +1,29 @@
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>ps', function()
builtin.grep_string({ search = vim.fn.input("Grep > ") });
end)
return {
"nvim-telescope/telescope.nvim",
tag = "0.1.8",
dependencies = {
"nvim-lua/plenary.nvim"
},
config = function()
require('telescope').setup({})
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>pws', function()
local word = vim.fn.expand("<cword>")
builtin.grep_string({ search = word })
end)
vim.keymap.set('n', '<leader>pWs', function()
local word = vim.fn.expand("<cWORD>")
builtin.grep_string({ search = word })
end)
vim.keymap.set('n', '<leader>ps', function()
builtin.grep_string({ search = vim.fn.input("Grep > ") })
end)
vim.keymap.set('n', '<leader>vh', builtin.help_tags, {})
end
}

View File

@@ -1,22 +1,38 @@
require 'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all" (the five listed parsers should always be installed)
ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "rust", "cpp", "cmake", "latex", "python", "groovy",
"ocaml" },
return {
"nvim-treesitter/nvim-treesitter",
build = function()
require("nvim-treesitter.instal").update({ with_sync = true})()
end,
config = function()
require("nvim-treesitter.configs").setup({
-- List of parsers
ensure_installed = {
"vimdoc", "vim", "lua", "c", "rust", "cpp", "cmake", "latex", "python", "groovy", "bash",
},
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
sync_install = false,
auto_install = true,
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = true,
indent = {
enable = true
},
highlight = {
enable = true,
highlight = {
enable = true,
additional_vim_regex_highlighting = { "markdown" },
},
})
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
local treesitter_parser_config = require("nvim-treesitter.parsers").get_parser_configs()
treesitter_parser_config.templ = {
install_info = {
url = "https://github.com/vrischmann/tree-sitter-templ.git",
files = { "src/parser.c", "src/scanner.c" },
branch = "master",
},
}
vim .treesitter.language.register("templ", "templ")
end
}

View File

@@ -1 +1,8 @@
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
return {
"mbbill/undotree",
config = function()
vim.keymap.set("n", "<leader>u", vim.cmd.UndoTreeToggle)
end
}

View File

@@ -1 +1,6 @@
vim.keymap.set("n", "<leader>gs", vim.cmd.Git)
return {
"tpope/vim-fugitive",
config = function()
vim.keymap.set("n", "<leader>gs", vim.cmd.Git)
end
}