Skip to content

Commit

Permalink
docs: add recipe for minimum keyword length for command
Browse files Browse the repository at this point in the history
  • Loading branch information
Saghen committed Jan 16, 2025
1 parent c32eca4 commit ce76f54
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/recipes.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,20 @@ sources.min_keyword_length = function()
end
```

### Set minimum keyword length for command only in cmdline

If you'd prefer the menu doesn't popup when typing abbreviations like `wq`, you may set the minimum keyword length to 2 when typing the command.

```lua
sources = {
min_keyword_length = function(ctx)
-- only applies when typing a command, doesn't apply to arguments
if ctx.mode == 'cmdline' and string.find(ctx.line, ' ') == nil then return 2 end
return 0
end
}
```

## For writers

When writing prose, you may want significantly different behavior than typical LSP completions. If you find any interesting configurations, please open a PR adding it here!
Expand Down

0 comments on commit ce76f54

Please sign in to comment.