Skip to content

Commit

Permalink
fix: Update extra/config.md reference config
Browse files Browse the repository at this point in the history
  • Loading branch information
myme committed May 14, 2024
1 parent 131e904 commit e58b785
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 13 deletions.
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<tab>`.

```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 "$@"
```
Expand All @@ -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
```

Expand All @@ -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
```

Expand All @@ -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
```

Expand Down
30 changes: 20 additions & 10 deletions extra/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 "$@"
```

Expand All @@ -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
```

Expand All @@ -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
```

Expand Down Expand Up @@ -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
```

0 comments on commit e58b785

Please sign in to comment.