summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-04-30 15:10:46 +0300
committerPaul Buetow <paul@buetow.org>2025-04-30 15:10:46 +0300
commite5f81c2ccb837e11abaadd82e046cd5439d50996 (patch)
treedcb473ecfdf471366aebc9c351c7895fa1a8b62c
parent54404eec7e2090cb94ecd0b9cb42547b2b250a65 (diff)
Update
-rw-r--r--dotfiles/fish/conf.d/editor.fish11
-rw-r--r--dotfiles/fish/conf.d/quickedit.fish7
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