Replaced packer with lazyvim plugin manager

This commit is contained in:
2024-02-27 17:08:10 +01:00
parent 7c0dd99803
commit d548c4027e
23 changed files with 324 additions and 149 deletions

View File

@@ -1,9 +0,0 @@
function ActivateColorScheme(color)
color = color or "catppuccin-mocha"
vim.cmd.colorscheme(color)
vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
end
ActivateColorScheme()

View File

@@ -1,2 +0,0 @@
-- Disable copilot by default
vim.g.copilot_enabled = false

View File

@@ -1 +0,0 @@
vim.keymap.set("n", "<leader>gs", vim.cmd.Git);

View File

@@ -1,11 +0,0 @@
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", "<C-u>", function() ui.nav_file(1) end)
vim.keymap.set("n", "<C-i>", function() ui.nav_file(2) end)
vim.keymap.set("n", "<C-o>", function() ui.nav_file(3) end)
-- Conflicts with find git files -- vim.keymap.set("n", "<C-p>", function() ui.nav_file(4) end)

View File

@@ -1,89 +0,0 @@
-- custom lsp per project
require("neoconf").setup({
-- override any of the default settings here
plugins = {
-- configures lsp clients with settings in the following order:
-- - lua settings passed in lspconfig setup
-- - global json settings
-- - local json settings
lspconfig = {
enabled = true,
},
-- configures jsonls to get completion in .nvim.settings.json files
jsonls = {
enabled = true,
-- only show completion in json settings for configured lsp servers
configured_servers_only = false,
},
-- configures lua_ls to get completion of lspconfig server settings
lua_ls = {
-- by default, lua_ls annotations are only enabled in your neovim config directory
enabled_for_neovim_config = true,
-- explicitely enable adding annotations. Mostly relevant to put in your local .nvim.settings.json file
enabled = false,
},
},
})
local lsp = require('lsp-zero')
lsp.on_attach(function(client, bufnr)
-- see :help lsp-zero-keybindings
-- to learn the available actions
lsp.default_keymaps({buffer = bufnr})
end)
lsp.extend_cmp()
require('mason').setup({})
require('mason-lspconfig').setup({
-- Replace the language servers listed here
-- with the ones you want to install
ensure_installed = {'eslint', 'tsserver', 'rust_analyzer', 'lua_ls', 'clangd',
'volar', 'pylsp'},
-- handlers = {
-- lsp.default_setup,
-- lua_ls = function()
-- -- (Optional) Configure lua language server for neovim
-- require('lspconfig').lua_ls.setup(lsp.nvim_lua_ls())
-- end,
-- },
})
require('mason-lspconfig').setup_handlers({
function(server_name)
local server_config = {}
if require("neoconf").get(server_name .. ".disable") then
return
end
if server_name == "volar" then
server_config.filetypes = { 'vue', 'typescript', 'javascript' }
end
require('lspconfig')[server_name].setup(server_config)
end,
})
local cmp = require('cmp')
local cmp_action = require('lsp-zero').cmp_action()
cmp.setup({
mapping = {
-- `Enter` key to confirm completion
['<CR>'] = cmp.mapping.confirm({select = false}),
-- Alt+Space to trigger completion menu
['<M-Space>'] = cmp.mapping.complete(),
-- Tab to change item in completion menu
['<Tab>'] = cmp_action.tab_complete(),
-- Shift+Tab goes to the previus item in the completion menu
['<S-Tab>'] = cmp_action.select_prev_or_fallback(),
-- Navigate between documentation
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-r>'] = cmp.mapping.scroll_docs(-4),
}
})
lsp.set_preferences({
sign_icons = {}
})

View File

@@ -1,6 +0,0 @@
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)

View File

@@ -1,26 +0,0 @@
require'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all" (the five listed parsers should always be installed)
ensure_installed = {"javascript", "typescript", "rust", "c", "lua", "vim", "vimdoc", "query" },
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = true,
-- List of parsers to ignore installing (for "all")
-- ignore_install = { "javascript" },
---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
highlight = {
enable = true,
-- 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,
},
}

View File

@@ -1 +0,0 @@
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)

View File

