From 16e001c3a2e4da17b9b09f7a631158c8d8522bde Mon Sep 17 00:00:00 2001 From: Sidharth Kshatriya Date: Wed, 19 Jan 2022 12:10:20 +0530 Subject: [PATCH] Improve comment --- rc/modules/fzf-file.kak | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rc/modules/fzf-file.kak b/rc/modules/fzf-file.kak index 2ebf563..2412ead 100644 --- a/rc/modules/fzf-file.kak +++ b/rc/modules/fzf-file.kak @@ -33,11 +33,13 @@ bool fzf_file_preview true define-command -hidden fzf-file -params 0..1 %{ evaluate-commands %sh{ + # Default fzf-file behavior search_dir="." if [ "$1" = "buffile-dir" ]; then - # dirname will return '.' if the file is non-existent. - # This value is a fail-safe default if we ever use buffile-dir functionality - # by mistake on files that do not have a directory e.g. *scratch* + # If the buffile-dir functionality (which is currently mapped to F) is + # invoked by mistake on a buffile like `*scratch*` or `*grep*` and similar, there will be + # no slashes in the buffile name and `dirname` will return `.` which means the functionality + # will revert to the normal fzf-file behavior -- which is what we want in this scenario. search_dir=$(dirname "$kak_buffile") fi