diff options
| -rw-r--r-- | dotfiles/fish/conf.d/editor.fish | 11 | ||||
| -rw-r--r-- | dotfiles/fish/conf.d/quickedit.fish | 7 |
2 files changed, 9 insertions, 9 deletions
diff --git a/dotfiles/fish/conf.d/editor.fish b/dotfiles/fish/conf.d/editor.fish index 4982ae7..111c6d9 100644 --- a/dotfiles/fish/conf.d/editor.fish +++ b/dotfiles/fish/conf.d/editor.fish @@ -9,16 +9,12 @@ function editor::helix::open_with_lock set -l file $argv[1] set -l lock "$file.lock" if test -f "$lock" - if pgrep -f hx - echo "File lock $lock exists! Another instance is editing it?" - return 2 - end + echo "File lock $lock exists! Another instance is editing it?" + return 2 end touch $lock - function cleanup_lock --on-process-exit hx - rm -f $lock - end hx $file $argv[2..-1] + rm $lock end function editor::helix::edit::remote @@ -29,5 +25,6 @@ function editor::helix::edit::remote hx $local_path end +abbr -a lhx 'editor::helix::open_with_lock' abbr -a hxl 'editor::helix::open_with_lock' abbr -a rhx 'editor::helix::edit::remote' diff --git a/dotfiles/fish/conf.d/quickedit.fish b/dotfiles/fish/conf.d/quickedit.fish index ca3ad3b..3569581 100644 --- a/dotfiles/fish/conf.d/quickedit.fish +++ b/dotfiles/fish/conf.d/quickedit.fish @@ -42,9 +42,12 @@ function quickedit | grep "$grep_pattern" \ | fzf ) - $EDITOR $file_path + hx + + if editor::helix::open_with_lock $file_path + quickedit::postaction $file_path + end - quickedit::postaction $file_path cd $prev_dir end |