@@ -0,0 +1,21 @@
{
"LuaSnip": { "branch": "master", "commit": "f3b3d3446bcbfa62d638b1903ff00a78b2b730a1" },
"catppuccin": { "branch": "main", "commit": "c0de3b46811fe1ce3912e2245a9dfbea6b41c300" },
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
"copilot.vim": { "branch": "release", "commit": "8f24a74d5937c1fb28fbce5caf05ffc633093fc5" },
"harpoon": { "branch": "master", "commit": "ccae1b9bec717ae284906b0bf83d720e59d12b91" },
"lazy.nvim": { "branch": "main", "commit": "aedcd79811d491b60d0a6577a9c1701063c2a609" },
"lsp-zero.nvim": { "branch": "v3.x", "commit": "009ace7a0ca360d9299ff7eb33364b5c16556561" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "21d33d69a81f6351e5a5f49078b2e4f0075c8e73" },
"mason.nvim": { "branch": "main", "commit": "3b5068f0fc565f337d67a2d315d935f574848ee7" },
"neoconf.nvim": { "branch": "main", "commit": "faab415b0ba57f0a15a82210f346f662e6551e1a" },
"nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" },
"nvim-lspconfig": { "branch": "master", "commit": "b1a11b042d015df5b8f7f33aa026e501b639c649" },
"nvim-treesitter": { "branch": "master", "commit": "db12bd416e2764420047e4a5d6b96fe44e4377d5" },
"plenary.nvim": { "branch": "master", "commit": "4f71c0c4a196ceb656c824a70792f3df3ce6bb6d" },
"telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" },
"undotree": { "branch": "master", "commit": "9dbbf3b7d19dda0d22ceca461818e4739ad8154d" },
"vim-fugitive": { "branch": "master", "commit": "2e88f14a585c014691904ba8fe39e6ea851c9422" },
"vim-tmux-navigator": { "branch": "master", "commit": "38b1d0402c4600543281dc85b3f51884205674b6" },
"vimwiki": { "branch": "dev", "commit": "fde35bb87e45abe930eebef5ab99a16289e53789" }
}

View File

@@ -1,4 +1,5 @@
require("configs.remap")
require("configs.packer")
require("configs.set")
require("configs.templates")
require("configs.remap") -- set remps like leader and other useful ones
require("configs.set") -- set vim preferences
-- require("configs.packer")
require("configs.lazy") -- configure lazy plugin manager
require("configs.templates") -- configure templates for various files

View File

@@ -0,0 +1,15 @@
-- Bootstrap lazy plugin manager
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)
require("lazy").setup("plugins")

View File

@@ -0,0 +1,29 @@
return {
{ "catppuccin/nvim", name = "catppuccin", priority = 1000,
config = function()
require('catppuccin').setup({
term_colors = false,
transparent_background = true,
styles = {
comments = {},
conditionals = {},
loops = {},
functions = {},
keywords = {},
strings = {},
variables = {},
numbers = {},
booleans = {},
properties = {},
types = {},
},
})
-- set the colorscheme
vim.cmd('colorscheme catppuccin')
-- Do i need those?
vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
end
},
}

View File

@@ -0,0 +1,8 @@
return {
{ 'github/copilot.vim',
config = function ()
-- Disable copilot by default
vim.g.copilot_enabled = false
end
}
}

View File

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

View File

@@ -0,0 +1,17 @@
return {
{ "ThePrimeagen/harpoon",
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", "<C-u>", function() ui.nav_file(1) end)
vim.keymap.set("n", "<C-i>", function() ui.nav_file(2) end)
vim.keymap.set("n", "<C-o>", function() ui.nav_file(3) end)
-- Conflicts with find git files -- vim.keymap.set("n", "<C-p>", function() ui.nav_file(4) end)
end,
dependencies = { "nvim-lua/plenary.nvim" }
},
}

View File

@@ -0,0 +1,2 @@
return {
}

View File

