Skip to content

Latest commit

 

History

History
261 lines (176 loc) · 3.61 KB

config.md

File metadata and controls

261 lines (176 loc) · 3.61 KB

Nixon

Config

The following source code block defines a nixon configuration using YAML:

# Enable "exact" matching algorithm.
exact_match: true

# Ignore case by default.
ignore_case: true

# Evaluate direnv environments.
use_direnv: true

# Evaluate nix shell environments.
use_nix: true

# Location of project directories.
project_dirs:
  - ~/src

# Project types, with marker file detection.
project_types:
  - name: cabal
    test: ["cabal.project"]
    desc: Cabal new-style project,
  - name: npm
    test: ["package.json"]
    desc: NPM project,
  - name: nix
    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

Generic commands

terminal &

x-terminal-emulator

emacs &

emacs

json-greetings

[
 {"title": "Norwegian", "value": "Hei, Verden!"},
 {"title": "English", "value": "Hello, World!"},
 {"title": "French", "value": "Bonjour, Monde!"}
]

hello-world

Select from one or more greetings in a JSON format.

cat

networks

Use nmcli to list available networks.

nmcli connection

network-connect

Use the networks placeholder to select a network to connect to.

# nmcli connection up "$1"
echo "$@"

pd

The current project directory is available through the $nixon_project_path environment variable.

echo "Project dir: $nixon_project_path"

nix stuff

nix-build

nix-build

nix-shell

nix-shell

npm stuff {type="npm"}

npm-scripts

List all npm scripts in a package.json.

jq '.scripts | to_entries | map({ title: (.key + " → " + .value), value: .key })' package.json

npm-run

Run a npm script from package.json.

npm run "$1"

npm-install

npm install

yarn stuff {type="yarn"}

yarn-run

yarn run "$1"

yarn-install

yarn install

Cabal stuff {type="cabal"}

cabal-build

cabal build

cabal-run

cabal run

cabal-test

cabal test

Git stuff

git-log

git log --oneline --color

git-files

git ls-files

git-show

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.

git show "$@"

Files

cat

Basic check for stdin is readable when there are no stdin placeholder args.

cat

rg-files

rg --files

vim-stdin

Open files in vim passing files to open in through stdin and xargs.

xargs vim -p

vim-stdin-concat

Open files in vim passing files to open in through stdin and xargs concatenating every stdin input.

xargs vim -p

vim-arg

Open files in vim passing files as a single positional argument.

vim -p "$1"

vim-args

Open files in vim passing files as positional arguments.

vim -p "$@"

vim-env

Open files in vim passing files in an environment variable.

vim -p $rg_files

vim-env-alias

Open files in vim passing files in an environment variable.

vim -p $FILES