diff options
author | Canop <cano.petrole@gmail.com> | 2022-03-27 20:48:30 +0200 |
---|---|---|
committer | Canop <cano.petrole@gmail.com> | 2022-03-27 20:48:30 +0200 |
commit | a697c79919301313a6942808363f5a9483c3b1d7 (patch) | |
tree | e5d718af7d3a67028302411c7206fbc8a1d41c2f /website/docs | |
parent | a9c90d1d98d52db4e27f0484303dc157b431519c (diff) |
verb filtering by file extension
Fix #508
Diffstat (limited to 'website/docs')
-rw-r--r-- | website/docs/conf_verbs.md | 31 | ||||
-rw-r--r-- | website/docs/css/tab-langs.css | 6 | ||||
-rw-r--r-- | website/docs/js/tab-langs.js | 1 |
3 files changed, 36 insertions, 2 deletions
diff --git a/website/docs/conf_verbs.md b/website/docs/conf_verbs.md index 51fe1ce..4a488f0 100644 --- a/website/docs/conf_verbs.md +++ b/website/docs/conf_verbs.md @@ -33,6 +33,7 @@ invocation | | how the verb is called by the user, with placeholders for argumen internal | | execution, when your verb is based on a predefined broot verb external | | execution, when your verb is based on an external command cmd | | a semicolon sequence to execute, similar to an argument you pass to `--cmd` +extensions | | optional array of allowed file extensions key | | a keyboard key triggering execution keys | | several keyboard shortcuts triggering execution (if you want to have the choice) shortcut | | an alternate way to call the verb (without the arguments part) @@ -82,6 +83,36 @@ invocation = "xtv" external = ["xterm", "-e", "nvim {file}"] ``` +# File extensions + +You may filter the execution of a verb with file extensions. + +For example, if you'd want <kbd>enter</kbd> to work as predefined in most cases but just choose a specific action for some files, you might add this verb definition: + +```hjson +{ + name: open-code + key: enter + extensions: [ + rs + js + toml + ] + execution: "$EDITOR +{line} {file}" + working_dir: "{root}" + leave_broot: false +} +``` +```toml +[[verbs]] +name = "open-code" +key = "enter" +extensions = ["rs", "js", "toml"] +execution = "$EDITOR +{line} {file}" +working_dir = "{root}" +leave_broot = false +``` + # Shortcuts and Verb search **broot** looks for the first token following a space or `:` and tries to find the verb you want. diff --git a/website/docs/css/tab-langs.css b/website/docs/css/tab-langs.css index 67ab38a..0dbc294 100644 --- a/website/docs/css/tab-langs.css +++ b/website/docs/css/tab-langs.css @@ -14,12 +14,14 @@ border-left: solid 1px #e1e4e5; background: #f8f8f8; cursor: auto; - z-index: 2; +} + +pre.tabbed { } /* Hljs support for unknown languages like Hjson has * regressed, I have to hack */ -pre code.language-Hjson { +pre code.language-Hjson, pre code.language-hjson { display: block; overflow-x: auto; padding: 0.5em; diff --git a/website/docs/js/tab-langs.js b/website/docs/js/tab-langs.js index c05eae5..937e56f 100644 --- a/website/docs/js/tab-langs.js +++ b/website/docs/js/tab-langs.js @@ -18,6 +18,7 @@ function find_groups(langs) { ); if (!lang) return; let pre = this.parentElement; + pre.classList.add("tabbed"); let last_group = groups[groups.length-1]; let item = { lang, pre }; if (last_group) { |