From 09940eb3db2ce56fa0947ef726abcdf00bc8942a Mon Sep 17 00:00:00 2001 From: vincent Date: Tue, 12 Sep 2023 23:40:25 +0200 Subject: [PATCH] switch to Lazy --- nvim/.config/nvim/init.lua | 8 +- nvim/.config/nvim/lua/init.lua | 17 - nvim/.config/nvim/lua/keymapping.lua | 2 +- nvim/.config/nvim/lua/plugins/cmp.lua | 2 +- .../.config/nvim/lua/plugins/lsp/handlers.lua | 2 +- nvim/.config/nvim/lua/plugins/nvim-tree.lua | 12 - nvim/.config/nvim/lua/pluginsLazy.lua | 306 ++++++++++++++++++ 7 files changed, 310 insertions(+), 39 deletions(-) delete mode 100644 nvim/.config/nvim/lua/init.lua create mode 100644 nvim/.config/nvim/lua/pluginsLazy.lua diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua index 25946de..84ff950 100644 --- a/nvim/.config/nvim/init.lua +++ b/nvim/.config/nvim/init.lua @@ -1,9 +1,8 @@ -require('plugins') +require('pluginsLazy') require('options') require('keymapping') require('colorscheme') -require('plugins.lsp.mason') --------------------- --Global Varialbles-- --------------------- @@ -16,8 +15,3 @@ vim.filetype.add({ }) vim.g.airline_powerline_font = true -vim.g.easyescape_chars = { - j = 1, - k = 1 -} -vim.g.easyescape_timeout = 100 diff --git a/nvim/.config/nvim/lua/init.lua b/nvim/.config/nvim/lua/init.lua deleted file mode 100644 index bfbb14b..0000000 --- a/nvim/.config/nvim/lua/init.lua +++ /dev/null @@ -1,17 +0,0 @@ -require('gitsigns').setup() -require('feline').setup() -require('nvim-web-devicons').setup() -require('nvim-autopairs').setup{} -require("indent_blankline").setup {} -require'nvim-tree'.setup() -require("which-key").setup { - - -- your configuration comes here - - -- or leave it empty to use the default settings - - -- refer to the configuration section below - -} - -require'nvim-web-devicons'.get_icons() diff --git a/nvim/.config/nvim/lua/keymapping.lua b/nvim/.config/nvim/lua/keymapping.lua index 6367f27..817000d 100644 --- a/nvim/.config/nvim/lua/keymapping.lua +++ b/nvim/.config/nvim/lua/keymapping.lua @@ -23,6 +23,7 @@ keymap('n', '',':NvimTreeToggle', opts) keymap('n', 'r',':NvimTreeRefresh', opts) keymap('n', 'n',':NvimTreeFindFile', opts) keymap("n", "e", ":NvimTreeToggle", opts) + -- Navigate buffers keymap("n", "", ":bnext", opts) keymap("n", "", ":bprevious", opts) @@ -32,4 +33,3 @@ keymap("n", "", ":bprevious", opts) --force sudo save keymap('c', 'w!!','w !sudo tee > /dev/null %', opts) -require('plugins.markdown-preview') diff --git a/nvim/.config/nvim/lua/plugins/cmp.lua b/nvim/.config/nvim/lua/plugins/cmp.lua index 02af4dd..5f1748c 100644 --- a/nvim/.config/nvim/lua/plugins/cmp.lua +++ b/nvim/.config/nvim/lua/plugins/cmp.lua @@ -109,7 +109,7 @@ cmp.setup({ sources = { { name = "nvim_lsp" }, { name = "nvim_lua" }, - { name = "luasnip" }, + { name = "lua_snip" }, { name = "buffer" }, { name = "path" }, { name = 'calc' }, diff --git a/nvim/.config/nvim/lua/plugins/lsp/handlers.lua b/nvim/.config/nvim/lua/plugins/lsp/handlers.lua index 09fe281..458fd9d 100644 --- a/nvim/.config/nvim/lua/plugins/lsp/handlers.lua +++ b/nvim/.config/nvim/lua/plugins/lsp/handlers.lua @@ -23,7 +23,7 @@ M.setup = function() end local config = { - virtual_text = false, -- disable virtual text + virtual_text = true, -- disable virtual text signs = { active = signs, -- show signs }, diff --git a/nvim/.config/nvim/lua/plugins/nvim-tree.lua b/nvim/.config/nvim/lua/plugins/nvim-tree.lua index 9963733..e341c0a 100644 --- a/nvim/.config/nvim/lua/plugins/nvim-tree.lua +++ b/nvim/.config/nvim/lua/plugins/nvim-tree.lua @@ -4,11 +4,6 @@ if not status_ok then return end -local config_status_ok, nvim_tree_config = pcall(require, "nvim-tree.config") -if not config_status_ok then - return -end -local tree_cb = nvim_tree_config.nvim_tree_callback nvim_tree.setup({ update_focused_file = { enable = true, @@ -27,12 +22,5 @@ nvim_tree.setup({ view = { width = 30, side = "left", - mappings = { - list = { - { key = { "l", "", "o" }, cb = tree_cb("edit") }, - { key = "h", cb = tree_cb("close_node") }, - { key = "v", cb = tree_cb("vsplit") }, - }, - }, }, }) diff --git a/nvim/.config/nvim/lua/pluginsLazy.lua b/nvim/.config/nvim/lua/pluginsLazy.lua new file mode 100644 index 0000000..1bcddda --- /dev/null +++ b/nvim/.config/nvim/lua/pluginsLazy.lua @@ -0,0 +1,306 @@ +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) + +return require("lazy").setup({ + { + "https://github.com/nvim-lua/plenary.nvim", + cmd = { "PlenaryBustedFile", "PlenaryBustedDirectory" }, + lazy = true, + }, + { + 'tpope/vim-eunuch', + event= "VeryLazy" + }, + { + "https://github.com/williamboman/mason-lspconfig.nvim", + event = { "BufReadPost", "BufNewFile" }, + dependencies = { + "https://github.com/williamboman/mason.nvim", + "https://github.com/neovim/nvim-lspconfig", + }, + config = function() + require('plugins.lsp.mason') + + end + }, + { + "https://github.com/jose-elias-alvarez/null-ls.nvim", + lazy = true, + config = function() + require "null-ls".setup({ + debug = false, + sources = { + formatting.prettier.with({ + extra_filetypes = { "toml" }, + extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" }, + }), + formatting.black.with({ extra_args = { "--fast" } }), + formatting.stylua, + formatting.google_java_format, + diagnostics.flake8, + diagnostics.eslint, + diagnostics.markdownlint, + }, + }) + end + }, + { + "https://github.com/iamcco/markdown-preview.nvim", + ft = "markdown", + build = "cd app && yarn install", + setup= function () + require("markdown-preview").setup({}) + vim.keymap.set("n", "mp", ":MarkdownPreviewToggle", { silent = true }) + end + }, + { + 'nvim-telescope/telescope.nvim', + lazy = true, + cmd = "Telescope", + config = function() + require 'telescope'.setup({ + extensions = { + fzf = { + fuzzy = true, -- false will only do exact matching + override_generic_sorter = true, -- override the generic sorter + override_file_sorter = true, -- override the file sorter + case_mode = "smart_case", -- or "ignore_case" or "respect_case" + -- the default case_mode is "smart_case" + } + } + }) + local opts = { silent = true } + vim.keymap.set("n", "", ":Telescope git_files", opts) + vim.keymap.set("n", "ff", ":Telescope find_files", opts) + vim.keymap.set("n", "fF", function() builtin.find_files({ cwd = utils.buffer_dir() }) end, opts) + vim.keymap.set("n", "/", ":Telescope live_grep", opts) + vim.keymap.set("n", "pp", ":Telescope projects", opts) + vim.keymap.set("n", ",", ":Telescope buffers", opts) + end + + }, + { + 'nvim-telescope/telescope-fzf-native.nvim', + lazy = true, + build = 'make', + }, + { + 'zhou13/vim-easyescape', + config = function() + vim.g.easyescape_chars = { + j = 0, + k = 0 + } + vim.g.easyescape_timeout = 99 + end + }, + { + "https://github.com/hrsh7th/nvim-cmp", + event = "VeryLazy", + dependencies = { + "https://github.com/hrsh7th/cmp-buffer", + "https://github.com/hrsh7th/cmp-nvim-lsp", + "https://github.com/hrsh7th/cmp-path", + "https://github.com/saadparwaiz1/cmp_luasnip", + 'hrsh7th/cmp-cmdline', + 'hrsh7th/cmp-calc', + 'hrsh7th/cmp-git', + 'hrsh7th/cmp-nvim-lua', + 'rafamadriz/friendly-snippets', + 'onsails/lspkind-nvim', + "https://github.com/L3MON4D3/LuaSnip", + + }, + config = function() + require('plugins.cmp') + end + }, + { + 'ellisonleao/gruvbox.nvim', + event = "VeryLazy", + }, + { + "https://github.com/lukas-reineke/indent-blankline.nvim", + event = { "BufReadPost", "BufNewFile" }, + config = function() + require("indent_blankline").setup({ + show_current_context = true, + show_first_indent_level = false, + show_trailing_blankline_indent = false, + use_treesitter = true, + }) + end, + }, + { + 'kyazdani42/nvim-web-devicons' + }, + { + "https://github.com/akinsho/bufferline.nvim", + event = "VeryLazy", + config = function() + require("bufferline").setup({ + options = { + always_show_bufferline = false, + }, + }) + end, + }, + { + "kyazdani42/nvim-tree.lua", + event = "VeryLazy", + config = function() + require("nvim-tree").setup({ + update_focused_file = { + enable = true, + update_cwd = true, + }, + diagnostics = { + enable = true, + show_on_dirs = true, + icons = { + hint = "", + info = "", + warning = "", + error = "", + }, + }, + view = { + width = 30, + side = "left", + }, + }) + end + }, + { + 'AckslD/nvim-whichkey-setup.lua', + event = "VeryLazy", + }, + { + "https://github.com/folke/which-key.nvim", + lazy = true, + config = function() + require("which-key").setup({}) + vim.api.nvim_set_option("timeoutlen", 300) + end, + cmd = "WhichKey", + event = "VeryLazy", + }, + { + "https://github.com/nvim-lualine/lualine.nvim", + event = "VeryLazy", + config = function() + require("lualine").setup({ + options = { + globalstatus = true, + }, + }) + end, + }, + { + "https://github.com/j-hui/fidget.nvim", + tag = "legacy", -- TODO https://github.com/j-hui/fidget.nvim/issues/131 + event = "VeryLazy", + config = function() + require("fidget").setup({ + text = { + spinner = "dots", + }, + }) + end, + }, + { + "https://github.com/lewis6991/gitsigns.nvim", + event = "VeryLazy", + config = function() + require("gitsigns").setup({ + current_line_blame = true, + }) + end, + }, + { + 'RRethy/vim-illuminate', + }, + { + "https://github.com/NeogitOrg/neogit", + cmd = "Neogit", + config = function() + require("neogit").setup({ + disable_commit_confirmation = true, + kind = "split", + integrations = { + diffview = true, + }, + }) + vim.keymap.set('n', 'gs', ':Neogit kind=split', { silent = true }) + end, + }, + { + "https://github.com/windwp/nvim-autopairs", + event = { "BufReadPost", "BufNewFile" }, + config = function() + require("nvim-autopairs").setup({ + check_ts = true, + }) + end, + }, + { 'RRethy/nvim-treesitter-endwise' + }, + { + "https://github.com/nvim-treesitter/nvim-treesitter", + event = { "BufReadPost", "BufNewFile" }, + config = function() + require("nvim-treesitter.configs").setup({ + ensure_installed = { + "bash", + "c", + "dockerfile", + "gitcommit", + "go", + "hcl", + "javascript", + "json", + "json5", + "jsonnet", + "latex", + "lua", + "nix", + "markdown", + "proto", + "python", + "rego", + "rust", + "terraform", + "typescript", + "yaml", + }, + highlight = { + enable = true, + }, + indent = { + enable = true, + }, + endwise = { + enable = true, + }, + }) + vim.treesitter.language.register("nomad", "hcl") + end, + }, + { + "https://github.com/mfussenegger/nvim-dap", + dependencies = { + { "rcarriga/nvim-dap-ui" }, + { "theHamsta/nvim-dap-virtual-text" }, + }, + }, +})