From e0415dc20e17015d8524e6a2c25b6e17e44e3595 Mon Sep 17 00:00:00 2001
From: Alfred Burgess <alfred.burgess95@gmail.com>
Date: Sat, 10 Feb 2024 17:55:08 +0800
Subject: [PATCH] Split pluggin list from init-lua.

---
 .gitignore             |  2 +
 init.lua               | 95 ++++++++++--------------------------------
 lua/plugins.lua        | 91 ++++++++++++++++++++++++++++++++++++++++
 plugins/catppuccin.lua |  5 +++
 plugins/telescope.lua  |  4 ++
 5 files changed, 124 insertions(+), 73 deletions(-)
 create mode 100644 lua/plugins.lua
 create mode 100644 plugins/catppuccin.lua
 create mode 100644 plugins/telescope.lua

diff --git a/.gitignore b/.gitignore
index 6fe588f..d2d2f09 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,4 @@
 usage_data.json
 lazy-lock.json
+
+usage-tracker.nvim/
diff --git a/init.lua b/init.lua
index 6b0f348..4e4aa23 100644
--- a/init.lua
+++ b/init.lua
@@ -1,5 +1,5 @@
 vim.cmd("set number")
-vim.cmd("syntax on")
+vim.cmd("set syntax")
 vim.cmd("set nowrap")
 vim.cmd("set noexpandtab")
 vim.cmd("set autoindent")
@@ -9,6 +9,7 @@ vim.cmd("set shiftwidth=2")
 
 vim.g.loaded_netrw = 1
 vim.g.loaded_netrwPlugin = 1
+vim.g.mapleader = " "
 
 local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.n"
 if not vim.loop.fs_stat(lazypath) then
@@ -26,82 +27,21 @@ vim.opt.rtp:prepend(vim.env.LAZY or lazypath)
 local opts = {
 }
 
-local plugins = {
-	{
-		"catppuccin/nvim",
-		name = "catppuccin",
-		priority = 1000,
-		lazy=false,
-		config = function() vim.cmd( [[colorscheme catppuccin]] ) end,
-	},
-	{ "nvim-treesitter/nvim-treesitter", build = ":TSUpdate", },
-	{ "nvim-tree/nvim-web-devicons" },
---	{ "tanvirtin/vgit.nvim", requires = { "nvim-lua/plenary.nvim", "nvim-tree/nvim-web-devicons" }, },
-	{ "williamboman/mason.nvim" },
-	{ "ms-jpq/coq_nvim" },
-	{ "vijaymarupudi/nvim-fzf" },
-	{ "eandrju/cellular-automaton.nvim" },
-	{
-	  "m4xshen/hardtime.nvim",
-	  dependencies = { "MunifTanjim/nui.nvim", "nvim-lua/plenary.nvim" },
-	  opts = {}
-	},
-	{
-		"nvim-tree/nvim-tree.lua",
-		version = "*",
-		lazy = false,
-		dependencies = { "nvim-tree/nvim-web-devicons", },
-		config = function()
-			require("nvim-tree").setup {}
-		end,
-	},
-	{ "nvim-lua/plenary.nvim" },
-	{ "f-person/git-blame.nvim" },
-	{ "airblade/vim-gitgutter" },
-	{
-	  "aaronhallaert/advanced-git-search.nvim",
-	  dependencies = { "nvim-telescope/telescope.nvim" }
-	},
-	{ "gaborvecsei/usage-tracker.nvim" },
-	{
-		"kylechui/nvim-surround",
-		version = "*", -- Use for stability; omit to use `main` branch for the latest features
-		event = "VeryLazy",
-		config = function()
-			require("nvim-surround").setup({
-				-- Configuration here, or leave empty to use defaults
-			})
-		end
-	},
-	{ "nvim-telescope/telescope.nvim", tag = "0.1.5", dependencies = { "nvim-lua/plenary.nvim" } },
-	{
-		"folke/which-key.nvim",
-		event = "VeryLazy",
-		init = function()
-			vim.o.timeout = true
-			vim.o.timeoutlen = 300
-    		end, opts = { }
-	},
-	{ "windwp/nvim-autopairs", event = "InsertEnter", opts={} }, 
-	{ "nvim-lualine/lualine.nvim", dependencies = { "nvim-tree/nvim-web-devicons" }, lazy=false },
-	{ "sudormrfbin/cheatsheet.nvim", dependencies = { "nvim-telescope/telescope.nvim", "nvim-lua/popup.nvim", "nvim-lua/plenary.nvim" } },
-	{"romgrk/barbar.nvim",
-		dependencies = {
-			"lewis6991/gitsigns.nvim", -- OPTIONAL: for git status
-			"nvim-tree/nvim-web-devicons", -- OPTIONAL: for file icons
-		},
-		init = function() vim.g.barbar_auto_setup = false end,
-		opts = { },
-		version = "^1.0.0", -- optional: only update when a new 1.x version is released
-	},
-}
 
-require("lazy").setup( plugins, opts)
+require("lazy").setup( "plugins", opts)
+
+local builtin = require("telescope.builtin")
+vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
+vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
+vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
+vim.keymap.set('n', '<leader>fh', builtin.help_tags, {})
 
 require("mason").setup()
-require("telescope").setup()
+-- require("telescope").setup()
 require("fzf")--.setup()
