From e58b785d586e46b707bc0818875dec769d01c016 Mon Sep 17 00:00:00 2001 From: Martin Myrseth Date: Tue, 14 May 2024 23:59:42 +0200 Subject: [PATCH] fix: Update extra/config.md reference config --- README.md | 14 +++++++++++--- extra/config.md | 30 ++++++++++++++++++++---------- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index b079578..65b02c9 100644 --- a/README.md +++ b/README.md @@ -134,6 +134,14 @@ It's possible to specify a multi-selection modifier to let the user select multiple files to pass to `vim`. In the `fzf` interface marking files for selection is done using ``. +```bash ${git-files | multi} +vim -p "$@" +``` + +### `vim-files-m` + +There's a shorthand `:m` if typing ` | multi` is too long. + ```bash ${git-files:m} vim -p "$@" ``` @@ -144,7 +152,7 @@ The `stdin` placeholder may be used to select candidates that will be passed to the command's `stdin`. Here we're using the `xargs` command to relay that as positional arguments to `vim`. -```bash <{git-files:m} +```bash <{git-files | multi m} xargs vim -p ``` @@ -155,7 +163,7 @@ into an environmental variable. The `environment variable` is named after the placeholder action with `-` *(dashes)* replaced by `_` *(underscore)*, `git_files` in this case. -```bash ={git-files:m} +```bash ={git-files | multi} vim -p $git_files ``` @@ -164,7 +172,7 @@ vim -p $git_files It is possible to give the environment variable an explicit name by placing and alias before the `=`, in this case `FILES`. -```bash FILES={git-files:m} +```bash FILES={git-files | multi} vim -p $FILES ``` diff --git a/extra/config.md b/extra/config.md index 59bd42c..dce965e 100644 --- a/extra/config.md +++ b/extra/config.md @@ -30,11 +30,14 @@ project_types: test: ["package.json"] desc: NPM project, - name: nix - test: ["default.nix", "shell.nix"] - desc: Nix project, + test: ["flake.nix"] + desc: Nix flake project, - name: git test: [".git"] desc: Git repository, + - name: rust + test: ["Cargo.toml"] + desc: Rust project, - name: project desc: Generic project ``` @@ -65,28 +68,35 @@ emacs ### `hello-world` -```bash <{json-greetings:m} +Select from one or more greetings in a JSON format. + +```bash <{json-greetings | multi} cat ``` ### `networks` +Use `nmcli` to list available networks. + ```bash nmcli -t connection | cut -d':' -f1 ``` ### `network-connect` +Use the `networks` placeholder to select a network to connect to. + ```bash ${networks} nmcli connection up "$1" ``` ### `pd` +The current project directory is available through the `$nixon_project_path` +environment variable. + ```bash -cd "$nixon_project_path/../.." -echo -n "Current dir: " -pwd +echo "Project dir: $nixon_project_path" ``` ## nix stuff @@ -180,7 +190,7 @@ git ls-files Invoke `git show` on commits selected from `git log`. It uses multiple selection and a field selector of `1` to pick the commit `SHA1` from the log. -```bash ${git-log:m1} +```bash ${git-log | multi | fields 1} git show "$@" ``` @@ -204,7 +214,7 @@ rg --files Open files in `vim` passing files to open in through `stdin` and `xargs`. -```bash <{rg-files:m} +```bash <{rg-files | multi} xargs vim -p ``` @@ -213,7 +223,7 @@ xargs vim -p Open files in `vim` passing files to open in through `stdin` and `xargs` concatenating every `stdin` input. -```bash <{git-files:m} <{rg-files:m} +```bash <{git-files | multi} <{rg-files:m} xargs vim -p ``` @@ -245,6 +255,6 @@ vim -p $rg_files Open files in `vim` passing files in an environment variable. -```bash FILES={rg-files:m} +```bash FILES={rg-files | multi} vim -p $FILES ```