summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-04-24 07:03:49 +0300
committerPaul Buetow <paul@buetow.org>2025-04-24 07:03:49 +0300
commit20c26eacc4ea35ff04526ec4fadde1516cf12726 (patch)
treec7b8c99943b87b6cb682422c6f4bbd8001412e3d
parentb417ddb1105d248d628633381937285316342f16 (diff)
jo
-rw-r--r--dotfiles/fish/conf.d/quickedit.fish31
1 files changed, 21 insertions, 10 deletions
diff --git a/dotfiles/fish/conf.d/quickedit.fish b/dotfiles/fish/conf.d/quickedit.fish
index b3ed9ab..c805bee 100644
--- a/dotfiles/fish/conf.d/quickedit.fish
+++ b/dotfiles/fish/conf.d/quickedit.fish
@@ -1,24 +1,21 @@
set -gx QUICKEDIT_DIR ~/QuickEdit
-function quickedit
- set -l prev_dir (pwd)
- set -l grep_pattern .
+function quickedit::postaction
+ set -l file_path $argv[1]
+ set -l make_run 0
- if test (count $argv) -gt 0
- set grep_pattern $argv[1]
+ if test -f Makefile
+ make
+ set make_run 1
end
- cd $QUICKEDIT_DIR
- set -l file_path (find -L . -type f -not -path '*/.*' | grep "$grep_pattern" | fzf)
- $EDITOR $file_path
-
# Go to git toplevel dir (if exists)
cd (dirname $file_path)
set -l git_dir (git rev-parse --show-toplevel 2>/dev/null)
if test $status -eq 0
cd $git_dir
end
- if test -f Makefile
+ if not $make_run -eq 1 -a test -f Makefile
make
end
if test -d .git
@@ -26,7 +23,21 @@ function quickedit
git pull
git push
end
+end
+
+function quickedit
+ set -l prev_dir (pwd)
+ set -l grep_pattern .
+
+ if test (count $argv) -gt 0
+ set grep_pattern $argv[1]
+ end
+
+ cd $QUICKEDIT_DIR
+ set -l file_path (find -L . -type f -not -path '*/.*' | grep "$grep_pattern" | fzf)
+ $EDITOR $file_path
+ quickedit::postaction $file_path
cd $prev_dir
end