From bae8cdc462d67e658e740dee21432c5a90cf8d2c Mon Sep 17 00:00:00 2001 From: Adam Cooper Date: Fri, 27 Oct 2023 08:28:25 -0400 Subject: [PATCH] Replace vim-plug with lazy-nvim --- neovim/init.lua | 91 ++++++++++++++++++++++++++++--------------------- 1 file changed, 52 insertions(+), 39 deletions(-) diff --git a/neovim/init.lua b/neovim/init.lua index b7572cb..a46a391 100644 --- a/neovim/init.lua +++ b/neovim/init.lua @@ -48,53 +48,66 @@ vim.api.nvim_set_keymap("t", "", "k", { noremap = true }) vim.api.nvim_set_keymap("t", "", "h", { noremap = true }) vim.api.nvim_set_keymap("t", "", "l", { noremap = true }) --- vim-plug -vim.cmd([[ - if empty(glob('~/.vim/autoload/plug.vim')) - silent !curl -fLo ~/.config/local/share/nvim/autoload/plug.vim --create-dirs - \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim - autocmd VimEnter * PlugInstall --sync | source $MYVIMRC - endif +vim.keymap.set({"i", "n", "t", "v"}, "", function () vim.cmd("nohlsearch") end) - function! Cond(cond, ...) - let opts = get(a:000, 0, {}) - return a:cond ? extend(opts, { 'on': [], 'for': [] }) - endfunction +-- lazy.nvim +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) - call plug#begin('~/.config/nvim/plugged') - Plug 'williamboman/mason.nvim' - Plug 'williamboman/mason-lspconfig.nvim' - Plug 'neovim/nvim-lspconfig' - Plug 'nvimdev/lspsaga.nvim' - Plug 'nvim-lualine/lualine.nvim' - Plug 'nvim-tree/nvim-web-devicons' - Plug 'nvim-lua/plenary.nvim' - Plug 'nvim-telescope/telescope.nvim', { 'branch': '0.1.x' } - Plug 'nvim-treesitter/nvim-treesitter', { 'do': ':TSUpdate' } - Plug 'neovim/nvim-lspconfig' - Plug 'hrsh7th/cmp-nvim-lsp' - Plug 'hrsh7th/cmp-buffer' - Plug 'hrsh7th/cmp-path' - Plug 'hrsh7th/cmp-cmdline' - Plug 'hrsh7th/nvim-cmp' - Plug 'hrsh7th/cmp-vsnip' - Plug 'hrsh7th/vim-vsnip' - Plug 'tpope/vim-fugitive' - Plug 'lewis6991/gitsigns.nvim' - Plug 'dracula/vim', { 'as': 'dracula' } - Plug 'tpope/vim-surround' - call plug#end() -]]) +require("lazy").setup({ + { + "dracula/vim", + name = "dracula", + lazy = false, + priority = 1000, + config = function () + vim.cmd([[colorscheme dracula]]) + end, + }, + "williamboman/mason.nvim", + "williamboman/mason-lspconfig.nvim", + "neovim/nvim-lspconfig", + "nvimdev/lspsaga.nvim", + "nvim-lualine/lualine.nvim", + "nvim-tree/nvim-web-devicons", + "nvim-lua/plenary.nvim", + { "nvim-telescope/telescope.nvim", branch = "0.1.x" }, + { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + }, + "neovim/nvim-lspconfig", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-cmdline", + "hrsh7th/nvim-cmp", + "hrsh7th/cmp-vsnip", + "hrsh7th/vim-vsnip", + "tpope/vim-fugitive", + "lewis6991/gitsigns.nvim", + "tpope/vim-surround", +}) require('mason').setup() require('mason-lspconfig').setup() require('lualine').setup { - options = { theme = 'dracula' }, - tabline = { - lualine_a = { 'buffers' }, - } + options = { theme = 'dracula' }, + tabline = { + lualine_a = { 'buffers' }, } +} local builtin = require('telescope.builtin') vim.keymap.set('n', 'ff', builtin.find_files, {})