diff --git a/init.lua b/init.lua index 72414be..5407840 100644 --- a/init.lua +++ b/init.lua @@ -106,3 +106,4 @@ vim.o.statusline = "%#StatusNormal# " require("core") require("lazy.load") +require("config") diff --git a/lua/config/bufferline.lua b/lua/config/bufferline.lua new file mode 100644 index 0000000..bae77cb --- /dev/null +++ b/lua/config/bufferline.lua @@ -0,0 +1,24 @@ +--- Ensure plugin is avaiable +local ok, bufferline = pcall(require, "bufferline") +if not ok then + return +end + +--- Plugin options +opts = { + options = { + -- mode = "tabs", + separator_style = "slant", + }, +} + +--- Load plugin +bufferline.setup(opts) + +--- Override keymaps +local km = vim.keymap.set +km("n", "", ":BufferLineCycleNext") +km("n", "", ":BufferLineCyclePrev") +km("n", "bn", ":BufferLineMoveNext") +km("n", "bp", ":BufferLineMovePrev") +km("n", "bc", ":BufferLinePickClose") diff --git a/lua/config/comment.lua b/lua/config/comment.lua new file mode 100644 index 0000000..e128c73 --- /dev/null +++ b/lua/config/comment.lua @@ -0,0 +1,8 @@ +--- Ensure plugin is avaiable +local ok, comment = pcall(require, "Comment") +if not ok then + return +end + +--- Load plugin +comment.setup() diff --git a/lua/config/init.lua b/lua/config/init.lua new file mode 100644 index 0000000..bdc4c8f --- /dev/null +++ b/lua/config/init.lua @@ -0,0 +1,2 @@ +require("config/comment") +require("config/bufferline") diff --git a/lua/lazy/load.lua b/lua/lazy/load.lua index e2cf336..ee6e327 100644 --- a/lua/lazy/load.lua +++ b/lua/lazy/load.lua @@ -21,4 +21,9 @@ opts = { }, } -require("lazy").setup("plugins", opts) +local ok, lazy = pcall(require, "lazy") +if not ok then + return +end + +lazy.setup("plugins", opts) diff --git a/lua/plugins/bufferline.lua b/lua/plugins/bufferline.lua index feb1727..6358ba4 100644 --- a/lua/plugins/bufferline.lua +++ b/lua/plugins/bufferline.lua @@ -1,26 +1,3 @@ -local function config() - --- Ensure plugin is avaiable - local bufferline = require("bufferline"); - - --- Plugin options - opts = { - options = { - -- mode = "tabs", - separator_style = "slant", - }, - } - - --- Load plugin - bufferline.setup(opts) - - --- Override keymaps - local km = vim.keymap.set - km("n", "", ":BufferLineCycleNext") - km("n", "", ":BufferLineCyclePrev") - km("n", "bn", ":BufferLineMoveNext") - km("n", "bp", ":BufferLineMovePrev") - km("n", "bc", ":BufferLinePickClose") -end return { "akinsho/bufferline.nvim", diff --git a/lua/plugins/comment.lua b/lua/plugins/comment.lua index e4c898c..c47d047 100644 --- a/lua/plugins/comment.lua +++ b/lua/plugins/comment.lua @@ -1,13 +1,4 @@ -local function config() - --- Ensure plugin is avaiable - local comment = require('Comment') - - --- Load plugin - comment.setup() -end - return { "numToStr/Comment.nvim", event = { "BufReadPre", "BufNewFile" }, - config = config } diff --git a/lua/plugins/nvim-treesitter.lua b/lua/plugins/nvim-treesitter.lua index 97ba123..dd5d9c1 100644 --- a/lua/plugins/nvim-treesitter.lua +++ b/lua/plugins/nvim-treesitter.lua @@ -10,28 +10,7 @@ local function config() autotag = { enable = true, }, - ensure_installed = { - "json", - "javascript", - "typescript", - "tsx", - "yaml", - "html", - "css", - "prisma", - "markdown", - "markdown_inline", - "svelte", - "graphql", - "bash", - "lua", - "vim", - "dockerfile", - "gitignore", - "query", - "rst", - "php", - }, + auto_install = true, incremental_selection = { enable = true, keymaps = {