diff --git a/.gitignore b/.gitignore index 728ce77..a1abc6c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -neovim/.config/nvim/plugin +neovim/.config/nvim/lazy-lock.json diff --git a/neovim/.config/nvim/init.lua b/neovim/.config/nvim/init.lua index b71f08e..1f1a5be 100644 --- a/neovim/.config/nvim/init.lua +++ b/neovim/.config/nvim/init.lua @@ -1,72 +1,78 @@ --- Install packer automagically -local install_path = vim.fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim" -if vim.fn.empty(vim.fn.glob(install_path)) > 0 then - PACKER_BOOTSTRAP = vim.fn.system({ - "git", - "clone", - "--depth", - "1", - "https://github.com/wbthomason/packer.nvim", - install_path, - }) -end - -require("packer").startup(function(use) - use({ "wbthomason/packer.nvim" }) - use({ "nvim-lua/plenary.nvim" }) - - use({ "nvim-treesitter/nvim-treesitter", "nvim-treesitter/playground" }) - use({ - "JoosepAlviste/nvim-ts-context-commentstring", - config = function() - require("ts_context_commentstring").setup({}) - vim.g.skip_ts_context_commentstring_module = true - end, - }) - - use({ "nvim-telescope/telescope.nvim" }) - - use({ "tpope/vim-fugitive" }) - use({ "lewis6991/gitsigns.nvim" }) - - use({ - "hrsh7th/nvim-cmp", - { - { "hrsh7th/cmp-nvim-lsp" }, - { "hrsh7th/cmp-buffer" }, - { "hrsh7th/cmp-path" }, - { "hrsh7th/cmp-cmdline" }, - { "petertriho/cmp-git" }, - }, - }) - use({ "L3MON4D3/LuaSnip", { - "saadparwaiz1/cmp_luasnip", - "rafamadriz/friendly-snippets", - } }) - - use({ "nvimtools/none-ls.nvim" }) - - use({ "kyazdani42/nvim-tree.lua" }) - use({ "kyazdani42/nvim-web-devicons" }) - - use({ - "windwp/nvim-autopairs", - config = function() - require("nvim-autopairs").setup({}) - end, - }) - use({ "windwp/nvim-ts-autotag" }) - - use({ "numToStr/Comment.nvim" }) - - use({ "nvim-lualine/lualine.nvim" }) - - use({ "b0o/SchemaStore.nvim" }) - - if PACKER_BOOTSTRAP then - require("packer").sync() +-- Install lazy automagically +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) end -end) +end +vim.opt.rtp:prepend(lazypath) vim.g.mapleader = " " vim.opt.termguicolors = true + +require("lazy").setup({ + spec = { + { "nvim-lua/plenary.nvim" }, + + { "nvim-treesitter/nvim-treesitter" }, + { "nvim-treesitter/playground" }, + + { + "JoosepAlviste/nvim-ts-context-commentstring", + config = function() + require("ts_context_commentstring").setup({}) + vim.g.skip_ts_context_commentstring_module = true + end, + }, + + { "nvim-telescope/telescope.nvim" }, + + { "tpope/vim-fugitive" }, + { "lewis6991/gitsigns.nvim" }, + + { + "hrsh7th/nvim-cmp", + dependencies = { + { "hrsh7th/cmp-nvim-lsp" }, + { "hrsh7th/cmp-buffer" }, + { "hrsh7th/cmp-path" }, + { "hrsh7th/cmp-cmdline" }, + { "petertriho/cmp-git" }, + }, + }, + + { + "L3MON4D3/LuaSnip", + dependencies = { + "saadparwaiz1/cmp_luasnip", + "rafamadriz/friendly-snippets", + }, + }, + + { "nvimtools/none-ls.nvim" }, + + { + "kyazdani42/nvim-tree.lua", + dependencies = { + { "kyazdani42/nvim-web-devicons" }, + }, + }, + + { "windwp/nvim-autopairs", opts = {} }, + { "windwp/nvim-ts-autotag" }, + + { "numToStr/Comment.nvim" }, + + { "nvim-lualine/lualine.nvim" }, + + { "b0o/SchemaStore.nvim" }, + }, +})