feat: add autopairs

main
jaredgoldman 2024-04-07 17:41:50 -04:00
parent 1080cfd16c
commit bbafc09997
6 changed files with 41 additions and 8 deletions

View File

@ -1,6 +1,6 @@
require("colorscheme")
require("options")
require("plugins") require("plugins")
require("options")
require("colorscheme")
require("lsp") require("lsp")
require("config.telescope") require("config.telescope")
require("config.comment") require("config.comment")
@ -11,4 +11,5 @@ require("config.theme")
require("config.lualine") require("config.lualine")
require("config.fterm") require("config.fterm")
require("config.harpoon") require("config.harpoon")
require("config.pairs")
require("keymaps") require("keymaps")

View File

@ -6,7 +6,7 @@
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"copilot.vim": { "branch": "release", "commit": "49e0348bfb913fae63ca5ddb987a8bccd193da86" }, "copilot.vim": { "branch": "release", "commit": "7097b09e52621a97d11f254e04de5e5a0f26e5f5" },
"harpoon": { "branch": "harpoon2", "commit": "da326d0438ac68dee9b6b62a734be940a8bd8405" }, "harpoon": { "branch": "harpoon2", "commit": "da326d0438ac68dee9b6b62a734be940a8bd8405" },
"lazy.nvim": { "branch": "main", "commit": "31ddbea7c10b6920c9077b66c97951ca8682d5c8" }, "lazy.nvim": { "branch": "main", "commit": "31ddbea7c10b6920c9077b66c97951ca8682d5c8" },
"lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" }, "lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" },

View File

@ -1,8 +1,11 @@
-- local base16 = require'lualine.themes.base16' -- local base16 = require'lualine.themes.base16'
local ayu_dark = require'lualine.themes.ayu_dark' -- local ayu_dark = require'lualine.themes.ayu_dark'
-- local base16 = require'lualine.themes.base16'
-- local codedark = require'lualine.themes.codedark'
local horizon = require'lualine.themes.horizon'
-- Change the background of lualine_c section for normal mode -- Change the background of lualine_c section for normal mode
require('lualine').setup { require('lualine').setup {
options = { theme = ayu_dark }, options = { theme = horizon},
} }

View File

@ -0,0 +1,21 @@
local npairs = require("nvim-autopairs")
local Rule = require('nvim-autopairs.rule')
local ts_conds = require('nvim-autopairs.ts-conds')
npairs.setup({
check_ts = true,
ts_config = {
lua = {'string'},-- it will not add a pair on that treesitter node
javascript = {'template_string'},
java = false,-- don't check treesitter on java
}
})
-- press % => %% only while inside a comment or string
npairs.add_rules({
Rule("%", "%", "lua")
:with_pair(ts_conds.is_ts_node({'string','comment'})),
Rule("$", "$", "lua")
:with_pair(ts_conds.is_not_ts_node({'function'}))
})

View File

@ -64,5 +64,13 @@ require("lazy").setup({
"ThePrimeagen/harpoon", "ThePrimeagen/harpoon",
branch = "harpoon2", branch = "harpoon2",
requires = { { "nvim-lua/plenary.nvim" } } requires = { { "nvim-lua/plenary.nvim" } }
} },
{
'windwp/nvim-autopairs',
event = "InsertEnter",
config = true
-- use opts = {} for passing setup options
-- this is equalent to setup({}) function
},
'nvim-treesitter/nvim-treesitter'
}) })

View File

@ -4,9 +4,9 @@
- telescope x - telescope x
- theming x - theming x
- tabfluline x - tabfluline x
- rice - rice x
- terminal x - terminal x
- harpoon - harpoon x
- extended history x - extended history x
- auto-pairs - auto-pairs
- lua vim linting - lua vim linting