Skip to content

Commit

Permalink
docs(functions): describe new mode=field
Browse files Browse the repository at this point in the history
  • Loading branch information
hinell committed Oct 19, 2023
1 parent 29513d1 commit f0caf2e
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions doc/table_structures/FUNCTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,27 @@ local functions = {
}
```

## Specifying mode

By default, the funciton is shown and run in `*` (all) modes.
You can use `mode` property to narrow function's scope, so it always run in specified mode:

```lua
local functions = {
{
mode = 'x', description = 'My function',
function() print('only runs in charwise-visual and selection mode!') end
},
{
description = 'Buffer: git: stage selected hunk'
mode = { 'x', 'V', 'v' },
function()
gitsigns.stage_hunk({ vim.fn.line('.'), vim.fn.line('v') })
end
}
}
```

## Options

You can also pass options via the `opts` property:
Expand Down

0 comments on commit f0caf2e

Please sign in to comment.