Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: generated vimdoc #429

Merged
merged 2 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 24 additions & 14 deletions doc/nvim-autopairs-rules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,15 @@ takes place. There are no predicates if you don’t define any, and so any
events without predicates behave as if they had a single predicate that always
returns true.

The predicate functions will receive an `opts` table with the following fields:
- `rule` the `Rule` object - `bufnr` the buffer number - `col` the current
column (1-indexed) - `ts_node` the current treesitter node (if treesitter is
enabled) - `text` the current line, with typed char inserted - `line` the
current line, before substitutions - `char` the typed char - `prev_char` the
text just before cursor (with length `== #rule.start_pair`) - `next_char` the
text just after cursor (with length `== #rule.start_pair` if rule is not regex,
else end of line)

A `Rule` may have more than one predicate defined for a given event, and the
order that they are defined will be the order that they are checked. However,
the **first** non-`nil` value returned by a predicate is used and the remaining
Expand All @@ -164,24 +173,25 @@ earlier have priority over predicates defined later.

`WITH_PAIR(COND, POS)` ~

After typing the opening part, `cond` will fire and the ending part will only
be added if `cond` returned true. `with_pair` may be called more than once, and
by default, each predicate is appended to a list. When the "pair" event fires,
the _first_ predicate to return non-nil is used as the condition result.
Specifying `pos` allows explicit control over the order of the predicates.
After typing the opening part, the ending part will only be added if
`cond(opts)` returned true. `with_pair` may be called more than once, and by
default, each predicate is appended to a list. When the "pair" event fires, the
_first_ predicate to return non-nil is used as the condition result. Specifying
`pos` allows explicit control over the order of the predicates.

`WITH_MOVE(COND)` ~

If `cond` is true, the cursor is simply moved right when typing the ending part
of the pair and the next character is also the ending part, e.g. `|" -> "|`
when typing `"`. If `cond` returns false, the ending part is inserted as normal
instead.
If `cond(opts)` is true, the cursor is simply moved right when typing the
ending part of the pair and the next character is also the ending part,
e.g. `foo|"` => `foo"|` when typing `"`. If `cond(opts)` returns false, the
ending part is inserted as normal instead.

`WITH_CR(COND)` ~

If `cond` is true, then move the ending part of the pair to a new line below
the cursor after pressing `<CR>` while the cursor is between the pair (think
curly braces opening a block). Otherwise `<CR>` behaves as normal. For example:
If `cond(opts)` is true, then move the ending part of the pair to a new line
below the cursor after pressing `<CR>` while the cursor is between the pair
(think curly braces opening a block). Otherwise `<CR>` behaves as normal. For
example:

>
{|}
Expand All @@ -199,8 +209,8 @@ Typing `<CR>` produces the following when `cond` is true:

`WITH_DEL(COND)` ~

If `cond` is true, when the cursor is between the pair, pressing `<BS>` to
delete the opening part of the pair will delete the ending part as well.
If `cond(opts)` is true, when the cursor is between the pair, pressing `<BS>`
to delete the opening part of the pair will delete the ending part as well.

THE `USE_*` METHODS *nvim-autopairs-rules-the-`use_*`-methods*

Expand Down
82 changes: 54 additions & 28 deletions doc/nvim-autopairs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,19 @@ INSTALLATION *nvim-autopairs-installation*

Install the plugin with your preferred package manager:

LAZY.NVIM <HTTPS://GITHUB.COM/FOLKE/LAZY.NVIM> ~

>
{
'windwp/nvim-autopairs',
event = "InsertEnter",
config = true
-- use opts = {} for passing setup options
-- this is equivalent to setup({}) function
}
<


VIM-PLUG <HTTPS://GITHUB.COM/JUNEGUNN/VIM-PLUG> ~

>
Expand All @@ -34,30 +47,35 @@ PACKER <HTTPS://GITHUB.COM/WBTHOMASON/PACKER.NVIM> ~
>
use {
"windwp/nvim-autopairs",
config = function() require("nvim-autopairs").setup {} end
event = "InsertEnter",
config = function()
require("nvim-autopairs").setup {}
end
}
<


DEFAULT VALUES *nvim-autopairs-default-values*

