From 2ce35ffb6fc489ccf09306d52b4f103b6e1cf380 Mon Sep 17 00:00:00 2001 From: frosty Date: Mon, 8 Jul 2024 20:07:02 -0400 Subject: [PATCH] move plugins to separate files inside plugins dir --- lua/frosty/plugins/alpha.lua | 20 +++ lua/frosty/plugins/autopairs.lua | 5 + lua/frosty/plugins/colors.lua | 9 ++ lua/frosty/plugins/comment.lua | 5 + lua/frosty/plugins/completions.lua | 48 ++++++ lua/frosty/plugins/indent-blankline.lua | 9 ++ lua/frosty/plugins/init.lua | 199 ------------------------ lua/frosty/plugins/lspconfig.lua | 32 ++++ lua/frosty/plugins/lualine.lua | 19 +++ lua/frosty/plugins/neogit.lua | 5 + lua/frosty/plugins/telescope.lua | 17 ++ lua/frosty/plugins/todo-comments.lua | 7 + lua/frosty/plugins/treesitter.lua | 10 ++ 13 files changed, 186 insertions(+), 199 deletions(-) create mode 100644 lua/frosty/plugins/alpha.lua create mode 100644 lua/frosty/plugins/autopairs.lua create mode 100644 lua/frosty/plugins/colors.lua create mode 100644 lua/frosty/plugins/comment.lua create mode 100644 lua/frosty/plugins/completions.lua create mode 100644 lua/frosty/plugins/indent-blankline.lua delete mode 100644 lua/frosty/plugins/init.lua create mode 100644 lua/frosty/plugins/lspconfig.lua create mode 100644 lua/frosty/plugins/lualine.lua create mode 100644 lua/frosty/plugins/neogit.lua create mode 100644 lua/frosty/plugins/telescope.lua create mode 100644 lua/frosty/plugins/todo-comments.lua create mode 100644 lua/frosty/plugins/treesitter.lua diff --git a/lua/frosty/plugins/alpha.lua b/lua/frosty/plugins/alpha.lua new file mode 100644 index 0000000..1440e7a --- /dev/null +++ b/lua/frosty/plugins/alpha.lua @@ -0,0 +1,20 @@ +return { + 'goolord/alpha-nvim', + dependencies = { 'nvim-lua/plenary.nvim' }, + config = function() + local alpha = require('alpha') + local dashboard = require('alpha.themes.dashboard') + + dashboard.section.buttons.val = { + dashboard.button('SPC p f', 'Find files'), + dashboard.button('SPC p o', 'Recent files'), + dashboard.button('SPC p e', 'File explorer'), + dashboard.button('SPC p g', 'File grep'), + dashboard.button('SPC l', 'Lazy'), + dashboard.button('Z Q', 'Quit') + } + + alpha.setup(dashboard.opts) + vim.cmd('autocmd FileType alpha setlocal nofoldenable') + end +} diff --git a/lua/frosty/plugins/autopairs.lua b/lua/frosty/plugins/autopairs.lua new file mode 100644 index 0000000..b80e3da --- /dev/null +++ b/lua/frosty/plugins/autopairs.lua @@ -0,0 +1,5 @@ +return { + 'windwp/nvim-autopairs', + event = 'InsertEnter', + config = true +} diff --git a/lua/frosty/plugins/colors.lua b/lua/frosty/plugins/colors.lua new file mode 100644 index 0000000..3083bac --- /dev/null +++ b/lua/frosty/plugins/colors.lua @@ -0,0 +1,9 @@ +return { + 'ellisonleao/gruvbox.nvim', + priority = 1000, + init = function() + vim.o.background = 'dark' + vim.cmd('colorscheme gruvbox') + vim.api.nvim_set_hl(0, 'Normal', { bg = 'none' }) + end +} diff --git a/lua/frosty/plugins/comment.lua b/lua/frosty/plugins/comment.lua new file mode 100644 index 0000000..760a327 --- /dev/null +++ b/lua/frosty/plugins/comment.lua @@ -0,0 +1,5 @@ +return { + 'numToStr/Comment.nvim', + event = 'VeryLazy', + config = true +} diff --git a/lua/frosty/plugins/completions.lua b/lua/frosty/plugins/completions.lua new file mode 100644 index 0000000..1a4f52b --- /dev/null +++ b/lua/frosty/plugins/completions.lua @@ -0,0 +1,48 @@ +return { + 'hrsh7th/nvim-cmp', + dependencies = { 'neovim/nvim-lspconfig', 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip' }, + config = function() + local cmp = require('cmp') + local luasnip = require('luasnip') + + cmp.setup({ + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }), + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { 'i', 's' }), + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { 'i', 's' }), + }), + sources = { + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + { name = 'buffer' } + } + }) + end +} diff --git a/lua/frosty/plugins/indent-blankline.lua b/lua/frosty/plugins/indent-blankline.lua new file mode 100644 index 0000000..4024690 --- /dev/null +++ b/lua/frosty/plugins/indent-blankline.lua @@ -0,0 +1,9 @@ +return { + 'lukas-reineke/indent-blankline.nvim', + main = 'ibl', + opts = { + scope = { + enabled = false + } + } +} diff --git a/lua/frosty/plugins/init.lua b/lua/frosty/plugins/init.lua deleted file mode 100644 index c178839..0000000 --- a/lua/frosty/plugins/init.lua +++ /dev/null @@ -1,199 +0,0 @@ -return { - { - 'neovim/nvim-lspconfig', - dependencies = { 'hrsh7th/cmp-nvim-lsp' }, - config = function() - local lspconfig = require('lspconfig') - local capabilities = require('cmp_nvim_lsp').default_capabilities() - - lspconfig['lua_ls'].setup({ - capabilities = capabilities, - settings = { - Lua = { - diagnostics = { - globals = { 'vim' } - }, - format = { - enable = true, - defaultConfig = { quote_style = 'single' } - } - } - } - }) - lspconfig['rust_analyzer'].setup({ - capabilities = capabilities, - }) - lspconfig['bashls'].setup({ - capabilities = capabilities, - settings = { - filetypes = { 'sh', 'zsh' } - } - }) - end - }, - - { - 'hrsh7th/nvim-cmp', - dependencies = { 'neovim/nvim-lspconfig', 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip' }, - config = function() - local cmp = require('cmp') - local luasnip = require('luasnip') - - cmp.setup({ - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - mapping = cmp.mapping.preset.insert({ - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.confirm({ - behavior = cmp.ConfirmBehavior.Replace, - select = true, - }), - [''] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - else - fallback() - end - end, { 'i', 's' }), - [''] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { 'i', 's' }), - }), - sources = { - { name = 'nvim_lsp' }, - { name = 'luasnip' }, - { name = 'buffer' } - } - }) - end - }, - - { - 'ellisonleao/gruvbox.nvim', - priority = 1000, - init = function() - vim.o.background = 'dark' - vim.cmd('colorscheme gruvbox') - vim.api.nvim_set_hl(0, 'Normal', { bg = 'none' }) - end - }, - - { - 'lukas-reineke/indent-blankline.nvim', - main = 'ibl', - opts = { - scope = { - enabled = false - } - } - }, - - { - 'nvim-lualine/lualine.nvim', - dependencies = { 'nvim-tree/nvim-web-devicons', 'archibate/lualine-time' }, - opts = { - options = { - icons_enabled = false, - section_separators = '', - component_separators = '' - }, - sections = { - lualine_a = { 'mode' }, - lualine_b = { 'branch', 'diff', 'diagnostics' }, - lualine_c = { 'filename' }, - lualine_x = { 'filetype' }, - lualine_y = { 'progress' }, - lualine_z = { 'location' } - } - } - }, - - { - 'goolord/alpha-nvim', - dependencies = { 'nvim-lua/plenary.nvim' }, - config = function() - local alpha = require('alpha') - local dashboard = require('alpha.themes.dashboard') - - dashboard.section.buttons.val = { - dashboard.button('SPC p f', 'Find files'), - dashboard.button('SPC p o', 'Recent files'), - dashboard.button('SPC p e', 'File explorer'), - dashboard.button('SPC p g', 'File grep'), - dashboard.button('SPC l', 'Lazy'), - dashboard.button('Z Q', 'Quit') - } - - alpha.setup(dashboard.opts) - vim.cmd('autocmd FileType alpha setlocal nofoldenable') - end - }, - - { - 'nvim-treesitter/nvim-treesitter', - build = ':TSUpdate', - opts = { - ensure_installed = { 'c', 'lua', 'vim', 'yaml', 'toml', 'markdown', 'vimdoc', 'bash', 'html', 'python', 'haskell', 'rust' }, - sync_install = false, - highlight = { enable = true }, - indent = { enable = true } - } - }, - - { - 'nvim-telescope/telescope.nvim', - dependencies = { 'nvim-lua/plenary.nvim' }, - opts = { - pickers = { - find_files = { - find_command = { 'rg', '--files', '--hidden', '-g', '!.git' } - }, - buffers = { - show_all_buffers = true - }, - mappings = { - n = { ['q'] = require('telescope.actions').close }, - } - } - } - }, - - { - 'numToStr/Comment.nvim', - event = 'VeryLazy', - config = true - }, - - { - 'folke/todo-comments.nvim', - dependencies = { 'nvim-lua/plenary.nvim' }, - opts = { - signs = false - } - }, - - { - 'windwp/nvim-autopairs', - event = 'InsertEnter', - config = true - }, - - { - 'NeogitOrg/neogit', - dependencies = { 'nvim-lua/plenary.nvim', 'sindrets/diffview.nvim', 'nvim-telescope/telescope.nvim' }, - config = true - } -} diff --git a/lua/frosty/plugins/lspconfig.lua b/lua/frosty/plugins/lspconfig.lua new file mode 100644 index 0000000..ea80d7e --- /dev/null +++ b/lua/frosty/plugins/lspconfig.lua @@ -0,0 +1,32 @@ +return { + 'neovim/nvim-lspconfig', + dependencies = { 'hrsh7th/cmp-nvim-lsp' }, + config = function() + local lspconfig = require('lspconfig') + local capabilities = require('cmp_nvim_lsp').default_capabilities() + + lspconfig['lua_ls'].setup({ + capabilities = capabilities, + settings = { + Lua = { + diagnostics = { + globals = { 'vim' } + }, + format = { + enable = true, + defaultConfig = { quote_style = 'single' } + } + } + } + }) + lspconfig['rust_analyzer'].setup({ + capabilities = capabilities, + }) + lspconfig['bashls'].setup({ + capabilities = capabilities, + settings = { + filetypes = { 'sh', 'zsh' } + } + }) + end +} diff --git a/lua/frosty/plugins/lualine.lua b/lua/frosty/plugins/lualine.lua new file mode 100644 index 0000000..11a6e36 --- /dev/null +++ b/lua/frosty/plugins/lualine.lua @@ -0,0 +1,19 @@ +return { + 'nvim-lualine/lualine.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons', 'archibate/lualine-time' }, + opts = { + options = { + icons_enabled = false, + section_separators = '', + component_separators = '' + }, + sections = { + lualine_a = { 'mode' }, + lualine_b = { 'branch', 'diff', 'diagnostics' }, + lualine_c = { 'filename' }, + lualine_x = { 'filetype' }, + lualine_y = { 'progress' }, + lualine_z = { 'location' } + } + } +} diff --git a/lua/frosty/plugins/neogit.lua b/lua/frosty/plugins/neogit.lua new file mode 100644 index 0000000..a1e4279 --- /dev/null +++ b/lua/frosty/plugins/neogit.lua @@ -0,0 +1,5 @@ +return { + 'NeogitOrg/neogit', + dependencies = { 'nvim-lua/plenary.nvim', 'sindrets/diffview.nvim', 'nvim-telescope/telescope.nvim' }, + config = true +} diff --git a/lua/frosty/plugins/telescope.lua b/lua/frosty/plugins/telescope.lua new file mode 100644 index 0000000..f2b7e54 --- /dev/null +++ b/lua/frosty/plugins/telescope.lua @@ -0,0 +1,17 @@ +return { + 'nvim-telescope/telescope.nvim', + dependencies = { 'nvim-lua/plenary.nvim' }, + opts = { + pickers = { + find_files = { + find_command = { 'rg', '--files', '--hidden', '-g', '!.git' } + }, + buffers = { + show_all_buffers = true + }, + mappings = { + n = { ['q'] = require('telescope.actions').close }, + } + } + } +} diff --git a/lua/frosty/plugins/todo-comments.lua b/lua/frosty/plugins/todo-comments.lua new file mode 100644 index 0000000..f5fd492 --- /dev/null +++ b/lua/frosty/plugins/todo-comments.lua @@ -0,0 +1,7 @@ +return { + 'folke/todo-comments.nvim', + dependencies = { 'nvim-lua/plenary.nvim' }, + opts = { + signs = false + } +} diff --git a/lua/frosty/plugins/treesitter.lua b/lua/frosty/plugins/treesitter.lua new file mode 100644 index 0000000..b45878c --- /dev/null +++ b/lua/frosty/plugins/treesitter.lua @@ -0,0 +1,10 @@ +return { + 'nvim-treesitter/nvim-treesitter', + build = ':TSUpdate', + opts = { + ensure_installed = { 'c', 'lua', 'vim', 'yaml', 'toml', 'markdown', 'vimdoc', 'bash', 'html', 'python', 'haskell', 'rust' }, + sync_install = false, + highlight = { enable = true }, + indent = { enable = true } + } +}