-
-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(editing-support): add ultimate-autopair.nvim (#314)
* feat(editing-support): add ultimate-autopair.nvim * load on event * move readme --------- Co-authored-by: windowsrefund <mtf8>
- Loading branch information
1 parent
840e049
commit 73a537c
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
lua/astrocommunity/editing-support/ultimate-autopair-nvim/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# ultimate-autopair.nvim | ||
|
||
**Repository** <https://github.com/altermo/ultimate-autopair.nvim> | ||
|
||
- Replace nvim-autopairs with ultimate-autopair.nvim. | ||
- Setup rule to automatically disable pairing while editing comments. | ||
- Add `<leader>ua` keymap to toggle the plugin off and on. |
44 changes: 44 additions & 0 deletions
44
lua/astrocommunity/editing-support/ultimate-autopair-nvim/init.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
return { | ||
{ | ||
"windwp/nvim-autopairs", | ||
enabled = false, | ||
}, | ||
{ | ||
"altermo/ultimate-autopair.nvim", | ||
event = "InsertEnter", | ||
opts = { | ||
cmap = false, | ||
extensions = { | ||
rules = { | ||
rules = { | ||
{ | ||
"call", | ||
function(o) | ||
-- disable in comments including markdown style | ||
local status, node = pcall(vim.treesitter.get_node, { pos = { o.linenr - 1, o.col - 2 } }) | ||
return o.incmd | ||
or o.col == 1 | ||
or not status | ||
or not node | ||
or node:type() ~= "comment" and node:type() ~= "html_block" | ||
end, | ||
}, | ||
}, | ||
}, | ||
-- get fly mode working on strings: https://github.com/altermo/ultimate-autopair.nvim/issues/17 | ||
fly = { | ||
nofilter = true, | ||
}, | ||
}, | ||
{ '"', '"', fly = true, p = 11 }, | ||
{ "'", "'", fly = true, p = 11 }, | ||
}, | ||
keys = { | ||
{ | ||
"<leader>ua", | ||
function() require("ultimate-autopair").toggle() end, | ||
desc = "Toggle ultimate-autopair", | ||
}, | ||
}, | ||
}, | ||
} |