From 21e7ab7b279d8ad30e52d9523b3fdc3d8722878f Mon Sep 17 00:00:00 2001 From: Uttarayan Mondal Date: Sat, 14 Jan 2023 19:46:37 +0530 Subject: [PATCH] [feat] Migrate from packer.nvim to lazy.nvim --- config/fish/config.fish | 3 + config/nvim/init.lua | 18 +- config/nvim/lazy-lock.json | 45 ++++ config/nvim/lua/lsp/init.lua | 13 ++ config/nvim/lua/plugins.lua | 415 ++++++++++++++++++----------------- 5 files changed, 281 insertions(+), 213 deletions(-) create mode 100644 config/nvim/lazy-lock.json diff --git a/config/fish/config.fish b/config/fish/config.fish index e2345753..03e658f2 100644 --- a/config/fish/config.fish +++ b/config/fish/config.fish @@ -8,3 +8,6 @@ export DYLD_FALLBACK_LIBRARY_PATH="/Library/Developer/CommandLineTools/usr/lib" # export FZF_DEFAULT_COMMAND="fd --type f --hidden --exclude .git" export CARGO_TARGET_DIR="$HOME/.local/share/cargo-target" + +# The next line updates PATH for the Google Cloud SDK. +if [ -f '/Users/fs0c131y/Projects/gcloud/google-cloud-sdk/path.fish.inc' ]; . '/Users/fs0c131y/Projects/gcloud/google-cloud-sdk/path.fish.inc'; end diff --git a/config/nvim/init.lua b/config/nvim/init.lua index 88c94652..a90a333e 100644 --- a/config/nvim/init.lua +++ b/config/nvim/init.lua @@ -1,12 +1,12 @@ -- Need to replace this once lua api has vim modes -vim.api.nvim_exec([[ - augroup Packer - autocmd! - autocmd BufWritePost init.lua PackerCompile - autocmd BufWritePost keymaps.lua PackerCompile - autocmd BufWritePost plugins.lua PackerCompile - augroup end -]], false) +-- vim.api.nvim_exec([[ +-- augroup Packer +-- autocmd! +-- autocmd BufWritePost init.lua PackerCompile +-- autocmd BufWritePost keymaps.lua PackerCompile +-- autocmd BufWritePost plugins.lua PackerCompile +-- augroup end +-- ]], false) vim.api.nvim_exec([[ augroup AutoSaveGroup @@ -102,8 +102,8 @@ vim.g.coq_settings = { -- vim.g.rooter_manual_only = 1 vim.g.copilot_node_command = "~/.local/share/nvm/v16.18.1/bin/node" -require('plugins') require('keymaps') +require('plugins') require 'nvim-treesitter.configs'.setup { -- ensure_installed = "all", diff --git a/config/nvim/lazy-lock.json b/config/nvim/lazy-lock.json new file mode 100644 index 00000000..11beb1ff --- /dev/null +++ b/config/nvim/lazy-lock.json @@ -0,0 +1,45 @@ +{ + "chadtree": { "branch": "chad", "commit": "6bdd731301e546e133c7c3e52bf31e7594394e27" }, + "comfortable-motion.vim": { "branch": "master", "commit": "e20aeafb07c6184727b29f7674530150f7ab2036" }, + "copilot.vim": { "branch": "release", "commit": "324ec9eb69e20971b58340d0096c3caac7bc2089" }, + "coq.artifacts": { "branch": "artifacts", "commit": "53cac5a2cc6f64765b658114efb50d62d7497ff4" }, + "coq.thirdparty": { "branch": "3p", "commit": "af94c7ad7ca379a68db0fef12622f8066248f2d3" }, + "coq_nvim": { "branch": "coq", "commit": "8fe777d9ce4eb8519bef208f92e0843ddf2b2a1a" }, + "crates.nvim": { "branch": "main", "commit": "e02eadc598b03d618c22200b0e7979048f6f96b1" }, + "dashboard-nvim": { "branch": "master", "commit": "f7d623457d6621b25a1292b24e366fae40cb79ab" }, + "diffview.nvim": { "branch": "main", "commit": "0987307b6e3488b14e07d1bd728b747122f10efd" }, + "formatter.nvim": { "branch": "master", "commit": "8a4c961330cc4688087f23d18fa7d2f1af9a4902" }, + "galaxyline.nvim": { "branch": "main", "commit": "4d4f5fc8e20a10824117e5beea7ec6e445466a8f" }, + "glow.nvim": { "branch": "main", "commit": "4e4c6486110d9d9905d2efc5fd2d562212f0d212" }, + "hop.nvim": { "branch": "v2", "commit": "90db1b2c61b820e230599a04fedcd2679e64bd07" }, + "indent-blankline.nvim": { "branch": "master", "commit": "c4c203c3e8a595bc333abaf168fcb10c13ed5fb7" }, + "lazy.nvim": { "branch": "main", "commit": "666ed7bf73eb5895253c1155bd29270b066cbdac" }, + "lsp-status.nvim": { "branch": "master", "commit": "54f48eb5017632d81d0fd40112065f1d062d0629" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "43c7f402cb9822b61b5dc05bf0b385928df256a6" }, + "mason.nvim": { "branch": "main", "commit": "8529daa38242091d579ed24f28b35c8b80928e8a" }, + "nvim-colorizer.lua": { "branch": "master", "commit": "36c610a9717cc9ec426a07c8e6bf3b3abcb139d6" }, + "nvim-dap": { "branch": "master", "commit": "0efe0eb17e21d0ff90027d2408fff7759cc95efd" }, + "nvim-dap-ui": { "branch": "master", "commit": "b80227ea56a48177786904f6322abc8b2dc0bc36" }, + "nvim-lspconfig": { "branch": "master", "commit": "ed88435764d8b00442e66d39ec3d9c360e560783" }, + "nvim-treesitter": { "branch": "master", "commit": "d18851653e6edaeb6c0b381abf8def1305337942" }, + "nvim-web-devicons": { "branch": "master", "commit": "6c38926351372ea87034dec26182b62c835ff3bc" }, + "plenary.nvim": { "branch": "master", "commit": "1c7e3e6b0f4dd5a174fcea9fda8a4d7de593b826" }, + "rust-tools.nvim": { "branch": "master", "commit": "df584e84393ef255f5b8cbd709677d6a3a5bf42f" }, + "sonokai": { "branch": "master", "commit": "e2e89497f178bec568a0a43cda651f0429ec8ec1" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "fab3e2212e206f4f8b3bbaa656e129443c9b802e" }, + "telescope-ui-select.nvim": { "branch": "master", "commit": "62ea5e58c7bbe191297b983a9e7e89420f581369" }, + "telescope.nvim": { "branch": "master", "commit": "b69b33eded07341253bc1f0b4ae6bbc5c411a2ab" }, + "toggleterm.nvim": { "branch": "main", "commit": "a54e6c471ce1cd8ef8357e34598a28a955297131" }, + "trouble.nvim": { "branch": "main", "commit": "83ec606e7065adf134d17f4af6bae510e3c491c1" }, + "vim-abolish": { "branch": "master", "commit": "aa3428b734ddbd0105615832843f619774a6871e" }, + "vim-base64": { "branch": "master", "commit": "d15253105f6a329cd0632bf9dcbf2591fb5944b8" }, + "vim-commentary": { "branch": "master", "commit": "e87cd90dc09c2a203e13af9704bd0ef79303d755" }, + "vim-fugitive": { "branch": "master", "commit": "9c5f675db54139c18ed4a1a18989ea2da37d6cae" }, + "vim-gh-line": { "branch": "master", "commit": "fbf368bdfad7e5478009a6dc62559e6b2c72d603" }, + "vim-mergetool": { "branch": "master", "commit": "0275a85256ad173e3cde586d54f66566c01b607f" }, + "vim-repeat": { "branch": "master", "commit": "24afe922e6a05891756ecf331f39a1f6743d3d5a" }, + "vim-speeddating": { "branch": "master", "commit": "5a36fd29df63ea3f65562bd2bb837be48a5ec90b" }, + "vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" }, + "vim-vinegar": { "branch": "master", "commit": "bb1bcddf43cfebe05eb565a84ab069b357d0b3d6" }, + "which-key.nvim": { "branch": "main", "commit": "e4fa445065a2bb0bbc3cca85346b67817f28e83e" } +} \ No newline at end of file diff --git a/config/nvim/lua/lsp/init.lua b/config/nvim/lua/lsp/init.lua index c358ac5f..e932ea60 100644 --- a/config/nvim/lua/lsp/init.lua +++ b/config/nvim/lua/lsp/init.lua @@ -21,3 +21,16 @@ vim.o.completeopt = "menuone,noselect" -- vim.api.nvim_buf_set_option(0, 'omnifunc', 'v:lua.vim.lsp.omnifunc') -- vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') + +local lspconfig = require 'lspconfig' +local lspstatus = require 'lsp-status' +local coq = require 'coq' + +require('mason-lspconfig').setup_handlers({ + function(server_name) + lspconfig[server_name].setup({ + on_attach = lspstatus.on_attach, + capabilities = coq.lsp_ensure_capabilities(lspstatus.capabilities), + }) + end, +}) diff --git a/config/nvim/lua/plugins.lua b/config/nvim/lua/plugins.lua index f8835f11..ce3f2aec 100644 --- a/config/nvim/lua/plugins.lua +++ b/config/nvim/lua/plugins.lua @@ -1,204 +1,211 @@ -local vim = vim -local execute = vim.api.nvim_command -local fn = vim.fn -local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim' - -if fn.empty(fn.glob(install_path)) > 0 then - fn.system({ 'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path }) - execute 'packadd packer.nvim' -end - -local use = require('packer').use - -return require('packer').startup(function() - -- Packer can manage itself - use { 'wbthomason/packer.nvim' } - use { 'williamboman/mason.nvim', - config = function() - require("mason").setup({ - ui = { - icons = { - package_installed = "✓", - package_pending = "➜", - package_uninstalled = "✗" - } - } - }) - end - } - use { - "williamboman/mason-lspconfig.nvim", - config = function() - require("mason-lspconfig").setup({ - ensure_installed = { "sumneko_lua", "rust_analyzer" }, - automatic_installation = true, - }) - end - } - - use { 'mhartington/formatter.nvim' } - - -- use 'imsnif/kdl.vim' - use 'christianrondeau/vim-base64' - use { - 'NTBBloodbath/galaxyline.nvim', branch = 'main', - config = function() require('statusline') end, - requires = { 'kyazdani42/nvim-web-devicons' } - } - use { 'sainnhe/sonokai', config = function() require('colorscheme') end } - use { 'folke/which-key.nvim', config = function() require("which-key").setup() end } - use { 'yuttie/comfortable-motion.vim' } - use { 'ruanyl/vim-gh-line' } - use { 'nvim-telescope/telescope.nvim', requires = { { 'nvim-lua/plenary.nvim' } } } - use { - 'nvim-telescope/telescope-fzf-native.nvim', - run = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build', - config = function() - require('telescope').setup { - defaults = { - initial_mode = 'insert', - }, - 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" - } - } - } - require('telescope').load_extension('fzf') - end, - } - - use { 'nvim-telescope/telescope-ui-select.nvim', - config = function() - require("telescope").load_extension("ui-select") - end - } - - - - use { - 'tpope/vim-commentary', - 'tpope/vim-fugitive', - 'tpope/vim-repeat', - 'tpope/vim-speeddating', - 'tpope/vim-surround', - 'tpope/vim-vinegar', - } - - use { 'norcalli/nvim-colorizer.lua', config = function() require 'colorizer'.setup() end, } - - -- lsp - -- use { 'onsails/lspkind-nvim', config = function() require'lspkind'.init() end, } - use { - 'folke/trouble.nvim', - config = function() - -- local actions = require("telescope.actions") - require("trouble").setup() - local trouble = require("trouble.providers.telescope") - local telescope = require("telescope") - telescope.setup { - defaults = { - mappings = { - i = { [""] = trouble.open_with_trouble }, - n = { [""] = trouble.open_with_trouble }, - }, - }, - } - - end, - } - - use { 'neovim/nvim-lspconfig', config = function() require("lsp") end, } - use { 'nvim-lua/lsp-status.nvim' } - - use { 'ms-jpq/coq_nvim', requires = { 'ms-jpq/coq.artifacts' }, run = ':COQdeps' } - use { 'ms-jpq/chadtree', run = ':CHADdeps' } - use { 'ms-jpq/coq.thirdparty', config = function() - require("coq_3p")({ - { - src = "repl", - sh = "sh", - shell = { p = "perl", n = "node" }, - max_lines = 99, - deadline = 500, - unsafe = { "rm", "poweroff", "mv" } - }, - { src = "bc", short_name = "MATH", precision = 6 }, - { src = "copilot", short_name = "COP", accept_key = "" }, - { src = "dap" } - }) - end - } - - -- use 'airblade/vim-rooter' - -- use({ - -- "https://git.sr.ht/~whynothugo/lsp_lines.nvim", - -- config = function() - -- require("lsp_lines").setup() - -- end, - -- }) - - use { - 'lukas-reineke/indent-blankline.nvim', - config = function() - require("indent_blankline").setup { - show_end_of_line = true, - } - end - } - - use { 'sindrets/diffview.nvim', requires = 'nvim-lua/plenary.nvim' } - use { - 'akinsho/toggleterm.nvim', - config = function() require 'setup.toggleterm' end, - } - - use { - 'glepnir/dashboard-nvim', - config = function() require 'setup.dashboard' end, - } - use 'github/copilot.vim' - - use { - 'nvim-treesitter/nvim-treesitter', - run = ':TSUpdate' - } - - use 'samoshkin/vim-mergetool' - - - use { - 'saecki/crates.nvim', - tag = 'v0.2.1', - requires = { 'nvim-lua/plenary.nvim' }, - config = function() - require('crates').setup { - src = { - coq = { - enabled = true, - name = "crates.nvim", - }, - }, - } - end, - } - use { 'simrat39/rust-tools.nvim', config = function() require 'setup.rust-tools' end } - - use 'ellisonleao/glow.nvim' - - use { "rcarriga/nvim-dap-ui", requires = { "mfussenegger/nvim-dap" }, - config = function() require("dapui").setup() end } - - use { - 'phaazon/hop.nvim', - branch = 'v2', -- optional but strongly recommended - config = function() - -- you can configure Hop the way you like here; see :h hop-config - require 'hop'.setup { keys = 'etovxqpdygfblzhckisuran' } - end - } - -end); +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, opts) +-- if fn.empty(fn.glob(install_path)) > 0 then +-- fn.system({ 'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path }) +-- execute 'packadd packer.nvim' +-- end + +-- local use = require('packer').use + +return require('lazy').setup({ + 'ellisonleao/glow.nvim', + 'samoshkin/vim-mergetool', + + 'mhartington/formatter.nvim', + 'christianrondeau/vim-base64', + + 'tpope/vim-commentary', + 'tpope/vim-fugitive', + 'tpope/vim-repeat', + 'tpope/vim-speeddating', + 'tpope/vim-surround', + 'tpope/vim-vinegar', + 'tpope/vim-abolish', + + 'yuttie/comfortable-motion.vim', + 'ruanyl/vim-gh-line', + + { 'williamboman/mason.nvim', + config = function() + require("mason").setup({ + ui = { + icons = { + package_installed = "✓", + package_pending = "➜", + package_uninstalled = "✗" + } + } + }) + end + }, + { + "williamboman/mason-lspconfig.nvim", + config = function() + require("mason-lspconfig").setup({ + ensure_installed = { "sumneko_lua", "rust_analyzer", "gopls" }, + automatic_installation = true, + }) + end + }, + + { + 'NTBBloodbath/galaxyline.nvim', branch = 'main', + config = function() require('statusline') end, + dependencies = { 'kyazdani42/nvim-web-devicons' } + }, + { 'sainnhe/sonokai', config = function() require('colorscheme') end }, + { 'folke/which-key.nvim', config = function() require("which-key").setup() end }, + { 'nvim-telescope/telescope.nvim', dependencies = { 'nvim-lua/plenary.nvim' } }, + { + 'nvim-telescope/telescope-fzf-native.nvim', + build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build', + config = function() + require('telescope').setup { + defaults = { + initial_mode = 'insert', + }, + 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" + } + } + } + require('telescope').load_extension('fzf') + end, + }, + + { 'nvim-telescope/telescope-ui-select.nvim', + config = function() + require("telescope").load_extension("ui-select") + end + }, + + + { 'norcalli/nvim-colorizer.lua', config = function() require 'colorizer'.setup() end, }, + + -- lsp + -- use { 'onsails/lspkind-nvim', config = function() require'lspkind'.init() end, } + { + 'folke/trouble.nvim', + config = function() + -- local actions = require("telescope.actions") + require("trouble").setup() + local trouble = require("trouble.providers.telescope") + local telescope = require("telescope") + telescope.setup { + defaults = { + mappings = { + i = { [""] = trouble.open_with_trouble }, + n = { [""] = trouble.open_with_trouble }, + }, + }, + } + + end, + }, + + { 'neovim/nvim-lspconfig', config = function() require("lsp") end, }, + { 'nvim-lua/lsp-status.nvim' }, + + { 'ms-jpq/coq_nvim', dependencies = { 'ms-jpq/coq.artifacts' }, build = ':COQdeps' }, + { 'ms-jpq/chadtree', build = ':CHADdeps' }, + { 'ms-jpq/coq.thirdparty', config = function() + require("coq_3p")({ + { + src = "repl", + sh = "sh", + shell = { p = "perl", n = "node" }, + max_lines = 99, + deadline = 500, + unsafe = { "rm", "poweroff", "mv" } + }, + { src = "bc", short_name = "MATH", precision = 6 }, + { src = "copilot", short_name = "COP", accept_key = "" }, + { src = "dap" } + }) + end + }, + + -- use 'airblade/vim-rooter' + -- use({ + -- "https://git.sr.ht/~whynothugo/lsp_lines.nvim", + -- config = function() + -- require("lsp_lines").setup() + -- end, + -- }) + + { + 'lukas-reineke/indent-blankline.nvim', + config = function() + require("indent_blankline").setup { + show_end_of_line = true, + } + end + }, + + { 'sindrets/diffview.nvim', dependencies = 'nvim-lua/plenary.nvim' }, + { + 'akinsho/toggleterm.nvim', + config = function() require 'setup.toggleterm' end, + }, + + { + 'glepnir/dashboard-nvim', + config = function() require 'setup.dashboard' end, + }, + 'github/copilot.vim', + + { + 'nvim-treesitter/nvim-treesitter', + build = ':TSUpdate' + }, + + + + { + 'saecki/crates.nvim', + tag = 'v0.2.1', + dependencies = { 'nvim-lua/plenary.nvim' }, + config = function() + require('crates').setup { + src = { + coq = { + enabled = true, + name = "crates.nvim", + }, + }, + } + end, + }, + { 'simrat39/rust-tools.nvim', config = function() require 'setup.rust-tools' end }, + + + { + "rcarriga/nvim-dap-ui", dependencies = { "mfussenegger/nvim-dap" }, + config = function() require("dapui").setup() end + }, + + { + 'phaazon/hop.nvim', + branch = 'v2', -- optional but strongly recommended + config = function() + -- you can configure Hop the way you like here; see :h hop-config + require 'hop'.setup { keys = 'etovxqpdygfblzhckisuran' } + end + }, + +});