>
local disable_filetype = { "TelescopePrompt" }
local disable_in_macro = false -- disable when recording or executing a macro
local disable_in_visualblock = false -- disable when insert after visual block mode
local disable_in_replace_mode = true
local ignored_next_char = [=[[%w%%%'%[%"%.%`%$]]=]
local enable_moveright = true
local enable_afterquote = true -- add bracket pairs after quote
local enable_check_bracket_line = true --- check bracket in same line
local enable_bracket_in_quote = true --
local enable_abbr = false -- trigger abbreviation
local break_undo = true -- switch for basic rule break undo sequence
local check_ts = false
local map_cr = true
local map_bs = true -- map the <BS> key
local map_c_h = false -- Map the <C-h> key to delete a pair
local map_c_w = false -- map <c-w> to delete a pair if possible
{
disable_filetype = { "TelescopePrompt", "spectre_panel" }
disable_in_macro = true -- disable when recording or executing a macro
disable_in_visualblock = false -- disable when insert after visual block mode
disable_in_replace_mode = true
ignored_next_char = [=[[%w%%%'%[%"%.%`%$]]=]
enable_moveright = true
enable_afterquote = true -- add bracket pairs after quote
enable_check_bracket_line = true --- check bracket in same line
enable_bracket_in_quote = true --
enable_abbr = false -- trigger abbreviation
break_undo = true -- switch for basic rule break undo sequence
check_ts = false
map_cr = true
map_bs = true -- map the <BS> key
map_c_h = false -- Map the <C-h> key to delete a pair
map_c_w = false -- map <c-w> to delete a pair if possible
}
<


Expand Down Expand Up @@ -135,7 +153,7 @@ Mapping `<CR>` You can customize the kind of completion
---@param rules table
---@param commit_character table<string>
handler = function(char, item, bufnr, rules, commit_character)
-- Your handler function. Inpect with print(vim.inspect{char, item, bufnr, rules, commit_character})
-- Your handler function. Inspect with print(vim.inspect{char, item, bufnr, rules, commit_character})
end
}
},
Expand Down Expand Up @@ -371,10 +389,10 @@ PLUGIN INTEGRATION ~
>
require('nvim-autopairs').disable()
require('nvim-autopairs').enable()
require('nvim-autopairs').toggle()
require('nvim-autopairs').remove_rule('(') -- remove rule (
require('nvim-autopairs').clear_rules() -- clear all rules
-- get rule " then modify it. It can return a list of rule or just a rule
require('nvim-autopairs').get_rule('"')
require('nvim-autopairs').get_rules('"')
<


Expand All @@ -384,18 +402,21 @@ PLUGIN INTEGRATION ~

>
-- remove add single quote on filetype scheme or lisp
require("nvim-autopairs").get_rule("'")[1].not_filetypes = { "scheme", "lisp" }
require("nvim-autopairs").get_rule("'")[1]:with_pair(cond.not_after_text("["}))
require("nvim-autopairs").get_rules("'")[1].not_filetypes = { "scheme", "lisp" }
require("nvim-autopairs").get_rules("'")[1]:with_pair(cond.not_after_text("["))
<


FASTWRAP ~

>
Before Input After
--------------------------------------------------
(|foobar <M-e> then press $ (|foobar)
Before Input After Note
-----------------------------------------------------------------
(|foobar <M-e> then press $ (|foobar)
(|)(foobar) <M-e> then press q (|(foobar))
(|foo bar <M-e> then press qh (|foo) bar
(|foo bar <M-e> then press qH (foo|) bar
(|foo bar <M-e> then press qH (foo)| bar if cursor_pos_before = false
<


Expand All @@ -412,9 +433,12 @@ FASTWRAP ~
chars = { '{', '[', '(', '"', "'" },
pattern = [=[[%'%"%>%]%)%}%,]]=],
end_key = '$',
before_key = 'h',
after_key = 'l',
cursor_pos_before = true,
avoid_move_to_end = true, -- stay for direct end_key use
keys = 'qwertyuiopzxcvbnmasdfghjkl',
check_comma = true,
manual_position = true,
highlight = 'Search',
highlight_grey='Comment'
},
Expand All @@ -437,8 +461,10 @@ rules <https://github.com/windwp/nvim-autopairs/wiki/Custom-rules>
SPONSORS *nvim-autopairs-sponsors*

Thanks to everyone who sponsors my projects and makes continued development
maintenance possible! <!-- patreon --><a href="https://github.com/t4t5"><img
src="https://github.com/t4t5.png" width="60px" alt="" /></a><!-- patreon-->
maintenance possible!

<a href="https://github.com/looshch"><img src="https://github.com/looshch.png"
width="60px" alt="george looshch" /></a><!-- sponsors -->

Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>

Expand Down
Loading