@@ -0,0 +1,111 @@
return {
{
'VonHeikemen/lsp-zero.nvim',
branch = 'v3.x',
lazy = true,
config = false,
init = function()
-- Disable automatic setup, we are doing it manually
vim.g.lsp_zero_extend_cmp = 0
vim.g.lsp_zero_extend_lspconfig = 0
end,
},
{
'williamboman/mason.nvim',
lazy = false,
config = true,
},
-- Autocompletion
{
'hrsh7th/nvim-cmp',
event = 'InsertEnter',
dependencies = {
{'L3MON4D3/LuaSnip'},
},
config = function()
-- Here is where you configure the autocompletion settings.
local lsp_zero = require('lsp-zero')
lsp_zero.extend_cmp()
-- And you can configure cmp even more, if you want to.
local cmp = require('cmp')
local cmp_action = lsp_zero.cmp_action()
cmp.setup({
formatting = lsp_zero.cmp_format(),
mapping = cmp.mapping.preset.insert({
-- `Enter` key to confirm completion
['<CR>'] = cmp.mapping.confirm({select = false}),
-- Alt+Space to trigger completion menu
['<M-Space>'] = cmp.mapping.complete(),
-- Tab to change item in completion menu
['<Tab>'] = cmp_action.tab_complete(),
-- Shift+Tab goes to the previus item in the completion menu
['<S-Tab>'] = cmp_action.select_prev_or_fallback(),
-- Navigate between documentation
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-r>'] = cmp.mapping.scroll_docs(-4),
})
})
lsp_zero.set_preferences({
sign_icons = {}
})
end
},
-- LSP
{
'neovim/nvim-lspconfig',
cmd = {'LspInfo', 'LspInstall', 'LspStart'},
event = {'BufReadPre', 'BufNewFile'},
dependencies = {
{'hrsh7th/cmp-nvim-lsp'},
{'williamboman/mason-lspconfig.nvim'},
},
config = function()
-- This is where all the LSP shenanigans will live
local lsp_zero = require('lsp-zero')
lsp_zero.extend_lspconfig()
--- if you want to know more about lsp-zero and mason.nvim
--- read this: https://github.com/VonHeikemen/lsp-zero.nvim/blob/v3.x/doc/md/guides/integrate-with-mason-nvim.md
lsp_zero.on_attach(function(client, bufnr)
-- see :help lsp-zero-keybindings
-- to learn the available actions
lsp_zero.default_keymaps({buffer = bufnr})
end)
require('mason-lspconfig').setup({
ensure_installed = {'eslint', 'tsserver', 'rust_analyzer', 'lua_ls',
'clangd', 'volar', 'pylsp'},
handlers = {
lsp_zero.default_setup,
lua_ls = function()
-- (Optional) Configure lua language server for neovim
local lua_opts = lsp_zero.nvim_lua_ls()
require('lspconfig').lua_ls.setup(lua_opts)
end,
}
})
require('mason-lspconfig').setup_handlers({
function(server_name)
local server_config = {}
if require("neoconf").get(server_name .. ".disable") then
return
end
if server_name == "volar" then
server_config.filetypes = { 'vue', 'typescript', 'javascript' }
end
require('lspconfig')[server_name].setup(server_config)
end,
})
end
}
}

View File

@@ -0,0 +1,31 @@
return {
{ 'folke/neoconf.nvim',
config = function ()
require("neoconf").setup({
-- override any of the default settings here
plugins = {
-- configures lsp clients with settings in the following order:
-- - lua settings passed in lspconfig setup
-- - global json settings
-- - local json settings
lspconfig = {
enabled = true,
},
-- configures jsonls to get completion in .nvim.settings.json files
jsonls = {
enabled = true,
-- only show completion in json settings for configured lsp servers
configured_servers_only = false,
},
-- configures lua_ls to get completion of lspconfig server settings
lua_ls = {
-- by default, lua_ls annotations are only enabled in your neovim config directory
enabled_for_neovim_config = true,
-- explicitely enable adding annotations. Mostly relevant to put in your local .nvim.settings.json file
enabled = false,
},
},
})
end
}
}

View File

@@ -0,0 +1,12 @@
return {
"nvim-telescope/telescope.nvim", tag = "0.1.5",
config = function ()
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)
end,
dependencies = { "nvim-lua/plenary.nvim" }
}

View File

@@ -0,0 +1,5 @@
return {
{
'christoomey/vim-tmux-navigator'
}
}

View File

@@ -0,0 +1,32 @@
return {
{ "nvim-treesitter/nvim-treesitter", build = ":TSUpdate",
config = function()
require('nvim-treesitter.configs').setup({
-- A list of parser names, or "all" (the five listed parsers should always be installed)
ensure_installed = {"javascript", "typescript", "rust", "c", "lua", "vim", "vimdoc", "query" },
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = true,
-- List of parsers to ignore installing (for "all")
-- ignore_install = { "javascript" },
---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
highlight = {
enable = true,
-- 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,
},
})
end
}
}

View File

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

View File

@@ -0,0 +1,22 @@
return {
{ "vimwiki/vimwiki",
config = function()
-- Restrict vimwiki to only the path specified in the vimwiki_list global var
vim.g.vimwiki_global_ext = 0
-- Configure a list of vimwiki wiki, need a :PackerCompile to apply
vim.g.vimwiki_list = {
{
path = '~/Documents/cybersecurity/wiki/',
path_html = '~/Documents/cybersecurity/wiki/dist',
template_path = '~/.config/vimwiki/templates/cybersecurity/',
template_default = 'default',
template_ext = 'html',
css_name = 'css/styles.css',
syntax = 'markdown',
ext = '.md',
custom_wiki2html = '~/.config/vimwiki/parse_wiki.py',
},
}
end,
}
}