From 0a929f2062f36b40e0ba77e388b1f689725c63e5 Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Sun, 7 Apr 2024 17:35:05 +0200 Subject: [PATCH] Move autopairs example from README to an optional plugin --- README.md | 30 ----------------------------- init.lua | 1 + lua/kickstart/plugins/autopairs.lua | 16 +++++++++++++++ 3 files changed, 17 insertions(+), 30 deletions(-) create mode 100644 lua/kickstart/plugins/autopairs.lua diff --git a/README.md b/README.md index 5ca19d7a..31dfb7eb 100644 --- a/README.md +++ b/README.md @@ -106,36 +106,6 @@ information about extending and exploring Neovim. NOTE: You'll need to uncomment the line in the init.lua that turns on loading custom plugins. -
- Adding autopairs - -This will automatically install [windwp/nvim-autopairs](https://github.com/windwp/nvim-autopairs) -and enable it on startup. For more information, see documentation for -[lazy.nvim](https://github.com/folke/lazy.nvim). - -In the file: `lua/custom/plugins/autopairs.lua`, add: - -```lua --- File: lua/custom/plugins/autopairs.lua - -return { - "windwp/nvim-autopairs", - -- Optional dependency - dependencies = { 'hrsh7th/nvim-cmp' }, - config = function() - require("nvim-autopairs").setup {} - -- If you want to automatically add `(` after selecting a function or method - local cmp_autopairs = require('nvim-autopairs.completion.cmp') - local cmp = require('cmp') - cmp.event:on( - 'confirm_done', - cmp_autopairs.on_confirm_done() - ) - end, -} -``` - -
Adding a file tree plugin diff --git a/init.lua b/init.lua index 496f45b8..9604d46f 100644 --- a/init.lua +++ b/init.lua @@ -841,6 +841,7 @@ require('lazy').setup({ -- require 'kickstart.plugins.debug', -- require 'kickstart.plugins.indent_line', -- require 'kickstart.plugins.lint', + -- require 'kickstart.plugins.autopairs', -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- This is the easiest way to modularize your config. diff --git a/lua/kickstart/plugins/autopairs.lua b/lua/kickstart/plugins/autopairs.lua new file mode 100644 index 00000000..87a7e5ff --- /dev/null +++ b/lua/kickstart/plugins/autopairs.lua @@ -0,0 +1,16 @@ +-- autopairs +-- https://github.com/windwp/nvim-autopairs + +return { + 'windwp/nvim-autopairs', + event = 'InsertEnter', + -- Optional dependency + dependencies = { 'hrsh7th/nvim-cmp' }, + config = function() + require('nvim-autopairs').setup {} + -- If you want to automatically add `(` after selecting a function or method + local cmp_autopairs = require 'nvim-autopairs.completion.cmp' + local cmp = require 'cmp' + cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done()) + end, +}