[英]How to delete contents of an HTML tag in Emacs
Vim有一個很棒的功能,允許用戶刪除標記內容,引號等。例如,在以下情況:
<h1> Cursor is here -> █ <- :) </h1>
可以鍵入d i t (“在標簽中刪除”)以刪除<h1>
HTML標記的內容。
還有其他快捷方式,例如:
()
""
。 ''
。 Emacs有這樣的事嗎?
我知道zap-to-char
和nXhtml的sgml-delete-tag
,但它們不能完全按照我的意願行事。
這段代碼對你有用嗎?
(defun sgml-delete-tagged-text ()
"delete text between the tags that contain the current point"
(interactive)
(let ((b (point)))
(sgml-skip-tag-backward 1)
(when (not (eq b (point)))
;; moved somewhere, should be at front of a tag now
(save-excursion
(forward-sexp 1)
(setq b (point)))
(sgml-skip-tag-forward 1)
(backward-sexp 1)
(delete-region b (point)))))
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.