Skip to content

Commit

Permalink
Avoid error when fzf-marks file is readonly
Browse files Browse the repository at this point in the history
This is related to issue #50
  • Loading branch information
urbainvaes committed Jun 11, 2021
1 parent 15ceb2a commit f5c9866
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion fzf-marks.plugin.bash
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ function jump {
jumpdir=$(sed 's/.*: \(.*\)$/\1/;'"s#^~#${HOME}#" <<< $jumpline)
bookmarks=$(_fzm_handle_symlinks)
cd "${jumpdir}" || return
if ! [[ "${FZF_MARKS_KEEP_ORDER}" == 1 ]]; then
if [[ ! "${FZF_MARKS_KEEP_ORDER}" == 1 && -w ${FZF_MARKS_FILE} ]]; then
perl -n -i -e "print unless /^\\Q${jumpline//\//\\/}\\E\$/" "${bookmarks}"
printf '%s\n' "${jumpline}" >> "${FZF_MARKS_FILE}"
fi
Expand Down
2 changes: 1 addition & 1 deletion fzf-marks.plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ function jump {
jumpdir=$(sed 's/.*: \(.*\)$/\1/;'"s#^~#${HOME}#" <<< "$jumpline")
bookmarks=$(_fzm_handle_symlinks)
cd "${jumpdir}" || return
if ! [[ "${FZF_MARKS_KEEP_ORDER}" == 1 ]]; then
if [[ ! "${FZF_MARKS_KEEP_ORDER}" == 1 && -w ${FZF_MARKS_FILE} ]]; then
perl -n -i -e "print unless /^\\Q${jumpline//\//\\/}\\E\$/" "${bookmarks}"
printf '%s\n' "${jumpline}" >> "${FZF_MARKS_FILE}"
fi
Expand Down

0 comments on commit f5c9866

Please sign in to comment.