z_mirror/dotfiles

git clone https://git.raiguard.me/z_mirror/dotfiles

Caleb HeuerFix quoting issues in nnn picker script80db373

uraya-alpine
463 B16 linesraw
1#!/bin/sh
2# Invokes NNN to pick a file and opens the chosen file in kakoune.
3
4start_location="$1" kak_client="$2" kak_session="$3"
5if ! [ -f "$start_location" ]; then
6  start_location="$(dirname '$start_location')"
7fi
8
9tmp="${TMPDIR:-/tmp}/nnn_pick_$$"
10nnn -p "$tmp" "$start_location"
11filename=$(cat "$tmp" | sed "s/'/\\'/g")
12rm "$tmp"
13
14if [ -n "$filename" ]; then
15  echo "evaluate-commands -client '$kak_client' %{edit \"$filename\"}" | kak -p "$kak_session"
16fi