Skip to content

Commit

Permalink
style: Replace ‘ex:’ with ‘e.g.’ for standard English usage
Browse files Browse the repository at this point in the history
  • Loading branch information
vh-x committed Dec 31, 2024
1 parent c88435b commit 181ae82
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ in the `Replace:` input.

You can use `match` to refer to each match and need to `return` the value you want to be the replacement.
In the case of the `astgrep` engine, you will also have access to the meta variables by accessing them through the
`vars` table. ex: `$A` is referred to by `vars.A`, `$$$ARGS` is referred to by `vars.ARGS`.
`vars` table. e.g. `$A` is referred to by `vars.A`, `$$$ARGS` is referred to by `vars.ARGS`.

It is a similar situation for the `vimscript` interpreter.

Expand Down Expand Up @@ -204,14 +204,14 @@ open the search history as a buffer. From there you can pick an entry that will
Note that you can edit the history buffer and save just like any other buffer if you need to do some cleanup.
The format of a history entry is:
```
<optional comment, ex: My special search>
<optional comment, e.g. My special search>
Engine: <astgrep|ripgrep>(|lua)?
Search: <text>
Replace: <text>
Files Filter: <text>
Flags: <text>
```
where `<text>` can span multiple line with the aid of a "continuation prefix" (`| `). ex:
where `<text>` can span multiple line with the aid of a "continuation prefix" (`| `). e.g.
```
Replace: something
| additional replace text
Expand Down
2 changes: 1 addition & 1 deletion doc/grug-far.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ require('grug-far').toggle_instance({config}) *grug-far.toggle_instance()*
require('grug-far').toggle_flags({flags}) *grug-far.toggle_flags()*
Toggles given list of flags in the current grug-far buffer. The
flags get added to/removed from the Flags input line.
ex: require('grug-far).toggle_flags({'--fixed-strings'}).
e.g. require('grug-far).toggle_flags({'--fixed-strings'}).

Parameters: ~
{flags}(table) List of flag strings to toggle.
Expand Down
30 changes: 15 additions & 15 deletions lua/grug-far/opts.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ M.defaultOptions = {
-- whether to show placeholders
enabled = true,

search = 'ex: foo foo([a-z0-9]*) fun\\(',
replacement = 'ex: bar ${1}_foo $$MY_ENV_VAR ',
replacement_lua = 'ex: if vim.startsWith(match, "use") \\n then return "employ" .. match \\n else return match end',
filesFilter = 'ex: *.lua *.{css,js} **/docs/*.md (specify one per line)',
flags = 'ex: --help --ignore-case (-i) --replace= (empty replace) --multiline (-U)',
paths = 'ex: /foo/bar ../ ./hello\\ world/ ./src/foo.lua ~/.config',
search = 'e.g. foo foo([a-z0-9]*) fun\\(',
replacement = 'e.g. bar ${1}_foo $$MY_ENV_VAR ',
replacement_lua = 'e.g. if vim.startsWith(match, "use") \\n then return "employ" .. match \\n else return match end',
filesFilter = 'e.g. *.lua *.{css,js} **/docs/*.md (specify one per line)',
flags = 'e.g. --help --ignore-case (-i) --replace= (empty replace) --multiline (-U)',
paths = 'e.g. /foo/bar ../ ./hello\\ world/ ./src/foo.lua ~/.config',
},
},
-- see https://ast-grep.github.io
Expand All @@ -81,12 +81,12 @@ M.defaultOptions = {
-- whether to show placeholders
enabled = true,

search = 'ex: $A && $A() foo.bar($$$ARGS) $_FUNC($_FUNC)',
replacement = 'ex: $A?.() blah($$$ARGS)',
replacement_lua = 'ex: return vars.A == "blah" and "foo(" .. table.concat(vars.ARGS, ", ") .. ")" or match',
filesFilter = 'ex: *.lua *.{css,js} **/docs/*.md (specify one per line, filters via ripgrep)',
flags = 'ex: --help (-h) --debug-query=ast --rewrite= (empty replace) --strictness=<STRICTNESS>',
paths = 'ex: /foo/bar ../ ./hello\\ world/ ./src/foo.lua ~/.config',
search = 'e.g. $A && $A() foo.bar($$$ARGS) $_FUNC($_FUNC)',
replacement = 'e.g. $A?.() blah($$$ARGS)',
replacement_lua = 'e.g. return vars.A == "blah" and "foo(" .. table.concat(vars.ARGS, ", ") .. ")" or match',
filesFilter = 'e.g. *.lua *.{css,js} **/docs/*.md (specify one per line, filters via ripgrep)',
flags = 'e.g. --help (-h) --debug-query=ast --rewrite= (empty replace) --strictness=<STRICTNESS>',
paths = 'e.g. /foo/bar ../ ./hello\\ world/ ./src/foo.lua ~/.config',
},
},
},
Expand All @@ -102,9 +102,9 @@ M.defaultOptions = {
-- Supported:
-- * 'default': treat replacement as a string to pass to the current engine
-- * 'lua': treat replacement as lua function body where search match is identified by `match` and
-- meta variables (with astgrep for example) are available in `vars` table (ex: `vars.A` captures `$A`)
-- meta variables (with astgrep for example) are available in `vars` table (e.g. `vars.A` captures `$A`)
-- * 'vimscript': treat replacement as vimscript function body where search match is identified by `match` and
-- meta variables (with astgrep for example) are available in `vars` table (ex: `vars.A` captures `$A`)
-- meta variables (with astgrep for example) are available in `vars` table (e.g. `vars.A` captures `$A`)
enabledReplacementInterpreters = { 'default', 'lua', 'vimscript' },

-- which replacement interprer to use
Expand Down Expand Up @@ -157,7 +157,7 @@ M.defaultOptions = {
-- shortcuts for the actions you see at the top of the buffer
-- set to '' or false to unset. Mappings with no normal mode value will be removed from the help header
-- you can specify either a string which is then used as the mapping for both normal and insert mode
-- or you can specify a table of the form { [mode] = <lhs> } (ex: { i = '<C-enter>', n = '<localleader>gr'})
-- or you can specify a table of the form { [mode] = <lhs> } (e.g. { i = '<C-enter>', n = '<localleader>gr'})
-- it is recommended to use <localleader> though as that is more vim-ish
-- see https://learnvimscriptthehardway.stevelosh.com/chapters/11.html#local-leader
keymaps = {
Expand Down

0 comments on commit 181ae82

Please sign in to comment.