Skip to content

Commit

Permalink
fix: renamd global variable this_dir to _fzf_help_directory.
Browse files Browse the repository at this point in the history
  • Loading branch information
BartSte committed Feb 28, 2024
1 parent 6f29f55 commit 47739ae
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
22 changes: 15 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ user. A change is always categorized based on the following types:

If a change is breaking, this is mentioned and a major version is released.

# 2.1.1

## Bug

- The fzf-help.bash/fish/zsh files are sourced by the user. These files
contained a global variable called `this_dir`, which can get in the way of
other scripts, as it is not very unique. The variable is now renamed to
`_fzf_help_directory`.

# 2.1.0

## Features
Expand All @@ -25,8 +34,7 @@ If a change is breaking, this is mentioned and a major version is released.
- The `batcat` command is supported as an alternative to `bat`.
- The `bat` dependency is now optional as the `cat` command is used as a
fallback. A warning is shown when `bat` is not installed. This warning can be
disabled by setting the `FZF_HELP_BAT_WARNING` environment variable to
`false`.
disabled by setting the `FZF_HELP_BAT_WARNING` environment variable to `false`.
- Unitests are added to the `test` directory.
- The test runner called `bats` is added as a git submodule.
- The tests are executed in as a GitHub action in a pipeline.
Expand All @@ -42,15 +50,15 @@ If a change is breaking, this is mentioned and a major version is released.

## Features

- Added FZF_HELP_SYNTAX environment variable to configure the syntax highlighting
of the fzf preview window.
- Added FZF_HELP_SYNTAX environment variable to configure the syntax
highlighting of the fzf preview window.
- Added support for the fish shell.

## Improvements

- **Breaking**: Refactored the install and uninstall scripts. The install directory is now
`/usr/share/fzf-help` for root installations and `$HOME/.local/share/fzf-help`
for user installations, independent of the shell.
- **Breaking**: Refactored the install and uninstall scripts. The install
directory is now `/usr/share/fzf-help` for root installations and
`$HOME/.local/share/fzf-help` for user installations, independent of the shell.

# 1.1.0

Expand Down
4 changes: 2 additions & 2 deletions src/fzf-help.bash
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
this_dir=$(dirname $(realpath ${BASH_SOURCE:-$0}))
_fzf_help_directory=$(dirname $(realpath ${BASH_SOURCE:-$0}))

##############################################################################
# fzf-help-widget
Expand All @@ -10,7 +10,7 @@ this_dir=$(dirname $(realpath ${BASH_SOURCE:-$0}))
fzf-help-widget() {
[[ -z $READLINE_LINE ]] && { return; }

local opts=$(echo $READLINE_LINE | $this_dir/fzf-select-option | tr "\n" " ")
local opts=$(echo $READLINE_LINE | $_fzf_help_directory/fzf-select-option | tr "\n" " ")
READLINE_LINE="$READLINE_LINE$opts"
READLINE_POINT=${#READLINE_LINE}

Expand Down
4 changes: 2 additions & 2 deletions src/fzf-help.fish
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set this_dir (dirname (realpath (status filename)))
set _fzf_help_directory (dirname (realpath (status filename)))

##############################################################################
# fzf-help-widget
Expand All @@ -12,7 +12,7 @@ function fzf-help-widget
return
end
set -l cmd (echo -n (commandline|string collect))
set -l opts (echo -n (commandline|string collect)| $this_dir/fzf-select-option | tr "\n" " "|string collect)
set -l opts (echo -n (commandline|string collect)| $_fzf_help_directory/fzf-select-option | tr "\n" " "|string collect)
commandline -r -- $cmd$opts
commandline -f repaint
return $status
Expand Down
4 changes: 2 additions & 2 deletions src/fzf-help.zsh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
this_dir=$(dirname $(realpath ${BASH_SOURCE:-$0}))
_fzf_help_directory=$(dirname $(realpath ${BASH_SOURCE:-$0}))

##############################################################################
# fzf-help-widget
Expand All @@ -10,7 +10,7 @@ this_dir=$(dirname $(realpath ${BASH_SOURCE:-$0}))
fzf-help-widget() {
[[ -z $BUFFER ]] && { zle reset-prompt; return }

local opts=$(echo $BUFFER | $this_dir/fzf-select-option | tr "\n" " ")
local opts=$(echo $BUFFER | $_fzf_help_directory/fzf-select-option | tr "\n" " ")
BUFFER="$BUFFER$opts"

local ret=$?
Expand Down

0 comments on commit 47739ae

Please sign in to comment.