-require("nvim-tree").setup()
+require( 'neo-tree' )
+vim.keymap.set( 'n', '<C-n>', ':Neotree filesystem reveal right<CR>', {})
+
 -- require("vgit").setup()
 require("lualine").setup( {
 	options = { theme = "dracula" }
@@ -115,3 +55,12 @@ require("usage-tracker").setup({
     verbose = 0,
     -- telemetry_endpoint = "http://localhost:8000" -- you'll need to start the restapi for this feature
 })
+
+local config = require("nvim-treesitter.configs")
+config.setup({
+  ensure_installed = { "lua", "javascript", "c", "cpp", "dockerfile", "gitignore", "go", "json", "latex", "markdown", "make", "proto", "python", "rust", "scss", "sql", "typescript", "yaml"},
+  sync_install = false,
+  highlight = { enabble = true  },
+  indent = { enabble = true  },
+})
+
diff --git a/lua/plugins.lua b/lua/plugins.lua
new file mode 100644
index 0000000..00a46d8
--- /dev/null
+++ b/lua/plugins.lua
@@ -0,0 +1,91 @@
+return {
+  {
+    "catppuccin/nvim",
+    name = "catppuccin",
+    priority = 1000,
+    config = function ()
+      require('catppuccin').setup({ flavour="frappe" })
+      vim.cmd.colorscheme "catppuccin"
+    end
+
+  },
+  {
+    "nvim-neo-tree/neo-tree.nvim",
+    branch = "v3.x",
+    dependencies = {
+      "nvim-lua/plenary.nvim",
+      "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
+      "MunifTanjim/nui.nvim",
+      -- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information
+    }
+  },
+  { "nvim-treesitter/nvim-treesitter", build = ":TSUpdate", },
+  {
+    "nvim-neo-tree/neo-tree.nvim",
+    branch = "v3.x",
+    lazy=false,
+    dependencies = {
+      "nvim-lua/plenary.nvim",
+      "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
+      "MunifTanjim/nui.nvim",
+      -- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information
+    }
+  },
+  { "nvim-telescope/telescope.nvim", tag = "0.1.5", dependencies = { "nvim-lua/plenary.nvim" } },
+  { "nvim-tree/nvim-web-devicons" },
+  --	{ "tanvirtin/vgit.nvim", requires = { "nvim-lua/plenary.nvim", "nvim-tree/nvim-web-devicons" }, },
+  { "williamboman/mason.nvim" },
+  { "ms-jpq/coq_nvim" },
+  { "vijaymarupudi/nvim-fzf" },
+  { "eandrju/cellular-automaton.nvim" },
+  {
+    "m4xshen/hardtime.nvim",
+    dependencies = { "MunifTanjim/nui.nvim", "nvim-lua/plenary.nvim" },
+    opts = {}
+  },
+  { "nvim-lua/plenary.nvim" },
+  { "f-person/git-blame.nvim" },
+  { "airblade/vim-gitgutter" },
+  {
+    "aaronhallaert/advanced-git-search.nvim",
+    dependencies = { "nvim-telescope/telescope.nvim" }
+  },
+  { "gaborvecsei/usage-tracker.nvim" },
+  {
+    "goolord/alpha-nvim",
+    config = function ()
+      require'alpha'.setup(require'alpha.themes.dashboard'.config)
+    end
+  },
+  {
+    "kylechui/nvim-surround",
+    version = "*", -- Use for stability; omit to use `main` branch for the latest features
+    event = "VeryLazy",
+    config = function()
+      require("nvim-surround").setup({
+	-- Configuration here, or leave empty to use defaults
+      })
+    end
+  },
+  {
+    "folke/which-key.nvim",
+    event = "VeryLazy",
+    init = function()
+      vim.o.timeout = true
+      vim.o.timeoutlen = 300
+    end, opts = { }
+  },
+  { "windwp/nvim-autopairs", event = "InsertEnter", opts={} }, 
+  { "nvim-lualine/lualine.nvim", dependencies = { "nvim-tree/nvim-web-devicons" }, lazy=false },
+  { "sudormrfbin/cheatsheet.nvim", dependencies = { "nvim-telescope/telescope.nvim", "nvim-lua/popup.nvim", "nvim-lua/plenary.nvim" } },
+  {
+    "romgrk/barbar.nvim",
+    dependencies = {
+      "lewis6991/gitsigns.nvim", -- OPTIONAL: for git status
+      "nvim-tree/nvim-web-devicons", -- OPTIONAL: for file icons
+    },
+    init = function() vim.g.barbar_auto_setup = false end,
+    opts = { },
+    version = "^1.0.0", -- optional: only update when a new 1.x version is released
+  },
+}
diff --git a/plugins/catppuccin.lua b/plugins/catppuccin.lua
new file mode 100644
index 0000000..a6d1b7c
--- /dev/null
+++ b/plugins/catppuccin.lua
@@ -0,0 +1,5 @@
+return {
+  "catppuccin/nvim",
+  name = "catppuccin",
+  priority = 1000
+}
diff --git a/plugins/telescope.lua b/plugins/telescope.lua
new file mode 100644
index 0000000..83b135b
--- /dev/null
+++ b/plugins/telescope.lua
@@ -0,0 +1,4 @@
+return {
+	'nvim-telescope/telescope.nvim', tag = '0.1.5',
+	dependencies = { 'nvim-lua/plenary.nvim' }
+}
-- 
GitLab