{"id":24122170,"url":"https://github.com/tlinden/viking-mode","last_synced_at":"2025-02-28T19:24:34.338Z","repository":{"id":144613123,"uuid":"58819793","full_name":"TLINDEN/viking-mode","owner":"TLINDEN","description":"Kill first, ask later - an emacs mode for killing things quickly","archived":false,"fork":false,"pushed_at":"2016-07-05T20:27:37.000Z","size":2719,"stargazers_count":31,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-01-11T11:41:50.153Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://melpa.org/#/viking-mode","language":"Emacs Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TLINDEN.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-05-14T17:06:19.000Z","updated_at":"2024-10-15T14:09:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"15cdba88-70e2-43b1-9f27-f01334b00721","html_url":"https://github.com/TLINDEN/viking-mode","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TLINDEN%2Fviking-mode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TLINDEN%2Fviking-mode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TLINDEN%2Fviking-mode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TLINDEN%2Fviking-mode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TLINDEN","download_url":"https://codeload.github.com/TLINDEN/viking-mode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241210939,"owners_count":19927817,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-11T11:38:45.809Z","updated_at":"2025-02-28T19:24:34.325Z","avatar_url":"https://github.com/TLINDEN.png","language":"Emacs Lisp","funding_links":[],"categories":[],"sub_categories":[],"readme":"# viking-mode\nKill first, ask later - an emacs minor mode for killing things quickly\n\n[![MELPA](http://melpa.org/packages/viking-mode-badge.svg)](http://melpa.org/#/viking-mode)\n\n# Demo\n\n![demo](http://www.daemon.de/idisk/Misc/viking-mode-demo.gif)\n\n# Introduction\n\nViking minor mode  enables you to delete things at  point with one key\nstroke at once.  More  and more will be deleted if  you repeat the key\nstroke. As visual feedback the thing to be deleted will be highlighted\nshortly.\n\nThe default  key binding is C-d,  but you may  also bind it to  C-k or\nwhatever you wish.\n\nIf you  press C-d the  first time, the word  at point will  be deleted\n(but if  there's no word  at point but  whitespaces or an  empty line,\nthey will be deleted instead, which is the same as M-SPC).\n\nLike:\n\n    [keep pressing ctrl] C-d                  - word | spc\n                         C-d C-d              - line remainder\n                         C-d C-d C-d          - line\n                         C-d C-d C-d C-d      - paragraph\n                         C-d C-d C-d C-d C-d  - buffer\n\nHowever, this  only works when  pressing the key in  a row. If  you do\nsomething else in between, it starts from scratch (i.e.  delete word).\n\nYou can also repeat the last delete function with C-S-d (ctrl-shift-d)\nmultiple times.\n\nBy default  viking-mode is greedy:  after applying a kill  function it\nlooks if point  ends up alone on an empty  line or inside whitespaces.\nIn such a case, those will be deleted as well. The greedy behavior may\nbe turned off however.\n\nAnother  variant  is  to  use  viking mode  together  with  the  great\nexpand-region mode (available  on melpa). If installed  and enabled, a\nregion  is first  marked using  expand-region and  then deleted.  This\nmakes the deletion cascade language aware.\n\n# Install\n\nTo use, save viking-mode.el to a directory in your load-path.\n\nAdd something like this to your config:\n\n    (require 'viking-mode)\n    (add-hook 'text-mode-hook 'viking-mode)\n\nor load it manually\n\n    M-x viking-mode\n\nHowever, it's also possible to enable viking-mode globally:\n\n    (viking-global-mode)\n\n# Customize\n\nBy  default  viking-mode  doesn't  really  delete  things,  everything\nremains available for yanking in the  kill ring. However, you may turn\nit into berserk mode by setting 'viking-really-delete to t:\n\n    (setq viking-really-delete t)\n\nTo   turn  off   greedy   deleting  of   whitespace  remainders,   set\n'viking-greedy-kill to nil:\n\n    (setq viking-greedy-kill nil)\n\nTo enable quick deletion of regions using the normal key binding:\n\n     (setq viking-enable-region-kill t)\n\nTo turn off short blinking of deleted things (visual feedback):\n\n     (setq viking-enable-blinking nil)\n\nYou can change the default key binding by:\n\n    (define-key viking-mode-map (kbd \"C-k\") 'viking-kill-thing-at-point)\n\nThe key binding to repeat the last kill function can be changed:\n\n    (define-key viking-mode-map (kbd \"M-d\") 'viking-repeat-last-kill)\n\nIn case you  don't like the default key binding  cascade, you may also\nuse separate bindings for each kill function, e.g.:\n\n    (define-key viking-mode-map (kbd \"C-d\") nil)   turn C-d into a prefix-key\n    (define-key viking-mode-map (kbd \"C-d w\") 'viking-kill-word)\n    (define-key viking-mode-map (kbd \"C-d r\") 'viking-kill-line-from-point)\n    (define-key viking-mode-map (kbd \"C-d l\") 'viking-kill-line)\n    (define-key viking-mode-map (kbd \"C-d p\") 'viking-kill-paragraph)\n    (define-key viking-mode-map (kbd \"C-d a\") 'viking-kill-buffer)\n\nTo use viking-mode with expand-region:\n\n    (setq viking-use-expand-region-when-loaded t)\n    (require 'expand-region)\n    (global-set-key (kbd \"C-=\") 'er/expand-region)\n\nAlso, the font face of the short highlight can be modified:\n\n    M-x customize-face  (select viking-blink)\n\nThe kill functions to be called in a row can be customized as well. The\ndefault is this list:\n\n    (setq viking-kill-functions (list 'viking-kill-word\n                                      'viking-kill-line-from-point\n                                      'viking-kill-line\n                                      'viking-kill-paragraph\n                                      'viking-kill-buffer))\n\nNormally there should be no need  to modify it. However, this gives\nyou much more flexibility.\n\nOr, modify all available viking-mode variables interactively with:\n\n    M-x customize-group  (select viking-mode)\n\n# Tips\n\nBesides, the primary function of viking-mode is viking-last-key-repeats,\nwhich returns the number of times the last key have been pressed.\nThis can be used for other things as well, for example:\n\n    (defun goto-begin()\n    (interactive)\n      (let* ((key-times (viking-last-key-repeats)))\n        (cond\n         ((eq key-times 3)\n          (if mark-active\n              (goto-char (point-min))\n            (beginning-of-buffer))) \n         ((eq key-times 2)\n          (if mark-active () (push-mark))\n          (move-to-window-line 0)) \n         ((eq key-times 1)\n          (beginning-of-line)))))\n    \n    (defun goto-end ()\n      (interactive)\n      (let* ((key-times (viking-last-key-repeats)))\n        (cond\n         ((eq key-times 3)\n          (if mark-active\n              (goto-char (point-max))\n            (end-of-buffer))) \n         ((eq key-times 2)\n          (if mark-active () (push-mark))\n          (move-to-window-line -1)\n          (end-of-line)) \n         ((eq key-times 1)\n          (end-of-line)))))\n    \n    (global-set-key (kbd \"\u003chome\u003e\") 'goto-begin)\n    (global-set-key (kbd \"\u003cend\u003e\")  'goto-end)\n\nWhen you put this into your .emacs config, then you can do:\n\n    hit \u003chome\u003e once:  goto beginning of current line\n             repeat:  goto beginning of current window\n             repeat:  goto beginning of current buffer\n   \n(and the same with ```\u003cend\u003e``` in the other direction)\n\n# Reporting Bugs\n\nGoto https://github.com/tlinden/viking-mode and file a new issue.\n\n# Meta\n\nCopyright (C) 2016, T.v.Dein \u003ctlinden@cpan.org\u003e\n\nThis file is NOT part of Emacs.\n\nThis program is  free software; you can redistribute  it and/or modify\nit under the  terms of the GNU General Public  License as published by\nthe Free Software Foundation; either version  2 of the License, or (at\nyour option) any later version.\n\nThis program  is distributed in the  hope that it will  be useful, but\nWITHOUT   ANY  WARRANTY;   without  even   the  implied   warranty  of\nMERCHANTABILITY  or FITNESS  FOR A  PARTICULAR PURPOSE.   See the  GNU\nGeneral Public License for more details.\n\nYou should  have received  a copy  of the  GNU General  Public License\nalong  with  this  program;  if   not,  write  to  the  Free  Software\nFoundation, Inc.,  59 Temple Place,  Suite 330, Boston,  MA 02111-1307\nUSA\n       \nVersion  : 0.08\nAuthor   : T.v.Dein \u003ctlinden@cpan.org\u003e\nKeywords : kill delete\nURL      : https://github.com/tlinden/viking-mode\nLicense  : GNU General Public License \u003e= 2\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftlinden%2Fviking-mode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftlinden%2Fviking-mode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftlinden%2Fviking-mode/lists"}