aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--evil-commands.el9
-rw-r--r--evil-maps.el1
2 files changed, 10 insertions, 0 deletions
diff --git a/evil-commands.el b/evil-commands.el
index a0dfca6..b3f90b7 100644
--- a/evil-commands.el
+++ b/evil-commands.el
@@ -3165,6 +3165,15 @@ otherwise they are skipped. "
(and (not buffer-read-only)
(buffer-file-name))))))
+(evil-define-command evil-update ()
+ "Same as `evil-write', but only write when the buffer has been modified."
+ :motion nil
+ :move-point nil
+ :type line
+ :repeat nil
+ (when (buffer-modified-p)
+ (call-interactively #'evil-write)))
+
(evil-define-command evil-save (filename &optional bang)
"Save the current buffer to FILENAME.
Changes the file name of the current buffer to FILENAME. If no
diff --git a/evil-maps.el b/evil-maps.el
index 971cf7a..e3f2651 100644
--- a/evil-maps.el
+++ b/evil-maps.el
@@ -472,6 +472,7 @@ included in `evil-insert-state-bindings' by default."
(evil-ex-define-cmd "e[dit]" 'evil-edit)
(evil-ex-define-cmd "w[rite]" 'evil-write)
+(evil-ex-define-cmd "up[date]" 'evil-update)
(evil-ex-define-cmd "wa[ll]" 'evil-write-all)
(evil-ex-define-cmd "sav[eas]" 'evil-save)
(evil-ex-define-cmd "r[ead]" 'evil-read)