From 08edf2a17ee04bf7c87a20f0a659ccede08d46c7 Mon Sep 17 00:00:00 2001 From: Brian Hicks Date: Mon, 15 Feb 2021 13:44:12 -0600 Subject: [PATCH] grep for exact matches --- pkgs/kak-open/rc/kak-open.kak | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/kak-open/rc/kak-open.kak b/pkgs/kak-open/rc/kak-open.kak index 3a2c242..e9d9c44 100644 --- a/pkgs/kak-open/rc/kak-open.kak +++ b/pkgs/kak-open/rc/kak-open.kak @@ -3,7 +3,7 @@ declare-option str similar_sort_path "similar-sort" define-command -docstring 'open files named similarly to the current buffer' open-similar %{ tmux-terminal-horizontal sh -c %{ set -euo pipefail - FILE="$(git ls-files --others --cached --exclude-standard | $1 $2 | grep -v $2 | fzf --tiebreak index)" + FILE="$(git ls-files --others --cached --exclude-standard | $1 $2 | grep -Ev "^$2\$" | fzf --tiebreak index)" printf "evaluate-commands -client %s edit %s\n" "$3" "$FILE" | indiekak -p $4 } -- %opt{similar_sort_path} %val{bufname} %val{client} %val{session} } @@ -16,7 +16,7 @@ define-command -docstring 'open buffers named similarly to the current buffer' o OPTIONS="$(printf "%s\n%s" "$OPTIONS" "$OPTION")" done - BUFFER="$(echo "$OPTIONS" | $1 $2 | grep -v $2 | grep -ve '^$' | fzf --tiebreak index)" + BUFFER="$(echo "$OPTIONS" | $1 $2 | grep -Ev "^$2\$" | grep -ve '^$' | fzf --tiebreak index)" printf "evaluate-commands -client %s edit '%s'\n" "$3" "$BUFFER" | indiekak -p $4 } -- %opt{similar_sort_path} %val{bufname} %val{client} %val{session} %val{buflist} }