mirror of
https://gitlab.com/dwt1/dotfiles.git
synced 2026-04-23 03:20:26 +10:00
Moving to Doom Emacs!
This commit is contained in:
102
.emacs.d/modules/editor/evil/+commands.el
Normal file
102
.emacs.d/modules/editor/evil/+commands.el
Normal file
@@ -0,0 +1,102 @@
|
||||
;;; editor/evil/+commands.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;
|
||||
;;; Custom commands
|
||||
;; Editing
|
||||
(evil-ex-define-cmd "@" #'+evil:macro-on-all-lines) ; TODO Test me
|
||||
(evil-ex-define-cmd "R[ead]" #'+evil:read)
|
||||
(evil-ex-define-cmd "al[ign]" #'+evil:align)
|
||||
(evil-ex-define-cmd "ral[ign]" #'+evil:align-right)
|
||||
(evil-ex-define-cmd "enhtml" #'+web:encode-html-entities)
|
||||
(evil-ex-define-cmd "dehtml" #'+web:decode-html-entities)
|
||||
(evil-ex-define-cmd "mc" #'+multiple-cursors:evil-mc)
|
||||
(evil-ex-define-cmd "iedit" #'evil-multiedit-ex-match)
|
||||
(evil-ex-define-cmd "na[rrow]" #'+evil:narrow-buffer)
|
||||
(evil-ex-define-cmd "retab" #'+evil:retab)
|
||||
(evil-ex-define-cmd "rev[erse]" #'+evil:reverse-lines)
|
||||
(evil-ex-define-cmd "l[ine]diff" #'evil-quick-diff)
|
||||
|
||||
;;; External resources
|
||||
;; TODO (evil-ex-define-cmd "db" #'doom:db)
|
||||
;; TODO (evil-ex-define-cmd "dbu[se]" #'doom:db-select)
|
||||
;; TODO (evil-ex-define-cmd "go[ogle]" #'doom:google-search)
|
||||
(evil-ex-define-cmd "lo[okup]" #'+lookup:online)
|
||||
(evil-ex-define-cmd "dash" #'+lookup:dash)
|
||||
(evil-ex-define-cmd "http" #'httpd-start) ; start http server
|
||||
(evil-ex-define-cmd "repl" #'+eval:repl) ; invoke or send to repl
|
||||
(evil-ex-define-cmd "h[elp]" #'+evil:help)
|
||||
|
||||
;; TODO (evil-ex-define-cmd "rx" 'doom:regex) ; open re-builder
|
||||
(evil-ex-define-cmd "sh[ell]" #'+eshell:run)
|
||||
(evil-ex-define-cmd "t[mux]" #'+tmux:run) ; send to tmux
|
||||
(evil-ex-define-cmd "tcd" #'+tmux:cd-here) ; cd to default-directory in tmux
|
||||
(evil-ex-define-cmd "pad" #'+evil:open-scratch-buffer)
|
||||
|
||||
;;; GIT
|
||||
(evil-ex-define-cmd "gist" #'+gist:send) ; send current buffer/region to gist
|
||||
(evil-ex-define-cmd "gistl" #'+gist:list) ; list gists by user
|
||||
(evil-ex-define-cmd "gbrowse" #'+vc:git-browse) ; show file/region in github/gitlab
|
||||
(evil-ex-define-cmd "gissues" #'forge-browse-issues) ; show github issues
|
||||
(evil-ex-define-cmd "git" #'magit-status) ; open magit status window
|
||||
(evil-ex-define-cmd "gstage" #'magit-stage)
|
||||
(evil-ex-define-cmd "gunstage" #'magit-unstage)
|
||||
(evil-ex-define-cmd "gblame" #'magit-blame)
|
||||
(evil-ex-define-cmd "grevert" #'git-gutter:revert-hunk)
|
||||
|
||||
;;; Dealing with buffers
|
||||
(evil-ex-define-cmd "k[ill]" #'doom/kill-current-buffer)
|
||||
(evil-ex-define-cmd "k[ill]all" #'+evil:kill-all-buffers)
|
||||
(evil-ex-define-cmd "k[ill]m" #'+evil:kill-matching-buffers)
|
||||
(evil-ex-define-cmd "k[ill]o" #'doom/kill-other-buffers)
|
||||
(evil-ex-define-cmd "k[ill]b" #'doom/kill-buried-buffers)
|
||||
(evil-ex-define-cmd "l[ast]" #'doom/popup-restore)
|
||||
(evil-ex-define-cmd "messages" #'view-echo-area-messages)
|
||||
(evil-ex-define-cmd "pop[up]" #'doom/popup-this-buffer)
|
||||
|
||||
;;; Project navigation
|
||||
(evil-ex-define-cmd "a" #'projectile-find-other-file)
|
||||
(evil-ex-define-cmd "cd" #'+evil:cd)
|
||||
(evil-ex-define-cmd "pwd" #'+evil:pwd)
|
||||
|
||||
(evil-define-command +evil:swiper (&optional search)
|
||||
"Invoke `swiper' with SEARCH, otherwise with the symbol at point."
|
||||
(interactive "<a>")
|
||||
(swiper-isearch search))
|
||||
(evil-ex-define-cmd "sw[iper]" #'+evil:swiper)
|
||||
|
||||
(cond ((featurep! :completion ivy)
|
||||
(evil-ex-define-cmd "pg[rep]" #'+ivy:project-search)
|
||||
(evil-ex-define-cmd "pg[grep]d" #'+ivy:project-search-from-cwd))
|
||||
|
||||
((featurep! :completion helm)
|
||||
(evil-ex-define-cmd "pg[rep]" #'+helm:project-search)
|
||||
(evil-ex-define-cmd "pg[grep]d" #'+helm:project-search-from-cwd)))
|
||||
|
||||
;;; Project tools
|
||||
(evil-ex-define-cmd "compile" #'+evil:compile)
|
||||
(evil-ex-define-cmd "mak[e]" #'+evil:make)
|
||||
(evil-ex-define-cmd "debug" #'+debugger/start)
|
||||
(evil-ex-define-cmd "er[rors]" #'flycheck-list-errors)
|
||||
|
||||
;;; File operations
|
||||
(evil-ex-define-cmd "cp" #'+evil:copy-this-file)
|
||||
(evil-ex-define-cmd "mv" #'+evil:move-this-file)
|
||||
(evil-ex-define-cmd "rm" #'+evil:delete-this-file)
|
||||
|
||||
;;; Sessions/tabs
|
||||
(evil-ex-define-cmd "sclear" #'+workspace/kill-session)
|
||||
(evil-ex-define-cmd "sl[oad]" #'doom/quickload-session)
|
||||
(evil-ex-define-cmd "ss[ave]" #'doom/quicksave-session)
|
||||
(evil-ex-define-cmd "tabc[lose]" #'+workspace:delete)
|
||||
(evil-ex-define-cmd "tabclear" #'doom/kill-all-buffers)
|
||||
(evil-ex-define-cmd "tabl[ast]" #'+workspace/switch-to-last)
|
||||
(evil-ex-define-cmd "tabload" #'+workspace:load)
|
||||
(evil-ex-define-cmd "tabn[ew]" #'+workspace:new)
|
||||
(evil-ex-define-cmd "tabn[ext]" #'+workspace:switch-next)
|
||||
(evil-ex-define-cmd "tabp[rev]" #'+workspace:switch-previous)
|
||||
(evil-ex-define-cmd "tabr[ename]" #'+workspace:rename)
|
||||
(evil-ex-define-cmd "tabs" #'+workspace/display)
|
||||
(evil-ex-define-cmd "tabsave" #'+workspace:save)
|
||||
|
||||
;;; Org-mode
|
||||
(evil-ex-define-cmd "cap" #'org-capture)
|
||||
238
.emacs.d/modules/editor/evil/+everywhere.el
Normal file
238
.emacs.d/modules/editor/evil/+everywhere.el
Normal file
@@ -0,0 +1,238 @@
|
||||
;;; editor/evil/+everywhere.el -*- lexical-binding: t; -*-
|
||||
|
||||
;; We load evil-collection ourselves for these reasons:
|
||||
;;
|
||||
;; 1. To truly lazy load it. Some of its modules, like
|
||||
;; evil-collection-{elisp-mode,buff-menu} are loaded immediately, because
|
||||
;; Emacs loads their packages immediately, which pulls in all of
|
||||
;; evil-collection (and other packages with it, sometimes).
|
||||
;; 2. This ensures a predictable load order, versus lazy loading using :defer or
|
||||
;; :after-call. This means users can use (after! org ...) and be sure that
|
||||
;; their changes will override evil-collection's.
|
||||
;; 3. Ideally, we'd do away with evil-collection entirely. It changes too often,
|
||||
;; introduces breaking bugs too frequently, and I don't agree with all their
|
||||
;; design choices. Regardless, it does mork than it causes trouble, so it may
|
||||
;; be here to stay.
|
||||
;; 4. Adds `+evil-collection-disabled-list', to make it easier for users to
|
||||
;; disable modules, and to reduce the effort required to maintain our copy of
|
||||
;; `evil-collection-list' (now I can just copy it from time to time).
|
||||
|
||||
(defvar +evil-collection-disabled-list
|
||||
'(anaconda-mode
|
||||
buff-menu
|
||||
comint
|
||||
company
|
||||
custom
|
||||
eldoc
|
||||
elisp-mode
|
||||
ert
|
||||
free-keys
|
||||
help
|
||||
helm
|
||||
image
|
||||
kotlin-mode
|
||||
occur
|
||||
package-menu
|
||||
ruby-mode
|
||||
simple
|
||||
slime)
|
||||
"A list of `evil-collection' modules to ignore. See the definition of this
|
||||
variable for an explanation of the defaults (in comments). See
|
||||
`evil-collection-mode-list' for a list of available options.")
|
||||
|
||||
(defvar evil-collection-setup-minibuffer nil)
|
||||
|
||||
;; We do this ourselves, and better.
|
||||
(defvar evil-collection-want-unimpaired-p nil)
|
||||
|
||||
;; This has to be defined here since evil-collection doesn't autoload its own.
|
||||
;; It must be updated whenever evil-collection updates theirs. Here's an easy
|
||||
;; way to update it:
|
||||
;;
|
||||
;; (with-current-buffer
|
||||
;; (url-retrieve-synchronously "https://raw.githubusercontent.com/emacs-evil/evil-collection/master/evil-collection.el" t t)
|
||||
;; (goto-char (point-min))
|
||||
;; (when (re-search-forward "^(defvar evil-collection--supported-modes\n[^(]+")
|
||||
;; (let ((list (sexp-at-point)))
|
||||
;; ;; Fixes
|
||||
;; (when (assq 'pdf list)
|
||||
;; (setf (alist-get 'pdf list) '(pdf-tools)))
|
||||
;; (kill-new (prin1-to-string list)))))
|
||||
|
||||
(defvar evil-collection-mode-list
|
||||
`(2048-game
|
||||
ag
|
||||
alchemist
|
||||
anaconda-mode
|
||||
apropos
|
||||
arc-mode
|
||||
bookmark
|
||||
(buff-menu "buff-menu")
|
||||
calc
|
||||
calendar
|
||||
cider
|
||||
cmake-mode
|
||||
comint
|
||||
company
|
||||
compile
|
||||
(custom cus-edit)
|
||||
cus-theme
|
||||
daemons
|
||||
deadgrep
|
||||
debbugs
|
||||
debug
|
||||
diff-mode
|
||||
dired
|
||||
disk-usage
|
||||
doc-view
|
||||
docker
|
||||
ebib
|
||||
edbi
|
||||
edebug
|
||||
ediff
|
||||
eglot
|
||||
elfeed
|
||||
elisp-mode
|
||||
elisp-refs
|
||||
elisp-slime-nav
|
||||
emms
|
||||
epa
|
||||
ert
|
||||
eshell
|
||||
eval-sexp-fu
|
||||
evil-mc
|
||||
eww
|
||||
flycheck
|
||||
flymake
|
||||
free-keys
|
||||
geiser
|
||||
ggtags
|
||||
git-timemachine
|
||||
go-mode
|
||||
grep
|
||||
guix
|
||||
hackernews
|
||||
helm
|
||||
help
|
||||
helpful
|
||||
hg-histedit
|
||||
hungry-delete
|
||||
ibuffer
|
||||
image
|
||||
image-dired
|
||||
image+
|
||||
imenu-list
|
||||
indium
|
||||
info
|
||||
ivy
|
||||
js2-mode
|
||||
leetcode
|
||||
log-edit
|
||||
log-view
|
||||
lsp-ui-imenu
|
||||
lua-mode
|
||||
kotlin-mode
|
||||
macrostep
|
||||
man
|
||||
magit
|
||||
magit-todos
|
||||
,@(if evil-collection-setup-minibuffer '(minibuffer))
|
||||
monky
|
||||
mu4e
|
||||
mu4e-conversation
|
||||
neotree
|
||||
notmuch
|
||||
nov
|
||||
(occur replace)
|
||||
omnisharp
|
||||
outline
|
||||
p4
|
||||
(package-menu package)
|
||||
pass
|
||||
(pdf pdf-tools)
|
||||
popup
|
||||
proced
|
||||
process-menu
|
||||
prodigy
|
||||
profiler
|
||||
python
|
||||
quickrun
|
||||
racer
|
||||
realgud
|
||||
reftex
|
||||
restclient
|
||||
rjsx-mode
|
||||
robe
|
||||
rtags
|
||||
ruby-mode
|
||||
simple
|
||||
slime
|
||||
sly
|
||||
tablist
|
||||
(term term ansi-term multi-term)
|
||||
tetris
|
||||
tide
|
||||
transmission
|
||||
typescript-mode
|
||||
vc-annotate
|
||||
vc-dir
|
||||
vc-git
|
||||
vdiff
|
||||
view
|
||||
vlf
|
||||
vterm
|
||||
w3m
|
||||
wdired
|
||||
wgrep
|
||||
which-key
|
||||
woman
|
||||
xref
|
||||
youtube-dl
|
||||
(ztree ztree-diff)))
|
||||
|
||||
(defun +evil-collection-init (module &optional disabled-list)
|
||||
"Initialize evil-collection-MODULE.
|
||||
|
||||
Unlike `evil-collection-init', this respects `+evil-collection-disabled-list',
|
||||
and complains if a module is loaded too early (during startup)."
|
||||
(unless (memq (or (car-safe module) module) disabled-list)
|
||||
(doom-log "Initialized evil-collection-%s %s"
|
||||
(or (car-safe module) module)
|
||||
(if doom-init-time "" "(too early!)"))
|
||||
(with-demoted-errors "evil-collection error: %s"
|
||||
(evil-collection-init (list module)))))
|
||||
|
||||
|
||||
;;
|
||||
;;; Bootstrap
|
||||
|
||||
;; These modes belong to packages that Emacs always loads at startup, causing
|
||||
;; evil-collection to load immediately. We avoid this by loading them after
|
||||
;; evil-collection has first loaded...
|
||||
(with-eval-after-load 'evil-collection
|
||||
(mapc #'+evil-collection-init '(comint custom help)))
|
||||
|
||||
;; ...or on first invokation of their associated major/minor modes.
|
||||
(add-transient-hook! 'Buffer-menu-mode
|
||||
(+evil-collection-init '(buff-menu "buff-menu")))
|
||||
(add-transient-hook! 'image-mode
|
||||
(+evil-collection-init 'image))
|
||||
(add-transient-hook! 'emacs-lisp-mode
|
||||
(+evil-collection-init 'elisp-mode))
|
||||
(add-transient-hook! 'occur-mode
|
||||
(+evil-collection-init 'replace))
|
||||
|
||||
(evil-define-key* 'normal process-menu-mode-map
|
||||
"q" #'kill-current-buffer
|
||||
"d" #'process-menu-delete-process)
|
||||
|
||||
;; Don't overwrite the leader keys
|
||||
(setq evil-collection-key-blacklist
|
||||
(list doom-leader-key doom-localleader-key
|
||||
doom-leader-alt-key doom-localleader-alt-key))
|
||||
|
||||
;; Load the rest
|
||||
(dolist (mode evil-collection-mode-list)
|
||||
(dolist (req (or (cdr-safe mode) (list mode)))
|
||||
(with-eval-after-load req
|
||||
(+evil-collection-init mode +evil-collection-disabled-list))))
|
||||
176
.emacs.d/modules/editor/evil/README.org
Normal file
176
.emacs.d/modules/editor/evil/README.org
Normal file
@@ -0,0 +1,176 @@
|
||||
#+TITLE: feature/evil
|
||||
#+DATE: February 2, 2017
|
||||
#+SINCE: v2.0
|
||||
#+STARTUP: inlineimages
|
||||
|
||||
* Table of Contents :TOC_3:noexport:
|
||||
- [[#description][Description]]
|
||||
- [[#module-flags][Module Flags]]
|
||||
- [[#plugins][Plugins]]
|
||||
- [[#hacks][Hacks]]
|
||||
- [[#prerequisites][Prerequisites]]
|
||||
- [[#features][Features]]
|
||||
- [[#ported-vim-plugins][Ported vim plugins]]
|
||||
- [[#custom-text-objects][Custom Text Objects]]
|
||||
- [[#custom-ex-commands][Custom Ex Commands]]
|
||||
- [[#configuration][Configuration]]
|
||||
- [[#removing-evil-mode][Removing evil-mode]]
|
||||
- [[#restoring-old-substitution-behavior-on-ss][Restoring old substitution behavior on s/S]]
|
||||
|
||||
* Description
|
||||
This holy module brings the vim experience to Emacs.
|
||||
|
||||
** Module Flags
|
||||
+ =+everywhere= Enables evilified keybinds everywhere possible. Uses the
|
||||
[[https://github.com/emacs-evil/evil-collection][evil-collection]] plugin as a foundation.
|
||||
|
||||
** Plugins
|
||||
+ [[https://github.com/emacs-evil/evil][evil]]
|
||||
+ [[https://github.com/wcsmith/evil-args][evil-args]]
|
||||
+ [[https://github.com/PythonNut/evil-easymotion][evil-easymotion]]
|
||||
+ [[https://github.com/cute-jumper/evil-embrace.el][evil-embrace]]
|
||||
+ [[https://github.com/syl20bnr/evil-escape][evil-escape]]
|
||||
+ [[https://github.com/Dewdrops/evil-exchange][evil-exchange]]
|
||||
+ [[https://github.com/TheBB/evil-indent-plus][evil-indent-plus]]
|
||||
+ [[https://github.com/redguardtoo/evil-nerd-commenter][evil-nerd-commentary]]
|
||||
+ [[https://github.com/redguardtoo/evil-matchit][evil-matchit]]
|
||||
+ [[https://github.com/cofi/evil-numbers][evil-numbers]]
|
||||
+ [[https://github.com/noctuid/evil-textobj-anyblock][evil-textobj-anyblock]]
|
||||
+ [[https://github.com/hlissner/evil-snipe][evil-snipe]]
|
||||
+ [[https://github.com/emacs-evil/evil-surround][evil-surround]]
|
||||
+ [[https://github.com/alexmurray/evil-vimish-fold][evil-vimish-fold]]
|
||||
+ [[https://github.com/bling/evil-visualstar][evil-visualstar]]
|
||||
+ [[https://github.com/ninrod/exato][exato]]
|
||||
+ [[https://github.com/emacs-evil/evil-collection][evil-collection]]*
|
||||
+ [[https://www.github.com/rgrinberg/evil-quick-diff][evil-quick-diff]]
|
||||
|
||||
** Hacks
|
||||
+ The o/O keys will respect and continue commented lines (can be disabled by
|
||||
setting ~+evil-want-o/O-to-continue-comments~ to ~nil~).
|
||||
+ In visual mode, =*= and =#= will search for the current selection instead of
|
||||
the word-at-point.
|
||||
+ The ~:g[lobal]~ ex command has been modified to highlight matches.
|
||||
+ More of vim's filename modifiers are supported in ex commands (like ~:p~,
|
||||
~:p:h~ or ~:t~) than vanilla evil-mode offers.
|
||||
+ A custom filename modifier is available in Doom: ~:P~, which expands to the
|
||||
project root (throws an error if not in a project).
|
||||
|
||||
* Prerequisites
|
||||
This module has no external prerequisites.
|
||||
|
||||
* Features
|
||||
** Ported vim plugins
|
||||
The following vim plugins have been ported to evil:
|
||||
|
||||
| Vim Plugin | Emacs Plugin | Keybind(s) |
|
||||
|-----------------------+--------------------------------+--------------------------------------------|
|
||||
| vim-commentary | evil-nerd-commenter | omap =gc= |
|
||||
| vim-easymotion | evil-easymotion | omap =gs= |
|
||||
| vim-seek or vim-sneak | evil-snipe | mmap =s= / =S=, omap =z= / =Z= & =x= / =X= |
|
||||
| vim-surround | evil-embrace and evil-surround | vmap =S=, omap =ys= |
|
||||
|
||||
This module has also ported vim-unimpaired keybinds to Emacs.
|
||||
|
||||
In other modules:
|
||||
+ The tools/neotree & tools/treemacs modules provide a =NERDTree= equivalent.
|
||||
+ The editor/multiple-cursors module contains functionality equal to the
|
||||
following vim plugins:
|
||||
+ evil-multiedit => vim-multiedit
|
||||
+ evil-mc => vim-multiple-cursors
|
||||
|
||||
** Custom Text Objects
|
||||
This module provides a couple extra text objects, along with the built-in ones.
|
||||
For posterity, here are the built-in ones:
|
||||
|
||||
+ =w W= words
|
||||
+ =s= sentences
|
||||
+ =p= paragraphs
|
||||
+ =b= parenthesized blocks
|
||||
+ =b ( ) { } [ ] < >= braces, parentheses and brackets
|
||||
+ =' " `= quotes
|
||||
+ =t= tags
|
||||
+ =o= symbols
|
||||
|
||||
And these are text objects added by this module:
|
||||
|
||||
+ =a= C-style function arguments (provided by ~evil-args~)
|
||||
+ =B= any block delimited by braces, parentheses or brackets (provided by
|
||||
~evil-textobj-anyblock~)
|
||||
+ =i j k= by indentation (=k= includes one line above; =j= includes one line
|
||||
above and below) (provided by ~evil-indent-plus~)
|
||||
+ =x= XML attributes (provided by ~exato~)
|
||||
|
||||
** Custom Ex Commands
|
||||
| Ex Command | Description |
|
||||
|-----------------------+--------------------------------------------------------------------------------------|
|
||||
| ~:@~ | Apply macro on selected lines |
|
||||
| ~:ag[!] REGEXP~ | Perform a project search with ag |
|
||||
| ~:agcwd[!] REGEXP~ | Perform a project search with ag from the current directory |
|
||||
| ~:al[ign][!] REGEXP~ | Align text to the first match of REGEXP. If BANG, align all matches on each line |
|
||||
| ~:cp[!] NEWPATH~ | Copy the current file to NEWPATH |
|
||||
| ~:dash QUERY~ | Look up QUERY (or the symbol at point) in dash docsets |
|
||||
| ~:dehtml [INPUT]~ | HTML decode selected text / inserts result if INPUT is given |
|
||||
| ~:enhtml [INPUT]~ | HTML encode selected text / inserts result if INPUT is given |
|
||||
| ~:grep[!]~ | Perform a project search with git-grep |
|
||||
| ~:grepcwd[!]~ | Perform a project search with git-grep from the current directory |
|
||||
| ~:iedit REGEXP~ | Invoke iedit on all matches for REGEXP |
|
||||
| ~:k[ill]all[!]~ | Kill all buffers (if BANG, affect buffer across workspaces) |
|
||||
| ~:k[ill]b~ | Kill all buried buffers |
|
||||
| ~:k[ill]m[!] REGEXP~ | Kill buffers whose name matches REGEXP (if BANG, affect buffers across workspaces) |
|
||||
| ~:k[ill]o~ | Kill all other buffers besides the selected one |
|
||||
| ~:k[ill]~ | Kill the current buffer |
|
||||
| ~:lo[okup] QUERY~ | Look up QUERY on an online search engine |
|
||||
| ~:mc REGEXP~ | Invoke multiple cursors on all matches for REGEXP |
|
||||
| ~:mv[!] NEWPATH~ | Move the current file to NEWPATH |
|
||||
| ~:na[rrow]~ | Narrow the buffer to the selection |
|
||||
| ~:pad~ | Open a scratch pad for running code quickly |
|
||||
| ~:ral[ign][!] REGEXP~ | Right-Align text that matches REGEXP. If BANG, align all matches on each line |
|
||||
| ~:repl~ | Open a REPL and/or copy the current selection to it |
|
||||
| ~:retab~ | Convert indentation to the default within the selection |
|
||||
| ~:rev[erse]~ | Reverse the selected lines |
|
||||
| ~:rg[!]~ | Perform a project search with ripgrep |
|
||||
| ~:rgcwd[!]~ | Perform a project search with ripgrep from the current directory |
|
||||
| ~:rm[!] [PATH]~ | Delete the current buffer's file and buffer |
|
||||
| ~:tcd[!]~ | Send =cd X= to tmux. X = the project root if BANG, X = ~default-directory~ otherwise |
|
||||
|
||||
* Configuration
|
||||
** Removing evil-mode
|
||||
You must do two things to remove Evil:
|
||||
|
||||
1. Remove =:editor evil= from =~/.doom.d/init.el=,
|
||||
2. Run ~doom refresh~ to clean up lingering dependencies and refresh your
|
||||
autoloads files.
|
||||
3. [OPTIONAL] You may want to assign new values to ~doom-leader-alt-key~ and
|
||||
~doom-localleader-alt-key~. These are bound to =C-c= and =C-c l= by default.
|
||||
|
||||
#+begin_quote
|
||||
Ignore ~doom-leader-key~ and ~doom-localleader-key~, they don't apply to
|
||||
non-evil sessions.
|
||||
#+end_quote
|
||||
|
||||
Evil-specific configuration and keybindings (defined with ~map!~) will be
|
||||
ignored without =:editor evil= present (and omitted when byte-compiling).
|
||||
|
||||
Keep in mind that, at the time of this writing, Doom was designed by a vimmer,
|
||||
for vimmers. Little consideration has been put into designing a keybind scheme
|
||||
for vanilla Emacs users (though it's being worked on!).
|
||||
|
||||
That means that much of Doom's functionality will be orphaned in an evil-less
|
||||
setup. You'll have to set your own keybinds.
|
||||
|
||||
I suggest studying [[file:../../config/default/+emacs-bindings.el][config/default/+emacs-bindings.el]] to see what keybinds are
|
||||
available for non-evil users. Otherwise, you may find inspiration [[file:../../../docs/example_configs.org][on the example
|
||||
Doom configurations page]].
|
||||
|
||||
** Restoring old substitution behavior on s/S
|
||||
Doom replaces the =s= and =S= keys with the =evil-snipe= package (a port of
|
||||
vim-seek/vim-sneak for 2-character versions of f/F/t/T).
|
||||
|
||||
To disable evil-snipe on s/S, you can either:
|
||||
|
||||
1. Disable ~evil-snipe-mode~ by adding ~(after! evil-snipe (evil-snipe-mode
|
||||
-1))~ to =$DOOMDIR/config.el=,
|
||||
2. Or disable =evil-snipe= completely with ~(package! evil-snipe :disable t)~
|
||||
added to =$DOOMDIR/packages.el=, but this will also disable incremental
|
||||
highlighting for the f/F/t/T motions keys.
|
||||
3. Or use =cl= and =cc=, respectively; they do the same thing.
|
||||
198
.emacs.d/modules/editor/evil/autoload/advice.el
Normal file
198
.emacs.d/modules/editor/evil/autoload/advice.el
Normal file
@@ -0,0 +1,198 @@
|
||||
;;; editor/evil/autoload/advice.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil-escape-a (&rest _)
|
||||
"Call `doom/escape' if `evil-force-normal-state' is called interactively."
|
||||
(when (called-interactively-p 'any)
|
||||
(call-interactively #'doom/escape)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil-resolve-vim-path-a (file-name)
|
||||
"Take a path and resolve any vim-like filename modifiers in it. This adds
|
||||
support for most vim file modifiers, as well as:
|
||||
|
||||
%:P Resolves to `doom-project-root'.
|
||||
|
||||
See http://vimdoc.sourceforge.net/htmldoc/cmdline.html#filename-modifiers for
|
||||
more information on modifiers."
|
||||
(let* (case-fold-search
|
||||
(regexp (concat "\\(?:^\\|[^\\\\]\\)"
|
||||
"\\([#%]\\)"
|
||||
"\\(\\(?::\\(?:[PphtreS~.]\\|g?s[^:\t\n ]+\\)\\)*\\)"))
|
||||
(matches
|
||||
(cl-loop with i = 0
|
||||
while (and (< i (length file-name))
|
||||
(string-match regexp file-name i))
|
||||
do (setq i (1+ (match-beginning 0)))
|
||||
and collect
|
||||
(cl-loop for j to (/ (length (match-data)) 2)
|
||||
collect (match-string j file-name)))))
|
||||
(dolist (match matches)
|
||||
(let ((flags (split-string (car (cdr (cdr match))) ":" t))
|
||||
(path (and buffer-file-name
|
||||
(pcase (car (cdr match))
|
||||
("%" (file-relative-name buffer-file-name))
|
||||
("#" (save-excursion (other-window 1) (file-relative-name buffer-file-name))))))
|
||||
flag global)
|
||||
(if (not path)
|
||||
(setq path "")
|
||||
(while flags
|
||||
(setq flag (pop flags))
|
||||
(when (string-suffix-p "\\" flag)
|
||||
(setq flag (concat flag (pop flags))))
|
||||
(when (string-prefix-p "gs" flag)
|
||||
(setq global t
|
||||
flag (substring flag 1)))
|
||||
(setq path
|
||||
(or (pcase (substring flag 0 1)
|
||||
("p" (expand-file-name path))
|
||||
("~" (concat "~/" (file-relative-name path "~")))
|
||||
("." (file-relative-name path default-directory))
|
||||
("t" (file-name-nondirectory (directory-file-name path)))
|
||||
("r" (file-name-sans-extension path))
|
||||
("e" (file-name-extension path))
|
||||
("S" (shell-quote-argument path))
|
||||
("h"
|
||||
(let ((parent (file-name-directory (expand-file-name path))))
|
||||
(unless (equal (file-truename path)
|
||||
(file-truename parent))
|
||||
(if (file-name-absolute-p path)
|
||||
(directory-file-name parent)
|
||||
(file-relative-name parent)))))
|
||||
("s"
|
||||
(if (featurep 'evil)
|
||||
(when-let (args (evil-delimited-arguments (substring flag 1) 2))
|
||||
(let ((pattern (evil-transform-vim-style-regexp (car args)))
|
||||
(replace (cadr args)))
|
||||
(replace-regexp-in-string
|
||||
(if global pattern (concat "\\(" pattern "\\).*\\'"))
|
||||
(evil-transform-vim-style-regexp replace) path t t
|
||||
(unless global 1))))
|
||||
path))
|
||||
("P"
|
||||
(let ((project-root (doom-project-root (file-name-directory (expand-file-name path)))))
|
||||
(unless project-root
|
||||
(user-error "Not in a project"))
|
||||
(abbreviate-file-name project-root)))
|
||||
(_ path))
|
||||
"")))
|
||||
;; strip trailing slash, if applicable
|
||||
(when (and (not (string= path "")) (equal (substring path -1) "/"))
|
||||
(setq path (substring path 0 -1))))
|
||||
(setq file-name
|
||||
(replace-regexp-in-string
|
||||
(format "\\(?:^\\|[^\\\\]\\)\\(%s\\)"
|
||||
(regexp-quote (string-trim-left (car match))))
|
||||
path file-name t t 1))))
|
||||
(replace-regexp-in-string regexp "\\1" file-name t)))
|
||||
|
||||
(defun +evil--insert-newline (&optional above _noextranewline)
|
||||
(let ((pos (save-excursion (beginning-of-line-text) (point)))
|
||||
comment-auto-fill-only-comments)
|
||||
(require 'smartparens)
|
||||
(evil-narrow-to-field
|
||||
(if above
|
||||
(if (save-excursion (nth 4 (sp--syntax-ppss pos)))
|
||||
(evil-save-goal-column
|
||||
(setq evil-auto-indent nil)
|
||||
(goto-char pos)
|
||||
(let ((ws (abs (skip-chars-backward " \t"))))
|
||||
;; FIXME oh god why
|
||||
(save-excursion
|
||||
(if comment-line-break-function
|
||||
(funcall comment-line-break-function nil)
|
||||
(comment-indent-new-line))
|
||||
(when (and (derived-mode-p 'c-mode 'c++-mode 'objc-mode 'java-mode 'js2-mode)
|
||||
(eq (char-after) ?/))
|
||||
(insert "*"))
|
||||
(insert
|
||||
(make-string (max 0 (+ ws (skip-chars-backward " \t")))
|
||||
32)))
|
||||
(insert (make-string (max 1 ws) 32))))
|
||||
(evil-move-beginning-of-line)
|
||||
(insert (if use-hard-newlines hard-newline "\n"))
|
||||
(forward-line -1)
|
||||
(back-to-indentation))
|
||||
(evil-move-end-of-line)
|
||||
(cond ((sp-point-in-comment pos)
|
||||
(setq evil-auto-indent nil)
|
||||
(if comment-line-break-function
|
||||
(funcall comment-line-break-function)
|
||||
(comment-indent-new-line)))
|
||||
;; TODO Find a better way to do this
|
||||
((and (eq major-mode 'haskell-mode)
|
||||
(fboundp 'haskell-indentation-newline-and-indent))
|
||||
(setq evil-auto-indent nil)
|
||||
(haskell-indentation-newline-and-indent))
|
||||
(t
|
||||
(insert (if use-hard-newlines hard-newline "\n"))
|
||||
(back-to-indentation)))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil--insert-newline-below-and-respect-comments-a (orig-fn count)
|
||||
(if (or (not +evil-want-o/O-to-continue-comments)
|
||||
(not (eq this-command 'evil-open-below))
|
||||
(evil-insert-state-p))
|
||||
(funcall orig-fn count)
|
||||
(cl-letf (((symbol-function 'evil-insert-newline-below)
|
||||
(lambda () (+evil--insert-newline))))
|
||||
(let ((evil-auto-indent evil-auto-indent))
|
||||
(funcall orig-fn count)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil--insert-newline-above-and-respect-comments-a (orig-fn count)
|
||||
(if (or (not +evil-want-o/O-to-continue-comments)
|
||||
(not (eq this-command 'evil-open-above))
|
||||
(evil-insert-state-p))
|
||||
(funcall orig-fn count)
|
||||
(cl-letf (((symbol-function 'evil-insert-newline-above)
|
||||
(lambda () (+evil--insert-newline 'above))))
|
||||
(let ((evil-auto-indent evil-auto-indent))
|
||||
(funcall orig-fn count)))))
|
||||
|
||||
;;;###autoload (autoload '+evil-window-split-a "editor/evil/autoload/advice" nil t)
|
||||
(evil-define-command +evil-window-split-a (&optional count file)
|
||||
"Same as `evil-window-split', but correctly updates the window history."
|
||||
:repeat nil
|
||||
(interactive "P<f>")
|
||||
;; HACK This ping-ponging between the destination and source windows is to
|
||||
;; update the window focus history, so that, if you close either split
|
||||
;; afterwards you won't be sent to some random window.
|
||||
(let ((doom-inhibit-switch-window-hooks t)
|
||||
(origwin (selected-window)))
|
||||
(select-window (split-window origwin count 'below))
|
||||
(unless evil-split-window-below
|
||||
(select-window origwin))
|
||||
(run-hooks 'doom-switch-window-hook))
|
||||
(recenter)
|
||||
(when (and (not count) evil-auto-balance-windows)
|
||||
(balance-windows (window-parent)))
|
||||
(if file (evil-edit file)))
|
||||
|
||||
;;;###autoload (autoload '+evil-window-vsplit-a "editor/evil/autoload/advice" nil t)
|
||||
(evil-define-command +evil-window-vsplit-a (&optional count file)
|
||||
"Same as `evil-window-split', but correctly updates the window history."
|
||||
:repeat nil
|
||||
(interactive "P<f>")
|
||||
;; HACK This ping-ponging between the destination and source windows is to
|
||||
;; update the window focus history, so that, if you close either split
|
||||
;; afterwards you won't be sent to some random window.
|
||||
(let ((doom-inhibit-switch-window-hooks t)
|
||||
(origwin (selected-window)))
|
||||
(select-window (split-window origwin count 'right))
|
||||
(unless evil-vsplit-window-right
|
||||
(select-window origwin))
|
||||
(run-hooks 'doom-switch-window-hook))
|
||||
(run-hooks)
|
||||
(recenter)
|
||||
(when (and (not count) evil-auto-balance-windows)
|
||||
(balance-windows (window-parent)))
|
||||
(if file (evil-edit file)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil--fix-dabbrev-in-minibuffer-h ()
|
||||
"Make `try-expand-dabbrev' from `hippie-expand' work in minibuffer. See
|
||||
`he-dabbrev-beg', so we need to redefine syntax for '/'."
|
||||
(set-syntax-table (let* ((table (make-syntax-table)))
|
||||
(modify-syntax-entry ?/ "." table)
|
||||
table)))
|
||||
39
.emacs.d/modules/editor/evil/autoload/embrace.el
Normal file
39
.emacs.d/modules/editor/evil/autoload/embrace.el
Normal file
@@ -0,0 +1,39 @@
|
||||
;;; editor/evil/autoload/embrace.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil--embrace-get-pair (char)
|
||||
(if-let* ((pair (cdr-safe (assoc (string-to-char char) evil-surround-pairs-alist))))
|
||||
pair
|
||||
(if-let* ((pair (assoc-default char embrace--pairs-list)))
|
||||
(if-let* ((real-pair (and (functionp (embrace-pair-struct-read-function pair))
|
||||
(funcall (embrace-pair-struct-read-function pair)))))
|
||||
real-pair
|
||||
(cons (embrace-pair-struct-left pair) (embrace-pair-struct-right pair)))
|
||||
(cons char char))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil--embrace-escaped ()
|
||||
"Backslash-escaped surround character support for embrace."
|
||||
(let ((char (read-char "\\")))
|
||||
(if (eq char 27)
|
||||
(cons "" "")
|
||||
(let ((pair (+evil--embrace-get-pair (string char)))
|
||||
(text (if (sp-point-in-string) "\\\\%s" "\\%s")))
|
||||
(cons (format text (car pair))
|
||||
(format text (cdr pair)))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil--embrace-latex ()
|
||||
"LaTeX command support for embrace."
|
||||
(cons (format "\\%s{" (read-string "\\")) "}"))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil--embrace-elisp-fn ()
|
||||
"Elisp function support for embrace."
|
||||
(cons (format "(%s " (or (read-string "(") "")) ")"))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil--embrace-angle-brackets ()
|
||||
"Type/generic angle brackets."
|
||||
(cons (format "%s<" (or (read-string "") ""))
|
||||
">"))
|
||||
180
.emacs.d/modules/editor/evil/autoload/evil.el
Normal file
180
.emacs.d/modules/editor/evil/autoload/evil.el
Normal file
@@ -0,0 +1,180 @@
|
||||
;; editor/evil/autoload/evil.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;;###autodef
|
||||
(defun set-evil-initial-state! (modes state)
|
||||
"Set the initialize STATE of MODES using `evil-set-initial-state'."
|
||||
(declare (indent defun))
|
||||
(after! evil
|
||||
(if (listp modes)
|
||||
(dolist (mode (doom-enlist modes))
|
||||
(evil-set-initial-state mode state))
|
||||
(evil-set-initial-state modes state))))
|
||||
|
||||
|
||||
;;
|
||||
;;; Interactive commands
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil/visual-indent ()
|
||||
"vnoremap < <gv"
|
||||
(interactive)
|
||||
(evil-shift-right (region-beginning) (region-end))
|
||||
(evil-normal-state)
|
||||
(evil-visual-restore))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil/visual-dedent ()
|
||||
"vnoremap > >gv"
|
||||
(interactive)
|
||||
(evil-shift-left (region-beginning) (region-end))
|
||||
(evil-normal-state)
|
||||
(evil-visual-restore))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil/paste-preserve-register ()
|
||||
"Call `evil-paste-after' without overwriting the clipboard (by writing to the
|
||||
0 register instead). This allows you to paste the same text again afterwards."
|
||||
(interactive)
|
||||
(let ((evil-this-register ?0))
|
||||
(call-interactively #'evil-paste-after)))
|
||||
|
||||
(defun +evil--window-swap (direction)
|
||||
"Move current window to the next window in DIRECTION.
|
||||
If there are no windows there and there is only one window, split in that
|
||||
direction and place this window there. If there are no windows and this isn't
|
||||
the only window, use evil-window-move-* (e.g. `evil-window-move-far-left')."
|
||||
(when (window-dedicated-p)
|
||||
(user-error "Cannot swap a dedicated window"))
|
||||
(let* ((this-window (selected-window))
|
||||
(this-buffer (current-buffer))
|
||||
(that-window (windmove-find-other-window direction nil this-window))
|
||||
(that-buffer (window-buffer that-window)))
|
||||
(when (or (minibufferp that-buffer)
|
||||
(window-dedicated-p this-window))
|
||||
(setq that-buffer nil that-window nil))
|
||||
(if (not (or that-window (one-window-p t)))
|
||||
(funcall (pcase direction
|
||||
('left #'evil-window-move-far-left)
|
||||
('right #'evil-window-move-far-right)
|
||||
('up #'evil-window-move-very-top)
|
||||
('down #'evil-window-move-very-bottom)))
|
||||
(unless that-window
|
||||
(setq that-window
|
||||
(split-window this-window nil
|
||||
(pcase direction
|
||||
('up 'above)
|
||||
('down 'below)
|
||||
(_ direction))))
|
||||
(with-selected-window that-window
|
||||
(switch-to-buffer (doom-fallback-buffer)))
|
||||
(setq that-buffer (window-buffer that-window)))
|
||||
(with-selected-window this-window
|
||||
(switch-to-buffer that-buffer))
|
||||
(with-selected-window that-window
|
||||
(switch-to-buffer this-buffer))
|
||||
(select-window that-window))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil/window-move-left () "See `+evil--window-swap'" (interactive) (+evil--window-swap 'left))
|
||||
;;;###autoload
|
||||
(defun +evil/window-move-right () "See `+evil--window-swap'" (interactive) (+evil--window-swap 'right))
|
||||
;;;###autoload
|
||||
(defun +evil/window-move-up () "See `+evil--window-swap'" (interactive) (+evil--window-swap 'up))
|
||||
;;;###autoload
|
||||
(defun +evil/window-move-down () "See `+evil--window-swap'" (interactive) (+evil--window-swap 'down))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil/easymotion ()
|
||||
"Invoke and lazy-load `evil-easymotion' without compromising which-key
|
||||
integration."
|
||||
(interactive)
|
||||
(let ((prefix (this-command-keys)))
|
||||
(evil-define-key* 'motion 'global prefix nil)
|
||||
(evilem-default-keybindings (key-description prefix))
|
||||
(setq prefix-arg current-prefix-arg
|
||||
unread-command-events
|
||||
(mapcar (lambda (e) (cons t e))
|
||||
(vconcat (when evil-this-operator
|
||||
(where-is-internal evil-this-operator
|
||||
evil-normal-state-map
|
||||
t))
|
||||
prefix)))))
|
||||
|
||||
;;;###autoload (autoload '+evil:apply-macro "editor/evil/autoload/evil" nil t)
|
||||
(evil-define-operator +evil:apply-macro (beg end)
|
||||
"Apply macro to each line."
|
||||
:move-point nil
|
||||
(interactive "<r>")
|
||||
(let ((register (or evil-this-register (read-char)))
|
||||
macro)
|
||||
(cond ((or (and (eq register ?@) (eq evil-last-register ?:))
|
||||
(eq register ?:))
|
||||
(setq macro (lambda () (evil-ex-repeat nil))
|
||||
evil-last-register ?:))
|
||||
((eq register ?@)
|
||||
(unless evil-last-register
|
||||
(user-error "No previously executed keyboard macro."))
|
||||
(setq macro (evil-get-register evil-last-register t)))
|
||||
((setq macro (evil-get-register register t)
|
||||
evil-last-register register)))
|
||||
(unless macro
|
||||
(user-error "No macro recorded in %c register" register))
|
||||
(evil-change-state 'normal)
|
||||
(evil-with-single-undo
|
||||
(let ((lines (count-lines beg end)))
|
||||
(message "Applied macro in %c register %d times" register lines)
|
||||
(apply-macro-to-region-lines beg end macro)
|
||||
(message "Applied macro in %c register %d times...DONE" register lines)))))
|
||||
|
||||
;;;###autoload (autoload '+evil:retab "editor/evil/autoload/evil" nil t)
|
||||
(evil-define-operator +evil:retab (&optional beg end)
|
||||
"Wrapper around `doom/retab'."
|
||||
:motion nil :move-point nil :type line
|
||||
(interactive "<r>")
|
||||
(doom/retab beg end))
|
||||
|
||||
;;;###autoload (autoload '+evil:narrow-buffer "editor/evil/autoload/evil" nil t)
|
||||
(evil-define-operator +evil:narrow-buffer (beg end &optional bang)
|
||||
"Narrow the buffer to region between BEG and END.
|
||||
|
||||
Widens narrowed buffers first. If BANG, use indirect buffer clones instead."
|
||||
:move-point nil
|
||||
(interactive "<r><!>")
|
||||
(if (not bang)
|
||||
(if (buffer-narrowed-p)
|
||||
(widen)
|
||||
(narrow-to-region beg end))
|
||||
(when (buffer-narrowed-p)
|
||||
(doom/widen-indirectly-narrowed-buffer t))
|
||||
(doom/narrow-buffer-indirectly beg end)))
|
||||
|
||||
;;;###autoload (autoload '+evil:yank-unindented "editor/evil/autoload/evil" nil t)
|
||||
(evil-define-operator +evil:yank-unindented (beg end _type _register _yank-handler)
|
||||
"Saves the (reindented) characters in motion into the kill-ring."
|
||||
:move-point nil
|
||||
:repeat nil
|
||||
(interactive "<R><x><y>")
|
||||
(let ((indent (save-excursion (goto-char beg) (current-indentation)))
|
||||
(text (buffer-substring beg end)))
|
||||
(with-temp-buffer
|
||||
(insert text)
|
||||
(indent-rigidly (point-min) (point-max) (- indent))
|
||||
(evil-yank (point-min) (point-max)))))
|
||||
|
||||
|
||||
;;
|
||||
;;; wgrep
|
||||
|
||||
;;;###autoload (autoload '+evil-delete "editor/evil/autoload/evil" nil t)
|
||||
(evil-define-operator +evil-delete (beg end type register yank-handler)
|
||||
"A wrapper around `evil-delete' for `wgrep' buffers that will invoke
|
||||
`wgrep-mark-deletion' on lines you try to delete."
|
||||
(interactive "<R><x><y>")
|
||||
(condition-case _ex
|
||||
(evil-delete beg end type register yank-handler)
|
||||
('text-read-only
|
||||
(evil-apply-on-block
|
||||
(lambda (beg _)
|
||||
(goto-char beg)
|
||||
(call-interactively #'wgrep-mark-deletion))
|
||||
beg (1- end) nil))))
|
||||
190
.emacs.d/modules/editor/evil/autoload/ex.el
Normal file
190
.emacs.d/modules/editor/evil/autoload/ex.el
Normal file
@@ -0,0 +1,190 @@
|
||||
;;; editor/evil/autoload/ex.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defvar +evil--flag nil)
|
||||
|
||||
(defun +evil--ex-match-init (name &optional face update-hook)
|
||||
(with-current-buffer evil-ex-current-buffer
|
||||
(cond
|
||||
((eq +evil--flag 'start)
|
||||
(evil-ex-make-hl name
|
||||
:face (or face 'evil-ex-lazy-highlight)
|
||||
:update-hook (or update-hook #'evil-ex-pattern-update-ex-info))
|
||||
(setq +evil--flag 'update))
|
||||
|
||||
((eq +evil--flag 'stop)
|
||||
(evil-ex-delete-hl name)))))
|
||||
|
||||
(defun +evil--ex-buffer-match (arg &optional hl-name flags beg end)
|
||||
(when (and (eq +evil--flag 'update)
|
||||
evil-ex-substitute-highlight-all
|
||||
(not (zerop (length arg))))
|
||||
(condition-case lossage
|
||||
(let* ((pattern (evil-ex-make-substitute-pattern
|
||||
arg
|
||||
(or flags (list))))
|
||||
(range (or (evil-copy-range evil-ex-range)
|
||||
(evil-range (or beg (line-beginning-position))
|
||||
(or end (line-end-position))
|
||||
'line
|
||||
:expanded t))))
|
||||
(evil-expand-range range)
|
||||
(evil-ex-hl-set-region hl-name
|
||||
(max (evil-range-beginning range) (window-start))
|
||||
(min (evil-range-end range) (window-end)))
|
||||
(evil-ex-hl-change hl-name pattern))
|
||||
(end-of-file
|
||||
(evil-ex-pattern-update-ex-info nil "incomplete replacement"))
|
||||
(user-error
|
||||
(evil-ex-pattern-update-ex-info nil (format "?%s" lossage))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil-ex-regexp-match (flag &optional arg invert)
|
||||
(let ((hl-name 'evil-ex-buffer-match)
|
||||
(+evil--flag flag))
|
||||
(with-selected-window (minibuffer-selected-window)
|
||||
(+evil--ex-match-init hl-name)
|
||||
(cl-destructuring-bind (&optional arg flags)
|
||||
(evil-delimited-arguments arg 2)
|
||||
(let ((evil-ex-substitute-global
|
||||
(if invert
|
||||
(not evil-ex-substitute-global)
|
||||
evil-ex-substitute-global)))
|
||||
(+evil--ex-buffer-match
|
||||
arg hl-name (string-to-list flags)))))))
|
||||
|
||||
|
||||
;;
|
||||
;;; Ex Commands
|
||||
|
||||
;;;###autoload (autoload '+evil:align "editor/evil/autoload/ex" nil t)
|
||||
(evil-define-command +evil:align (beg end pattern &optional flags)
|
||||
"Ex interface to `align-regexp'.
|
||||
|
||||
PATTERN is a vim-style regexp. FLAGS is an optional string of characters.
|
||||
Supports the following flags:
|
||||
|
||||
g Repeat alignment on all matches in each line"
|
||||
(interactive "<r><//>")
|
||||
(align-regexp
|
||||
beg end
|
||||
(concat "\\(\\s-*\\)" (evil-transform-vim-style-regexp pattern))
|
||||
1 1 (memq ?g flags)))
|
||||
|
||||
;;;###autoload (autoload '+evil:align-right "editor/evil/autoload/ex" nil t)
|
||||
(evil-define-command +evil:align-right (beg end pattern &optional flags)
|
||||
"Ex interface to `align-regexp' that right-aligns matches.
|
||||
|
||||
PATTERN is a vim-style regexp. FLAGS is an optional string of characters.
|
||||
Supports the following flags:
|
||||
|
||||
g Repeat alignment on all matches in each line"
|
||||
(interactive "<r><//>")
|
||||
(align-regexp
|
||||
beg end
|
||||
(concat "\\(" (evil-transform-vim-style-regexp pattern) "\\)")
|
||||
-1 1 (memq ?g flags)))
|
||||
|
||||
;; ;;;###autoload (autoload '+evil:sort "editor/evil/autoload/ex" nil nil)
|
||||
;; (evil-define-command +evil:sort (beg end &optional pattern flags reverse)
|
||||
;; (interactive "<r><//><!>"))
|
||||
|
||||
;;;###autoload (autoload '+evil:open-scratch-buffer "editor/evil/autoload/ex" nil t)
|
||||
(evil-define-operator +evil:open-scratch-buffer (bang)
|
||||
(interactive "<!>")
|
||||
(doom/open-scratch-buffer bang))
|
||||
|
||||
;;;###autoload (autoload '+evil:pwd "editor/evil/autoload/ex" nil t)
|
||||
(evil-define-command +evil:pwd (bang)
|
||||
"Display the current working directory. If BANG, copy it to your clipboard."
|
||||
(interactive "<!>")
|
||||
(if (not bang)
|
||||
(pwd)
|
||||
(kill-new default-directory)
|
||||
(message "Copied to clipboard")))
|
||||
|
||||
;;;###autoload (autoload '+evil:make "editor/evil/autoload/ex" nil t)
|
||||
(evil-define-command +evil:make (arguments &optional bang)
|
||||
"Run make with ARGUMENTS.
|
||||
If BANG is non-nil, open compilation output in a comint buffer.
|
||||
|
||||
If BANG, then run ARGUMENTS as a full command. This command understands vim file
|
||||
modifiers (like %:p:h). See `+evil-resolve-vim-path-a' for details."
|
||||
(interactive "<sh><!>")
|
||||
(+evil:compile (format "make %s"
|
||||
(evil-ex-replace-special-filenames
|
||||
arguments))
|
||||
bang))
|
||||
|
||||
;;;###autoload (autoload '+evil:compile "editor/evil/autoload/ex" nil t)
|
||||
(evil-define-command +evil:compile (arguments &optional bang)
|
||||
"Run `compile-command' with ARGUMENTS.
|
||||
If BANG is non-nil, open compilation output in a comint buffer.
|
||||
|
||||
This command understands vim file modifiers (like %:p:h). See
|
||||
`+evil-resolve-vim-path-a' for details."
|
||||
(interactive "<sh><!>")
|
||||
(compile (evil-ex-replace-special-filenames
|
||||
(format "%s %s"
|
||||
(eval compile-command)
|
||||
arguments))
|
||||
bang))
|
||||
|
||||
;;;###autoload (autoload '+evil:reverse-lines "editor/evil/autoload/ex" nil t)
|
||||
(evil-define-command +evil:reverse-lines (beg end)
|
||||
"Reverse lines between BEG and END."
|
||||
(interactive "<r>")
|
||||
(reverse-region beg end))
|
||||
|
||||
;;;###autoload (autoload '+evil:cd "editor/evil/autoload/ex" nil t)
|
||||
(evil-define-command +evil:cd (&optional path)
|
||||
"Change `default-directory' with `cd'."
|
||||
(interactive "<f>")
|
||||
(let ((path (or path "~")))
|
||||
(cd path)
|
||||
(message "Changed directory to '%s'" (abbreviate-file-name (expand-file-name path)))))
|
||||
|
||||
;;;###autoload (autoload '+evil:kill-all-buffers "editor/evil/autoload/ex" nil t)
|
||||
(evil-define-command +evil:kill-all-buffers (&optional bang)
|
||||
"Kill all buffers. If BANG, kill current session too."
|
||||
(interactive "<!>")
|
||||
(if (and bang (fboundp '+workspace/kill-session))
|
||||
(+workspace/kill-session)
|
||||
(call-interactively #'doom/kill-all-buffers)))
|
||||
|
||||
;;;###autoload (autoload '+evil:kill-matching-buffers "editor/evil/autoload/ex" nil t)
|
||||
(evil-define-command +evil:kill-matching-buffers (&optional bang pattern)
|
||||
"Kill all buffers matching PATTERN regexp. If BANG, only match project
|
||||
buffers."
|
||||
(interactive "<a>")
|
||||
(doom/kill-matching-buffers
|
||||
pattern (if bang (doom-project-buffer-list))))
|
||||
|
||||
;;;###autoload (autoload '+evil:help "editor/evil/autoload/ex" nil t)
|
||||
(evil-define-command +evil:help (&optional bang query)
|
||||
"Look up documentation for QUERY.
|
||||
|
||||
If QUERY is in the format of an ex command, it will map it to the underlying
|
||||
function and open its documentation with `helpful-function'. Otherwise, it will
|
||||
search for it with `apropos'.
|
||||
|
||||
If QUERY is empty, this runs the equivalent of 'M-x apropos'. If BANG is
|
||||
non-nil, a search is preformed against Doom's manual (with `doom/help-search')."
|
||||
(interactive "<!><a>")
|
||||
(if bang
|
||||
(doom/help-search query)
|
||||
(save-match-data
|
||||
(cond ((or (null query) (string-empty-p (string-trim query)))
|
||||
(call-interactively
|
||||
(or (command-remapping #'apropos)
|
||||
#'apropos)))
|
||||
((string-match "^ *:\\([^ ]+\\)$" query)
|
||||
(helpful-function
|
||||
(evil-ex-completed-binding (match-string 1 query))))
|
||||
((message "Searching for %S, this may take a while..." query)
|
||||
(apropos query t))))))
|
||||
|
||||
;;;###autoload (autoload '+evil:read "editor/evil/autoload/ex" nil t)
|
||||
(evil-define-command +evil:read (count file)
|
||||
"Alternative version of `evil-read' that replaces filename modifiers in FILE."
|
||||
(interactive "P<fsh>")
|
||||
(evil-read count (evil-ex-replace-special-filenames file)))
|
||||
33
.emacs.d/modules/editor/evil/autoload/files.el
Normal file
33
.emacs.d/modules/editor/evil/autoload/files.el
Normal file
@@ -0,0 +1,33 @@
|
||||
;;; editor/evil/autoload/files.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;;###autoload (autoload '+evil:delete-this-file "editor/evil/autoload/files" nil t)
|
||||
(evil-define-command +evil:delete-this-file (&optional filename force-p)
|
||||
"Delete FILENAME (defaults to the file associated with current buffer) and
|
||||
kills the buffer. If FORCE-P, force the deletion (don't ask for confirmation)."
|
||||
:repeat nil
|
||||
(interactive "<f><!>")
|
||||
(doom/delete-this-file (or filename (file-truename buffer-file-name))
|
||||
force-p))
|
||||
|
||||
;;;###autoload (autoload '+evil:move-this-file "editor/evil/autoload/files" nil t)
|
||||
(evil-define-command +evil:move-this-file (new-path &optional force-p)
|
||||
"Move current buffer's file to NEW-PATH. Replaces %, # and other vim-esque
|
||||
filename modifiers (see `+evil*ex-replace-special-filenames'). If FORCE-P,
|
||||
overwrite the destination file if it exists, without confirmation."
|
||||
:repeat nil
|
||||
(interactive "<f><!>")
|
||||
(when (or (not new-path) (string-empty-p new-path))
|
||||
(user-error "No new path was specified"))
|
||||
(doom/move-this-file new-path force-p))
|
||||
|
||||
;;;###autoload (autoload '+evil:copy-this-file "editor/evil/autoload/files" nil nil)
|
||||
(evil-define-command +evil:copy-this-file (new-path &optional force-p)
|
||||
"Copy current buffer's file to NEW-PATH. Replaces %, # and other vim-esque
|
||||
filename modifiers (see `+evil*ex-replace-special-filenames'). If FORCE-P,
|
||||
overwrite the destination file if it exists, without confirmation."
|
||||
:repeat nil
|
||||
(interactive "<f><!>")
|
||||
(when (or (not new-path) (string-empty-p new-path))
|
||||
(user-error "No new path was specified"))
|
||||
(doom/copy-this-file new-path force-p))
|
||||
|
||||
13
.emacs.d/modules/editor/evil/autoload/textobjects.el
Normal file
13
.emacs.d/modules/editor/evil/autoload/textobjects.el
Normal file
@@ -0,0 +1,13 @@
|
||||
;;; editor/evil/autoload/textobjects.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;;###autoload (autoload '+evil:whole-buffer-txtobj "editor/evil/autoload/textobjects" nil nil)
|
||||
(evil-define-text-object +evil:whole-buffer-txtobj (count &optional _beg _end type)
|
||||
"Text object to select the whole buffer."
|
||||
(evil-range (point-min) (point-max) type))
|
||||
|
||||
;;;###autoload (autoload '+evil:defun-txtobj "editor/evil/autoload/textobjects" nil nil)
|
||||
(evil-define-text-object +evil:defun-txtobj (count &optional _beg _end type)
|
||||
"Text object to select the whole buffer."
|
||||
(cl-destructuring-bind (beg . end)
|
||||
(bounds-of-thing-at-point 'defun)
|
||||
(evil-range beg end type)))
|
||||
200
.emacs.d/modules/editor/evil/autoload/unimpaired.el
Normal file
200
.emacs.d/modules/editor/evil/autoload/unimpaired.el
Normal file
@@ -0,0 +1,200 @@
|
||||
;;; editor/evil/autoload/unimpaired.el -*- lexical-binding: t; -*-
|
||||
|
||||
;; These are ported from vim-unimpaired https://github.com/tpope/vim-unimpaired
|
||||
;; and bound in the :config default module (in +evil-bindings.el).
|
||||
|
||||
;;
|
||||
;;; Next/Previous commands
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil/next-beginning-of-method (count)
|
||||
"Jump to the beginning of the COUNT-th method/function after point."
|
||||
(interactive "p")
|
||||
(beginning-of-defun (- count)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil/previous-beginning-of-method (count)
|
||||
"Jump to the beginning of the COUNT-th method/function before point."
|
||||
(interactive "p")
|
||||
(beginning-of-defun count))
|
||||
|
||||
;;;###autoload
|
||||
(defalias #'+evil/next-end-of-method #'end-of-defun
|
||||
"Jump to the end of the COUNT-th method/function after point.")
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil/previous-end-of-method (count)
|
||||
"Jump to the end of the COUNT-th method/function before point."
|
||||
(interactive "p")
|
||||
(end-of-defun (- count)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil/next-preproc-directive (count)
|
||||
"Jump to the COUNT-th preprocessor directive after point.
|
||||
|
||||
By default, this only recognizes C preproc directives. To change this see
|
||||
`+evil-preprocessor-regexp'."
|
||||
(interactive "p")
|
||||
;; TODO More generalized search, to support directives in other languages?
|
||||
(if (re-search-forward +evil-preprocessor-regexp nil t count)
|
||||
(goto-char (match-beginning 0))
|
||||
(user-error "No preprocessor directives %s point"
|
||||
(if (> count 0) "after" "before"))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil/previous-preproc-directive (count)
|
||||
"Jump to the COUNT-th preprocessor directive before point.
|
||||
|
||||
See `+evil/next-preproc-directive' for details."
|
||||
(interactive "p")
|
||||
(+evil/next-preproc-statement (- count)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil/next-comment (count)
|
||||
"Jump to the beginning of the COUNT-th commented region after point."
|
||||
(interactive "p")
|
||||
(let ((orig-pt (point)))
|
||||
(require 'newcomment)
|
||||
(dotimes (_ (abs count))
|
||||
(cond ((> count 0)
|
||||
(while (and (not (eobp)) (sp-point-in-comment))
|
||||
(forward-line 1))
|
||||
(unless (comment-search-forward (point-max) 'noerror)
|
||||
(goto-char orig-pt)
|
||||
(user-error "No comment after point")))
|
||||
(t
|
||||
(while (and (not (bobp)) (sp-point-in-comment))
|
||||
(forward-line -1))
|
||||
(unless (comment-search-backward nil 'noerror)
|
||||
(goto-char orig-pt)
|
||||
(user-error "No comment before point")))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil/previous-comment (count)
|
||||
"Jump to the beginning of the COUNT-th commented region before point."
|
||||
(interactive "p")
|
||||
(+evil/next-comment (- count)))
|
||||
|
||||
;;; ] SPC / [ SPC
|
||||
;;;###autoload
|
||||
(defun +evil/insert-newline-below (count)
|
||||
"Insert COUNT blank line(s) below current line. Does not change modes."
|
||||
(interactive "p")
|
||||
(dotimes (_ count)
|
||||
(save-excursion (evil-insert-newline-below))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil/insert-newline-above (count)
|
||||
"Insert COUNT blank line(s) above current line. Does not change modes."
|
||||
(interactive "p")
|
||||
(dotimes (_ count)
|
||||
(save-excursion (evil-insert-newline-above))))
|
||||
|
||||
;;; ]t / [t
|
||||
;;;###autoload
|
||||
(defun +evil/next-frame (count)
|
||||
"Focus next frame."
|
||||
(interactive "p")
|
||||
(dotimes (_ (abs count))
|
||||
(let ((frame (if (> count 0) (next-frame) (previous-frame))))
|
||||
(if (eq frame (selected-frame))
|
||||
(user-error "No other frame")
|
||||
(select-frame-set-input-focus frame)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil/previous-frame (count)
|
||||
"Focus previous frame."
|
||||
(interactive "p")
|
||||
(+evil/next-frame (- count)))
|
||||
|
||||
;;; ]f / [f
|
||||
(defun +evil--next-file (n)
|
||||
(unless buffer-file-name
|
||||
(user-error "Must be called from a file-visiting buffer"))
|
||||
(let* ((directory (file-name-directory buffer-file-name))
|
||||
(filename (file-name-nondirectory buffer-file-name))
|
||||
(files (doom-glob (file-name-directory buffer-file-name) "[!.]*"))
|
||||
(index (cl-position filename files :test #'file-equal-p)))
|
||||
(when (null index)
|
||||
(user-error "Couldn't find this file in current directory"))
|
||||
(let ((index (+ index n)))
|
||||
(cond ((>= index (length files))
|
||||
(user-error "No files after this one"))
|
||||
((< index 0)
|
||||
(user-error "No files before this one"))
|
||||
((expand-file-name (nth index files) directory))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil/next-file (count)
|
||||
"Open file following this one, alphabetically, in the same directory."
|
||||
(interactive "p")
|
||||
(find-file (+evil--next-file count)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil/previous-file (count)
|
||||
"Open file preceding this one, alphabetically, in the same directory."
|
||||
(interactive "p")
|
||||
(find-file (+evil--next-file (- count))))
|
||||
|
||||
|
||||
;;
|
||||
;;; Encoding/Decoding
|
||||
|
||||
;; NOTE For ]x / [x see :lang web
|
||||
;; - `+web:encode-html-entities'
|
||||
;; - `+web:decode-html-entities'
|
||||
|
||||
(defun +evil--encode (beg end fn)
|
||||
(save-excursion
|
||||
(goto-char beg)
|
||||
(let* ((end (if (eq evil-this-type 'line) (1- end) end))
|
||||
(text (buffer-substring-no-properties beg end)))
|
||||
(delete-region beg end)
|
||||
(insert (funcall fn text)))))
|
||||
|
||||
;;; ]u / [u
|
||||
;;;###autoload (autoload '+evil:url-encode "editor/evil/autoload/unimpaired" nil t)
|
||||
(evil-define-operator +evil:url-encode (_count &optional beg end)
|
||||
"TODO"
|
||||
(interactive "<c><r>")
|
||||
(+evil--encode beg end #'url-encode-url))
|
||||
|
||||
;;;###autoload (autoload '+evil:url-decode "editor/evil/autoload/unimpaired" nil t)
|
||||
(evil-define-operator +evil:url-decode (_count &optional beg end)
|
||||
"TODO"
|
||||
(interactive "<c><r>")
|
||||
(+evil--encode beg end #'url-unhex-string))
|
||||
|
||||
;;; ]y / [y
|
||||
;;;###autoload (autoload '+evil:c-string-encode "editor/evil/autoload/unimpaired" nil t)
|
||||
(evil-define-operator +evil:c-string-encode (_count &optional beg end)
|
||||
"TODO"
|
||||
(interactive "<c><r>")
|
||||
(+evil--encode
|
||||
beg end
|
||||
(lambda (text)
|
||||
(replace-regexp-in-string "[\"\\]" (lambda (ch) (concat "\\" ch)) text))))
|
||||
|
||||
;;;###autoload (autoload '+evil:c-string-decode "editor/evil/autoload/unimpaired" nil t)
|
||||
(evil-define-operator +evil:c-string-decode (_count &optional beg end)
|
||||
"TODO"
|
||||
(interactive "<c><r>")
|
||||
(+evil--encode
|
||||
beg end
|
||||
(lambda (text)
|
||||
(replace-regexp-in-string "\\\\[\"\\]" (lambda (str) (substring str 1)) text))))
|
||||
|
||||
|
||||
;;
|
||||
;;; Standalone
|
||||
|
||||
;;; gp
|
||||
;;;###autoload
|
||||
(defun +evil/reselect-paste ()
|
||||
"Return to visual mode and reselect the last pasted region."
|
||||
(interactive)
|
||||
(cl-destructuring-bind (_ _ _ beg end &optional _)
|
||||
evil-last-paste
|
||||
(evil-visual-make-selection
|
||||
(save-excursion (goto-char beg) (point-marker))
|
||||
end)))
|
||||
587
.emacs.d/modules/editor/evil/config.el
Normal file
587
.emacs.d/modules/editor/evil/config.el
Normal file
@@ -0,0 +1,587 @@
|
||||
;;; editor/evil/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
;; I'm a vimmer at heart. Its modal philosophy suits me better, and this module
|
||||
;; strives to make Emacs a much better vim than vim was.
|
||||
|
||||
(defvar +evil-repeat-keys (cons ";" ",")
|
||||
"The keys to use for universal repeating motions.
|
||||
|
||||
This is a cons cell whose CAR is the key for repeating a motion forward, and
|
||||
whose CDR is for repeating backward. They should both be kbd-able strings.")
|
||||
|
||||
(defvar +evil-want-o/O-to-continue-comments t
|
||||
"If non-nil, the o/O keys will continue comment lines if the point is on a
|
||||
line with a linewise comment.")
|
||||
|
||||
(defvar +evil-preprocessor-regexp "^\\s-*#[a-zA-Z0-9_]"
|
||||
"The regexp used by `+evil/next-preproc-directive' and
|
||||
`+evil/previous-preproc-directive' on ]# and [#, to jump between preprocessor
|
||||
directives. By default, this only recognizes C directives.")
|
||||
|
||||
;; Set these defaults before `evil'; use `defvar' so they can be changed prior
|
||||
;; to loading.
|
||||
(defvar evil-want-C-i-jump (or (daemonp) (display-graphic-p)))
|
||||
(defvar evil-want-C-u-scroll t)
|
||||
(defvar evil-want-C-w-scroll t)
|
||||
(defvar evil-want-Y-yank-to-eol t)
|
||||
(defvar evil-want-abbrev-expand-on-insert-exit nil)
|
||||
|
||||
(use-package! evil
|
||||
:hook (doom-init-modules . evil-mode)
|
||||
:demand t
|
||||
:preface
|
||||
(setq evil-want-visual-char-semi-exclusive t
|
||||
evil-magic t
|
||||
evil-echo-state t
|
||||
evil-indent-convert-tabs t
|
||||
evil-ex-search-vim-style-regexp t
|
||||
evil-ex-substitute-global t
|
||||
evil-ex-visual-char-range t ; column range for ex commands
|
||||
evil-insert-skip-empty-lines t
|
||||
evil-mode-line-format 'nil
|
||||
evil-respect-visual-line-mode t
|
||||
;; more vim-like behavior
|
||||
evil-symbol-word-search t
|
||||
;; cursor appearance
|
||||
evil-default-cursor '+evil-default-cursor-fn
|
||||
evil-normal-state-cursor 'box
|
||||
evil-emacs-state-cursor '(box +evil-emacs-cursor-fn)
|
||||
evil-insert-state-cursor 'bar
|
||||
evil-visual-state-cursor 'hollow
|
||||
;; must be set before evil/evil-collection is loaded
|
||||
evil-want-keybinding (not (featurep! +everywhere))
|
||||
;; Only do highlighting in selected window so that Emacs has less work
|
||||
;; to do highlighting them all.
|
||||
evil-ex-interactive-search-highlight 'selected-window)
|
||||
|
||||
:config
|
||||
(evil-select-search-module 'evil-search-module 'evil-search)
|
||||
|
||||
(put 'evil-define-key* 'lisp-indent-function 'defun)
|
||||
|
||||
;; stop copying each visual state move to the clipboard:
|
||||
;; https://bitbucket.org/lyro/evil/issue/336/osx-visual-state-copies-the-region-on
|
||||
;; grokked from:
|
||||
;; http://stackoverflow.com/questions/15873346/elisp-rename-macro
|
||||
(advice-add #'evil-visual-update-x-selection :override #'ignore)
|
||||
|
||||
;; Start help-with-tutorial in emacs state
|
||||
(advice-add #'help-with-tutorial :after (lambda (&rest _) (evil-emacs-state +1)))
|
||||
|
||||
;; Allows you to click buttons without initiating a selection
|
||||
(define-key evil-motion-state-map [down-mouse-1] nil)
|
||||
|
||||
;; Done in a hook to ensure the popup rules load as late as possible
|
||||
(add-hook! 'doom-init-modules-hook
|
||||
(defun +evil--init-popup-rules-h ()
|
||||
(set-popup-rules!
|
||||
'(("^\\*evil-registers" :size 0.3)
|
||||
("^\\*Command Line" :size 8)))))
|
||||
|
||||
;; Change the cursor color in emacs state. We do it this roundabout way
|
||||
;; instead of changing `evil-default-cursor' (or `evil-emacs-state-cursor') so
|
||||
;; it won't interfere with users who have changed these variables.
|
||||
(defvar +evil--default-cursor-color "#ffffff")
|
||||
(defvar +evil--emacs-cursor-color "#ff9999")
|
||||
|
||||
(add-hook! 'doom-load-theme-hook
|
||||
(defun +evil-update-cursor-color-h ()
|
||||
(setq +evil--default-cursor-color (face-background 'cursor)
|
||||
+evil--emacs-cursor-color (face-foreground 'warning))))
|
||||
|
||||
(defun +evil-default-cursor-fn ()
|
||||
(evil-set-cursor-color +evil--default-cursor-color))
|
||||
(defun +evil-emacs-cursor-fn ()
|
||||
(evil-set-cursor-color +evil--emacs-cursor-color))
|
||||
|
||||
(setq-hook! 'after-change-major-mode-hook evil-shift-width tab-width)
|
||||
|
||||
|
||||
;; --- keybind fixes ----------------------
|
||||
(after! wgrep
|
||||
;; A wrapper that invokes `wgrep-mark-deletion' across lines you use
|
||||
;; `evil-delete' in wgrep buffers.
|
||||
(define-key wgrep-mode-map [remap evil-delete] #'+evil-delete))
|
||||
|
||||
(add-hook! 'doom-escape-hook
|
||||
(defun +evil-disable-ex-highlights-h ()
|
||||
"Disable ex search buffer highlights."
|
||||
(when (evil-ex-hl-active-p 'evil-ex-search)
|
||||
(evil-ex-nohighlight)
|
||||
t)))
|
||||
|
||||
|
||||
;; --- evil hacks -------------------------
|
||||
(unless noninteractive
|
||||
(setq save-silently t)
|
||||
(add-hook! 'after-save-hook
|
||||
(defun +evil-display-vimlike-save-message-h ()
|
||||
"Shorter, vim-esque save messages."
|
||||
(message "\"%s\" %dL, %dC written"
|
||||
(if buffer-file-name
|
||||
(file-relative-name (file-truename buffer-file-name) (doom-project-root))
|
||||
(buffer-name))
|
||||
(count-lines (point-min) (point-max))
|
||||
(buffer-size)))))
|
||||
|
||||
;; 'gq' moves the cursor to the beginning of selection. Disable this, since
|
||||
;; it's more disruptive than helpful.
|
||||
(defadvice! +evil--dont-move-cursor-a (orig-fn &rest args)
|
||||
:around #'evil-indent
|
||||
(save-excursion (apply orig-fn args)))
|
||||
|
||||
;; In evil, registers 2-9 are buffer-local. In vim, they're global, so...
|
||||
(defadvice! +evil--make-numbered-markers-global-a (_arg)
|
||||
:after-until #'evil-global-marker-p
|
||||
(and (>= char ?2) (<= char ?9)))
|
||||
|
||||
;; Make ESC (from normal mode) the universal escaper. See `doom-escape-hook'.
|
||||
(advice-add #'evil-force-normal-state :after #'+evil-escape-a)
|
||||
|
||||
;; monkey patch `evil-ex-replace-special-filenames' to improve support for
|
||||
;; file modifiers like %:p:h. This adds support for most of vim's modifiers,
|
||||
;; and one custom one: %:P (expand to the project root).
|
||||
(advice-add #'evil-ex-replace-special-filenames :override #'+evil-resolve-vim-path-a)
|
||||
|
||||
;; make `try-expand-dabbrev' (from `hippie-expand') work in minibuffer
|
||||
(add-hook 'minibuffer-inactive-mode-hook #'+evil--fix-dabbrev-in-minibuffer-h)
|
||||
|
||||
;; Focus and recenter new splits
|
||||
(advice-add #'evil-window-split :override #'+evil-window-split-a)
|
||||
(advice-add #'evil-window-vsplit :override #'+evil-window-vsplit-a)
|
||||
|
||||
;; Make o/O continue comments (see `+evil-want-o/O-to-continue-comments')
|
||||
(advice-add #'evil-open-above :around #'+evil--insert-newline-above-and-respect-comments-a)
|
||||
(advice-add #'evil-open-below :around #'+evil--insert-newline-below-and-respect-comments-a)
|
||||
|
||||
;; Recenter screen after most searches
|
||||
(dolist (fn '(evil-visualstar/begin-search-forward
|
||||
evil-visualstar/begin-search-backward
|
||||
evil-ex-search-word-backward
|
||||
evil-ex-search-word-backward
|
||||
evil-ex-search-forward
|
||||
evil-ex-search-backward))
|
||||
(advice-add fn :after #'doom-recenter-a))
|
||||
|
||||
;; --- custom interactive codes -----------
|
||||
;; These arg types will highlight matches in the current buffer
|
||||
(evil-ex-define-argument-type regexp-match
|
||||
:runner (lambda (flag &optional arg) (+evil-ex-regexp-match flag arg 'inverted)))
|
||||
(evil-ex-define-argument-type regexp-global-match
|
||||
:runner +evil-ex-regexp-match)
|
||||
|
||||
(defun +evil--regexp-match-args (arg)
|
||||
(when (evil-ex-p)
|
||||
(cl-destructuring-bind (&optional arg flags)
|
||||
(evil-delimited-arguments arg 2)
|
||||
(list arg (string-to-list flags)))))
|
||||
|
||||
;; Other commands can make use of this
|
||||
(evil-define-interactive-code "<//>"
|
||||
:ex-arg regexp-match
|
||||
(+evil--regexp-match-args evil-ex-argument))
|
||||
|
||||
(evil-define-interactive-code "<//!>"
|
||||
:ex-arg regexp-global-match
|
||||
(+evil--regexp-match-args evil-ex-argument))
|
||||
|
||||
;; Forward declare these so that ex completion works, even if the autoloaded
|
||||
;; functions aren't loaded yet.
|
||||
(evil-add-command-properties '+evil:align :ex-arg 'regexp-match)
|
||||
(evil-add-command-properties '+evil:align-right :ex-arg 'regexp-match)
|
||||
(evil-add-command-properties '+multiple-cursors:evil-mc :ex-arg 'regexp-global-match)
|
||||
|
||||
;; Lazy load evil ex commands
|
||||
(delq! 'evil-ex features)
|
||||
(add-transient-hook! 'evil-ex (provide 'evil-ex))
|
||||
(after! evil-ex (load! "+commands")))
|
||||
|
||||
|
||||
;;
|
||||
;;; Packages
|
||||
|
||||
(use-package! evil-easymotion
|
||||
:commands evilem-create evilem-default-keybindings
|
||||
:config
|
||||
;; Use evil-search backend, instead of isearch
|
||||
(evilem-make-motion evilem-motion-search-next #'evil-ex-search-next
|
||||
:bind ((evil-ex-search-highlight-all nil)))
|
||||
(evilem-make-motion evilem-motion-search-previous #'evil-ex-search-previous
|
||||
:bind ((evil-ex-search-highlight-all nil)))
|
||||
|
||||
(evilem-make-motion evilem-motion-search-word-forward #'evil-ex-search-word-forward
|
||||
:bind ((evil-ex-search-highlight-all nil)))
|
||||
(evilem-make-motion evilem-motion-search-word-backward #'evil-ex-search-word-backward
|
||||
:bind ((evil-ex-search-highlight-all nil))))
|
||||
|
||||
|
||||
(use-package! evil-embrace
|
||||
:commands embrace-add-pair embrace-add-pair-regexp
|
||||
:hook (LaTeX-mode . embrace-LaTeX-mode-hook)
|
||||
:hook (org-mode . embrace-org-mode-hook)
|
||||
:hook ((ruby-mode enh-ruby-mode) . embrace-ruby-mode-hook)
|
||||
:hook (emacs-lisp-mode . embrace-emacs-lisp-mode-hook)
|
||||
:hook ((lisp-mode emacs-lisp-mode clojure-mode racket-mode)
|
||||
. +evil-embrace-lisp-mode-hook-h)
|
||||
:hook ((org-mode LaTeX-mode) . +evil-embrace-latex-mode-hook-h)
|
||||
:hook ((c++-mode rust-mode rustic-mode csharp-mode java-mode swift-mode typescript-mode)
|
||||
. +evil-embrace-angle-bracket-modes-hook-h)
|
||||
:init
|
||||
(after! evil-surround
|
||||
(evil-embrace-enable-evil-surround-integration))
|
||||
:config
|
||||
(setq evil-embrace-show-help-p nil)
|
||||
|
||||
(defun +evil-embrace-latex-mode-hook-h ()
|
||||
(embrace-add-pair-regexp ?l "\\[a-z]+{" "}" #'+evil--embrace-latex))
|
||||
|
||||
(defun +evil-embrace-lisp-mode-hook-h ()
|
||||
(push (cons ?f (make-embrace-pair-struct
|
||||
:key ?f
|
||||
:read-function #'+evil--embrace-elisp-fn
|
||||
:left-regexp "([^ ]+ "
|
||||
:right-regexp ")"))
|
||||
embrace--pairs-list))
|
||||
|
||||
(defun +evil-embrace-angle-bracket-modes-hook-h ()
|
||||
(set (make-local-variable 'evil-embrace-evil-surround-keys)
|
||||
(delq ?< evil-embrace-evil-surround-keys))
|
||||
(push (cons ?< (make-embrace-pair-struct
|
||||
:key ?<
|
||||
:read-function #'+evil--embrace-angle-brackets
|
||||
:left-regexp "\\[a-z]+<"
|
||||
:right-regexp ">"))
|
||||
embrace--pairs-list))
|
||||
|
||||
;; Add escaped-sequence support to embrace
|
||||
(setf (alist-get ?\\ (default-value 'embrace--pairs-list))
|
||||
(make-embrace-pair-struct
|
||||
:key ?\\
|
||||
:read-function #'+evil--embrace-escaped
|
||||
:left-regexp "\\[[{(]"
|
||||
:right-regexp "\\[]})]")))
|
||||
|
||||
|
||||
(use-package! evil-escape
|
||||
:commands evil-escape
|
||||
:after-call pre-command-hook
|
||||
:init
|
||||
(setq evil-escape-excluded-states '(normal visual multiedit emacs motion)
|
||||
evil-escape-excluded-major-modes '(neotree-mode treemacs-mode vterm-mode)
|
||||
evil-escape-key-sequence "jk"
|
||||
evil-escape-delay 0.15)
|
||||
(evil-define-key* '(insert replace visual operator) 'global "\C-g" #'evil-escape)
|
||||
:config
|
||||
;; no `evil-escape' in minibuffer
|
||||
(add-hook 'evil-escape-inhibit-functions #'minibufferp)
|
||||
;; so that evil-escape-mode-hook runs, and can be toggled by evil-mc
|
||||
(evil-escape-mode +1))
|
||||
|
||||
|
||||
(use-package! evil-exchange
|
||||
:commands evil-exchange
|
||||
:config
|
||||
(add-hook! 'doom-escape-hook
|
||||
(defun +evil--escape-exchange-h ()
|
||||
(when evil-exchange--overlays
|
||||
(evil-exchange-cancel)
|
||||
t))))
|
||||
|
||||
|
||||
(use-package! evil-quick-diff
|
||||
:commands (evil-quick-diff evil-quick-diff-cancel))
|
||||
|
||||
|
||||
(use-package! evil-nerd-commenter
|
||||
:commands (evilnc-comment-operator
|
||||
evilnc-inner-comment
|
||||
evilnc-outer-commenter))
|
||||
|
||||
|
||||
(use-package! evil-snipe
|
||||
:commands (evil-snipe-mode
|
||||
evil-snipe-override-mode
|
||||
evil-snipe-local-mode
|
||||
evil-snipe-override-local-mode)
|
||||
:after-call pre-command-hook
|
||||
:init
|
||||
(setq evil-snipe-smart-case t
|
||||
evil-snipe-scope 'line
|
||||
evil-snipe-repeat-scope 'visible
|
||||
evil-snipe-char-fold t)
|
||||
:config
|
||||
(pushnew! evil-snipe-disabled-modes 'Info-mode 'calc-mode)
|
||||
(evil-snipe-mode +1)
|
||||
(evil-snipe-override-mode +1))
|
||||
|
||||
|
||||
(use-package! evil-surround
|
||||
:commands (global-evil-surround-mode
|
||||
evil-surround-edit
|
||||
evil-Surround-edit
|
||||
evil-surround-region)
|
||||
:config (global-evil-surround-mode 1))
|
||||
|
||||
|
||||
(use-package! evil-traces
|
||||
:after evil-ex
|
||||
:config
|
||||
(pushnew! evil-traces-argument-type-alist
|
||||
'(+evil:align . evil-traces-global)
|
||||
'(+evil:align-right . evil-traces-global))
|
||||
(evil-traces-mode))
|
||||
|
||||
|
||||
;; Allows you to use the selection for * and #
|
||||
(use-package! evil-visualstar
|
||||
:commands (evil-visualstar/begin-search
|
||||
evil-visualstar/begin-search-forward
|
||||
evil-visualstar/begin-search-backward)
|
||||
:init
|
||||
(evil-define-key* 'visual 'global
|
||||
"*" #'evil-visualstar/begin-search-forward
|
||||
"#" #'evil-visualstar/begin-search-backward))
|
||||
|
||||
|
||||
;;
|
||||
;;; Text object plugins
|
||||
|
||||
(use-package! exato
|
||||
:commands evil-outer-xml-attr evil-inner-xml-attr)
|
||||
|
||||
|
||||
;;
|
||||
;;; Keybinds
|
||||
|
||||
(defmacro set-repeater! (command next-func prev-func)
|
||||
"Makes ; and , the universal repeat-keys in evil-mode.
|
||||
To change these keys see `+evil-repeat-keys'."
|
||||
(let ((fn-sym (intern (format "+evil/repeat-%s" (doom-unquote command)))))
|
||||
`(progn
|
||||
(defun ,fn-sym (&rest _)
|
||||
(when +evil-repeat-keys
|
||||
(evil-define-key* 'motion 'local
|
||||
(kbd (car +evil-repeat-keys)) #',next-func
|
||||
(kbd (cdr +evil-repeat-keys)) #',prev-func)))
|
||||
(advice-add #',command :after-while #',fn-sym))))
|
||||
|
||||
;; n/N
|
||||
(set-repeater! evil-ex-search-next evil-ex-search-next evil-ex-search-previous)
|
||||
(set-repeater! evil-ex-search-previous evil-ex-search-next evil-ex-search-previous)
|
||||
(set-repeater! evil-ex-search-forward evil-ex-search-next evil-ex-search-previous)
|
||||
(set-repeater! evil-ex-search-backward evil-ex-search-next evil-ex-search-previous)
|
||||
|
||||
;; f/F/t/T/s/S
|
||||
(after! evil-snipe
|
||||
(setq evil-snipe-repeat-keys nil
|
||||
evil-snipe-override-evil-repeat-keys nil) ; causes problems with remapped ;
|
||||
(set-repeater! evil-snipe-f evil-snipe-repeat evil-snipe-repeat-reverse)
|
||||
(set-repeater! evil-snipe-F evil-snipe-repeat evil-snipe-repeat-reverse)
|
||||
(set-repeater! evil-snipe-t evil-snipe-repeat evil-snipe-repeat-reverse)
|
||||
(set-repeater! evil-snipe-T evil-snipe-repeat evil-snipe-repeat-reverse)
|
||||
(set-repeater! evil-snipe-s evil-snipe-repeat evil-snipe-repeat-reverse)
|
||||
(set-repeater! evil-snipe-S evil-snipe-repeat evil-snipe-repeat-reverse)
|
||||
(set-repeater! evil-snipe-x evil-snipe-repeat evil-snipe-repeat-reverse)
|
||||
(set-repeater! evil-snipe-X evil-snipe-repeat evil-snipe-repeat-reverse))
|
||||
|
||||
;; */#
|
||||
(set-repeater! evil-visualstar/begin-search-forward
|
||||
evil-ex-search-next evil-ex-search-previous)
|
||||
(set-repeater! evil-visualstar/begin-search-backward
|
||||
evil-ex-search-previous evil-ex-search-next)
|
||||
|
||||
|
||||
;; `evil-collection'
|
||||
(when (featurep! +everywhere)
|
||||
(unless doom-reloading-p
|
||||
(load! "+everywhere"))
|
||||
|
||||
(setq evil-collection-company-use-tng (featurep! :completion company +tng))
|
||||
|
||||
;; Don't let evil-collection interfere with certain keys
|
||||
(appendq! evil-collection-key-blacklist
|
||||
(append (when (featurep! :tools lookup)
|
||||
'("gd" "gf" "K"))
|
||||
(when (featurep! :tools eval)
|
||||
'("gr" "gR"))
|
||||
'("[" "]" "gz" "<escape>")))
|
||||
|
||||
(defadvice! +evil-collection-disable-blacklist-a (orig-fn)
|
||||
:around #'evil-collection-vterm-toggle-send-escape ; allow binding to ESC
|
||||
(let (evil-collection-key-blacklist)
|
||||
(apply orig-fn))))
|
||||
|
||||
;; Keybinds that have no Emacs+evil analogues (i.e. don't exist):
|
||||
;; zq - mark word at point as good word
|
||||
;; zw - mark word at point as bad
|
||||
;; zu{q,w} - undo last marking
|
||||
;; Keybinds that evil define:
|
||||
;; z= - correct flyspell word at point
|
||||
;; ]s - jump to previous spelling error
|
||||
;; [s - jump to next spelling error
|
||||
|
||||
(map! :v "@" #'+evil:apply-macro
|
||||
|
||||
;; ported from vim-unimpaired
|
||||
:n "] SPC" #'+evil/insert-newline-below
|
||||
:n "[ SPC" #'+evil/insert-newline-above
|
||||
:n "]b" #'next-buffer
|
||||
:n "[b" #'previous-buffer
|
||||
:n "]f" #'+evil/next-file
|
||||
:n "[f" #'+evil/previous-file
|
||||
:m "]u" #'+evil:url-encode
|
||||
:m "[u" #'+evil:url-decode
|
||||
:m "]y" #'+evil:c-string-encode
|
||||
:m "[y" #'+evil:c-string-decode
|
||||
(:when (featurep! :lang web)
|
||||
:m "]x" #'+web:encode-html-entities
|
||||
:m "[x" #'+web:decode-html-entities)
|
||||
(:when (featurep! :ui vc-gutter)
|
||||
:m "]d" #'git-gutter:next-hunk
|
||||
:m "[d" #'git-gutter:previous-hunk)
|
||||
(:when (featurep! :ui hl-todo)
|
||||
:m "]t" #'hl-todo-next
|
||||
:m "[t" #'hl-todo-previous)
|
||||
(:when (featurep! :ui workspaces)
|
||||
:n "gt" #'+workspace:switch-next
|
||||
:n "gT" #'+workspace:switch-previous
|
||||
:n "]w" #'+workspace/switch-right
|
||||
:n "[w" #'+workspace/switch-left)
|
||||
|
||||
;; custom vim-unmpaired-esque keys
|
||||
:m "]#" #'+evil/next-preproc-directive
|
||||
:m "[#" #'+evil/previous-preproc-directive
|
||||
:m "]a" #'evil-forward-arg
|
||||
:m "[a" #'evil-backward-arg
|
||||
:m "]c" #'+evil/next-comment
|
||||
:m "[c" #'+evil/previous-comment
|
||||
:m "]e" #'next-error
|
||||
:m "[e" #'previous-error
|
||||
:n "]F" #'+evil/next-frame
|
||||
:n "[F" #'+evil/previous-frame
|
||||
:m "]h" #'outline-next-visible-heading
|
||||
:m "[h" #'outline-previous-visible-heading
|
||||
:m "]m" #'+evil/next-beginning-of-method
|
||||
:m "[m" #'+evil/previous-beginning-of-method
|
||||
:m "]M" #'+evil/next-end-of-method
|
||||
:m "[M" #'+evil/previous-end-of-method
|
||||
:n "[o" #'+evil/insert-newline-above
|
||||
:n "]o" #'+evil/insert-newline-below
|
||||
:n "gp" #'+evil/reselect-paste
|
||||
:v "gp" #'+evil/paste-preserve-register
|
||||
:nv "g@" #'+evil:apply-macro
|
||||
:nv "gc" #'evilnc-comment-operator
|
||||
:nv "gx" #'evil-exchange
|
||||
:nv "gy" #'+evil:yank-unindented
|
||||
:n "g=" #'evil-numbers/inc-at-pt
|
||||
:n "g-" #'evil-numbers/dec-at-pt
|
||||
:v "g=" #'evil-numbers/inc-at-pt-incremental
|
||||
:v "g-" #'evil-numbers/dec-at-pt-incremental
|
||||
:v "g+" #'evil-numbers/inc-at-pt
|
||||
(:when (featurep! :tools lookup)
|
||||
:nv "K" #'+lookup/documentation
|
||||
:nv "gd" #'+lookup/definition
|
||||
:nv "gD" #'+lookup/references
|
||||
:nv "gf" #'+lookup/file)
|
||||
(:when (featurep! :tools eval)
|
||||
:nv "gr" #'+eval:region
|
||||
:n "gR" #'+eval/buffer
|
||||
:v "gR" #'+eval:replace-region
|
||||
;; Restore these keybinds, since the blacklisted/overwritten gr/gR will
|
||||
;; undo them:
|
||||
(:after dired
|
||||
:map dired-mode-map
|
||||
:n "gr" #'revert-buffer)
|
||||
(:after notmuch
|
||||
:map notmuch-common-keymap
|
||||
:n "gr" #'notmuch-refresh-this-buffer
|
||||
:n "gR" #'notmuch-poll-and-refresh-this-buffer)
|
||||
(:after elfeed
|
||||
:map elfeed-search-update--force
|
||||
:n "gr" #'elfeed-search-update--force
|
||||
:n "gR" #'elfeed-search-fetch))
|
||||
|
||||
:nv "z=" #'flyspell-correct-word-generic
|
||||
;; custom evil keybinds
|
||||
:nv "zn" #'+evil:narrow-buffer
|
||||
:n "zN" #'doom/widen-indirectly-narrowed-buffer
|
||||
:n "zx" #'kill-current-buffer
|
||||
:n "ZX" #'bury-buffer
|
||||
;; don't leave visual mode after shifting
|
||||
:v "<" #'+evil/visual-dedent ; vnoremap < <gv
|
||||
:v ">" #'+evil/visual-indent ; vnoremap > >gv
|
||||
|
||||
;; window management (prefix "C-w")
|
||||
(:map evil-window-map
|
||||
;; Navigation
|
||||
"C-h" #'evil-window-left
|
||||
"C-j" #'evil-window-down
|
||||
"C-k" #'evil-window-up
|
||||
"C-l" #'evil-window-right
|
||||
"C-w" #'other-window
|
||||
;; Swapping windows
|
||||
"H" #'+evil/window-move-left
|
||||
"J" #'+evil/window-move-down
|
||||
"K" #'+evil/window-move-up
|
||||
"L" #'+evil/window-move-right
|
||||
"C-S-w" #'ace-swap-window
|
||||
;; Window undo/redo
|
||||
(:prefix "m"
|
||||
"m" #'doom/window-maximize-buffer
|
||||
"v" #'doom/window-maximize-vertically
|
||||
"s" #'doom/window-maximize-horizontally)
|
||||
"u" #'winner-undo
|
||||
"C-u" #'winner-undo
|
||||
"C-r" #'winner-redo
|
||||
"o" #'doom/window-enlargen
|
||||
;; Delete window
|
||||
"d" #'evil-window-delete
|
||||
"C-C" #'ace-delete-window)
|
||||
|
||||
;; text objects
|
||||
:textobj "a" #'evil-inner-arg #'evil-outer-arg
|
||||
:textobj "B" #'evil-textobj-anyblock-inner-block #'evil-textobj-anyblock-a-block
|
||||
:textobj "c" #'evilnc-inner-comment #'evilnc-outer-commenter
|
||||
:textobj "f" #'+evil:defun-txtobj #'+evil:defun-txtobj
|
||||
:textobj "g" #'+evil:whole-buffer-txtobj #'+evil:whole-buffer-txtobj
|
||||
:textobj "i" #'evil-indent-plus-i-indent #'evil-indent-plus-a-indent
|
||||
:textobj "j" #'evil-indent-plus-i-indent-up-down #'evil-indent-plus-a-indent-up-down
|
||||
:textobj "k" #'evil-indent-plus-i-indent-up #'evil-indent-plus-a-indent-up
|
||||
:textobj "x" #'evil-inner-xml-attr #'evil-outer-xml-attr
|
||||
|
||||
;; evil-easymotion
|
||||
(:after evil-easymotion
|
||||
:map evilem-map
|
||||
"a" (evilem-create #'evil-forward-arg)
|
||||
"A" (evilem-create #'evil-backward-arg)
|
||||
"s" #'evil-avy-goto-char-2
|
||||
"SPC" (λ!! #'evil-avy-goto-char-timer t)
|
||||
"/" #'evil-avy-goto-char-timer)
|
||||
|
||||
;; evil-snipe
|
||||
(:after evil-snipe
|
||||
:map evil-snipe-parent-transient-map
|
||||
"C-;" (λ! (require 'evil-easymotion)
|
||||
(call-interactively
|
||||
(evilem-create #'evil-snipe-repeat
|
||||
:bind ((evil-snipe-scope 'whole-buffer)
|
||||
(evil-snipe-enable-highlight)
|
||||
(evil-snipe-enable-incremental-highlight))))))
|
||||
|
||||
;; evil-surround
|
||||
:v "S" #'evil-surround-region
|
||||
:o "s" #'evil-surround-edit
|
||||
:o "S" #'evil-Surround-edit
|
||||
|
||||
;; Omni-completion
|
||||
(:when (featurep! :completion company)
|
||||
(:prefix "C-x"
|
||||
:i "C-l" #'+company/whole-lines
|
||||
:i "C-k" #'+company/dict-or-keywords
|
||||
:i "C-f" #'company-files
|
||||
:i "C-]" #'company-etags
|
||||
:i "s" #'company-ispell
|
||||
:i "C-s" #'company-yasnippet
|
||||
:i "C-o" #'company-capf
|
||||
:i "C-n" #'+company/dabbrev
|
||||
:i "C-p" #'+company/dabbrev-code-previous)))
|
||||
29
.emacs.d/modules/editor/evil/packages.el
Normal file
29
.emacs.d/modules/editor/evil/packages.el
Normal file
@@ -0,0 +1,29 @@
|
||||
;; -*- no-byte-compile: t; -*-
|
||||
;;; editor/evil/packages.el
|
||||
|
||||
(package! evil)
|
||||
(package! evil-args)
|
||||
(package! evil-easymotion)
|
||||
(package! evil-embrace)
|
||||
(package! evil-escape)
|
||||
(package! evil-exchange)
|
||||
(package! evil-indent-plus)
|
||||
(package! evil-nerd-commenter)
|
||||
(package! evil-numbers :recipe (:host github :repo "janpath/evil-numbers"))
|
||||
(package! evil-snipe)
|
||||
(package! evil-surround)
|
||||
(package! evil-textobj-anyblock)
|
||||
(package! evil-traces)
|
||||
(package! evil-visualstar)
|
||||
(package! exato)
|
||||
(package! evil-quick-diff :recipe (:host github :repo "rgrinberg/evil-quick-diff"))
|
||||
|
||||
;;
|
||||
(when (featurep! +everywhere)
|
||||
;; `evil-collection-neotree' uses the `neotree-make-executor' macro, but this
|
||||
;; requires neotree be available during byte-compilation (while installing).
|
||||
(when (featurep! :ui neotree)
|
||||
(package! neotree)
|
||||
(autoload 'neotree-make-executor "neotree" nil nil 'macro))
|
||||
|
||||
(package! evil-collection))
|
||||
69
.emacs.d/modules/editor/evil/test/test-evil.el
Normal file
69
.emacs.d/modules/editor/evil/test/test-evil.el
Normal file
@@ -0,0 +1,69 @@
|
||||
;; -*- no-byte-compile: t; -*-
|
||||
;;; editor/evil/test/test-evil.el
|
||||
|
||||
(describe "feature/evil"
|
||||
:var (resv project-root)
|
||||
|
||||
(require! :editor evil)
|
||||
(require 'evil)
|
||||
(load! "../autoload/evil")
|
||||
|
||||
(before-each
|
||||
(fset 'resv #'+evil-resolve-vim-path-a)
|
||||
(spy-on 'doom-project-root :and-call-fake (lambda () project-root)))
|
||||
|
||||
;; `evil-ex-replace-special-filenames' / `+evil-resolve-vim-path-a'
|
||||
(describe "file modifiers"
|
||||
(it "supports basic vim file modifiers"
|
||||
(let ((buffer-file-name "~/.emacs.d/test/modules/feature/test-evil.el")
|
||||
(default-directory "~/.emacs.d/test/modules/")
|
||||
(project-root "~/.emacs.d/"))
|
||||
(expect (resv "%") :to-equal "feature/test-evil.el")
|
||||
(expect (resv "%:r") :to-equal "feature/test-evil")
|
||||
(expect (resv "%:r.elc") :to-equal "feature/test-evil.elc")
|
||||
(expect (resv "%:e") :to-equal "el")
|
||||
(expect (resv "%:p") :to-equal (expand-file-name buffer-file-name))
|
||||
(expect (resv "%:h") :to-equal "feature")
|
||||
(expect (resv "%:t") :to-equal "test-evil.el")
|
||||
(expect (resv "%:.") :to-equal "feature/test-evil.el")
|
||||
(expect (resv "%:~") :to-equal "~/.emacs.d/test/modules/feature/test-evil.el")
|
||||
(expect (file-truename (resv "%:p"))
|
||||
:to-equal (file-truename buffer-file-name))))
|
||||
|
||||
(it "supports nested vim file modifiers"
|
||||
(let ((buffer-file-name "~/vim/src/version.c")
|
||||
(default-directory "~/vim/")
|
||||
(project-root "~/vim/"))
|
||||
(expect (resv "%:p") :to-equal (expand-file-name "~/vim/src/version.c"))
|
||||
(expect (resv "%:p:.") :to-equal "src/version.c")
|
||||
(expect (resv "%:p:~") :to-equal "~/vim/src/version.c")
|
||||
(expect (resv "%:h") :to-equal "src")
|
||||
(expect (resv "%:p:h") :to-equal (expand-file-name "~/vim/src"))
|
||||
(expect (resv "%:p:h:h") :to-equal (expand-file-name "~/vim"))
|
||||
(expect (resv "%:t") :to-equal "version.c")
|
||||
(expect (resv "%:p:t") :to-equal "version.c")
|
||||
(expect (resv "%:r") :to-equal "src/version")
|
||||
(expect (resv "%:p:r") :to-equal (expand-file-name "~/vim/src/version"))
|
||||
(expect (resv "%:t:r") :to-equal "version")))
|
||||
|
||||
(it "cleans up empty file modifiers"
|
||||
(let (buffer-file-name default-directory)
|
||||
(expect (resv "%") :to-equal "")
|
||||
(expect (resv "%:r") :to-equal "")
|
||||
(expect (resv "%:e") :to-equal "")
|
||||
(expect (resv "%:h") :to-equal "")
|
||||
(expect (resv "%:t") :to-equal "")
|
||||
(expect (resv "%:.") :to-equal "")
|
||||
(expect (resv "%:~") :to-equal "")
|
||||
(expect (resv "%:P") :to-equal "")))
|
||||
|
||||
(it "supports substitution modifiers"
|
||||
(let ((buffer-file-name "~/.emacs.d/test/modules/feature/test-evil.el")
|
||||
(default-directory "~/.emacs.d/test/modules/"))
|
||||
(expect (resv "%:s?e?x?") :to-equal "fxature/test-evil.el")
|
||||
(expect (resv "%:gs?e?x?") :to-equal "fxaturx/txst-xvil.xl")))
|
||||
|
||||
(it "cleans up empty substitution modifiers"
|
||||
(let (buffer-file-name default-directory)
|
||||
(expect (resv "%:s?e?x?") :to-equal "")
|
||||
(expect (resv "%:gs?e?x?") :to-equal "")))))
|
||||
79
.emacs.d/modules/editor/file-templates/README.org
Normal file
79
.emacs.d/modules/editor/file-templates/README.org
Normal file
@@ -0,0 +1,79 @@
|
||||
#+TITLE: editor/file-templates
|
||||
#+DATE: February 11, 2017
|
||||
#+SINCE: v2.0
|
||||
#+STARTUP: inlineimages
|
||||
|
||||
* Table of Contents :TOC_2:noexport:
|
||||
- [[Description][Description]]
|
||||
- [[Module Flags][Module Flags]]
|
||||
- [[Plugins][Plugins]]
|
||||
- [[Prerequisites][Prerequisites]]
|
||||
- [[Usage][Usage]]
|
||||
- [[Inserting OSS licenses][Inserting OSS licenses]]
|
||||
- [[Configuration][Configuration]]
|
||||
- [[Registering a new file template][Registering a new file template]]
|
||||
- [[Changing existing file templates][Changing existing file templates]]
|
||||
- [[Adding new OSS licenses][Adding new OSS licenses]]
|
||||
- [[Troubleshooting][Troubleshooting]]
|
||||
- [[Appendix][Appendix]]
|
||||
- [[API][API]]
|
||||
- [[Commands][Commands]]
|
||||
- [[Variables][Variables]]
|
||||
|
||||
* Description
|
||||
This module adds file templates for blank files, powered by yasnippet.
|
||||
|
||||
** Module Flags
|
||||
This module provides no flags.
|
||||
|
||||
** Plugins
|
||||
This module installs no plugins.
|
||||
|
||||
* Prerequisites
|
||||
This module has no prerequisites.
|
||||
|
||||
* Usage
|
||||
File templates are automatically expanded when opening empty files.
|
||||
|
||||
They are also regular yasnippet snippets, which can be expanded by typing their
|
||||
trigger and pressing =TAB=. By convention, the triggers for file templates are
|
||||
prefixed with two underscores ~__~.
|
||||
|
||||
** Inserting OSS licenses
|
||||
A special command is available for inserting software licenses: ~M-x
|
||||
+file-templates/insert-license~.
|
||||
|
||||
#+begin_quote
|
||||
Licenses with a ~-bp~ suffix are boilerplate templates; shorter versions meant
|
||||
for comment headers in code.
|
||||
#+end_quote
|
||||
|
||||
* Configuration
|
||||
** TODO Registering a new file template
|
||||
** TODO Changing existing file templates
|
||||
** Adding new OSS licenses
|
||||
The ~+file-templates/insert-license~ command searches for snippets under
|
||||
~text-mode~ that are named ~__license-ABC~, where ABC is the short name of the
|
||||
license. e.g. ~__license-mit~.
|
||||
|
||||
So long as these files exist, ~+file-templates/insert-license~ will recognize
|
||||
them.
|
||||
|
||||
* Troubleshooting
|
||||
If a file template isn't expanding where you expect it to, run ~M-x
|
||||
+file-templates/debug~. This will report to you what file template rule would
|
||||
apply for the correct file.
|
||||
|
||||
* Appendix
|
||||
** API
|
||||
+ ~set-file-template! PRED &rest PLIST~
|
||||
+ ~set-file-templates! &rest TEMPLATES~
|
||||
|
||||
** Commands
|
||||
+ ~+file-templates/insert-license~
|
||||
+ ~+file-templates/debug~
|
||||
|
||||
** Variables
|
||||
+ ~+file-templates-dir~
|
||||
+ ~+file-templates-default-trigger~
|
||||
+ ~+file-templates-alist~
|
||||
118
.emacs.d/modules/editor/file-templates/autoload.el
Normal file
118
.emacs.d/modules/editor/file-templates/autoload.el
Normal file
@@ -0,0 +1,118 @@
|
||||
;;; editor/file-templates/autoload.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defun +file-templates--set (pred plist)
|
||||
(if (null (car-safe plist))
|
||||
(setq +file-templates-alist
|
||||
(delq (assoc pred +file-templates-alist)
|
||||
+file-templates-alist))
|
||||
(push `(,pred ,@plist) +file-templates-alist)))
|
||||
|
||||
;;;###autodef
|
||||
(defun set-file-template! (pred &rest plist)
|
||||
"Register a file template.
|
||||
|
||||
PRED can either be a regexp string or a major mode symbol. PLIST may contain
|
||||
these properties:
|
||||
|
||||
:when FUNCTION
|
||||
Provides a secondary predicate. This function takes no arguments and is
|
||||
executed from within the target buffer. If it returns nil, this rule will be
|
||||
skipped over.
|
||||
:trigger STRING|FUNCTION
|
||||
If a string, this is the yasnippet trigger keyword used to trigger the
|
||||
target snippet.
|
||||
If a function, this function will be run in the context of the buffer to
|
||||
insert a file template into. It is given no arguments and must insert text
|
||||
into the current buffer manually.
|
||||
If omitted, `+file-templates-default-trigger' is used.
|
||||
:mode SYMBOL
|
||||
What mode to get the yasnippet snippet from. If omitted, either PRED (if
|
||||
it's a major-mode symbol) or the mode of the buffer is used.
|
||||
:project BOOL
|
||||
If non-nil, ignore this template if this buffer isn't in a project.
|
||||
:ignore BOOL
|
||||
If non-nil, don't expand any template for this file and don't test any other
|
||||
file template rule against this buffer.
|
||||
|
||||
\(fn PRED &key WHEN TRIGGER MODE PROJECT IGNORE)"
|
||||
(declare (indent defun))
|
||||
(defer-until! (boundp '+file-templates-alist)
|
||||
(+file-templates--set pred plist)))
|
||||
|
||||
;;;###autodef
|
||||
(defun set-file-templates! (&rest templates)
|
||||
"Like `set-file-templates!', but can register multiple file templates at once.
|
||||
|
||||
\(fn &rest (PRED &key WHEN TRIGGER MODE PROJECT IGNORE))"
|
||||
(defer-until! (boundp '+file-templates-alist)
|
||||
(dolist (template templates)
|
||||
(+file-templates--set (car template) (cdr template)))))
|
||||
|
||||
|
||||
;;
|
||||
;;; Library
|
||||
|
||||
;;;###autoload
|
||||
(cl-defun +file-templates--expand (pred &key project mode trigger ignore _when)
|
||||
"Auto insert a yasnippet snippet into current file and enter insert mode (if
|
||||
evil is loaded and enabled)."
|
||||
(when (and pred (not ignore))
|
||||
(when (if project (doom-project-p) t)
|
||||
(unless mode
|
||||
(setq mode (if (symbolp pred) pred major-mode)))
|
||||
(unless mode
|
||||
(user-error "Couldn't determine mode for %s file template" pred))
|
||||
(unless trigger
|
||||
(setq trigger +file-templates-default-trigger))
|
||||
(if (functionp trigger)
|
||||
(funcall trigger)
|
||||
(require 'yasnippet)
|
||||
(unless yas-minor-mode
|
||||
(yas-minor-mode-on))
|
||||
(when (and yas-minor-mode
|
||||
(when-let
|
||||
(template (cl-find trigger (yas--all-templates (yas--get-snippet-tables mode))
|
||||
:key #'yas--template-key :test #'equal))
|
||||
(yas-expand-snippet (yas--template-content template)))
|
||||
(and (featurep 'evil) evil-local-mode)
|
||||
(and yas--active-field-overlay
|
||||
(overlay-buffer yas--active-field-overlay)
|
||||
(overlay-get yas--active-field-overlay 'yas--field)))
|
||||
(evil-initialize-state 'insert))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +file-templates-get-short-path ()
|
||||
"Fetches a short file path for the header in Doom module templates."
|
||||
(let ((path (file-truename (or buffer-file-name default-directory))))
|
||||
(save-match-data
|
||||
(cond ((string-match "/modules/\\(.+\\)$" path)
|
||||
(match-string 1 path))
|
||||
((file-in-directory-p path doom-emacs-dir)
|
||||
(file-relative-name path doom-emacs-dir))
|
||||
((abbreviate-file-name path))))))
|
||||
|
||||
|
||||
;;
|
||||
;;; Commands
|
||||
|
||||
;;;###autoload
|
||||
(defun +file-templates/insert-license ()
|
||||
"Insert a license file template into the current file."
|
||||
(interactive)
|
||||
(require 'yasnippet)
|
||||
(let ((templates
|
||||
(let (yas-choose-tables-first ; avoid prompts
|
||||
yas-choose-keys-first)
|
||||
(cl-loop for tpl in (yas--all-templates (yas--get-snippet-tables 'text-mode))
|
||||
for uuid = (yas--template-uuid tpl)
|
||||
if (string-prefix-p "__license-" uuid)
|
||||
collect (cons (string-remove-prefix "__license-" uuid) tpl)))))
|
||||
(when-let (uuid (yas-choose-value (mapcar #'car templates)))
|
||||
(yas-expand-snippet (cdr (assoc uuid templates))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +file-templates/debug ()
|
||||
"Tests the current buffer and outputs the file template rule most appropriate
|
||||
for it. This is used for testing."
|
||||
(interactive)
|
||||
(message "Found %s" (cl-find-if #'+file-template-p +file-templates-alist)))
|
||||
159
.emacs.d/modules/editor/file-templates/config.el
Normal file
159
.emacs.d/modules/editor/file-templates/config.el
Normal file
@@ -0,0 +1,159 @@
|
||||
;;; editor/file-templates/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defvar +file-templates-dir
|
||||
(expand-file-name "templates/" (file-name-directory load-file-name))
|
||||
"The path to a directory of yasnippet folders to use for file templates.")
|
||||
|
||||
(defvar +file-templates-default-trigger "__"
|
||||
"The default yasnippet trigger key (a string) for file template rules that
|
||||
don't have a :trigger property in `+file-templates-alist'.")
|
||||
|
||||
(defvar +file-templates-alist
|
||||
`(;; General
|
||||
(gitignore-mode)
|
||||
(dockerfile-mode)
|
||||
("/docker-compose\\.yml$" :mode yaml-mode)
|
||||
("/Makefile$" :mode makefile-gmake-mode)
|
||||
;; elisp
|
||||
("/.dir-locals.el$")
|
||||
("/packages\\.el$" :when +file-templates-in-emacs-dirs-p
|
||||
:trigger "__doom-packages"
|
||||
:mode emacs-lisp-mode)
|
||||
("/doctor\\.el$" :when +file-templates-in-emacs-dirs-p
|
||||
:trigger "__doom-doctor"
|
||||
:mode emacs-lisp-mode)
|
||||
("/test/.+\\.el$" :when +file-templates-in-emacs-dirs-p
|
||||
:trigger "__doom-test"
|
||||
:mode emacs-lisp-mode)
|
||||
("\\.el$" :when +file-templates-in-emacs-dirs-p
|
||||
:trigger "__doom-module"
|
||||
:mode emacs-lisp-mode)
|
||||
("-test\\.el$" :mode emacs-ert-mode)
|
||||
(emacs-lisp-mode :trigger "__initfile")
|
||||
(snippet-mode)
|
||||
;; C/C++
|
||||
("/main\\.c\\(?:c\\|pp\\)$" :trigger "__main.cpp" :mode c++-mode)
|
||||
("/win32_\\.c\\(?:c\\|pp\\)$" :trigger "__winmain.cpp" :mode c++-mode)
|
||||
("\\.c\\(?:c\\|pp\\)$" :trigger "__cpp" :mode c++-mode)
|
||||
("\\.h\\(?:h\\|pp\\|xx\\)$" :trigger "__hpp" :mode c++-mode)
|
||||
("\\.h$" :trigger "__h" :mode c-mode)
|
||||
(c-mode :trigger "__c")
|
||||
;; direnv
|
||||
("/\\.envrc$" :trigger "__envrc" :mode direnv-envrc-mode)
|
||||
;; go
|
||||
("/main\\.go$" :trigger "__main.go" :mode go-mode :project t)
|
||||
(go-mode :trigger "__.go")
|
||||
;; web-mode
|
||||
("/normalize\\.scss$" :trigger "__normalize.scss" :mode scss-mode)
|
||||
("/master\\.scss$" :trigger "__master.scss" :mode scss-mode)
|
||||
("\\.html$" :trigger "__.html" :mode web-mode)
|
||||
(scss-mode)
|
||||
;; java
|
||||
("/main\\.java$" :trigger "__main" :mode java-mode)
|
||||
("/build\\.gradle$" :trigger "__build.gradle" :mode android-mode)
|
||||
("/src/.+\\.java$" :mode java-mode)
|
||||
;; javascript
|
||||
("/package\\.json$" :trigger "__package.json" :mode json-mode)
|
||||
("/bower\\.json$" :trigger "__bower.json" :mode json-mode)
|
||||
("/gulpfile\\.js$" :trigger "__gulpfile.js" :mode js-mode)
|
||||
("/webpack\\.config\\.js$" :trigger "__webpack.config.js" :mode js-mode)
|
||||
("\\.js\\(?:on\\|hintrc\\)$" :mode json-mode)
|
||||
;; Lua
|
||||
("/main\\.lua$" :trigger "__main.lua" :mode love-mode)
|
||||
("/conf\\.lua$" :trigger "__conf.lua" :mode love-mode)
|
||||
;; Markdown
|
||||
(markdown-mode)
|
||||
;; Markdown
|
||||
(nxml-mode)
|
||||
;; Nix
|
||||
("/shell\\.nix$" :trigger "__shell.nix")
|
||||
(nix-mode)
|
||||
;; Org
|
||||
("/README\\.org$"
|
||||
:when +file-templates-in-emacs-dirs-p
|
||||
:trigger "__doom-readme"
|
||||
:mode org-mode)
|
||||
("\\.org$" :trigger "__" :mode org-mode)
|
||||
;; PHP
|
||||
("\\.class\\.php$" :trigger "__.class.php" :mode php-mode)
|
||||
(php-mode)
|
||||
;; Python
|
||||
;; TODO ("tests?/test_.+\\.py$" :trigger "__" :mode nose-mode)
|
||||
;; TODO ("/setup\\.py$" :trigger "__setup.py" :mode python-mode)
|
||||
(python-mode)
|
||||
;; Ruby
|
||||
("/lib/.+\\.rb$" :trigger "__module" :mode ruby-mode :project t)
|
||||
("/spec_helper\\.rb$" :trigger "__helper" :mode rspec-mode :project t)
|
||||
("_spec\\.rb$" :mode rspec-mode :project t)
|
||||
("/\\.rspec$" :trigger "__.rspec" :mode rspec-mode :project t)
|
||||
("\\.gemspec$" :trigger "__.gemspec" :mode ruby-mode :project t)
|
||||
("/Gemfile$" :trigger "__Gemfile" :mode ruby-mode :project t)
|
||||
("/Rakefile$" :trigger "__Rakefile" :mode ruby-mode :project t)
|
||||
(ruby-mode)
|
||||
;; Rust
|
||||
("/Cargo.toml$" :trigger "__Cargo.toml" :mode rust-mode)
|
||||
("/main\\.rs$" :trigger "__main.rs" :mode rust-mode)
|
||||
;; Slim
|
||||
("/\\(?:index\\|main\\)\\.slim$" :mode slim-mode)
|
||||
;; Shell scripts
|
||||
("\\.zunit$" :trigger "__zunit" :mode sh-mode)
|
||||
(fish-mode)
|
||||
(sh-mode)
|
||||
;; Solidity
|
||||
(solidity-mode :trigger "__sol"))
|
||||
"An alist of file template rules. The CAR of each rule is either a major mode
|
||||
symbol or regexp string. The CDR is a plist. See `set-file-template!' for more
|
||||
information.")
|
||||
|
||||
|
||||
;;
|
||||
;; Library
|
||||
|
||||
(defun +file-templates-in-emacs-dirs-p (file)
|
||||
"Returns t if FILE is in Doom or your private directory."
|
||||
(or (file-in-directory-p file doom-private-dir)
|
||||
(file-in-directory-p file doom-emacs-dir)))
|
||||
|
||||
(defun +file-template-p (rule)
|
||||
"Return t if RULE applies to the current buffer."
|
||||
(let ((pred (car rule))
|
||||
(plist (cdr rule)))
|
||||
(and (cond ((symbolp pred) (eq major-mode pred))
|
||||
((and (stringp pred) buffer-file-name)
|
||||
(string-match-p pred buffer-file-name))
|
||||
((not (plist-member plist :when)) t)
|
||||
((funcall (plist-get plist :when) buffer-file-name)))
|
||||
rule)))
|
||||
|
||||
(defun +file-templates-check-h ()
|
||||
"Check if the current buffer is a candidate for file template expansion. It
|
||||
must be non-read-only, empty, and there must be a rule in
|
||||
`+file-templates-alist' that applies to it."
|
||||
(and buffer-file-name
|
||||
(not buffer-read-only)
|
||||
(bobp) (eobp)
|
||||
(not (member (substring (buffer-name) 0 1) '("*" " ")))
|
||||
(not (file-exists-p buffer-file-name))
|
||||
;; Prevent file-templates from breaking org-capture when target file
|
||||
;; doesn't exist and has a file template.
|
||||
(or (not (fboundp 'org-capture-get))
|
||||
(not (org-capture-get :new-buffer)))
|
||||
(when-let (rule (cl-find-if #'+file-template-p +file-templates-alist))
|
||||
(apply #'+file-templates--expand rule))))
|
||||
|
||||
|
||||
;;
|
||||
;;; Bootstrap
|
||||
|
||||
(after! yasnippet
|
||||
(if (featurep! :editor snippets)
|
||||
(add-to-list 'yas-snippet-dirs '+file-templates-dir 'append #'eq)
|
||||
(setq yas-prompt-functions (delq #'yas-dropdown-prompt yas-prompt-functions)
|
||||
yas-snippet-dirs '(+file-templates-dir))
|
||||
;; Exit snippets on ESC from normal mode
|
||||
(add-hook 'doom-escape-hook #'yas-abort-snippet)
|
||||
;; Ensure file templates in `+file-templates-dir' are visible
|
||||
(yas-reload-all)))
|
||||
|
||||
;;
|
||||
(add-hook 'find-file-hook #'+file-templates-check-h)
|
||||
5
.emacs.d/modules/editor/file-templates/packages.el
Normal file
5
.emacs.d/modules/editor/file-templates/packages.el
Normal file
@@ -0,0 +1,5 @@
|
||||
;; -*- no-byte-compile: t; -*-
|
||||
;;; editor/file-templates/packages.el
|
||||
|
||||
(package! yasnippet)
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = false
|
||||
insert_final_newline = false
|
||||
@@ -0,0 +1,49 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: build.gradle template
|
||||
# condition: (eq major-mode 'groovy-mode)
|
||||
# --
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:1.2.3'
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'android'
|
||||
|
||||
android {
|
||||
compileSdkVersion 22
|
||||
buildToolsVersion "22.0.1"
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
manifest.srcFile 'AndroidManifest.xml'
|
||||
java.srcDirs = ['java']
|
||||
resources.srcDirs = ['java']
|
||||
aidl.srcDirs = ['java']
|
||||
renderscript.srcDirs = ['java']
|
||||
res.srcDirs = ['res']
|
||||
assets.srcDirs = ['assets']
|
||||
}
|
||||
|
||||
// Move the tests to tests/java, tests/res, etc...
|
||||
androidTest.setRoot('../tests')
|
||||
|
||||
// Move the build types to build-types/<type>
|
||||
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
|
||||
// This moves them out of them default location under src/<type>/... which would
|
||||
// conflict with src/ being used by the main source set.
|
||||
// Adding new build types or product flavors should be accompanied
|
||||
// by a similar customization.
|
||||
debug.setRoot('build-types/debug')
|
||||
release.setRoot('build-types/release')
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
}
|
||||
}
|
||||
|
||||
$0
|
||||
@@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# group: file templates
|
||||
# contributor: Henrik Lissner
|
||||
# --
|
||||
#include "`(file-name-nondirectory (file-name-sans-extension (buffer-file-name)))`.h"
|
||||
|
||||
$0
|
||||
@@ -0,0 +1,10 @@
|
||||
# -*- mode: snippet -*-
|
||||
# group: file templates
|
||||
# contributor: Henrik Lissner
|
||||
# --
|
||||
#ifndef ${1:__`(upcase (file-name-base buffer-file-name))`_H_$(upcase yas-text)}
|
||||
#define $1
|
||||
|
||||
$0
|
||||
|
||||
#endif // $1
|
||||
@@ -0,0 +1,13 @@
|
||||
# -*- mode: snippet -*-
|
||||
# group: file templates
|
||||
# contributor: Henrik Lissner
|
||||
# --
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
$0
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
# -*- mode: snippet -*-
|
||||
# group: file templates
|
||||
# contributor: Henrik Lissner
|
||||
# --
|
||||
#include <Windows.h>
|
||||
|
||||
int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
|
||||
{
|
||||
$0
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# group: file templates
|
||||
# contributor: Henrik Lissner
|
||||
# --
|
||||
#include "`(file-name-nondirectory (file-name-sans-extension (buffer-file-name)))`.h"
|
||||
|
||||
$0
|
||||
10
.emacs.d/modules/editor/file-templates/templates/c-mode/__h
Normal file
10
.emacs.d/modules/editor/file-templates/templates/c-mode/__h
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- mode: snippet -*-
|
||||
# group: file templates
|
||||
# contributor: Henrik Lissner
|
||||
# --
|
||||
#ifndef ${1:__`(upcase (file-name-base buffer-file-name))`_H_$(upcase yas-text)}
|
||||
#define $1
|
||||
|
||||
$0
|
||||
|
||||
#endif // $1
|
||||
@@ -0,0 +1,15 @@
|
||||
# -*- mode: snippet -*-
|
||||
# group: file templates
|
||||
# contributor: Henrik Lissner
|
||||
# condition: (executable-find "nix-env")
|
||||
# --
|
||||
if type lorri &>/dev/null; then
|
||||
echo "direnv: using lorri"
|
||||
eval "$(lorri direnv)"
|
||||
else
|
||||
# fall back to using direnv's builtin nix support
|
||||
# to prevent bootstrapping problems.
|
||||
use nix
|
||||
fi
|
||||
|
||||
`%`$0
|
||||
@@ -0,0 +1,4 @@
|
||||
FROM ${1:phusion/baseimage:latest}
|
||||
MAINTAINER ${2:`user-full-name` <`user-mail-address`>}
|
||||
|
||||
$0
|
||||
@@ -0,0 +1,3 @@
|
||||
;;; `(file-name-nondirectory buffer-file-name)`
|
||||
|
||||
$0
|
||||
@@ -0,0 +1,3 @@
|
||||
;;; `(+file-templates-get-short-path)` -*- lexical-binding: t; -*-
|
||||
|
||||
$0
|
||||
@@ -0,0 +1,3 @@
|
||||
;;; `(+file-templates-get-short-path)` -*- lexical-binding: t; -*-
|
||||
|
||||
$0
|
||||
@@ -0,0 +1,4 @@
|
||||
;; -*- no-byte-compile: t; -*-
|
||||
;;; `(+file-templates-get-short-path)`
|
||||
|
||||
$0
|
||||
@@ -0,0 +1,4 @@
|
||||
;; -*- no-byte-compile: t; -*-
|
||||
;;; `(+file-templates-get-short-path)`
|
||||
|
||||
$0
|
||||
@@ -0,0 +1,6 @@
|
||||
;;; `(file-name-nondirectory buffer-file-name)`${1: --- ${2:description}} -*- lexical-binding: t; -*-
|
||||
|
||||
$0
|
||||
|
||||
(provide '`(file-name-base buffer-file-name)`)
|
||||
;;; `(file-name-nondirectory buffer-file-name)` ends here
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env fish
|
||||
|
||||
$0
|
||||
@@ -0,0 +1,31 @@
|
||||
.DS_Store
|
||||
.idea
|
||||
*.log
|
||||
tmp/
|
||||
|
||||
`(let ((type-ignore (yas-choose-value '("(none)" "python" "ruby" "java" "js"))))
|
||||
(string-join
|
||||
(cond ((string= type-ignore "python")
|
||||
'("*.py[cod]"
|
||||
"*.egg"
|
||||
"build"
|
||||
"htmlcov"))
|
||||
((string= type-ignore "ruby")
|
||||
'(".ruby-version"
|
||||
".bundle"
|
||||
"vendor"
|
||||
"Gemfile.lock"
|
||||
"coverage"))
|
||||
((string= type-ignore "java")
|
||||
'("*.class"
|
||||
"build"))
|
||||
((string= type-ignore "js")
|
||||
'("*.tern-port"
|
||||
"node_modules/"
|
||||
"npm-debug.log*"
|
||||
"yarn-debug.log*"
|
||||
"yarn-error.log*"
|
||||
"*.tsbuildinfo"
|
||||
".npm"
|
||||
".eslintcache")))
|
||||
"\n"))`
|
||||
@@ -0,0 +1,7 @@
|
||||
package ${1:main}
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
$0
|
||||
@@ -0,0 +1,9 @@
|
||||
package ${1:main}
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
$0
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
(defun yas-java-project-package ()
|
||||
(or (and (eq major-mode 'java-mode)
|
||||
(+java-current-package))
|
||||
""))
|
||||
|
||||
(defun yas-java-class-name ()
|
||||
(or (and (eq major-mode 'java-mode)
|
||||
(+java-current-class))
|
||||
""))
|
||||
@@ -0,0 +1,9 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: Java file template
|
||||
# --
|
||||
package `(yas-java-project-package)`;
|
||||
|
||||
public class `(yas-java-class-name)` $1
|
||||
{
|
||||
$0
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: Java MAIN file template
|
||||
# --
|
||||
package `(yas-java-project-package)`;
|
||||
|
||||
public class `(yas-java-class-name)` $1
|
||||
{
|
||||
public static void main(String[] args) {
|
||||
$0
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
const gulp = require('gulp');
|
||||
|
||||
// Default task
|
||||
gulp.task('default', [$1]);
|
||||
@@ -0,0 +1,21 @@
|
||||
module.exports = {
|
||||
entry: [
|
||||
${1:'./app/main.js'}
|
||||
],
|
||||
output: {
|
||||
path: __dirname + '/dist',
|
||||
filename: "app.bundle.js"
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
use: {
|
||||
loader: "babel-loader"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
// plugins: []
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
[
|
||||
$0
|
||||
]
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "${1:package-name}",
|
||||
"description": "${2:description}",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
"`user-full-name` <`user-mail-address`>"
|
||||
],
|
||||
"main": "public/app.js",
|
||||
"moduleType": [],
|
||||
"homepage": "",
|
||||
"dependencies": {
|
||||
`%`$0
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "${1:package-name}",
|
||||
"description": "${2:description}",
|
||||
"version": "1.0.0",
|
||||
"author": "`user-full-name` <`user-mail-address`>",
|
||||
"license": "MIT",
|
||||
"main": "${3:app/${4:main.js}}",
|
||||
"scripts": {
|
||||
$0
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: love.conf
|
||||
# condition: (eq major-mode 'lua-mode)
|
||||
# --
|
||||
function love.conf(t)
|
||||
t.identity = nil -- The name of the save directory (string)
|
||||
t.version = "0.9.1" -- The LÖVE version this game was made for (string)
|
||||
t.console = false -- Attach a console (boolean, Windows only)
|
||||
|
||||
t.window.title = "${1:Untitled}" -- The window title (string)
|
||||
t.window.icon = nil -- Filepath to an image to use as the window's icon (string)
|
||||
t.window.width = 800 -- The window width (number)
|
||||
t.window.height = 600 -- The window height (number)
|
||||
t.window.borderless = false -- Remove all border visuals from the window (boolean)
|
||||
t.window.resizable = false -- Let the window be user-resizable (boolean)
|
||||
t.window.minwidth = 1 -- Minimum window width if the window is resizable (number)
|
||||
t.window.minheight = 1 -- Minimum window height if the window is resizable (number)
|
||||
t.window.fullscreen = false -- Enable fullscreen (boolean)
|
||||
t.window.fullscreentype = "normal" -- Standard fullscreen or desktop fullscreen mode (string)
|
||||
t.window.vsync = true -- Enable vertical sync (boolean)
|
||||
t.window.fsaa = 0 -- The number of samples to use with multi-sampled antialiasing (number)
|
||||
t.window.display = 1 -- Index of the monitor to show the window in (number)
|
||||
t.window.highdpi = false -- Enable high-dpi mode for the window on a Retina display (boolean). Added in 0.9.1
|
||||
t.window.srgb = false -- Enable sRGB gamma correction when drawing to the screen (boolean). Added in 0.9.1
|
||||
|
||||
t.modules.audio = true -- Enable the audio module (boolean)
|
||||
t.modules.event = true -- Enable the event module (boolean)
|
||||
t.modules.graphics = true -- Enable the graphics module (boolean)
|
||||
t.modules.image = true -- Enable the image module (boolean)
|
||||
t.modules.joystick = true -- Enable the joystick module (boolean)
|
||||
t.modules.keyboard = true -- Enable the keyboard module (boolean)
|
||||
t.modules.math = true -- Enable the math module (boolean)
|
||||
t.modules.mouse = true -- Enable the mouse module (boolean)
|
||||
t.modules.physics = true -- Enable the physics module (boolean)
|
||||
t.modules.sound = true -- Enable the sound module (boolean)
|
||||
t.modules.system = true -- Enable the system module (boolean)
|
||||
t.modules.timer = true -- Enable the timer module (boolean)
|
||||
t.modules.window = true -- Enable the window module (boolean)
|
||||
t.modules.thread = true -- Enable the thread module (boolean)
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
##
|
||||
# ${1:Project Title}
|
||||
#
|
||||
# @file
|
||||
# @version 0.1
|
||||
|
||||
$0
|
||||
|
||||
# end
|
||||
@@ -0,0 +1,46 @@
|
||||
# -*- mode: snippet -*-
|
||||
# contributor: Henrik Lissner
|
||||
# --
|
||||
CC = clang++
|
||||
TAGS = ctags -e -x >TAGS
|
||||
FLAGS = -std=c++11 -stdlib=libc++ -Iinclude -I/usr/local/include -L/usr/local/lib
|
||||
CFLAGS = -pedantic -Wall -Wextra -ggdb3
|
||||
LIBS = # ...
|
||||
|
||||
DEBUG_FLAGS = -O0 -D _DEBUG
|
||||
RELEASE_FLAGS = -O2 -D NDEBUG -combile -fwhole-program
|
||||
|
||||
RELEASE_DIR = ./build/release
|
||||
DEBUG_DIR = ./build/debug
|
||||
|
||||
TARGET = ${1:appname$(replace-regexp-in-string " " "" yas-text nil t)}
|
||||
HEADERS = \$(shell echo include/*.h)
|
||||
SOURCES = \$(shell echo src/*.cpp) \$(shell echo src/**/*.cpp)
|
||||
OBJECTS = \$(SOURCES:.cpp=.o)
|
||||
|
||||
###
|
||||
|
||||
all: \$(TARGET)
|
||||
|
||||
debug: FLAGS += \$(DEBUG_FLAGS)
|
||||
debug: \$(TARGET)
|
||||
|
||||
release: FLAGS += \$(RELEASE_FLAGS)
|
||||
release: \$(TARGET)
|
||||
|
||||
profile: CFLAGS += -pg
|
||||
profile: \$(TARGET)
|
||||
|
||||
\$(TARGET): \$(OBJECTS)
|
||||
\$(CC) \$(FLAGS) \$(CFLAGS) -o \$(TARGET) \$(OBJECTS)
|
||||
|
||||
%.o: %.cpp
|
||||
\$(CC) \$(FLAGS) \$(CFLAGS) -c -o \$@ \$<
|
||||
|
||||
tags: \$(SOURCES)
|
||||
\$(CTAGS) \$(SOURCES)
|
||||
|
||||
clean:
|
||||
-rm -f \$(OBJECTS) \$(TARGET)
|
||||
|
||||
.PHONY: all profile release debug clean
|
||||
@@ -0,0 +1,6 @@
|
||||
# -*- mode: snippet -*-
|
||||
# group: file templates
|
||||
# --
|
||||
# ${1:Document Title}
|
||||
|
||||
$0
|
||||
@@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# group: file templates
|
||||
# --
|
||||
---
|
||||
layout: ${1:default}
|
||||
---
|
||||
$0
|
||||
@@ -0,0 +1,9 @@
|
||||
# -*- mode: snippet -*-
|
||||
# group: file templates
|
||||
# contributor: Henrik Lissner
|
||||
# --
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
$0
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{ pkgs ? import <nixpkgs> {} }:
|
||||
|
||||
with pkgs;
|
||||
|
||||
mkShell {
|
||||
buildInputs = [
|
||||
${0:`%`}
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
`%`$0
|
||||
@@ -0,0 +1,6 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: Org template
|
||||
# --
|
||||
#+TITLE: ${1:`(file-name-base buffer-file-name)`}
|
||||
|
||||
$0
|
||||
@@ -0,0 +1,17 @@
|
||||
#+TITLE:${1:Contact Name}
|
||||
#+DATE: `(format-time-string "%Y-%m-%d")`
|
||||
#+EMAIL: ${2:email@address.com}
|
||||
#+ADDRESS: $3
|
||||
#+CITY: $4
|
||||
#+COUNTRY: $5
|
||||
|
||||
${0:...}
|
||||
|
||||
* Associates
|
||||
+ Associate's name :: associates@email.com
|
||||
* Projects [/]
|
||||
** ACTIVE ... [/]
|
||||
* Invoices [/]
|
||||
** PENDING YYMM-0000 *1,000 USD*
|
||||
* Notes
|
||||
* Correspondence
|
||||
@@ -0,0 +1,42 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: Doom module readme
|
||||
# --
|
||||
#+TITLE: ${1:`(if (string-match "modules/\\([^/]+\\)/\\([^/]+\\)/.+" buffer-file-name)
|
||||
(format "%s/%s"
|
||||
(match-string 1 buffer-file-name)
|
||||
(match-string 2 buffer-file-name))
|
||||
"")`}
|
||||
#+DATE: `(format (format-time-string "%B %%s, %Y") (string-to-number (format-time-string "%d")))`
|
||||
#+SINCE: ${2:{replace with next tagged release version}}
|
||||
#+STARTUP: inlineimages
|
||||
|
||||
* Table of Contents :TOC_3:noexport:
|
||||
|
||||
* Description
|
||||
${3:A summary of what this module does.}
|
||||
|
||||
+ If possible, include a brief list of feature highlights here
|
||||
+ Like code completion, syntax checking or available snippets
|
||||
+ Include links to packages & external things where possible
|
||||
|
||||
** Module Flags
|
||||
This module provides no flags.
|
||||
|
||||
** Plugins
|
||||
{A list of linked plugins}
|
||||
|
||||
** Hacks
|
||||
{A list of internal modifications to included packages}
|
||||
|
||||
* Prerequisites
|
||||
This module has no prereqisites.
|
||||
|
||||
* Features
|
||||
An in-depth list of features, how to use them, and their dependencies.
|
||||
|
||||
* Configuration
|
||||
How to configure this module, including common problems and how to address them.
|
||||
|
||||
* Troubleshooting
|
||||
Common issues and their solution, or places to look for help.
|
||||
$0
|
||||
@@ -0,0 +1,21 @@
|
||||
#+TITLE:${1:1234-5678}
|
||||
#+DATE: `(format-time-string "%Y-%m-%d")`
|
||||
#+ISSUED: ${2:`(format-time-string "%Y-%m-%d")`}
|
||||
#+PAID: ${3:`(format-time-string "%Y-%m-%d")`}
|
||||
#+CURRENCY: ${4:CAD|USD|DKK|GBP}
|
||||
#+CONTACT: ${5:Contact ID}
|
||||
#+PROJECT: ${6:Project ID}
|
||||
|
||||
| *Description* | *qty* | *rate* | *total* |
|
||||
|----------------------------------------------+-----+--------+-------|
|
||||
| $0 [1] | | | |
|
||||
|----------------------------------------------+-----+--------+-------|
|
||||
| | | | |
|
||||
#+TBLFM: $4=$2+$3::@>$4=vsum(@2..@-1)
|
||||
|
||||
[1] ...
|
||||
|
||||
* Comments
|
||||
...
|
||||
* Notes
|
||||
** Attachments [0/0]
|
||||
@@ -0,0 +1,9 @@
|
||||
#+TITLE:${1:Project Name}
|
||||
#+DATE: `(format-time-string "%Y-%m-%d")`
|
||||
#+CONTACT: ${2:Contact name}
|
||||
|
||||
$0
|
||||
|
||||
* Tasks [/]
|
||||
* Timeframe
|
||||
* Notes
|
||||
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
$0
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
class `(doom/php-class-name)`$1 {
|
||||
|
||||
$0
|
||||
|
||||
}
|
||||
5
.emacs.d/modules/editor/file-templates/templates/python-mode/__
Executable file
5
.emacs.d/modules/editor/file-templates/templates/python-mode/__
Executable file
@@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# --
|
||||
#!/usr/bin/env `(file-name-nondirectory python-shell-interpreter)`
|
||||
|
||||
$0
|
||||
3
.emacs.d/modules/editor/file-templates/templates/rspec-mode/__
Executable file
3
.emacs.d/modules/editor/file-templates/templates/rspec-mode/__
Executable file
@@ -0,0 +1,3 @@
|
||||
# `(file-name-nondirectory buffer-file-name)`
|
||||
|
||||
$0
|
||||
3
.emacs.d/modules/editor/file-templates/templates/rspec-mode/__.rspec
Executable file
3
.emacs.d/modules/editor/file-templates/templates/rspec-mode/__.rspec
Executable file
@@ -0,0 +1,3 @@
|
||||
--color
|
||||
--require spec_helper
|
||||
--format=d
|
||||
9
.emacs.d/modules/editor/file-templates/templates/rspec-mode/__helper
Executable file
9
.emacs.d/modules/editor/file-templates/templates/rspec-mode/__helper
Executable file
@@ -0,0 +1,9 @@
|
||||
require 'bundler'
|
||||
|
||||
$:.unshift File.expand_path('../lib', __FILE__)
|
||||
|
||||
RSpec.configure do |c|
|
||||
c.tty = true
|
||||
end
|
||||
|
||||
$0
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
$0
|
||||
@@ -0,0 +1,3 @@
|
||||
source 'https://rubygems.org'
|
||||
|
||||
gem '$0'
|
||||
@@ -0,0 +1,16 @@
|
||||
require 'bundler/setup'
|
||||
$:.unshift File.expand_path('../lib', __FILE__)
|
||||
|
||||
# rake spec
|
||||
require 'rspec/core/rake_task'
|
||||
RSpec::Core::RakeTask.new(:spec) { |t| t.verbose = false }
|
||||
|
||||
# rake console
|
||||
task :console do
|
||||
require 'pry'
|
||||
require '${1:gem_name}'
|
||||
ARGV.clear
|
||||
Pry.start
|
||||
end
|
||||
|
||||
$0
|
||||
@@ -0,0 +1,12 @@
|
||||
# `(progn
|
||||
(setq-local pkgs (split-string (string-remove-prefix (concat (doom-project-root) "lib/") (file-name-sans-extension buffer-file-name)) "/" t))
|
||||
(setq-local pkgs-p (eq (length pkgs) 1))
|
||||
(setq-local pkg-module (replace-regexp-in-string " " "::" (capitalize (if pkgs-p (car pkgs) (string-join (butlast pkgs) " "))) nil t))
|
||||
|
||||
(concat "lib/" (file-name-nondirectory buffer-file-name)))`
|
||||
|
||||
module `pkg-module`
|
||||
`(when pkgs-p " VERSION='0.0.1'\n\n")``(concat " class " (if pkgs-p "<< self" (capitalize (car (last pkgs)))))`
|
||||
`%`${0:# Code here}
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
[package]
|
||||
name = "${1:Project Name}"
|
||||
version = "0.0.1"
|
||||
authors = [ "`user-full-name` <`user-mail-address`>" ]
|
||||
$0
|
||||
@@ -0,0 +1,5 @@
|
||||
use std::io;
|
||||
|
||||
fn main() {
|
||||
${0:println!("Hello, world!");}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env `(if (equal (file-name-extension buffer-file-name) "zsh") "zsh" "bash")`
|
||||
|
||||
$0
|
||||
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env zunit
|
||||
|
||||
@test '...' {
|
||||
$0
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
doctype html
|
||||
html(lang="en")
|
||||
head
|
||||
meta charset="utf-8"
|
||||
meta http-equiv="x-ua-compatible" content="ie=edge"
|
||||
|
||||
title ${1:Page Title}
|
||||
meta name="description" content=""
|
||||
meta name="viewport" content="width=device-width, initial-scale=1"
|
||||
|
||||
/ link rel="apple-touch-icon" href="apple-touch-icon.png"
|
||||
|
||||
link rel="stylesheet" type="text/css" href="css/master.css"
|
||||
|
||||
script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.min.js"
|
||||
body
|
||||
$0
|
||||
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# --
|
||||
# -*- mode: snippet -*-
|
||||
# name: $1
|
||||
# key: ${2:trigger-key}${3:
|
||||
# condition: t}
|
||||
# --
|
||||
$0
|
||||
@@ -0,0 +1,10 @@
|
||||
# -*- mode: snippet -*-
|
||||
# group: file templates
|
||||
# contributor: Edmund Miller
|
||||
# name: solidity template
|
||||
# --
|
||||
pragma solidity ^0.4.22;
|
||||
|
||||
contract $0 {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: Insert a license
|
||||
# type: command
|
||||
# --
|
||||
(+file-templates/insert-license)
|
||||
@@ -0,0 +1,207 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: Apache License 2.0
|
||||
# uuid: __license-apache
|
||||
# group: Licenses
|
||||
# contributor: https://choosealicense.com/licenses/apache-2.0/
|
||||
# --
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright `(format-time-string "%Y")` ${1:`user-full-name`}
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -0,0 +1,19 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: Apache License 2.0 (boilerplate)
|
||||
# uuid: __license-apache-bp
|
||||
# group: Licenses
|
||||
# contributor: https://choosealicense.com/licenses/apache-2.0/
|
||||
# --
|
||||
Copyright ${1:`(format-time-string "%Y")` `user-full-name`}
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -0,0 +1,28 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: 2-clause BSD License
|
||||
# uuid: __license-bsd2
|
||||
# group: Licenses
|
||||
# --
|
||||
Copyright (c) ${1:`(format-time-string "%Y")`} ${2:`user-full-name`}
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,31 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: 3-clause BSD License
|
||||
# uuid: __license-bsd3
|
||||
# --
|
||||
Copyright (c) ${1:`(format-time-string "%Y")`} ${2:`user-full-name`}
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,680 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: GNU GPL 3.0 License
|
||||
# uuid: __license-gpl3
|
||||
# group: Licenses
|
||||
# contributor: https://choosealicense.com/licenses/gpl-3.0/
|
||||
# --
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
@@ -0,0 +1,21 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: GNU GPL 3.0 License (boilerplate)
|
||||
# uuid: __license-gpl3-bp
|
||||
# group: Licenses
|
||||
# contributor: https://choosealicense.com/licenses/lgpl-3.0
|
||||
# --
|
||||
${1:<program name and description>}
|
||||
Copyright (C) ${2:`(format-time-string "%Y")`} ${3:`user-full-name`}
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
@@ -0,0 +1,171 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: GNU LGPL v3 License
|
||||
# uuid: __license-lgpl3
|
||||
# group: Licenses
|
||||
# contribuer: https://choosealicense.com/licenses/lgpl-3.0/
|
||||
# --
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
@@ -0,0 +1,28 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: MIT License
|
||||
# uuid: __license-mit
|
||||
# group: Licenses
|
||||
# contributor: https://choosealicense.com/licenses/mit/
|
||||
# --
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) ${1:`(format-time-string "%Y")`} ${2:`user-full-name`}
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -0,0 +1,380 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: Mozilla Public License 2.0
|
||||
# uuid: __license-mozilla
|
||||
# group: Licenses
|
||||
# contributor: https://choosealicense.com/licenses/mpl-2.0
|
||||
# --
|
||||
Mozilla Public License Version 2.0
|
||||
==================================
|
||||
|
||||
1. Definitions
|
||||
--------------
|
||||
|
||||
1.1. "Contributor"
|
||||
means each individual or legal entity that creates, contributes to
|
||||
the creation of, or owns Covered Software.
|
||||
|
||||
1.2. "Contributor Version"
|
||||
means the combination of the Contributions of others (if any) used
|
||||
by a Contributor and that particular Contributor's Contribution.
|
||||
|
||||
1.3. "Contribution"
|
||||
means Covered Software of a particular Contributor.
|
||||
|
||||
1.4. "Covered Software"
|
||||
means Source Code Form to which the initial Contributor has attached
|
||||
the notice in Exhibit A, the Executable Form of such Source Code
|
||||
Form, and Modifications of such Source Code Form, in each case
|
||||
including portions thereof.
|
||||
|
||||
1.5. "Incompatible With Secondary Licenses"
|
||||
means
|
||||
|
||||
(a) that the initial Contributor has attached the notice described
|
||||
in Exhibit B to the Covered Software; or
|
||||
|
||||
(b) that the Covered Software was made available under the terms of
|
||||
version 1.1 or earlier of the License, but not also under the
|
||||
terms of a Secondary License.
|
||||
|
||||
1.6. "Executable Form"
|
||||
means any form of the work other than Source Code Form.
|
||||
|
||||
1.7. "Larger Work"
|
||||
means a work that combines Covered Software with other material, in
|
||||
a separate file or files, that is not Covered Software.
|
||||
|
||||
1.8. "License"
|
||||
means this document.
|
||||
|
||||
1.9. "Licensable"
|
||||
means having the right to grant, to the maximum extent possible,
|
||||
whether at the time of the initial grant or subsequently, any and
|
||||
all of the rights conveyed by this License.
|
||||
|
||||
1.10. "Modifications"
|
||||
means any of the following:
|
||||
|
||||
(a) any file in Source Code Form that results from an addition to,
|
||||
deletion from, or modification of the contents of Covered
|
||||
Software; or
|
||||
|
||||
(b) any new file in Source Code Form that contains any Covered
|
||||
Software.
|
||||
|
||||
1.11. "Patent Claims" of a Contributor
|
||||
means any patent claim(s), including without limitation, method,
|
||||
process, and apparatus claims, in any patent Licensable by such
|
||||
Contributor that would be infringed, but for the grant of the
|
||||
License, by the making, using, selling, offering for sale, having
|
||||
made, import, or transfer of either its Contributions or its
|
||||
Contributor Version.
|
||||
|
||||
1.12. "Secondary License"
|
||||
means either the GNU General Public License, Version 2.0, the GNU
|
||||
Lesser General Public License, Version 2.1, the GNU Affero General
|
||||
Public License, Version 3.0, or any later versions of those
|
||||
licenses.
|
||||
|
||||
1.13. "Source Code Form"
|
||||
means the form of the work preferred for making modifications.
|
||||
|
||||
1.14. "You" (or "Your")
|
||||
means an individual or a legal entity exercising rights under this
|
||||
License. For legal entities, "You" includes any entity that
|
||||
controls, is controlled by, or is under common control with You. For
|
||||
purposes of this definition, "control" means (a) the power, direct
|
||||
or indirect, to cause the direction or management of such entity,
|
||||
whether by contract or otherwise, or (b) ownership of more than
|
||||
fifty percent (50%) of the outstanding shares or beneficial
|
||||
ownership of such entity.
|
||||
|
||||
2. License Grants and Conditions
|
||||
--------------------------------
|
||||
|
||||
2.1. Grants
|
||||
|
||||
Each Contributor hereby grants You a world-wide, royalty-free,
|
||||
non-exclusive license:
|
||||
|
||||
(a) under intellectual property rights (other than patent or trademark)
|
||||
Licensable by such Contributor to use, reproduce, make available,
|
||||
modify, display, perform, distribute, and otherwise exploit its
|
||||
Contributions, either on an unmodified basis, with Modifications, or
|
||||
as part of a Larger Work; and
|
||||
|
||||
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
||||
for sale, have made, import, and otherwise transfer either its
|
||||
Contributions or its Contributor Version.
|
||||
|
||||
2.2. Effective Date
|
||||
|
||||
The licenses granted in Section 2.1 with respect to any Contribution
|
||||
become effective for each Contribution on the date the Contributor first
|
||||
distributes such Contribution.
|
||||
|
||||
2.3. Limitations on Grant Scope
|
||||
|
||||
The licenses granted in this Section 2 are the only rights granted under
|
||||
this License. No additional rights or licenses will be implied from the
|
||||
distribution or licensing of Covered Software under this License.
|
||||
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
||||
Contributor:
|
||||
|
||||
(a) for any code that a Contributor has removed from Covered Software;
|
||||
or
|
||||
|
||||
(b) for infringements caused by: (i) Your and any other third party's
|
||||
modifications of Covered Software, or (ii) the combination of its
|
||||
Contributions with other software (except as part of its Contributor
|
||||
Version); or
|
||||
|
||||
(c) under Patent Claims infringed by Covered Software in the absence of
|
||||
its Contributions.
|
||||
|
||||
This License does not grant any rights in the trademarks, service marks,
|
||||
or logos of any Contributor (except as may be necessary to comply with
|
||||
the notice requirements in Section 3.4).
|
||||
|
||||
2.4. Subsequent Licenses
|
||||
|
||||
No Contributor makes additional grants as a result of Your choice to
|
||||
distribute the Covered Software under a subsequent version of this
|
||||
License (see Section 10.2) or under the terms of a Secondary License (if
|
||||
permitted under the terms of Section 3.3).
|
||||
|
||||
2.5. Representation
|
||||
|
||||
Each Contributor represents that the Contributor believes its
|
||||
Contributions are its original creation(s) or it has sufficient rights
|
||||
to grant the rights to its Contributions conveyed by this License.
|
||||
|
||||
2.6. Fair Use
|
||||
|
||||
This License is not intended to limit any rights You have under
|
||||
applicable copyright doctrines of fair use, fair dealing, or other
|
||||
equivalents.
|
||||
|
||||
2.7. Conditions
|
||||
|
||||
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
||||
in Section 2.1.
|
||||
|
||||
3. Responsibilities
|
||||
-------------------
|
||||
|
||||
3.1. Distribution of Source Form
|
||||
|
||||
All distribution of Covered Software in Source Code Form, including any
|
||||
Modifications that You create or to which You contribute, must be under
|
||||
the terms of this License. You must inform recipients that the Source
|
||||
Code Form of the Covered Software is governed by the terms of this
|
||||
License, and how they can obtain a copy of this License. You may not
|
||||
attempt to alter or restrict the recipients' rights in the Source Code
|
||||
Form.
|
||||
|
||||
3.2. Distribution of Executable Form
|
||||
|
||||
If You distribute Covered Software in Executable Form then:
|
||||
|
||||
(a) such Covered Software must also be made available in Source Code
|
||||
Form, as described in Section 3.1, and You must inform recipients of
|
||||
the Executable Form how they can obtain a copy of such Source Code
|
||||
Form by reasonable means in a timely manner, at a charge no more
|
||||
than the cost of distribution to the recipient; and
|
||||
|
||||
(b) You may distribute such Executable Form under the terms of this
|
||||
License, or sublicense it under different terms, provided that the
|
||||
license for the Executable Form does not attempt to limit or alter
|
||||
the recipients' rights in the Source Code Form under this License.
|
||||
|
||||
3.3. Distribution of a Larger Work
|
||||
|
||||
You may create and distribute a Larger Work under terms of Your choice,
|
||||
provided that You also comply with the requirements of this License for
|
||||
the Covered Software. If the Larger Work is a combination of Covered
|
||||
Software with a work governed by one or more Secondary Licenses, and the
|
||||
Covered Software is not Incompatible With Secondary Licenses, this
|
||||
License permits You to additionally distribute such Covered Software
|
||||
under the terms of such Secondary License(s), so that the recipient of
|
||||
the Larger Work may, at their option, further distribute the Covered
|
||||
Software under the terms of either this License or such Secondary
|
||||
License(s).
|
||||
|
||||
3.4. Notices
|
||||
|
||||
You may not remove or alter the substance of any license notices
|
||||
(including copyright notices, patent notices, disclaimers of warranty,
|
||||
or limitations of liability) contained within the Source Code Form of
|
||||
the Covered Software, except that You may alter any license notices to
|
||||
the extent required to remedy known factual inaccuracies.
|
||||
|
||||
3.5. Application of Additional Terms
|
||||
|
||||
You may choose to offer, and to charge a fee for, warranty, support,
|
||||
indemnity or liability obligations to one or more recipients of Covered
|
||||
Software. However, You may do so only on Your own behalf, and not on
|
||||
behalf of any Contributor. You must make it absolutely clear that any
|
||||
such warranty, support, indemnity, or liability obligation is offered by
|
||||
You alone, and You hereby agree to indemnify every Contributor for any
|
||||
liability incurred by such Contributor as a result of warranty, support,
|
||||
indemnity or liability terms You offer. You may include additional
|
||||
disclaimers of warranty and limitations of liability specific to any
|
||||
jurisdiction.
|
||||
|
||||
4. Inability to Comply Due to Statute or Regulation
|
||||
---------------------------------------------------
|
||||
|
||||
If it is impossible for You to comply with any of the terms of this
|
||||
License with respect to some or all of the Covered Software due to
|
||||
statute, judicial order, or regulation then You must: (a) comply with
|
||||
the terms of this License to the maximum extent possible; and (b)
|
||||
describe the limitations and the code they affect. Such description must
|
||||
be placed in a text file included with all distributions of the Covered
|
||||
Software under this License. Except to the extent prohibited by statute
|
||||
or regulation, such description must be sufficiently detailed for a
|
||||
recipient of ordinary skill to be able to understand it.
|
||||
|
||||
5. Termination
|
||||
--------------
|
||||
|
||||
5.1. The rights granted under this License will terminate automatically
|
||||
if You fail to comply with any of its terms. However, if You become
|
||||
compliant, then the rights granted under this License from a particular
|
||||
Contributor are reinstated (a) provisionally, unless and until such
|
||||
Contributor explicitly and finally terminates Your grants, and (b) on an
|
||||
ongoing basis, if such Contributor fails to notify You of the
|
||||
non-compliance by some reasonable means prior to 60 days after You have
|
||||
come back into compliance. Moreover, Your grants from a particular
|
||||
Contributor are reinstated on an ongoing basis if such Contributor
|
||||
notifies You of the non-compliance by some reasonable means, this is the
|
||||
first time You have received notice of non-compliance with this License
|
||||
from such Contributor, and You become compliant prior to 30 days after
|
||||
Your receipt of the notice.
|
||||
|
||||
5.2. If You initiate litigation against any entity by asserting a patent
|
||||
infringement claim (excluding declaratory judgment actions,
|
||||
counter-claims, and cross-claims) alleging that a Contributor Version
|
||||
directly or indirectly infringes any patent, then the rights granted to
|
||||
You by any and all Contributors for the Covered Software under Section
|
||||
2.1 of this License shall terminate.
|
||||
|
||||
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
||||
end user license agreements (excluding distributors and resellers) which
|
||||
have been validly granted by You or Your distributors under this License
|
||||
prior to termination shall survive termination.
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 6. Disclaimer of Warranty *
|
||||
* ------------------------- *
|
||||
* *
|
||||
* Covered Software is provided under this License on an "as is" *
|
||||
* basis, without warranty of any kind, either expressed, implied, or *
|
||||
* statutory, including, without limitation, warranties that the *
|
||||
* Covered Software is free of defects, merchantable, fit for a *
|
||||
* particular purpose or non-infringing. The entire risk as to the *
|
||||
* quality and performance of the Covered Software is with You. *
|
||||
* Should any Covered Software prove defective in any respect, You *
|
||||
* (not any Contributor) assume the cost of any necessary servicing, *
|
||||
* repair, or correction. This disclaimer of warranty constitutes an *
|
||||
* essential part of this License. No use of any Covered Software is *
|
||||
* authorized under this License except under this disclaimer. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 7. Limitation of Liability *
|
||||
* -------------------------- *
|
||||
* *
|
||||
* Under no circumstances and under no legal theory, whether tort *
|
||||
* (including negligence), contract, or otherwise, shall any *
|
||||
* Contributor, or anyone who distributes Covered Software as *
|
||||
* permitted above, be liable to You for any direct, indirect, *
|
||||
* special, incidental, or consequential damages of any character *
|
||||
* including, without limitation, damages for lost profits, loss of *
|
||||
* goodwill, work stoppage, computer failure or malfunction, or any *
|
||||
* and all other commercial damages or losses, even if such party *
|
||||
* shall have been informed of the possibility of such damages. This *
|
||||
* limitation of liability shall not apply to liability for death or *
|
||||
* personal injury resulting from such party's negligence to the *
|
||||
* extent applicable law prohibits such limitation. Some *
|
||||
* jurisdictions do not allow the exclusion or limitation of *
|
||||
* incidental or consequential damages, so this exclusion and *
|
||||
* limitation may not apply to You. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
8. Litigation
|
||||
-------------
|
||||
|
||||
Any litigation relating to this License may be brought only in the
|
||||
courts of a jurisdiction where the defendant maintains its principal
|
||||
place of business and such litigation shall be governed by laws of that
|
||||
jurisdiction, without reference to its conflict-of-law provisions.
|
||||
Nothing in this Section shall prevent a party's ability to bring
|
||||
cross-claims or counter-claims.
|
||||
|
||||
9. Miscellaneous
|
||||
----------------
|
||||
|
||||
This License represents the complete agreement concerning the subject
|
||||
matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent
|
||||
necessary to make it enforceable. Any law or regulation which provides
|
||||
that the language of a contract shall be construed against the drafter
|
||||
shall not be used to construe this License against a Contributor.
|
||||
|
||||
10. Versions of the License
|
||||
---------------------------
|
||||
|
||||
10.1. New Versions
|
||||
|
||||
Mozilla Foundation is the license steward. Except as provided in Section
|
||||
10.3, no one other than the license steward has the right to modify or
|
||||
publish new versions of this License. Each version will be given a
|
||||
distinguishing version number.
|
||||
|
||||
10.2. Effect of New Versions
|
||||
|
||||
You may distribute the Covered Software under the terms of the version
|
||||
of the License under which You originally received the Covered Software,
|
||||
or under the terms of any subsequent version published by the license
|
||||
steward.
|
||||
|
||||
10.3. Modified Versions
|
||||
|
||||
If you create software not governed by this License, and you want to
|
||||
create a new license for such software, you may create and use a
|
||||
modified version of this License if you rename the license and remove
|
||||
any references to the name of the license steward (except to note that
|
||||
such modified license differs from this License).
|
||||
|
||||
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
||||
Licenses
|
||||
|
||||
If You choose to distribute Source Code Form that is Incompatible With
|
||||
Secondary Licenses under the terms of this version of the License, the
|
||||
notice described in Exhibit B of this License must be attached.
|
||||
|
||||
Exhibit A - Source Code Form License Notice
|
||||
-------------------------------------------
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
If it is not possible or desirable to put the notice in a particular
|
||||
file, then You may include the notice in a location (such as a LICENSE
|
||||
file in a relevant directory) where a recipient would be likely to look
|
||||
for such a notice.
|
||||
|
||||
You may add additional accurate notices of copyright ownership.
|
||||
|
||||
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
||||
---------------------------------------------------------
|
||||
|
||||
This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||
defined by the Mozilla Public License, v. 2.0.
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: Mozilla Public License 2.0 (boilerplate)
|
||||
# uuid: __license-mozilla-bp
|
||||
# group: Licenses
|
||||
# contributor: https://choosealicense.com/licenses/mpl-2.0
|
||||
# --
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
@@ -0,0 +1,30 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: The Unlicense
|
||||
# uuid: __license-unlicense
|
||||
# group: Licenses
|
||||
# contributor: https://choosealicense.com/licenses/unlicense
|
||||
# --
|
||||
This is free and unencumbered software released into the public domain.
|
||||
|
||||
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||
distribute this software, either in source code form or as a compiled
|
||||
binary, for any purpose, commercial or non-commercial, and by any
|
||||
means.
|
||||
|
||||
In jurisdictions that recognize copyright laws, the author or authors
|
||||
of this software dedicate any and all copyright interest in the
|
||||
software to the public domain. We make this dedication for the benefit
|
||||
of the public at large and to the detriment of our heirs and
|
||||
successors. We intend this dedication to be an overt act of
|
||||
relinquishment in perpetuity of all present and future rights to this
|
||||
software under copyright law.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
For more information, please refer to <http://unlicense.org>
|
||||
@@ -0,0 +1,25 @@
|
||||
<!doctype html>
|
||||
<html class="no-js" lang="">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||
<title>${1:Untitled}</title>
|
||||
<meta name="description" content="">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
|
||||
<!-- Place favicon.ico in the root directory -->
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<!--[if lt IE 8]>
|
||||
<p class="browserupgrade">
|
||||
You are using an <strong>outdated</strong> browser. Please
|
||||
<a href="http://browsehappy.com/">upgrade your browser</a> to improve
|
||||
your experience.
|
||||
</p>
|
||||
<![endif]-->
|
||||
|
||||
$0
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,15 @@
|
||||
web:
|
||||
build: .
|
||||
ports:
|
||||
- "8080:80"
|
||||
volumes:
|
||||
- ./public:/var/www
|
||||
links:
|
||||
- mysql
|
||||
- memcache
|
||||
|
||||
mysql:
|
||||
image: mysql
|
||||
|
||||
redis:
|
||||
image: redis
|
||||
32
.emacs.d/modules/editor/fold/README.org
Normal file
32
.emacs.d/modules/editor/fold/README.org
Normal file
@@ -0,0 +1,32 @@
|
||||
#+TITLE: editor/fold
|
||||
#+DATE: February 17, 2019
|
||||
#+SINCE: v2.1
|
||||
#+STARTUP: inlineimages
|
||||
|
||||
* Table of Contents :TOC_3:noexport:
|
||||
- [[Description][Description]]
|
||||
- [[Module Flags][Module Flags]]
|
||||
- [[Plugins][Plugins]]
|
||||
- [[Prerequisites][Prerequisites]]
|
||||
- [[Features][Features]]
|
||||
- [[Configuration][Configuration]]
|
||||
- [[Troubleshooting][Troubleshooting]]
|
||||
|
||||
* Description
|
||||
This module marries hideshow, vimish-fold and outline-minor-mode to bring you
|
||||
marker, indent and syntax-based code folding for as many languages as possible.
|
||||
|
||||
** Module Flags
|
||||
This module provides no flags.
|
||||
|
||||
** Plugins
|
||||
+ evil-vimish-fold*
|
||||
|
||||
* Prerequisites
|
||||
This module has no prerequisites.
|
||||
|
||||
* TODO Features
|
||||
|
||||
* TODO Configuration
|
||||
|
||||
* TODO Troubleshooting
|
||||
155
.emacs.d/modules/editor/fold/autoload/fold.el
Normal file
155
.emacs.d/modules/editor/fold/autoload/fold.el
Normal file
@@ -0,0 +1,155 @@
|
||||
;;; editor/fold/autoload/fold.el -*- lexical-binding: t; -*-
|
||||
|
||||
;; `hideshow' is a decent code folding implementation, but it won't let you
|
||||
;; create custom folds. `vimish-fold' offers custom folds, but essentially
|
||||
;; ignores any other type of folding (indent or custom markers, which hideshow
|
||||
;; and `outline-mode' give you). This is my effort to combine them.
|
||||
|
||||
;;
|
||||
;;; Helpers
|
||||
|
||||
(defun +fold--ensure-hideshow-mode ()
|
||||
(unless (bound-and-true-p hs-minor-mode)
|
||||
(hs-minor-mode +1)))
|
||||
|
||||
(defun +fold--vimish-fold-p ()
|
||||
(and (featurep 'vimish-fold)
|
||||
(cl-some #'vimish-fold--vimish-overlay-p
|
||||
(overlays-at (point)))))
|
||||
|
||||
(defun +fold--outline-fold-p ()
|
||||
(and (or (bound-and-true-p outline-minor-mode)
|
||||
(derived-mode-p 'outline-mode))
|
||||
(outline-on-heading-p)))
|
||||
|
||||
(defun +fold--hideshow-fold-p ()
|
||||
(+fold--ensure-hideshow-mode)
|
||||
(save-excursion
|
||||
(ignore-errors
|
||||
(or (hs-looking-at-block-start-p)
|
||||
(hs-find-block-beginning)))))
|
||||
|
||||
(defun +fold--invisible-points (count)
|
||||
(let (points)
|
||||
(save-excursion
|
||||
(catch 'abort
|
||||
(if (< count 0) (beginning-of-line))
|
||||
(while (re-search-forward hs-block-start-regexp nil t
|
||||
(if (> count 0) 1 -1))
|
||||
(unless (invisible-p (point))
|
||||
(end-of-line)
|
||||
(when (hs-already-hidden-p)
|
||||
(push (point) points)
|
||||
(when (>= (length points) count)
|
||||
(throw 'abort nil))))
|
||||
(forward-line (if (> count 0) 1 -1)))))
|
||||
points))
|
||||
|
||||
(defmacro +fold-from-eol (&rest body)
|
||||
"Perform action after moving to the end of the line."
|
||||
`(save-excursion
|
||||
(end-of-line)
|
||||
,@body))
|
||||
|
||||
|
||||
;;
|
||||
;;; Commands
|
||||
|
||||
;;;###autoload
|
||||
(defun +fold/toggle ()
|
||||
"Toggle the fold at point.
|
||||
|
||||
Targets `vimmish-fold', `hideshow' and `outline' folds."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(cond ((+fold--vimish-fold-p) (vimish-fold-toggle))
|
||||
((+fold--outline-fold-p)
|
||||
(cl-letf (((symbol-function #'outline-hide-subtree)
|
||||
(symbol-function #'outline-hide-entry)))
|
||||
(outline-toggle-children)))
|
||||
((+fold--hideshow-fold-p) (+fold-from-eol (hs-toggle-hiding))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +fold/open ()
|
||||
"Open the folded region at point.
|
||||
|
||||
Targets `vimmish-fold', `hideshow' and `outline' folds."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(cond ((+fold--vimish-fold-p) (vimish-fold-unfold))
|
||||
((+fold--outline-fold-p)
|
||||
(outline-show-children)
|
||||
(outline-show-entry))
|
||||
((+fold--hideshow-fold-p) (+fold-from-eol (hs-show-block))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +fold/close ()
|
||||
"Close the folded region at point.
|
||||
|
||||
Targets `vimmish-fold', `hideshow' and `outline' folds."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(cond ((+fold--vimish-fold-p) (vimish-fold-refold))
|
||||
((+fold--hideshow-fold-p) (+fold-from-eol (hs-hide-block)))
|
||||
((+fold--outline-fold-p) (outline-hide-subtree)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +fold/open-all (&optional level)
|
||||
"Open folds at LEVEL (or all folds if LEVEL is nil)."
|
||||
(interactive
|
||||
(list (if current-prefix-arg (prefix-numeric-value current-prefix-arg))))
|
||||
(when (featurep 'vimish-fold)
|
||||
(vimish-fold-unfold-all))
|
||||
(save-excursion
|
||||
(+fold--ensure-hideshow-mode)
|
||||
(if (integerp level)
|
||||
(progn
|
||||
(outline-hide-sublevels (max 1 (1- level)))
|
||||
(hs-life-goes-on
|
||||
(hs-hide-level-recursive (1- level) (point-min) (point-max))))
|
||||
(hs-show-all)
|
||||
(when (fboundp 'outline-show-all)
|
||||
(outline-show-all)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +fold/close-all (&optional level)
|
||||
"Close folds at LEVEL (or all folds if LEVEL is nil)."
|
||||
(interactive
|
||||
(list (if current-prefix-arg (prefix-numeric-value current-prefix-arg))))
|
||||
(save-excursion
|
||||
(when (featurep 'vimish-fold)
|
||||
(vimish-fold-refold-all))
|
||||
(+fold--ensure-hideshow-mode)
|
||||
(hs-life-goes-on
|
||||
(if (integerp level)
|
||||
(hs-hide-level-recursive (1- level) (point-min) (point-max))
|
||||
(hs-hide-all)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +fold/next (count)
|
||||
"Jump to the next vimish fold, outline heading or folded region."
|
||||
(interactive "p")
|
||||
(cl-loop with orig-pt = (point)
|
||||
for fn
|
||||
in (list (lambda ()
|
||||
(when (bound-and-true-p hs-block-start-regexp)
|
||||
(car (+fold--invisible-points count))))
|
||||
(lambda ()
|
||||
(when (featurep 'vimish-fold)
|
||||
(if (> count 0)
|
||||
(evil-vimish-fold/next-fold count)
|
||||
(evil-vimish-fold/previous-fold (- count))))
|
||||
(if (/= (point) orig-pt) (point))))
|
||||
if (save-excursion (funcall fn))
|
||||
collect it into points
|
||||
finally do
|
||||
(if-let* ((pt (car (sort points (if (> count 0) #'< #'>)))))
|
||||
(goto-char pt)
|
||||
(message "No more folds %s point" (if (> count 0) "after" "before"))
|
||||
(goto-char orig-pt))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +fold/previous (count)
|
||||
"Jump to the previous vimish fold, outline heading or folded region."
|
||||
(interactive "p")
|
||||
(+fold/next (- count)))
|
||||
83
.emacs.d/modules/editor/fold/autoload/hideshow.el
Normal file
83
.emacs.d/modules/editor/fold/autoload/hideshow.el
Normal file
@@ -0,0 +1,83 @@
|
||||
;;; editor/fold/autoload/hideshow.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defface +fold-hideshow-folded-face
|
||||
`((t (:inherit font-lock-comment-face :weight light)))
|
||||
"Face to hightlight `hideshow' overlays."
|
||||
:group 'doom-themes)
|
||||
|
||||
;;;###autoload
|
||||
(defun +fold-hideshow-haml-forward-sexp-fn (arg)
|
||||
(haml-forward-sexp arg)
|
||||
(move-beginning-of-line 1))
|
||||
|
||||
;;;###autoload
|
||||
(defun +fold-hideshow-forward-block-by-indent-fn (_arg)
|
||||
(let ((start (current-indentation)))
|
||||
(forward-line)
|
||||
(unless (= start (current-indentation))
|
||||
(let ((range (+fold-hideshow-indent-range)))
|
||||
(goto-char (cadr range))
|
||||
(end-of-line)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +fold-hideshow-set-up-overlay-fn (ov)
|
||||
(when (eq 'code (overlay-get ov 'hs))
|
||||
(when (featurep 'vimish-fold)
|
||||
(overlay-put
|
||||
ov 'before-string
|
||||
(propertize "…" 'display
|
||||
(list vimish-fold-indication-mode
|
||||
'empty-line
|
||||
'vimish-fold-fringe))))
|
||||
(overlay-put
|
||||
ov 'display (propertize " [...] " 'face '+fold-hideshow-folded-face))))
|
||||
|
||||
|
||||
;;
|
||||
;;; Indentation detection
|
||||
|
||||
(defun +fold--hideshow-empty-line-p (_)
|
||||
(string= "" (string-trim (thing-at-point 'line 'no-props))))
|
||||
|
||||
(defun +fold--hideshow-geq-or-empty-p (base-indent)
|
||||
(or (+fold--hideshow-empty-line-p base-indent)
|
||||
(>= (current-indentation) base-indent)))
|
||||
|
||||
(defun +fold--hideshow-g-or-empty-p (base-indent)
|
||||
(or (+fold--hideshow-empty-line-p base-indent)
|
||||
(> (current-indentation) base-indent)))
|
||||
|
||||
(defun +fold--hideshow-seek (start direction before skip predicate base-indent)
|
||||
"Seeks forward (if direction is 1) or backward (if direction is -1) from start, until predicate
|
||||
fails. If before is nil, it will return the first line where predicate fails, otherwise it returns
|
||||
the last line where predicate holds."
|
||||
(save-excursion
|
||||
(goto-char start)
|
||||
(goto-char (point-at-bol))
|
||||
(let ((bnd (if (> 0 direction)
|
||||
(point-min)
|
||||
(point-max)))
|
||||
(pt (point)))
|
||||
(when skip (forward-line direction))
|
||||
(cl-loop while (and (/= (point) bnd) (funcall predicate base-indent))
|
||||
do (progn
|
||||
(when before (setq pt (point-at-bol)))
|
||||
(forward-line direction)
|
||||
(unless before (setq pt (point-at-bol)))))
|
||||
pt)))
|
||||
|
||||
(defun +fold-hideshow-indent-range (&optional point)
|
||||
"Return the point at the begin and end of the text block with the same (or
|
||||
greater) indentation. If `point' is supplied and non-nil it will return the
|
||||
begin and end of the block surrounding point."
|
||||
(save-excursion
|
||||
(when point
|
||||
(goto-char point))
|
||||
(let ((base-indent (current-indentation))
|
||||
(begin (point))
|
||||
(end (point)))
|
||||
(setq begin (+fold--hideshow-seek begin -1 t nil #'+fold--hideshow-geq-or-empty-p base-indent)
|
||||
begin (+fold--hideshow-seek begin 1 nil nil #'+fold--hideshow-g-or-empty-p base-indent)
|
||||
end (+fold--hideshow-seek end 1 t nil #'+fold--hideshow-geq-or-empty-p base-indent)
|
||||
end (+fold--hideshow-seek end -1 nil nil #'+fold--hideshow-empty-line-p base-indent))
|
||||
(list begin end base-indent))))
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user