mirror of
https://codeberg.org/scip/viking-mode.git
synced 2025-12-17 20:40:59 +01:00
final tests ok, some tweaks to the docs
This commit is contained in:
19
README.md
19
README.md
@@ -17,14 +17,13 @@ shortly.
|
|||||||
The default key binding is C-d, but you may also bind it to C-k or
|
The default key binding is C-d, but you may also bind it to C-k or
|
||||||
whatever you wish.
|
whatever you wish.
|
||||||
|
|
||||||
If you press C-d the first time, the word at point will be deleted.
|
If you press C-d the first time, the word at point will be deleted
|
||||||
If you press it again, the remainder of the line from point will be
|
(but if there's no word at point but whitespaces or an empty line,
|
||||||
deleted. If pressed again, the whole line, then the paragraph and
|
they will be deleted instead, which is the same as M-SPC).
|
||||||
finally the whole buffer will be deleted.
|
|
||||||
|
|
||||||
Like:
|
Like:
|
||||||
|
|
||||||
[keep pressing ctrl] C-d - word
|
[keep pressing ctrl] C-d - word | spc
|
||||||
C-d C-d - line remainder
|
C-d C-d - line remainder
|
||||||
C-d C-d C-d - line
|
C-d C-d C-d - line
|
||||||
C-d C-d C-d C-d - paragraph
|
C-d C-d C-d C-d - paragraph
|
||||||
@@ -33,6 +32,11 @@ Like:
|
|||||||
However, this only works when pressing the key in a row. If you do
|
However, this only works when pressing the key in a row. If you do
|
||||||
something else in between, it starts from scratch (i.e. delete word).
|
something else in between, it starts from scratch (i.e. delete word).
|
||||||
|
|
||||||
|
By default viking-mode is greedy: after applying a kill function it
|
||||||
|
looks if point ends up alone on an empty line or inside whitespaces.
|
||||||
|
In such a case, those will be deleted as well. The greedy behavior may
|
||||||
|
be turned off however.
|
||||||
|
|
||||||
# Install
|
# Install
|
||||||
|
|
||||||
To use, save viking-mode.el to a directory in your load-path.
|
To use, save viking-mode.el to a directory in your load-path.
|
||||||
@@ -58,6 +62,11 @@ it into berserk mode by setting 'viking-really-delete to t:
|
|||||||
|
|
||||||
(setq viking-really-delete t)
|
(setq viking-really-delete t)
|
||||||
|
|
||||||
|
To turn off greedy deleting of whitespace remainders, set
|
||||||
|
'viking-greedy-kill to nil:
|
||||||
|
|
||||||
|
(setq viking-greedy-kill nil)
|
||||||
|
|
||||||
You can change the default key binding by:
|
You can change the default key binding by:
|
||||||
|
|
||||||
(define-key viking-mode-map (kbd "C-k") 'viking-kill-thing-at-point)
|
(define-key viking-mode-map (kbd "C-k") 'viking-kill-thing-at-point)
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||||
;; USA
|
;; USA
|
||||||
|
|
||||||
;; Version: 0.03.TEST
|
;; Version: 0.03
|
||||||
;; Author: T.v.Dein <tlinden@cpan.org>
|
;; Author: T.v.Dein <tlinden@cpan.org>
|
||||||
;; Keywords: kill delete
|
;; Keywords: kill delete
|
||||||
;; URL: https://github.com/tlinden/viking-mode
|
;; URL: https://github.com/tlinden/viking-mode
|
||||||
@@ -36,8 +36,8 @@
|
|||||||
;; whatever you wish.
|
;; whatever you wish.
|
||||||
|
|
||||||
;; If you press C-d the first time, the word at point will be deleted
|
;; If you press C-d the first time, the word at point will be deleted
|
||||||
;; (but if there's no word at point but whitespaces or an empty line),
|
;; (but if there's no word at point but whitespaces or an empty line,
|
||||||
;; they will be deleted instead, which is the same as M-SPC.
|
;; they will be deleted instead, which is the same as M-SPC).
|
||||||
|
|
||||||
;; If you press C-d again, the remainder of the line from point will
|
;; If you press C-d again, the remainder of the line from point will
|
||||||
;; be deleted. If pressed again, the whole line, then the paragraph
|
;; be deleted. If pressed again, the whole line, then the paragraph
|
||||||
@@ -166,7 +166,7 @@
|
|||||||
;;; Code:
|
;;; Code:
|
||||||
;;;; Consts
|
;;;; Consts
|
||||||
|
|
||||||
(defconst viking-mode-version "0.02" "Viking Mode version.")
|
(defconst viking-mode-version "0.03" "Viking Mode version.")
|
||||||
|
|
||||||
(defgroup viking-mode nil
|
(defgroup viking-mode nil
|
||||||
"Kill first, ask later - an emacs mode for killing things quickly"
|
"Kill first, ask later - an emacs mode for killing things quickly"
|
||||||
@@ -292,6 +292,9 @@ should be a point-moving function."
|
|||||||
(message "word right of point deleted")))
|
(message "word right of point deleted")))
|
||||||
|
|
||||||
(defun viking--kill-space()
|
(defun viking--kill-space()
|
||||||
|
;; FIXME: might be better to implement this myself
|
||||||
|
;; so that all space+newlines will be deleted but
|
||||||
|
;; the last one, which is sometimes better...
|
||||||
"Kill space around point, including newline(s)."
|
"Kill space around point, including newline(s)."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((beg (save-excursion (skip-chars-backward " \t\r\n") (point)))
|
(let ((beg (save-excursion (skip-chars-backward " \t\r\n") (point)))
|
||||||
|
|||||||
Reference in New Issue
Block a user