File tree 3 files changed +9
-6
lines changed
contrib/ext-cmds/kbs2-snip
3 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,9 @@ configuration and/or store directories to the directories listed in their
32
32
` $XDG_CONFIG_HOME ` and ` $XDG_DATA_HOME ` directories for config and store data,
33
33
respectively ([ #315 ] ( https://github.com/woodruffw/kbs2/pull/315 ) )
34
34
35
+ * Contrib: ` kbs2 snip ` now checks ` commands.ext.snip.chooser ` instead of
36
+ ` commands.ext.snip.matcher ` ([ #329 ] ( https://github.com/woodruffw/kbs2/pull/329 ) )
37
+
35
38
### Removed
36
39
37
40
* CLI: The ` -g ` , ` --generate ` flag has been removed from ` kbs2 new ` . Generation
Original file line number Diff line number Diff line change @@ -15,14 +15,14 @@ See the configuration options below for alternatives.
15
15
16
16
## Configuration
17
17
18
- ` kbs2-snip ` reads the ` commands.ext.snip.matcher ` setting in the configuration
18
+ ` kbs2-snip ` reads the ` commands.ext.snip.chooser ` setting in the configuration
19
19
file to determine which fuzzy finder to use.
20
20
21
21
For example:
22
22
23
23
``` toml
24
24
[commands .snip ]
25
- matcher = " fzf"
25
+ chooser = " fzf"
26
26
```
27
27
28
28
...will cause ` kbs2-snip ` to use [ ` fzf ` ] ( https://github.com/junegunn/fzf ) .
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env ruby
2
2
# frozen_string_literal: true
3
3
4
- # kbs2-snip: quickly select and run a code snippet stored in kbs2 using a fuzzy matcher
5
- # By default, selecta is used as the fuzzy matcher .
4
+ # kbs2-snip: quickly select and run a code snippet stored in kbs2 using a fuzzy selector
5
+ # By default, selecta is used as the fuzzy selector .
6
6
7
7
require "open3"
8
8
require "optparse"
@@ -23,7 +23,7 @@ end.parse!
23
23
24
24
config = JSON . parse `kbs2 config dump`
25
25
26
- matcher = config . dig ( "commands" , "ext" , "snip" , "matcher " ) || "selecta"
26
+ chooser = config . dig ( "commands" , "ext" , "snip" , "chooser " ) || "selecta"
27
27
28
28
unstructureds = `kbs2 list -k unstructured` . split
29
29
snippets = unstructureds . filter_map do |label |
@@ -33,7 +33,7 @@ snippets = unstructureds.filter_map do |label|
33
33
[ "#{ label } - #{ contents [ 8 ..] } " , contents [ 8 ..] ] if contents . start_with? "snippet:"
34
34
end . to_h
35
35
36
- output , = Open3 . capture2 matcher , stdin_data : snippets . keys . join ( "\n " )
36
+ output , = Open3 . capture2 chooser , stdin_data : snippets . keys . join ( "\n " )
37
37
selection = output . chomp
38
38
code = snippets [ selection ]
39
39
You can’t perform that action at this time.
0 commit comments