Initial commit.
This commit is contained in:
commit
96a9c67ada
17
.gitignore
vendored
Normal file
17
.gitignore
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
# Emacs file
|
||||
*~
|
||||
amx-items
|
||||
custom-set-variables.el
|
||||
.python-environments
|
||||
auto-save-list
|
||||
elpa
|
||||
.last-package-update-day
|
||||
projectile.cache
|
||||
projectile-bookmarks.eld
|
||||
eshell/
|
||||
early-init-do-not-edit/
|
||||
places
|
||||
transient/
|
||||
elpy/
|
||||
recentf
|
||||
.cache
|
36
.gitmodules
vendored
Normal file
36
.gitmodules
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
[submodule "site-elisp\\color-rg"]
|
||||
path = site-elisp\\color-rg
|
||||
url = https://github.com/manateelazycat/color-rg.git
|
||||
[submodule "site-elisp\\awesome-pair"]
|
||||
path = site-elisp\\awesome-pair
|
||||
url = https://github.com/manateelazycat/awesome-pair.git
|
||||
[submodule "site-elisp\\header2"]
|
||||
path = site-elisp\\header2
|
||||
url = https://github.com/emacsmirror/header2.git
|
||||
[submodule "site-elisp\\grep-dired"]
|
||||
path = site-elisp\\grep-dired
|
||||
url = https://github.com/manateelazycat/grep-dired.git
|
||||
[submodule "site-elisp\\leetcode"]
|
||||
path = site-elisp\\leetcode
|
||||
url = https://github.com/kaiwk/leetcode.el.git
|
||||
[submodule "site-elisp\\delete-block"]
|
||||
path = site-elisp\\delete-block
|
||||
url = https://github.com/manateelazycat/delete-block.git
|
||||
[submodule "site-elisp\\instant-rename-tag"]
|
||||
path = site-elisp\\instant-rename-tag
|
||||
url = https://github.com/manateelazycat/instant-rename-tag.git
|
||||
[submodule "site-elisp\\emacs-application-framework"]
|
||||
path = site-elisp\\emacs-application-framework
|
||||
url = https://github.com/manateelazycat/emacs-application-framework.git
|
||||
[submodule "site-elisp\\snails"]
|
||||
path = site-elisp\\snails
|
||||
url = https://github.com/manateelazycat/snails.git
|
||||
[submodule "site-elisp\\multi-term"]
|
||||
path = site-elisp\\multi-term
|
||||
url = https://github.com/manateelazycat/multi-term.git
|
||||
[submodule "site-elisp\\epaint"]
|
||||
path = site-elisp\\epaint
|
||||
url = https://github.com/chuntaro/epaint.git
|
||||
[submodule "site-elisp\\aweshell"]
|
||||
path = site-elisp\\aweshell
|
||||
url = https://github.com/MatthewZMD/aweshell.git
|
68
early-init.el
Normal file
68
early-init.el
Normal file
@ -0,0 +1,68 @@
|
||||
;;; early-init.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: early-init.el
|
||||
;; Description: Early initialization
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Sun Jun 9 17:58:05 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Tue Sep 17 01:13:45 2019 (-0400)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d init early-init
|
||||
;; Compatibility: emacs-version >= 27
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; Emacs27 introduces early-init.el, which is run before init.el,
|
||||
;; before package and UI initialization happens.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
;; DeferGC
|
||||
(setq gc-cons-threshold 100000000)
|
||||
;; -DeferGC
|
||||
|
||||
;; UnsetPES
|
||||
(setq package-enable-at-startup nil)
|
||||
;; -UnsetPES
|
||||
|
||||
;; UnsetFNHA
|
||||
(defvar file-name-handler-alist-original file-name-handler-alist)
|
||||
(setq file-name-handler-alist nil)
|
||||
;; -UnsetFNHA
|
||||
|
||||
;; UnsetSRF
|
||||
(setq site-run-file nil)
|
||||
;; -UnsetSRF
|
||||
|
||||
;; DisableUnnecessaryInterface
|
||||
(menu-bar-mode -1)
|
||||
(unless (and (display-graphic-p) (eq system-type 'darwin))
|
||||
(push '(menu-bar-lines . 0) default-frame-alist))
|
||||
(push '(tool-bar-lines . 0) default-frame-alist)
|
||||
(push '(vertical-scroll-bars) default-frame-alist)
|
||||
;; -DisableUnnecessaryInterface
|
||||
|
||||
(provide 'early-init)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; early-init.el ends here
|
47
elisp/init-ace-window.el
Normal file
47
elisp/init-ace-window.el
Normal file
@ -0,0 +1,47 @@
|
||||
;;; init-ace-window.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-ace-window.el
|
||||
;; Description: Initialize Ace-Window
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Tue Apr 23 10:00:42 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Thu Aug 8 16:02:47 2019 (-0400)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d ace-window
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes ace-window
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
;; AceWindowPac
|
||||
(use-package ace-window
|
||||
:bind ("C-x C-o" . ace-window))
|
||||
;; -AceWindowPac
|
||||
|
||||
(provide 'init-ace-window)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-ace-window.el ends here
|
168
elisp/init-all-the-icons.el
Normal file
168
elisp/init-all-the-icons.el
Normal file
@ -0,0 +1,168 @@
|
||||
;;; init-all-the-icons.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-all-the-icons.el
|
||||
;; Description: Initialize All-The-Icons
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Thu Mar 14 17:06:08 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Tue Dec 24 11:47:45 2019 (-0500)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d all-the-icons
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes all-the-icons, all-the-icons-dired, all-the-icons-ivy
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(require 'init-const))
|
||||
|
||||
(use-package all-the-icons
|
||||
:if *sys/gui*
|
||||
:config
|
||||
(with-no-warnings
|
||||
;; FIXME: Align the directory icons
|
||||
;; @see https://github.com/domtronn/all-the-icons.el/pull/173
|
||||
(defun all-the-icons-icon-for-dir (dir &optional chevron padding)
|
||||
"Format an icon for DIR with CHEVRON similar to tree based directories."
|
||||
(let* ((matcher (all-the-icons-match-to-alist (file-name-base (directory-file-name dir)) all-the-icons-dir-icon-alist))
|
||||
(path (expand-file-name dir))
|
||||
(chevron (if chevron (all-the-icons-octicon (format "chevron-%s" chevron) :height 0.8 :v-adjust -0.1) ""))
|
||||
(padding (or padding "\t"))
|
||||
(icon (cond
|
||||
((file-symlink-p path)
|
||||
(all-the-icons-octicon "file-symlink-directory" :height 1.0 :v-adjust 0.0))
|
||||
((all-the-icons-dir-is-submodule path)
|
||||
(all-the-icons-octicon "file-submodule" :height 1.0 :v-adjust 0.0))
|
||||
((file-exists-p (format "%s/.git" path))
|
||||
(format "%s" (all-the-icons-octicon "repo" :height 1.1 :v-adjust 0.0)))
|
||||
(t (apply (car matcher) (list (cadr matcher) :v-adjust 0.0))))))
|
||||
(format "%s%s%s%s%s" padding chevron padding icon padding)))
|
||||
|
||||
(defun all-the-icons-reset ()
|
||||
"Reset (unmemoize/memoize) the icons."
|
||||
(interactive)
|
||||
(dolist (f '(all-the-icons-icon-for-file
|
||||
all-the-icons-icon-for-mode
|
||||
all-the-icons-icon-for-url
|
||||
all-the-icons-icon-family-for-file
|
||||
all-the-icons-icon-family-for-mode
|
||||
all-the-icons-icon-family))
|
||||
(ignore-errors
|
||||
(memoize-restore f)
|
||||
(memoize f)))
|
||||
(message "Reset all-the-icons")))
|
||||
|
||||
(add-to-list 'all-the-icons-mode-icon-alist
|
||||
'(bongo-playlist-mode all-the-icons-material "playlist_play" :height 1.2 :v-adjust -0.2 :face 'all-the-icons-green))
|
||||
(add-to-list 'all-the-icons-mode-icon-alist
|
||||
'(bongo-library-mode all-the-icons-material "library_music" :height 1.1 :v-adjust -0.2 :face 'all-the-icons-dgreen))
|
||||
(add-to-list 'all-the-icons-mode-icon-alist
|
||||
'(gnus-group-mode all-the-icons-fileicon "gnu" :face 'all-the-icons-silver))
|
||||
(add-to-list 'all-the-icons-mode-icon-alist
|
||||
'(gnus-summary-mode all-the-icons-octicon "inbox" :height 1.0 :v-adjust 0.0 :face 'all-the-icons-orange))
|
||||
(add-to-list 'all-the-icons-mode-icon-alist
|
||||
'(gnus-article-mode all-the-icons-octicon "mail" :height 1.1 :v-adjust 0.0 :face 'all-the-icons-lblue))
|
||||
(add-to-list 'all-the-icons-mode-icon-alist
|
||||
'(message-mode all-the-icons-octicon "mail" :height 1.1 :v-adjust 0.0 :face 'all-the-icons-lblue))
|
||||
(add-to-list 'all-the-icons-mode-icon-alist
|
||||
'(diff-mode all-the-icons-octicon "git-compare" :v-adjust 0.0 :face all-the-icons-lred))
|
||||
(add-to-list 'all-the-icons-mode-icon-alist
|
||||
'(flycheck-error-list-mode all-the-icons-octicon "checklist" :height 1.1 :v-adjust 0.0 :face all-the-icons-lred))
|
||||
(add-to-list 'all-the-icons-mode-icon-alist
|
||||
'(elfeed-search-mode all-the-icons-faicon "rss-square" :v-adjust -0.1 :face all-the-icons-orange))
|
||||
(add-to-list 'all-the-icons-mode-icon-alist
|
||||
'(elfeed-show-mode all-the-icons-octicon "rss" :height 1.1 :v-adjust 0.0 :face all-the-icons-lorange))
|
||||
(add-to-list 'all-the-icons-mode-icon-alist
|
||||
'(newsticker-mode all-the-icons-faicon "rss-square" :v-adjust -0.1 :face all-the-icons-orange))
|
||||
(add-to-list 'all-the-icons-mode-icon-alist
|
||||
'(newsticker-treeview-mode all-the-icons-faicon "rss-square" :v-adjust -0.1 :face all-the-icons-orange))
|
||||
(add-to-list 'all-the-icons-mode-icon-alist
|
||||
'(newsticker-treeview-list-mode all-the-icons-octicon "rss" :height 1.1 :v-adjust 0.0 :face all-the-icons-orange))
|
||||
(add-to-list 'all-the-icons-mode-icon-alist
|
||||
'(newsticker-treeview-item-mode all-the-icons-octicon "rss" :height 1.1 :v-adjust 0.0 :face all-the-icons-lorange))
|
||||
(add-to-list 'all-the-icons-icon-alist
|
||||
'("\\.[bB][iI][nN]$" all-the-icons-octicon "file-binary" :v-adjust 0.0 :face all-the-icons-yellow))
|
||||
(add-to-list 'all-the-icons-icon-alist
|
||||
'("\\.c?make$" all-the-icons-fileicon "gnu" :face all-the-icons-dorange))
|
||||
(add-to-list 'all-the-icons-icon-alist
|
||||
'("\\.conf$" all-the-icons-octicon "settings" :v-adjust 0.0 :face all-the-icons-yellow))
|
||||
(add-to-list 'all-the-icons-icon-alist
|
||||
'("\\.toml$" all-the-icons-octicon "settings" :v-adjust 0.0 :face all-the-icons-yellow))
|
||||
(add-to-list 'all-the-icons-mode-icon-alist
|
||||
'(conf-mode all-the-icons-octicon "settings" :v-adjust 0.0 :face all-the-icons-yellow))
|
||||
(add-to-list 'all-the-icons-mode-icon-alist
|
||||
'(conf-space-mode all-the-icons-octicon "settings" :v-adjust 0.0 :face all-the-icons-yellow))
|
||||
(add-to-list 'all-the-icons-mode-icon-alist
|
||||
'(forge-topic-mode all-the-icons-alltheicon "git" :face all-the-icons-blue))
|
||||
(add-to-list 'all-the-icons-icon-alist
|
||||
'("\\.xpm$" all-the-icons-octicon "file-media" :v-adjust 0.0 :face all-the-icons-dgreen))
|
||||
(add-to-list 'all-the-icons-mode-icon-alist
|
||||
'(help-mode all-the-icons-faicon "info-circle" :height 1.1 :v-adjust -0.1 :face all-the-icons-purple))
|
||||
(add-to-list 'all-the-icons-mode-icon-alist
|
||||
'(helpful-mode all-the-icons-faicon "info-circle" :height 1.1 :v-adjust -0.1 :face all-the-icons-purple))
|
||||
(add-to-list 'all-the-icons-mode-icon-alist
|
||||
'(Info-mode all-the-icons-faicon "info-circle" :height 1.1 :v-adjust -0.1))
|
||||
(add-to-list 'all-the-icons-icon-alist
|
||||
'("NEWS$" all-the-icons-faicon "newspaper-o" :height 0.9 :v-adjust -0.2))
|
||||
(add-to-list 'all-the-icons-icon-alist
|
||||
'("Cask\\'" all-the-icons-fileicon "elisp" :height 1.0 :v-adjust -0.2 :face all-the-icons-blue))
|
||||
(add-to-list 'all-the-icons-mode-icon-alist
|
||||
'(cask-mode all-the-icons-fileicon "elisp" :height 1.0 :v-adjust -0.2 :face all-the-icons-blue))
|
||||
(add-to-list 'all-the-icons-icon-alist
|
||||
'(".*\\.ipynb\\'" all-the-icons-fileicon "jupyter" :height 1.2 :face all-the-icons-orange))
|
||||
(add-to-list 'all-the-icons-mode-icon-alist
|
||||
'(ein:notebooklist-mode all-the-icons-faicon "book" :face all-the-icons-lorange))
|
||||
(add-to-list 'all-the-icons-mode-icon-alist
|
||||
'(ein:notebook-mode all-the-icons-fileicon "jupyter" :height 1.2 :face all-the-icons-orange))
|
||||
(add-to-list 'all-the-icons-mode-icon-alist
|
||||
'(ein:notebook-multilang-mode all-the-icons-fileicon "jupyter" :height 1.2 :face all-the-icons-dorange))
|
||||
(add-to-list 'all-the-icons-icon-alist
|
||||
'("\\.epub\\'" all-the-icons-faicon "book" :height 1.0 :v-adjust -0.1 :face all-the-icons-green))
|
||||
(add-to-list 'all-the-icons-mode-icon-alist
|
||||
'(nov-mode all-the-icons-faicon "book" :height 1.0 :v-adjust -0.1 :face all-the-icons-green))
|
||||
(add-to-list 'all-the-icons-mode-icon-alist
|
||||
'(gfm-mode all-the-icons-octicon "markdown" :face all-the-icons-lblue)))
|
||||
|
||||
;; ATIDiredPac
|
||||
(use-package all-the-icons-dired
|
||||
:after all-the-icons
|
||||
:if *sys/gui*
|
||||
:diminish
|
||||
:custom-face
|
||||
(all-the-icons-dired-dir-face ((t `(:foreground ,(face-background 'default)))))
|
||||
:hook (dired-mode . all-the-icons-dired-mode)
|
||||
:config
|
||||
;; Workaround for all-the-icons bug until PR merged https://github.com/domtronn/all-the-icons.el/pull/150
|
||||
(when (require 'all-the-icons nil 'noerror)
|
||||
(setq all-the-icons-mode-icon-alist
|
||||
(delete '(erc-mode all-the-icons-faicon "commenting-o" :height 1.0 :v-adjust 0.0 :face all-the-icons-white) all-the-icons-mode-icon-alist))
|
||||
(add-to-list 'all-the-icons-mode-icon-alist '(erc-mode all-the-icons-faicon "commenting-o" :height 1.0 :v-adjust 0.0))))
|
||||
;; -ATIDiredPac
|
||||
|
||||
(provide 'init-all-the-icons)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-all-the-icons.el ends here
|
58
elisp/init-avy.el
Normal file
58
elisp/init-avy.el
Normal file
@ -0,0 +1,58 @@
|
||||
;;; init-avy.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-avy.el
|
||||
;; Description: Initialize Avy
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Thu Mar 14 11:12:49 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Thu Nov 7 05:55:40 2019 (-0500)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d avy
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes avy
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(require 'init-global-config))
|
||||
|
||||
;; AvyPac
|
||||
(use-package avy
|
||||
:defer t
|
||||
:bind
|
||||
(("C-z c" . avy-goto-char-timer)
|
||||
("C-z l" . avy-goto-line))
|
||||
:custom
|
||||
(avy-timeout-seconds 0.3)
|
||||
(avy-style 'pre)
|
||||
:custom-face
|
||||
(avy-lead-face ((t (:background "#51afef" :foreground "#870000" :weight bold)))));
|
||||
;; -AvyPac
|
||||
|
||||
(provide 'init-avy)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-avy.el ends here
|
82
elisp/init-cc.el
Normal file
82
elisp/init-cc.el
Normal file
@ -0,0 +1,82 @@
|
||||
;;; init-cc.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-cc.el
|
||||
;; Description: Initialize C family languages
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Fri Mar 15 10:58:29 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Thu Dec 26 02:07:34 2019 (-0500)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d c c++ go ccls
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initialize ccls modern-cpp-font-lock go-mode
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(require 'init-const))
|
||||
|
||||
;; CCLSPac
|
||||
(use-package ccls
|
||||
:defer t
|
||||
:if (not *sys/win32*)
|
||||
:hook ((c-mode c++-mode objc-mode) .
|
||||
(lambda () (require 'ccls) (lsp)))
|
||||
:custom
|
||||
(ccls-executable (executable-find "ccls")) ; Add ccls to path if you haven't done so
|
||||
(ccls-sem-highlight-method 'font-lock)
|
||||
(ccls-enable-skipped-ranges nil)
|
||||
:config
|
||||
(lsp-register-client
|
||||
(make-lsp-client
|
||||
:new-connection (lsp-tramp-connection (cons ccls-executable ccls-args))
|
||||
:major-modes '(c-mode c++-mode cuda-mode objc-mode)
|
||||
:server-id 'ccls-remote
|
||||
:multi-root nil
|
||||
:remote? t
|
||||
:notification-handlers
|
||||
(lsp-ht ("$ccls/publishSkippedRanges" #'ccls--publish-skipped-ranges)
|
||||
("$ccls/publishSemanticHighlight" #'ccls--publish-semantic-highlight))
|
||||
:initialization-options (lambda () ccls-initialization-options)
|
||||
:library-folders-fn nil)))
|
||||
;; -CCLSPac
|
||||
|
||||
;; CPPFontLockPac
|
||||
(use-package modern-cpp-font-lock
|
||||
:diminish t
|
||||
:init (modern-c++-font-lock-global-mode t))
|
||||
;; -CPPFontLockPac
|
||||
|
||||
;; GoPac
|
||||
(use-package go-mode
|
||||
:mode "\\.go\\'"
|
||||
:hook (before-save . gofmt-before-save))
|
||||
;; -GoPac
|
||||
|
||||
(provide 'init-cc)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-cc.el ends here
|
49
elisp/init-comment.el
Normal file
49
elisp/init-comment.el
Normal file
@ -0,0 +1,49 @@
|
||||
;;; init-comment.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-comment.el
|
||||
;; Description: Initialize Evil-Nerd-Commenter
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Fri Apr 5 00:21:58 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Wed Oct 16 16:44:25 2019 (-0400)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d evil-nerd-commenter
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes evil-nerd-commenter
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
;; EvilNerdCommenPac
|
||||
(use-package evil-nerd-commenter
|
||||
:bind
|
||||
(("C-c M-;" . c-toggle-comment-style)
|
||||
("M-;" . evilnc-comment-or-uncomment-lines)))
|
||||
;; -EvilNerdCommenPac
|
||||
|
||||
(provide 'init-comment)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-comment.el ends here
|
224
elisp/init-company.el
Normal file
224
elisp/init-company.el
Normal file
@ -0,0 +1,224 @@
|
||||
;;; init-company.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-company.el
|
||||
;; Description: Initialize Company
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Fri Mar 15 10:02:00 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Fri Dec 27 22:11:06 2019 (-0500)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d company company-tabnine
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes company
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(require 'init-const))
|
||||
|
||||
;; ComPac
|
||||
(use-package company
|
||||
:diminish company-mode
|
||||
:hook ((prog-mode LaTeX-mode latex-mode ess-r-mode) . company-mode)
|
||||
:bind
|
||||
(:map company-active-map
|
||||
([tab] . smarter-yas-expand-next-field-complete)
|
||||
("TAB" . smarter-yas-expand-next-field-complete))
|
||||
("M-/" . company-complete)
|
||||
:custom
|
||||
(company-minimum-prefix-length 1)
|
||||
(company-tooltip-align-annotations t)
|
||||
(company-begin-commands '(self-insert-command))
|
||||
(company-require-match 'never)
|
||||
;; Don't use company in the following modes
|
||||
(company-global-modes '(not shell-mode eaf-mode))
|
||||
;; Trigger completion immediately.
|
||||
(company-idle-delay 0.1)
|
||||
;; Number the candidates (use M-1, M-2 etc to select completions).
|
||||
(company-show-numbers t)
|
||||
:config
|
||||
(unless *clangd* (delete 'company-clang company-backends))
|
||||
(global-company-mode 1)
|
||||
(defun smarter-yas-expand-next-field-complete ()
|
||||
"Try to `yas-expand' and `yas-next-field' at current cursor position.
|
||||
|
||||
If failed try to complete the common part with `company-complete-common'"
|
||||
(interactive)
|
||||
(if yas-minor-mode
|
||||
(let ((old-point (point))
|
||||
(old-tick (buffer-chars-modified-tick)))
|
||||
(yas-expand)
|
||||
(when (and (eq old-point (point))
|
||||
(eq old-tick (buffer-chars-modified-tick)))
|
||||
(ignore-errors (yas-next-field))
|
||||
(when (and (eq old-point (point))
|
||||
(eq old-tick (buffer-chars-modified-tick)))
|
||||
(company-complete-common))))
|
||||
(company-complete-common))))
|
||||
;; -ComPac
|
||||
|
||||
;; CompanyLSPPac
|
||||
;; (use-package company-lsp
|
||||
;; :defer t
|
||||
;; :custom (company-lsp-cache-candidates 'auto))
|
||||
;; ;; -CompanyLSPPac
|
||||
|
||||
;; CompanyTabNinePac
|
||||
;; (use-package company-tabnine
|
||||
;; :defer 1
|
||||
;; :custom
|
||||
;; (company-tabnine-max-num-results 9)
|
||||
;; :bind
|
||||
;; (("M-q" . company-other-backend)
|
||||
;; ("C-z t" . company-tabnine))
|
||||
;; :hook
|
||||
;; (lsp-after-open . (lambda ()
|
||||
;; (setq company-tabnine-max-num-results 3)
|
||||
;; (add-to-list 'company-transformers 'company//sort-by-tabnine t)
|
||||
;; (add-to-list 'company-backends '(company-lsp :with company-tabnine :separate))))
|
||||
;; (kill-emacs . company-tabnine-kill-process)
|
||||
;; :config
|
||||
;; ;; Enable TabNine on default
|
||||
;; (add-to-list 'company-backends #'company-tabnine)
|
||||
|
||||
;; ;; Integrate company-tabnine with lsp-mode
|
||||
;; (defun company//sort-by-tabnine (candidates)
|
||||
;; (if (or (functionp company-backend)
|
||||
;; (not (and (listp company-backend) (memq 'company-tabnine company-backend))))
|
||||
;; candidates
|
||||
;; (let ((candidates-table (make-hash-table :test #'equal))
|
||||
;; candidates-lsp
|
||||
;; candidates-tabnine)
|
||||
;; (dolist (candidate candidates)
|
||||
;; (if (eq (get-text-property 0 'company-backend candidate)
|
||||
;; 'company-tabnine)
|
||||
;; (unless (gethash candidate candidates-table)
|
||||
;; (push candidate candidates-tabnine))
|
||||
;; (push candidate candidates-lsp)
|
||||
;; (puthash candidate t candidates-table)))
|
||||
;; (setq candidates-lsp (nreverse candidates-lsp))
|
||||
;; (setq candidates-tabnine (nreverse candidates-tabnine))
|
||||
;; (nconc (seq-take candidates-tabnine 3)
|
||||
;; (seq-take candidates-lsp 6))))))
|
||||
;; ;; -CompanyTabNinePac
|
||||
|
||||
;; CompanyBoxPac
|
||||
(use-package company-box
|
||||
:diminish
|
||||
:functions (my-company-box--make-line
|
||||
my-company-box-icons--elisp)
|
||||
:commands (company-box--get-color
|
||||
company-box--resolve-colors
|
||||
company-box--add-icon
|
||||
company-box--apply-color
|
||||
company-box--make-line
|
||||
company-box-icons--elisp)
|
||||
:hook (company-mode . company-box-mode)
|
||||
:custom
|
||||
(company-box-backends-colors nil)
|
||||
(company-box-show-single-candidate t)
|
||||
(company-box-max-candidates 50)
|
||||
(company-box-doc-delay 0.3)
|
||||
:config
|
||||
;; Support `company-common'
|
||||
(defun my-company-box--make-line (candidate)
|
||||
(-let* (((candidate annotation len-c len-a backend) candidate)
|
||||
(color (company-box--get-color backend))
|
||||
((c-color a-color i-color s-color) (company-box--resolve-colors color))
|
||||
(icon-string (and company-box--with-icons-p (company-box--add-icon candidate)))
|
||||
(candidate-string (concat (propertize (or company-common "") 'face 'company-tooltip-common)
|
||||
(substring (propertize candidate 'face 'company-box-candidate) (length company-common) nil)))
|
||||
(align-string (when annotation
|
||||
(concat " " (and company-tooltip-align-annotations
|
||||
(propertize " " 'display `(space :align-to (- right-fringe ,(or len-a 0) 1)))))))
|
||||
(space company-box--space)
|
||||
(icon-p company-box-enable-icon)
|
||||
(annotation-string (and annotation (propertize annotation 'face 'company-box-annotation)))
|
||||
(line (concat (unless (or (and (= space 2) icon-p) (= space 0))
|
||||
(propertize " " 'display `(space :width ,(if (or (= space 1) (not icon-p)) 1 0.75))))
|
||||
(company-box--apply-color icon-string i-color)
|
||||
(company-box--apply-color candidate-string c-color)
|
||||
align-string
|
||||
(company-box--apply-color annotation-string a-color)))
|
||||
(len (length line)))
|
||||
(add-text-properties 0 len (list 'company-box--len (+ len-c len-a)
|
||||
'company-box--color s-color)
|
||||
line)
|
||||
line))
|
||||
(advice-add #'company-box--make-line :override #'my-company-box--make-line)
|
||||
|
||||
;; Prettify icons
|
||||
(defun my-company-box-icons--elisp (candidate)
|
||||
(when (derived-mode-p 'emacs-lisp-mode)
|
||||
(let ((sym (intern candidate)))
|
||||
(cond ((fboundp sym) 'Function)
|
||||
((featurep sym) 'Module)
|
||||
((facep sym) 'Color)
|
||||
((boundp sym) 'Variable)
|
||||
((symbolp sym) 'Text)
|
||||
(t . nil)))))
|
||||
(advice-add #'company-box-icons--elisp :override #'my-company-box-icons--elisp)
|
||||
|
||||
(when (and *sys/gui*
|
||||
(require 'all-the-icons nil t))
|
||||
(declare-function all-the-icons-faicon 'all-the-icons)
|
||||
(declare-function all-the-icons-material 'all-the-icons)
|
||||
(declare-function all-the-icons-octicon 'all-the-icons)
|
||||
(setq company-box-icons-all-the-icons
|
||||
`((Unknown . ,(all-the-icons-material "find_in_page" :height 0.85 :v-adjust -0.2))
|
||||
(Text . ,(all-the-icons-faicon "text-width" :height 0.8 :v-adjust -0.05))
|
||||
(Method . ,(all-the-icons-faicon "cube" :height 0.8 :v-adjust -0.05 :face 'all-the-icons-purple))
|
||||
(Function . ,(all-the-icons-faicon "cube" :height 0.8 :v-adjust -0.05 :face 'all-the-icons-purple))
|
||||
(Constructor . ,(all-the-icons-faicon "cube" :height 0.8 :v-adjust -0.05 :face 'all-the-icons-purple))
|
||||
(Field . ,(all-the-icons-octicon "tag" :height 0.8 :v-adjust 0 :face 'all-the-icons-lblue))
|
||||
(Variable . ,(all-the-icons-octicon "tag" :height 0.8 :v-adjust 0 :face 'all-the-icons-lblue))
|
||||
(Class . ,(all-the-icons-material "settings_input_component" :height 0.85 :v-adjust -0.2 :face 'all-the-icons-orange))
|
||||
(Interface . ,(all-the-icons-material "share" :height 0.85 :v-adjust -0.2 :face 'all-the-icons-lblue))
|
||||
(Module . ,(all-the-icons-material "view_module" :height 0.85 :v-adjust -0.2 :face 'all-the-icons-lblue))
|
||||
(Property . ,(all-the-icons-faicon "wrench" :height 0.8 :v-adjust -0.05))
|
||||
(Unit . ,(all-the-icons-material "settings_system_daydream" :height 0.85 :v-adjust -0.2))
|
||||
(Value . ,(all-the-icons-material "format_align_right" :height 0.85 :v-adjust -0.2 :face 'all-the-icons-lblue))
|
||||
(Enum . ,(all-the-icons-material "storage" :height 0.85 :v-adjust -0.2 :face 'all-the-icons-orange))
|
||||
(Keyword . ,(all-the-icons-material "filter_center_focus" :height 0.85 :v-adjust -0.2))
|
||||
(Snippet . ,(all-the-icons-material "format_align_center" :height 0.85 :v-adjust -0.2))
|
||||
(Color . ,(all-the-icons-material "palette" :height 0.85 :v-adjust -0.2))
|
||||
(File . ,(all-the-icons-faicon "file-o" :height 0.85 :v-adjust -0.05))
|
||||
(Reference . ,(all-the-icons-material "collections_bookmark" :height 0.85 :v-adjust -0.2))
|
||||
(Folder . ,(all-the-icons-faicon "folder-open" :height 0.85 :v-adjust -0.05))
|
||||
(EnumMember . ,(all-the-icons-material "format_align_right" :height 0.85 :v-adjust -0.2 :face 'all-the-icons-lblue))
|
||||
(Constant . ,(all-the-icons-faicon "square-o" :height 0.85 :v-adjust -0.05))
|
||||
(Struct . ,(all-the-icons-material "settings_input_component" :height 0.85 :v-adjust -0.2 :face 'all-the-icons-orange))
|
||||
(Event . ,(all-the-icons-faicon "bolt" :height 0.8 :v-adjust -0.05 :face 'all-the-icons-orange))
|
||||
(Operator . ,(all-the-icons-material "control_point" :height 0.85 :v-adjust -0.2))
|
||||
(TypeParameter . ,(all-the-icons-faicon "arrows" :height 0.8 :v-adjust -0.05))
|
||||
(Template . ,(all-the-icons-material "format_align_center" :height 0.85 :v-adjust -0.2)))
|
||||
company-box-icons-alist 'company-box-icons-all-the-icons)))
|
||||
;; -CompanyBoxPac
|
||||
|
||||
(provide 'init-company)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-company.el ends here
|
112
elisp/init-const.el
Normal file
112
elisp/init-const.el
Normal file
@ -0,0 +1,112 @@
|
||||
;;; init-const.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-const.el
|
||||
;; Description: Initialize Constants
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Mon Mar 18 14:20:54 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Mon Dec 9 20:49:39 2019 (-0500)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d constants
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes constants
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
;; UserInfo
|
||||
(setq user-full-name "Mikaël Capelle")
|
||||
(setq user-mail-address "capelle.mikael@gmail.com")
|
||||
;; -UserInfo
|
||||
|
||||
;; Consts
|
||||
(defconst *sys/gui*
|
||||
(display-graphic-p)
|
||||
"Are we running on a GUI Emacs?")
|
||||
|
||||
(defconst *sys/win32*
|
||||
(eq system-type 'windows-nt)
|
||||
"Are we running on a WinTel system?")
|
||||
|
||||
(defconst *sys/linux*
|
||||
(eq system-type 'gnu/linux)
|
||||
"Are we running on a GNU/Linux system?")
|
||||
|
||||
(defconst *sys/mac*
|
||||
(eq system-type 'darwin)
|
||||
"Are we running on a Mac system?")
|
||||
|
||||
(defconst *sys/root*
|
||||
(string-equal "root" (getenv "USER"))
|
||||
"Are you a ROOT user?")
|
||||
|
||||
(defconst *rg*
|
||||
(executable-find "rg")
|
||||
"Do we have ripgrep?")
|
||||
|
||||
(defconst *python*
|
||||
(executable-find "python")
|
||||
"Do we have python?")
|
||||
|
||||
(defconst *python3*
|
||||
(executable-find "python3")
|
||||
"Do we have python3?")
|
||||
|
||||
(defconst *tr*
|
||||
(executable-find "tr")
|
||||
"Do we have tr?")
|
||||
|
||||
(defconst *mvn*
|
||||
(executable-find "mvn")
|
||||
"Do we have Maven?")
|
||||
|
||||
(defconst *clangd*
|
||||
(or (executable-find "clangd") ;; usually
|
||||
(executable-find "/usr/local/opt/llvm/bin/clangd")) ;; macOS
|
||||
"Do we have clangd?")
|
||||
|
||||
(defconst *gcc*
|
||||
(executable-find "gcc")
|
||||
"Do we have gcc?")
|
||||
|
||||
(defconst *git*
|
||||
(executable-find "git")
|
||||
"Do we have git?")
|
||||
|
||||
(defconst *pdflatex*
|
||||
(executable-find "pdflatex")
|
||||
"Do we have pdflatex?")
|
||||
|
||||
(defconst *eaf-env*
|
||||
(and *sys/linux* *sys/gui* *python3*
|
||||
(executable-find "pip")
|
||||
(not (equal (shell-command-to-string "pip freeze | grep '^PyQt\\|PyQtWebEngine'") "")))
|
||||
"Check basic requirements for EAF to run.")
|
||||
;; -Consts
|
||||
|
||||
(provide 'init-const)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-const.el ends here
|
56
elisp/init-crux.el
Normal file
56
elisp/init-crux.el
Normal file
@ -0,0 +1,56 @@
|
||||
;;; init-crux.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-crux.el
|
||||
;; Description: Initialize Crux
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Tue Dec 24 13:15:38 2019 (-0500)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Thu Dec 26 22:02:32 2019 (-0500)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d crux
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes Crux
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
;; CruxPac
|
||||
(use-package crux
|
||||
:bind
|
||||
(("C-a" . crux-move-beginning-of-line)
|
||||
("C-x 4 t" . crux-transpose-windows)
|
||||
("C-x K" . crux-kill-other-buffers)
|
||||
("C-k" . crux-smart-kill-line))
|
||||
:config
|
||||
(crux-with-region-or-buffer indent-region)
|
||||
(crux-with-region-or-buffer untabify)
|
||||
(crux-with-region-or-point-to-eol kill-ring-save)
|
||||
(defalias 'rename-file-and-buffer #'crux-rename-file-and-buffer))
|
||||
;; -CruxPac
|
||||
|
||||
(provide 'init-crux)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-crux.el ends here
|
91
elisp/init-dashboard.el
Normal file
91
elisp/init-dashboard.el
Normal file
@ -0,0 +1,91 @@
|
||||
;;; init-dashboard.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-dashboard.el
|
||||
;; Description: Initialize Dashboard
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Thu Mar 14 17:21:46 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Mon Dec 23 18:19:44 2019 (-0500)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d dashboard
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes dashboard
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
;; DashboardPac
|
||||
(use-package dashboard
|
||||
:demand
|
||||
:diminish (dashboard-mode page-break-lines-mode)
|
||||
:bind ("C-z d" . open-dashboard)
|
||||
:custom
|
||||
(dashboard-banner-logo-title "Close the world. Open the nExt.")
|
||||
(dashboard-startup-banner
|
||||
(expand-file-name "images/KEC_Dark_BK_Small.png" user-emacs-directory))
|
||||
(dashboard-items '((recents . 7)
|
||||
(bookmarks . 7)
|
||||
(agenda . 5)))
|
||||
(dashboard-set-heading-icons t)
|
||||
(dashboard-set-navigator t)
|
||||
(initial-buffer-choice (lambda () (get-buffer dashboard-buffer-name)))
|
||||
(dashboard-navigator-buttons
|
||||
(if (featurep 'all-the-icons)
|
||||
`(((,(all-the-icons-octicon "mark-github" :height 1.1 :v-adjust -0.05)
|
||||
"M-EMACS" "Browse M-EMACS Homepage"
|
||||
(lambda (&rest _) (browse-url "https://github.com/MatthewZMD/.emacs.d")))
|
||||
(,(all-the-icons-fileicon "elisp" :height 1.0 :v-adjust -0.1)
|
||||
"Configuration" "" (lambda (&rest _) (edit-configs)))))
|
||||
`((("" "M-EMACS" "Browse M-EMACS Homepage"
|
||||
(lambda (&rest _) (browse-url "https://github.com/MatthewZMD/.emacs.d")))
|
||||
("" "Configuration" "" (lambda (&rest _) (edit-configs)))))))
|
||||
:custom-face
|
||||
(dashboard-banner-logo-title ((t (:family "Love LetterTW" :height 123))))
|
||||
:config
|
||||
(dashboard-modify-heading-icons '((recents . "file-text")
|
||||
(bookmarks . "book")))
|
||||
(dashboard-setup-startup-hook)
|
||||
;; Open Dashboard function
|
||||
(defun open-dashboard ()
|
||||
"Open the *dashboard* buffer and jump to the first widget."
|
||||
(interactive)
|
||||
(if (get-buffer dashboard-buffer-name)
|
||||
(kill-buffer dashboard-buffer-name))
|
||||
(dashboard-insert-startupify-lists)
|
||||
(switch-to-buffer dashboard-buffer-name)
|
||||
(goto-char (point-min))
|
||||
(delete-other-windows)))
|
||||
;; -DashboardPac
|
||||
|
||||
;; PBLPac
|
||||
(use-package page-break-lines
|
||||
:diminish
|
||||
:init (global-page-break-lines-mode))
|
||||
;; -PBLPac
|
||||
|
||||
(provide 'init-dashboard)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-dashboard.el ends here
|
102
elisp/init-dired.el
Normal file
102
elisp/init-dired.el
Normal file
@ -0,0 +1,102 @@
|
||||
;;; init-dired.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-dired.el
|
||||
;; Description: Initialize Dired and Related Configurations
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Thu Mar 14 11:37:00 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Wed Dec 25 02:33:09 2019 (-0500)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d dired auto-save
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes dired, super-save, disk-usage
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
;; DiredPackage
|
||||
(use-package dired
|
||||
:ensure nil
|
||||
:bind
|
||||
(("C-x C-j" . dired-jump)
|
||||
("C-x j" . dired-jump-other-window))
|
||||
:custom
|
||||
;; Always delete and copy recursively
|
||||
(dired-recursive-deletes 'always)
|
||||
(dired-recursive-copies 'always)
|
||||
;; Auto refresh Dired, but be quiet about it
|
||||
(global-auto-revert-non-file-buffers t)
|
||||
(auto-revert-verbose nil)
|
||||
;; Quickly copy/move file in Dired
|
||||
(dired-dwim-target t)
|
||||
;; Move files to trash when deleting
|
||||
(delete-by-moving-to-trash t)
|
||||
;; Load the newest version of a file
|
||||
(load-prefer-newer t)
|
||||
;; Detect external file changes and auto refresh file
|
||||
(auto-revert-use-notify nil)
|
||||
(auto-revert-interval 3) ; Auto revert every 3 sec
|
||||
:config
|
||||
;; Enable global auto-revert
|
||||
(global-auto-revert-mode t)
|
||||
;; Reuse same dired buffer, to prevent numerous buffers while navigating in dired
|
||||
(put 'dired-find-alternate-file 'disabled nil)
|
||||
:hook
|
||||
(dired-mode . (lambda ()
|
||||
(local-set-key (kbd "<mouse-2>") #'dired-find-alternate-file)
|
||||
(local-set-key (kbd "RET") #'dired-find-alternate-file)
|
||||
(local-set-key (kbd "^")
|
||||
(lambda () (interactive) (find-alternate-file ".."))))))
|
||||
;; -DiredPackage
|
||||
|
||||
;; DiskUsage
|
||||
(use-package disk-usage
|
||||
:commands (disk-usage))
|
||||
;; -DiskUsage
|
||||
|
||||
;; SuperSave
|
||||
(use-package super-save
|
||||
:diminish
|
||||
:custom
|
||||
(super-save-auto-save-when-idle t)
|
||||
(auto-save-default nil)
|
||||
(make-backup-files nil)
|
||||
:config
|
||||
(super-save-mode 1))
|
||||
;; -SuperSave
|
||||
|
||||
;; SaveAllBuffers
|
||||
(defun save-all-buffers ()
|
||||
"Instead of `save-buffer', save all opened buffers by calling `save-some-buffers' with ARG t."
|
||||
(interactive)
|
||||
(save-some-buffers t))
|
||||
(global-set-key (kbd "C-x C-s") nil)
|
||||
(global-set-key (kbd "C-x C-s") #'save-all-buffers)
|
||||
;; -SaveAllBuffers
|
||||
|
||||
(provide 'init-dired)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-dired.el ends here
|
47
elisp/init-discover-my-major.el
Normal file
47
elisp/init-discover-my-major.el
Normal file
@ -0,0 +1,47 @@
|
||||
;;; init-discover-my-major.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-discover-my-major.el
|
||||
;; Description: Initialize Discover-My-Major
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Thu Mar 14 15:38:29 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Thu Aug 8 16:05:23 2019 (-0400)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d discover-my-major
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes discover-my-major
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
;; DiscMyMajor
|
||||
(use-package discover-my-major
|
||||
:bind ("C-h C-m" . discover-my-major))
|
||||
;; -DiscMyMajor
|
||||
|
||||
(provide 'init-discover-my-major)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-discover-my-major.el ends here
|
52
elisp/init-dumb-jump.el
Normal file
52
elisp/init-dumb-jump.el
Normal file
@ -0,0 +1,52 @@
|
||||
;;; init-dumb-jump.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-dumb-jump.el
|
||||
;; Description: Initialize Dumb Jump
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Fri Mar 15 10:11:21 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Sat Aug 24 22:07:00 2019 (+0000)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes dumb-jump
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
;; DumbJump
|
||||
(use-package dumb-jump
|
||||
:bind
|
||||
(:map prog-mode-map
|
||||
(("C-c C-o" . dumb-jump-go-other-window)
|
||||
("C-c C-j" . dumb-jump-go)
|
||||
("C-c C-i" . dumb-jump-go-prompt)))
|
||||
:custom (dumb-jump-selector 'ivy))
|
||||
;; -DumbJump
|
||||
|
||||
(provide 'init-dumb-jump)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-dumb-jump.el ends here
|
67
elisp/init-eaf.el
Normal file
67
elisp/init-eaf.el
Normal file
@ -0,0 +1,67 @@
|
||||
;;; init-eaf.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-eaf.el
|
||||
;; Description: Initialize Emacs Application Framework
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Tue Jun 4 00:26:09 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Fri Dec 27 22:07:41 2019 (-0500)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d pdf-tools
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes Emacs Application Framework
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(require 'init-const))
|
||||
|
||||
;; EAFPac
|
||||
(use-package eaf
|
||||
:load-path (lambda () (expand-file-name "site-elisp/emacs-application-framework" user-emacs-directory))
|
||||
:if *eaf-env*
|
||||
:custom
|
||||
(eaf-find-alternate-file-in-dired t)
|
||||
(browse-url-browser-function 'eaf-open-browser) ;; Make EAF Browser my default browser
|
||||
:config
|
||||
(defalias 'browse-web #'eaf-open-browser)
|
||||
;; I already bind "RET", "<mouse-2>", "^" to `dired-find-alternate-file' in `init-dired.el'.
|
||||
;; Comment this line out of you don't want to use EAF to open available files in dired.
|
||||
;; (global-set-key [remap dired-find-alternate-file] #'eaf-file-open-in-dired)
|
||||
(eaf-bind-key scroll_up "RET" eaf-pdf-viewer-keybinding)
|
||||
(eaf-bind-key scroll_down_page "DEL" eaf-pdf-viewer-keybinding)
|
||||
(eaf-bind-key scroll_down_page "u" eaf-pdf-viewer-keybinding)
|
||||
(eaf-bind-key scroll_up_page "d" eaf-pdf-viewer-keybinding)
|
||||
(eaf-bind-key scroll_to_end "M->" eaf-pdf-viewer-keybinding)
|
||||
(eaf-bind-key scroll_to_home "M-<" eaf-pdf-viewer-keybinding)
|
||||
(eaf-bind-key quit-window "q" eaf-pdf-viewer-keybinding)
|
||||
(eaf-bind-key take_photo "p" eaf-camera-keybinding))
|
||||
;; -EAFPac
|
||||
|
||||
(provide 'init-eaf)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-eaf.el ends here
|
73
elisp/init-edit.el
Normal file
73
elisp/init-edit.el
Normal file
@ -0,0 +1,73 @@
|
||||
;;; init-edit.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-edit.el
|
||||
;; Description: Initialize Editing Configuration
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Thu Mar 28 13:25:24 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Tue Dec 24 11:50:24 2019 (-0500)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d iedit
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes iedit, awesome-pair, delete-block
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
(eval-when-compile
|
||||
(require 'init-global-config))
|
||||
|
||||
;; IEditPac
|
||||
(use-package iedit
|
||||
:bind ("C-z ," . iedit-mode)
|
||||
:diminish)
|
||||
;; -IEditPac
|
||||
|
||||
;; AwesomePairPac
|
||||
(use-package awesome-pair
|
||||
:load-path (lambda () (expand-file-name "site-elisp/awesome-pair" user-emacs-directory))
|
||||
:bind
|
||||
(:map prog-mode-map
|
||||
(("M-D" . awesome-pair-kill)
|
||||
("SPC" . awesome-pair-space)
|
||||
("=" . awesome-pair-equal)
|
||||
("M-F" . awesome-pair-jump-right)
|
||||
("M-B" . awesome-pair-jump-left)))
|
||||
:hook (prog-mode . awesome-pair-mode))
|
||||
;; -AwesomePairPac
|
||||
|
||||
;; DeleteBlockPac
|
||||
(use-package delete-block
|
||||
:load-path (lambda () (expand-file-name "site-elisp/delete-block" user-emacs-directory))
|
||||
:bind
|
||||
(("M-d" . delete-block-forward)
|
||||
("C-<backspace>" . delete-block-backward)
|
||||
("M-<backspace>" . delete-block-backward)
|
||||
("M-DEL" . delete-block-backward)))
|
||||
;; -DeleteBlockPac
|
||||
|
||||
(provide 'init-edit)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-edit.el ends here
|
48
elisp/init-ein.el
Normal file
48
elisp/init-ein.el
Normal file
@ -0,0 +1,48 @@
|
||||
;;; init-ein.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-ein.el
|
||||
;; Description: Initialize Emacs IPython Notebook Client
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Thu Mar 21 14:04:50 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Thu Aug 8 16:05:40 2019 (-0400)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d ein jupyter
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes Jupyter (formerly IPython) client for Emacs
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
;; EINPac
|
||||
(use-package ein
|
||||
:disabled
|
||||
:defer t)
|
||||
;; -EINPac
|
||||
|
||||
(provide 'init-ein)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-ein.el ends here
|
58
elisp/init-epaint.el
Normal file
58
elisp/init-epaint.el
Normal file
@ -0,0 +1,58 @@
|
||||
;;; init-epaint.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-epaint.el
|
||||
;; Description: Initialize epaint
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Mon Sep 16 15:47:34 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Mon Sep 16 16:17:43 2019 (-0400)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d epaint
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes epaint
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(require 'init-const))
|
||||
|
||||
;; EPaintPac
|
||||
(use-package epaint
|
||||
:if *sys/gui*
|
||||
:load-path (lambda () (expand-file-name "site-elisp/epaint" user-emacs-directory))
|
||||
:commands (epaint)
|
||||
:init
|
||||
(with-eval-after-load (quote epaint-context)
|
||||
(unless (boundp (quote cl-struct-epaint-drawable))
|
||||
(defvar cl-struct-epaint-drawable (quote epaint-drawable)))
|
||||
(unless (boundp (quote cl-struct-epaint-gc))
|
||||
(defvar cl-struct-epaint-gc (quote epaint-gc)))))
|
||||
;; -EPaintPac
|
||||
|
||||
(provide 'init-epaint)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-epaint.el ends here
|
140
elisp/init-erc.el
Normal file
140
elisp/init-erc.el
Normal file
@ -0,0 +1,140 @@
|
||||
;;; init-erc.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-erc.el
|
||||
;; Description: Initialize ERC
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Tue Jul 30 22:15:50 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Wed Dec 4 01:57:57 2019 (-0500)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d erc irc
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes erc
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(require 'init-global-config)
|
||||
(require 'init-func))
|
||||
|
||||
;; ERCPac
|
||||
(use-package erc
|
||||
:ensure nil
|
||||
:init
|
||||
(use-package erc-hl-nicks :defer t)
|
||||
(use-package erc-image :defer t)
|
||||
:custom-face
|
||||
(erc-notice-face ((t (:foreground "#ababab"))))
|
||||
:custom
|
||||
(erc-autojoin-channels-alist '(("freenode.net" "#emacs")))
|
||||
(erc-track-exclude-types '("NICK" "PART" "MODE" "324" "329" "332" "333" "353" "477"))
|
||||
(erc-hide-list '("JOIN" "PART" "QUIT"))
|
||||
(erc-lurker-hide-list '("JOIN" "PART" "QUIT"))
|
||||
(erc-server-coding-system '(utf-8 . utf-8))
|
||||
(erc-interpret-mirc-color t)
|
||||
(erc-kill-buffer-on-part t)
|
||||
(erc-kill-queries-on-quit t)
|
||||
(erc-kill-server-buffer-on-quit t)
|
||||
(erc-autojoin-timing 'ident)
|
||||
(erc-fill-function 'erc-fill-static)
|
||||
(erc-fill-static-center 15)
|
||||
(erc-lurker-threshold-time 43200)
|
||||
(erc-server-reconnect-attempts 5)
|
||||
(erc-server-reconnect-timeout 3)
|
||||
(erc-prompt-for-password nil)
|
||||
(erc-prompt-for-nickserv-password nil)
|
||||
:config
|
||||
;; Prerequisite: Configure this to your IRC nickname
|
||||
(defvar erc-nick ""
|
||||
"The nickname used to login into ERC")
|
||||
(add-to-list 'erc-modules 'notifications)
|
||||
(erc-track-mode t)
|
||||
(erc-services-mode 1)
|
||||
(defun erc-start-or-switch ()
|
||||
"Start ERC or switch to ERC buffer if it has started already."
|
||||
(interactive)
|
||||
(if (get-buffer "irc.freenode.net:6697")
|
||||
(erc-track-switch-buffer 1)
|
||||
(erc-tls :server "irc.freenode.net" :port 6697 :nick erc-nick)))
|
||||
|
||||
(defun erc-count-users ()
|
||||
"Displays the number of users and ops connected on the current channel."
|
||||
(interactive)
|
||||
(if (get-buffer "irc.freenode.net:6697")
|
||||
(let ((channel (erc-default-target)))
|
||||
(if (and channel (erc-channel-p channel))
|
||||
(let ((hash-table (with-current-buffer (erc-server-buffer)
|
||||
erc-server-users))
|
||||
(users 0)
|
||||
(ops 0))
|
||||
(maphash (lambda (k v)
|
||||
(when (member (current-buffer)
|
||||
(erc-server-user-buffers v))
|
||||
(cl-incf users))
|
||||
(when (erc-channel-user-op-p k)
|
||||
(cl-incf ops)))
|
||||
hash-table)
|
||||
(message "%d users (%s ops) are online on %s" users ops channel))
|
||||
(user-error "The current buffer is not a channel")))
|
||||
(user-error "You must first be connected on IRC")))
|
||||
|
||||
(defun erc-get-ops ()
|
||||
"Displays the names of ops users on the current channel."
|
||||
(interactive)
|
||||
(if (get-buffer "irc.freenode.net:6697")
|
||||
(let ((channel (erc-default-target)))
|
||||
(if (and channel (erc-channel-p channel))
|
||||
(let (ops)
|
||||
(maphash (lambda (nick cdata)
|
||||
(if (and (cdr cdata)
|
||||
(erc-channel-user-op (cdr cdata)))
|
||||
(setq ops (cons nick ops))))
|
||||
erc-channel-users)
|
||||
(if ops
|
||||
(message "The online ops users are: %s" (mapconcat 'identity ops " "))
|
||||
(message "There are no ops users online on %s" channel)))
|
||||
(user-error "The current buffer is not a channel")))
|
||||
(user-error "You must first be connected on IRC")))
|
||||
|
||||
(defun erc-notify (nickname message)
|
||||
"Displays a notification message for ERC."
|
||||
(let* ((channel (buffer-name))
|
||||
(nick (erc-hl-nicks-trim-irc-nick nickname))
|
||||
(title (if (string-match-p (concat "^" nickname) channel)
|
||||
nick
|
||||
(concat nick " (" channel ")")))
|
||||
(msg (s-trim (s-collapse-whitespace message))))
|
||||
(alert (concat nick ": " msg) :title title)))
|
||||
:bind
|
||||
("M-z i" . erc-start-or-switch)
|
||||
:hook
|
||||
(ercn-notify . erc-notify))
|
||||
;; -ERCPac
|
||||
|
||||
(provide 'init-erc)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-erc.el ends here
|
50
elisp/init-ess.el
Normal file
50
elisp/init-ess.el
Normal file
@ -0,0 +1,50 @@
|
||||
;;; init-ess.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-ess.el
|
||||
;; Description: Initialize ESS
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Tue Sep 3 21:28:26 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Wed Sep 4 00:27:58 2019 (-0400)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d ess
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initialies ESS
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
;; ESSPac
|
||||
(use-package ess
|
||||
:defer t
|
||||
:commands R
|
||||
:config
|
||||
(load "ess-autoloads"))
|
||||
;; -ESSPac
|
||||
|
||||
(provide 'init-ess)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-ess.el ends here
|
58
elisp/init-eww.el
Normal file
58
elisp/init-eww.el
Normal file
@ -0,0 +1,58 @@
|
||||
;;; init-eww.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-eww.el
|
||||
;; Description: Configure Eww
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Fri Mar 15 11:13:42 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Tue Dec 24 12:18:07 2019 (-0500)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d eww
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes eww
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(require 'init-const))
|
||||
|
||||
;; EWWPac
|
||||
(use-package eww
|
||||
:ensure nil
|
||||
:commands (eww)
|
||||
:hook (eww-mode . (lambda ()
|
||||
"Rename EWW's buffer so sites open in new page."
|
||||
(rename-buffer "eww" t)))
|
||||
:config
|
||||
;; I am using EAF-Browser instead of EWW
|
||||
(unless *eaf-env*
|
||||
(setq browse-url-browser-function 'eww-browse-url))) ; Hit & to browse url with system browser
|
||||
;; -EWWPac
|
||||
|
||||
(provide 'init-eww)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-eww.el ends here
|
64
elisp/init-flycheck.el
Normal file
64
elisp/init-flycheck.el
Normal file
@ -0,0 +1,64 @@
|
||||
;;; init-flycheck.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-flycheck.el
|
||||
;; Description: Initialize Flycheck
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Fri Mar 15 10:08:22 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Thu Aug 8 16:05:47 2019 (-0400)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d flycheck
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes flycheck
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
;; FlyCheckPac
|
||||
(use-package flycheck
|
||||
:defer t
|
||||
:hook (prog-mode . flycheck-mode)
|
||||
:custom
|
||||
(flycheck-emacs-lisp-load-path 'inherit)
|
||||
:config
|
||||
(add-hook 'flycheck-after-syntax-check-hook 'flycheck-autolist-hook)
|
||||
(flycheck-add-mode 'javascript-eslint 'js-mode)
|
||||
(flycheck-add-mode 'typescript-tslint 'rjsx-mode))
|
||||
;; -FlyCheckPac
|
||||
|
||||
(use-package flycheck-pos-tip
|
||||
:after (flycheck)
|
||||
:config
|
||||
(add-hook 'flycheck-mode-hook 'flycheck-pos-tip-mode))
|
||||
|
||||
(use-package flycheck-color-mode-line
|
||||
:after (flycheck)
|
||||
:config
|
||||
(add-hook 'flycheck-mode-hook 'flycheck-color-mode-line-mode))
|
||||
|
||||
(provide 'init-flycheck)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-flycheck.el ends here
|
84
elisp/init-fonts.el
Normal file
84
elisp/init-fonts.el
Normal file
@ -0,0 +1,84 @@
|
||||
;;; init-fonts.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-fonts.el
|
||||
;; Description: Initialize Fonts
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Thu Mar 14 17:32:54 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: lun. janv. 13 10:50:18 2020 (+0100)
|
||||
;; By: Mikaël Capelle
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d fonts
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes fonts
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(require 'init-const))
|
||||
|
||||
;; FontsList
|
||||
;; Input Mono, Monaco Style, Line Height 1.3 download
|
||||
;; from http://input.fontbureau.com/
|
||||
(defvar font-list '(
|
||||
("Fira Mono for Powerline" . 11)
|
||||
("Fira Mono" . 11)
|
||||
("Input" . 11)
|
||||
("SF Mono" . 12)
|
||||
("Consolas" . 12) ("Love LetterTW" . 12.5))
|
||||
"List of fonts and sizes. The first one available will be used.")
|
||||
;; -FontsList
|
||||
|
||||
;; FontFun
|
||||
(defun change-font ()
|
||||
"Documentation."
|
||||
(interactive)
|
||||
(let* (available-fonts font-name font-size font-setting)
|
||||
(dolist (font font-list (setq available-fonts (nreverse available-fonts)))
|
||||
(when (member (car font) (font-family-list))
|
||||
(push font available-fonts)))
|
||||
(if (not available-fonts)
|
||||
(message "No fonts from the chosen set are available")
|
||||
(if (called-interactively-p 'interactive)
|
||||
(let* ((chosen
|
||||
(assoc-string
|
||||
(completing-read "What font to use? " available-fonts nil t)
|
||||
available-fonts)))
|
||||
(setq font-name (car chosen)
|
||||
font-size (read-number "Font size: " (cdr chosen))))
|
||||
(setq font-name (caar available-fonts)
|
||||
font-size (cdar available-fonts)))
|
||||
(setq font-setting (format "%s-%d" font-name font-size))
|
||||
(set-frame-font font-setting nil t)
|
||||
(add-to-list 'default-frame-alist (cons 'font font-setting)))))
|
||||
|
||||
(when *sys/gui*
|
||||
(change-font))
|
||||
;; -FontFun
|
||||
|
||||
(provide 'init-fonts)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-fonts.el ends here
|
47
elisp/init-format.el
Normal file
47
elisp/init-format.el
Normal file
@ -0,0 +1,47 @@
|
||||
;;; init-format.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-format.el
|
||||
;; Description: Initialize Formatter
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Fri Mar 15 10:27:40 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Thu Aug 8 16:05:52 2019 (-0400)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d format-all
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes format-all
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
;; FormatAllPac
|
||||
(use-package format-all
|
||||
:bind ("C-c C-f" . format-all-buffer))
|
||||
;; -FormatAllPac
|
||||
|
||||
(provide 'init-format)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-format.el ends here
|
184
elisp/init-func.el
Normal file
184
elisp/init-func.el
Normal file
@ -0,0 +1,184 @@
|
||||
;;; init-func.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-func.el
|
||||
;; Description: Initialize Functions
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Sun Jun 9 17:53:44 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Fri Dec 27 01:02:58 2019 (-0500)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This file initializes functions
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(require 'init-global-config))
|
||||
|
||||
;; ResizeWidthHeight
|
||||
;; Resizes the window width based on the input
|
||||
(defun resize-window-width (w)
|
||||
"Resizes the window width based on W."
|
||||
(interactive (list (if (> (count-windows) 1)
|
||||
(read-number "Set the current window width in [1~9]x10%: ")
|
||||
(error "You need more than 1 window to execute this function!"))))
|
||||
(message "%s" w)
|
||||
(window-resize nil (- (truncate (* (/ w 10.0) (frame-width))) (window-total-width)) t))
|
||||
|
||||
;; Resizes the window height based on the input
|
||||
(defun resize-window-height (h)
|
||||
"Resizes the window height based on H."
|
||||
(interactive (list (if (> (count-windows) 1)
|
||||
(read-number "Set the current window height in [1~9]x10%: ")
|
||||
(error "You need more than 1 window to execute this function!"))))
|
||||
(message "%s" h)
|
||||
(window-resize nil (- (truncate (* (/ h 10.0) (frame-height))) (window-total-height)) nil))
|
||||
|
||||
;; Setup shorcuts for window resize width and height
|
||||
(global-set-key (kbd "C-z w") #'resize-window-width)
|
||||
(global-set-key (kbd "C-z h") #'resize-window-height)
|
||||
|
||||
(defun resize-window (width delta)
|
||||
"Resize the current window's size. If WIDTH is non-nil, resize width by some DELTA."
|
||||
(if (> (count-windows) 1)
|
||||
(window-resize nil delta width)
|
||||
(error "You need more than 1 window to execute this function!")))
|
||||
|
||||
;; Setup shorcuts for window resize width and height
|
||||
(global-set-key (kbd "M-W =") (lambda () (interactive) (resize-window t 5)))
|
||||
(global-set-key (kbd "M-W M-+") (lambda () (interactive) (resize-window t 5)))
|
||||
(global-set-key (kbd "M-W -") (lambda () (interactive) (resize-window t -5)))
|
||||
(global-set-key (kbd "M-W M-_") (lambda () (interactive) (resize-window t -5)))
|
||||
|
||||
(global-set-key (kbd "M-H =") (lambda () (interactive) (resize-window nil 5)))
|
||||
(global-set-key (kbd "M-H M-+") (lambda () (interactive) (resize-window nil 5)))
|
||||
(global-set-key (kbd "M-H -") (lambda () (interactive) (resize-window nil -5)))
|
||||
(global-set-key (kbd "M-H M-_") (lambda () (interactive) (resize-window nil -5)))
|
||||
;; -ResizeWidthheight
|
||||
|
||||
;; EditConfig
|
||||
(defun edit-configs ()
|
||||
"Opens the README.org file."
|
||||
(interactive)
|
||||
(find-file "~/.emacs.d/init.org"))
|
||||
|
||||
(global-set-key (kbd "C-z e") #'edit-configs)
|
||||
;; -EditConfig
|
||||
|
||||
;; OrgIncludeAuto
|
||||
(defun save-and-update-includes ()
|
||||
"Update the line numbers of #+INCLUDE:s in current buffer.
|
||||
Only looks at INCLUDEs that have either :range-begin or :range-end.
|
||||
This function does nothing if not in `org-mode', so you can safely
|
||||
add it to `before-save-hook'."
|
||||
(interactive)
|
||||
(when (derived-mode-p 'org-mode)
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(while (search-forward-regexp
|
||||
"^\\s-*#\\+INCLUDE: *\"\\([^\"]+\\)\".*:range-\\(begin\\|end\\)"
|
||||
nil 'noerror)
|
||||
(let* ((file (expand-file-name (match-string-no-properties 1)))
|
||||
lines begin end)
|
||||
(forward-line 0)
|
||||
(when (looking-at "^.*:range-begin *\"\\([^\"]+\\)\"")
|
||||
(setq begin (match-string-no-properties 1)))
|
||||
(when (looking-at "^.*:range-end *\"\\([^\"]+\\)\"")
|
||||
(setq end (match-string-no-properties 1)))
|
||||
(setq lines (decide-line-range file begin end))
|
||||
(when lines
|
||||
(if (looking-at ".*:lines *\"\\([-0-9]+\\)\"")
|
||||
(replace-match lines :fixedcase :literal nil 1)
|
||||
(goto-char (line-end-position))
|
||||
(insert " :lines \"" lines "\""))))))))
|
||||
|
||||
(add-hook 'before-save-hook #'save-and-update-includes)
|
||||
|
||||
(defun decide-line-range (file begin end)
|
||||
"Visit FILE and decide which lines to include.
|
||||
BEGIN and END are regexps which define the line range to use."
|
||||
(let (l r)
|
||||
(save-match-data
|
||||
(with-temp-buffer
|
||||
(insert-file-contents file)
|
||||
(goto-char (point-min))
|
||||
(if (null begin)
|
||||
(setq l "")
|
||||
(search-forward-regexp begin)
|
||||
(setq l (line-number-at-pos (match-beginning 0))))
|
||||
(if (null end)
|
||||
(setq r "")
|
||||
(search-forward-regexp end)
|
||||
(setq r (1+ (line-number-at-pos (match-end 0)))))
|
||||
(format "%s-%s" (+ l 1) (- r 1)))))) ;; Exclude wrapper
|
||||
;; -OrgIncludeAuto
|
||||
|
||||
;; BetterMiniBuffer
|
||||
(defun abort-minibuffer-using-mouse ()
|
||||
"Abort the minibuffer when using the mouse."
|
||||
(when (and (>= (recursion-depth) 1) (active-minibuffer-window))
|
||||
(abort-recursive-edit)))
|
||||
|
||||
(add-hook 'mouse-leave-buffer-hook 'abort-minibuffer-using-mouse)
|
||||
|
||||
;; keep the point out of the minibuffer
|
||||
(setq-default minibuffer-prompt-properties '(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt))
|
||||
;; -BetterMiniBuffer
|
||||
|
||||
;; DisplayLineOverlay
|
||||
(defun display-line-overlay+ (pos str &optional face)
|
||||
"Display line at POS as STR with FACE.
|
||||
|
||||
FACE defaults to inheriting from default and highlight."
|
||||
(let ((ol (save-excursion
|
||||
(goto-char pos)
|
||||
(make-overlay (line-beginning-position)
|
||||
(line-end-position)))))
|
||||
(overlay-put ol 'display str)
|
||||
(overlay-put ol 'face
|
||||
(or face '(:background null :inherit highlight)))
|
||||
ol))
|
||||
;; -DisplayLineOverlay
|
||||
|
||||
;; ReadLines
|
||||
(defun read-lines (filePath)
|
||||
"Return a list of lines of a file at FILEPATH."
|
||||
(with-temp-buffer (insert-file-contents filePath)
|
||||
(split-string (buffer-string) "\n" t)))
|
||||
;; -ReadLines
|
||||
|
||||
;; WhereAmI
|
||||
(defun where-am-i ()
|
||||
"An interactive function showing function `buffer-file-name' or `buffer-name'."
|
||||
(interactive)
|
||||
(message (kill-new (if (buffer-file-name) (buffer-file-name) (buffer-name)))))
|
||||
;; -WhereAmI
|
||||
|
||||
(provide 'init-func)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-func.el ends here
|
68
elisp/init-games.el
Normal file
68
elisp/init-games.el
Normal file
@ -0,0 +1,68 @@
|
||||
;;; init-games.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-games.el
|
||||
;; Description: Initialize Games
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Fri Mar 15 11:16:53 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Thu Dec 26 02:55:21 2019 (-0500)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d tetris speed-type 2048
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes tetris, speed-type, 2048
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
;; TetrisConfig
|
||||
(use-package tetris
|
||||
:ensure nil
|
||||
:commands (tetris)
|
||||
:bind
|
||||
(:map tetris-mode-map
|
||||
("C-p" . tetris-rotate-prev)
|
||||
("C-n" . tetris-rotate-down)
|
||||
("C-b" . tetris-move-left)
|
||||
("C-f" . tetris-move-right)
|
||||
("C-SPC" . tetris-move-bottom))
|
||||
:config
|
||||
(defadvice tetris-end-game (around zap-scores activate)
|
||||
(save-window-excursion ad-do-it)))
|
||||
;; -TetrisConfig
|
||||
|
||||
;; SpeedTypePac
|
||||
(use-package speed-type
|
||||
:commands (speed-type-text))
|
||||
;; -SpeedTypePac
|
||||
|
||||
;; 2048Pac
|
||||
(use-package 2048-game
|
||||
:commands (2048-game))
|
||||
;; -2048Pac
|
||||
|
||||
(provide 'init-games)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-games.el ends here
|
176
elisp/init-global-config.el
Normal file
176
elisp/init-global-config.el
Normal file
@ -0,0 +1,176 @@
|
||||
;;; init-global-config.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-global-config.el
|
||||
;; Description: Initialize Global Configurations
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Thu Mar 14 14:01:54 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Wed Dec 25 03:02:50 2019 (-0500)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This file initializes global configurations
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(require 'init-const))
|
||||
|
||||
;; SudoEditPac
|
||||
(use-package sudo-edit
|
||||
:commands (sudo-edit))
|
||||
;; -SudoEditPac
|
||||
|
||||
;; DefBindings
|
||||
;; Unbind unneeded keys
|
||||
(global-set-key (kbd "C-z") nil)
|
||||
(global-set-key (kbd "M-z") nil)
|
||||
(global-set-key (kbd "C-x C-z") nil)
|
||||
(global-set-key (kbd "M-/") nil)
|
||||
;; Use iBuffer instead of Buffer List
|
||||
(global-set-key (kbd "C-x C-b") #'ibuffer)
|
||||
;; Truncate lines
|
||||
(global-set-key (kbd "C-x C-l") #'toggle-truncate-lines)
|
||||
;; Adjust font size like web browsers
|
||||
(global-set-key (kbd "C-+") #'text-scale-increase)
|
||||
(global-set-key (kbd "C--") #'text-scale-decrease)
|
||||
;; Move up/down paragraph
|
||||
(global-set-key (kbd "M-n") #'forward-paragraph)
|
||||
(global-set-key (kbd "M-p") #'backward-paragraph)
|
||||
;; -DefBindings
|
||||
|
||||
;; UTF8Coding
|
||||
(unless *sys/win32*
|
||||
(set-selection-coding-system 'utf-8)
|
||||
(prefer-coding-system 'utf-8)
|
||||
(set-language-environment "UTF-8")
|
||||
(set-default-coding-systems 'utf-8)
|
||||
(set-terminal-coding-system 'utf-8)
|
||||
(set-keyboard-coding-system 'utf-8)
|
||||
(setq locale-coding-system 'utf-8))
|
||||
;; Treat clipboard input as UTF-8 string first; compound text next, etc.
|
||||
(when *sys/gui*
|
||||
(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)))
|
||||
;; -UTF8Coding
|
||||
|
||||
;; EditExp
|
||||
;; Remove useless whitespace before saving a file
|
||||
(defun delete-trailing-whitespace-except-current-line ()
|
||||
"Sometimes `delete-trailing-whitespace' becomes very annoying.
|
||||
It deletes trailing whitespace current line. Therefore I use this alternative."
|
||||
(interactive)
|
||||
(let ((begin (line-beginning-position))
|
||||
(end (line-end-position)))
|
||||
(save-excursion
|
||||
(when (< (point-min) begin)
|
||||
(save-restriction
|
||||
(narrow-to-region (point-min) (1- begin))
|
||||
(delete-trailing-whitespace)
|
||||
(widen)))
|
||||
(when (> (point-max) end)
|
||||
(save-restriction
|
||||
(narrow-to-region (+ end 2) (point-max))
|
||||
(delete-trailing-whitespace)
|
||||
(widen))))))
|
||||
(add-hook 'before-save-hook #'delete-trailing-whitespace-except-current-line)
|
||||
|
||||
;; Replace selection on insert
|
||||
(delete-selection-mode 1)
|
||||
|
||||
;; Map Alt key to Meta
|
||||
(setq x-alt-keysym 'meta)
|
||||
;; -EditExp
|
||||
|
||||
;; History
|
||||
(use-package recentf
|
||||
:ensure nil
|
||||
:hook (after-init . recentf-mode)
|
||||
:custom
|
||||
(recentf-auto-cleanup "05:00am")
|
||||
(recentf-max-saved-items 200)
|
||||
(recentf-exclude '((expand-file-name package-user-dir)
|
||||
".cache"
|
||||
".cask"
|
||||
".elfeed"
|
||||
"bookmarks"
|
||||
"cache"
|
||||
"ido.*"
|
||||
"persp-confs"
|
||||
"recentf"
|
||||
"undo-tree-hist"
|
||||
"url"
|
||||
"COMMIT_EDITMSG\\'")))
|
||||
|
||||
;; When buffer is closed, saves the cursor location
|
||||
(save-place-mode 1)
|
||||
|
||||
;; Set history-length longer
|
||||
(setq-default history-length 500)
|
||||
;; -History
|
||||
|
||||
;; SmallConfigs
|
||||
;; Turn Off Cursor Alarms
|
||||
(setq ring-bell-function 'ignore)
|
||||
|
||||
;; Show Keystrokes in Progress Instantly
|
||||
(setq echo-keystrokes 0.1)
|
||||
|
||||
;; Don't Lock Files
|
||||
(setq-default create-lockfiles nil)
|
||||
|
||||
;; Better Compilation
|
||||
(setq-default compilation-always-kill t) ; kill compilation process before starting another
|
||||
|
||||
(setq-default compilation-ask-about-save nil) ; save all buffers on `compile'
|
||||
|
||||
(setq-default compilation-scroll-output t)
|
||||
|
||||
;; ad-handle-definition warnings are generated when functions are redefined with `defadvice',
|
||||
;; they are not helpful.
|
||||
(setq ad-redefinition-action 'accept)
|
||||
|
||||
;; Move Custom-Set-Variables to Different File
|
||||
(setq custom-file (concat user-emacs-directory "custom-set-variables.el"))
|
||||
(load custom-file 'noerror)
|
||||
|
||||
;; So Long mitigates slowness due to extremely long lines.
|
||||
;; Currently available in Emacs master branch *only*!
|
||||
(when (fboundp 'global-so-long-mode)
|
||||
(global-so-long-mode))
|
||||
|
||||
;; Add a newline automatically at the end of the file upon save.
|
||||
(setq require-final-newline t)
|
||||
|
||||
;; Default .args, .in, .out files to text-mode
|
||||
(add-to-list 'auto-mode-alist '("\\.in\\'" . text-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.out\\'" . text-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.args\\'" . text-mode))
|
||||
;; -SmallConfigs
|
||||
|
||||
(provide 'init-global-config)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-global-config.el ends here
|
54
elisp/init-header.el
Normal file
54
elisp/init-header.el
Normal file
@ -0,0 +1,54 @@
|
||||
;;; init-header.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-header.el
|
||||
;; Description: Initialize Header2
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Fri Mar 15 10:32:02 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Tue Dec 24 11:54:28 2019 (-0500)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d header2
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes header2
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
;; Header2Pac
|
||||
(use-package header2
|
||||
:load-path (lambda () (expand-file-name "site-elisp/header2" user-emacs-directory))
|
||||
:custom
|
||||
(header-copyright-notice (concat "Copyright (C) 2019 " (user-full-name) "\n"))
|
||||
:hook (emacs-lisp-mode . auto-make-header)
|
||||
:config
|
||||
(add-to-list 'write-file-functions 'auto-update-file-header)
|
||||
(autoload 'auto-make-header "header2")
|
||||
(autoload 'auto-update-file-header "header2"))
|
||||
;; -Header2Pac
|
||||
|
||||
(provide 'init-header)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-header.el ends here
|
75
elisp/init-indent.el
Normal file
75
elisp/init-indent.el
Normal file
@ -0,0 +1,75 @@
|
||||
;;; init-indent.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-indent.el
|
||||
;; Description: Initialize Indentation
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Fri Mar 15 10:29:56 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Tue Dec 3 21:41:41 2019 (-0500)
|
||||
;; By: User Account1
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d highlight-indent-guides indentation
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes highlight-indent-guides
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(require 'init-const))
|
||||
|
||||
;; HighLightIndentPac
|
||||
(use-package highlight-indent-guides
|
||||
:if *sys/gui*
|
||||
:diminish
|
||||
:hook ((prog-mode web-mode nxml-mode) . highlight-indent-guides-mode)
|
||||
:custom
|
||||
(highlight-indent-guides-method 'character)
|
||||
(highlight-indent-guides-responsive 'top)
|
||||
(highlight-indent-guides-delay 0)
|
||||
(highlight-indent-guides-auto-character-face-perc 7))
|
||||
;; -HighLightIndentPac
|
||||
|
||||
;; IndentConfig
|
||||
(setq-default indent-tabs-mode nil)
|
||||
(setq-default indent-line-function 'insert-tab)
|
||||
(setq-default tab-width 4)
|
||||
(setq-default c-basic-offset 4)
|
||||
(setq-default js-switch-indent-offset 4)
|
||||
(c-set-offset 'comment-intro 0)
|
||||
(c-set-offset 'innamespace 0)
|
||||
(c-set-offset 'case-label '+)
|
||||
(c-set-offset 'access-label 0)
|
||||
(c-set-offset (quote cpp-macro) 0 nil)
|
||||
(add-hook 'after-change-major-mode-hook
|
||||
(lambda () (if (equal electric-indent-mode 't)
|
||||
(when (derived-mode-p 'text-mode)
|
||||
(electric-indent-mode -1))
|
||||
(electric-indent-mode 1))))
|
||||
;; -IndentConfig
|
||||
|
||||
(provide 'init-indent)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-indent.el ends here
|
56
elisp/init-java.el
Normal file
56
elisp/init-java.el
Normal file
@ -0,0 +1,56 @@
|
||||
;;; init-java.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-java.el
|
||||
;; Description: Initialize lsp-java java-one-click-run
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Thu Jul 4 21:26:24 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Thu Aug 8 16:06:55 2019 (-0400)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d lsp-java java-one-click-run
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes lsp-java and java-one-click-run
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(require 'init-const))
|
||||
|
||||
;; LSPJavaPac
|
||||
(use-package lsp-java
|
||||
:after lsp-mode
|
||||
:if *mvn*
|
||||
:config
|
||||
(use-package request :defer t)
|
||||
:custom
|
||||
(lsp-java-server-install-dir (expand-file-name "~/.emacs.d/eclipse.jdt.ls/server/"))
|
||||
(lsp-java-workspace-dir (expand-file-name "~/.emacs.d/eclipse.jdt.ls/workspace/")))
|
||||
;; -LSPJavaPac
|
||||
|
||||
(provide 'init-java)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-java.el ends here
|
79
elisp/init-latex.el
Normal file
79
elisp/init-latex.el
Normal file
@ -0,0 +1,79 @@
|
||||
;;; init-latex.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-latex.el
|
||||
;; Description: Initialize AUCTex
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Wed Sep 4 16:35:00 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Tue Dec 24 12:00:08 2019 (-0500)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d auctex
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes AUCTex
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(require 'init-const)
|
||||
(require 'init-global-config)
|
||||
(require 'init-func))
|
||||
|
||||
;; AUCTeXPac
|
||||
(use-package tex
|
||||
:ensure auctex
|
||||
:defer t
|
||||
:custom
|
||||
(TeX-auto-save t)
|
||||
(TeX-parse-self t)
|
||||
(TeX-master nil)
|
||||
;; to use pdfview with auctex
|
||||
(TeX-view-program-selection '((output-pdf "pdf-tools"))
|
||||
TeX-source-correlate-start-server t)
|
||||
(TeX-view-program-list '(("pdf-tools" "TeX-pdf-tools-sync-view")))
|
||||
(TeX-after-compilation-finished-functions #'TeX-revert-document-buffer)
|
||||
:hook
|
||||
(LaTeX-mode . (lambda ()
|
||||
(turn-on-reftex)
|
||||
(setq reftex-plug-into-AUCTeX t)
|
||||
(reftex-isearch-minor-mode)
|
||||
(setq TeX-PDF-mode t)
|
||||
(setq TeX-source-correlate-method 'synctex)
|
||||
(setq TeX-source-correlate-start-server t)))
|
||||
:config
|
||||
(when (version< emacs-version "26")
|
||||
(add-hook LaTeX-mode-hook #'display-line-numbers-mode)))
|
||||
;; -AUCTeXPac
|
||||
|
||||
;; OrgLatexPac
|
||||
(use-package org-edit-latex
|
||||
:defer t
|
||||
:after org)
|
||||
;; -OrgLatexPac
|
||||
|
||||
(provide 'init-latex)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-latex.el ends here
|
57
elisp/init-leetcode.el
Normal file
57
elisp/init-leetcode.el
Normal file
@ -0,0 +1,57 @@
|
||||
;;; init-leetcode.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-leetcode.el
|
||||
;; Description: Initialize LeetCode Client
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Thu Apr 11 22:28:41 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Sat Sep 7 00:52:17 2019 (-0400)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d leetcode
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes a LeetCode client
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(require 'init-const))
|
||||
|
||||
;; LeetCodePac
|
||||
(use-package leetcode
|
||||
:load-path (lambda () (expand-file-name "site-elisp/leetcode.el" user-emacs-directory))
|
||||
:commands (leetcode)
|
||||
:init
|
||||
(use-package graphql :defer t)
|
||||
(use-package aio :defer t)
|
||||
:custom
|
||||
(url-debug t)
|
||||
(leetcode-prefer-language "python3"))
|
||||
;; -LeetCodePac
|
||||
|
||||
(provide 'init-leetcode)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-leetcode.el ends here
|
114
elisp/init-lsp.el
Normal file
114
elisp/init-lsp.el
Normal file
@ -0,0 +1,114 @@
|
||||
;;; init-lsp.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-lsp.el
|
||||
;; Description: Initialize LSP
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Fri Mar 15 10:42:09 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Thu Dec 26 01:56:25 2019 (-0500)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d lsp
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes lsp-mode and dap-mode
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(require 'init-const))
|
||||
|
||||
;; LSPPac
|
||||
(use-package lsp-mode
|
||||
:defer t
|
||||
:commands lsp
|
||||
:custom
|
||||
(lsp-auto-guess-root nil)
|
||||
(lsp-prefer-flymake nil) ; Use flycheck instead of flymake
|
||||
(lsp-file-watch-threshold 2000)
|
||||
(read-process-output-max (* 1024 1024))
|
||||
:bind (:map lsp-mode-map ("C-c C-f" . lsp-format-buffer))
|
||||
:hook ((java-mode python-mode go-mode
|
||||
js-mode js2-mode typescript-mode web-mode
|
||||
c-mode c++-mode objc-mode) . lsp))
|
||||
;; -LSPPac
|
||||
|
||||
;; LSPUI
|
||||
(use-package lsp-ui
|
||||
:after lsp-mode
|
||||
:diminish
|
||||
:commands lsp-ui-mode
|
||||
:custom-face
|
||||
(lsp-ui-doc-background ((t (:background nil))))
|
||||
(lsp-ui-doc-header ((t (:inherit (font-lock-string-face italic)))))
|
||||
:bind (:map lsp-ui-mode-map
|
||||
([remap xref-find-definitions] . lsp-ui-peek-find-definitions)
|
||||
([remap xref-find-references] . lsp-ui-peek-find-references)
|
||||
("C-c u" . lsp-ui-imenu))
|
||||
:custom
|
||||
(lsp-ui-doc-enable t)
|
||||
(lsp-ui-doc-header t)
|
||||
(lsp-ui-doc-include-signature t)
|
||||
(lsp-ui-doc-position 'top)
|
||||
(lsp-ui-doc-border (face-foreground 'default))
|
||||
(lsp-ui-sideline-enable nil)
|
||||
(lsp-ui-sideline-ignore-duplicate t)
|
||||
(lsp-ui-sideline-show-code-actions nil)
|
||||
:config
|
||||
;; Use lsp-ui-doc-webkit only in GUI
|
||||
(if *sys/gui*
|
||||
(setq lsp-ui-doc-use-webkit t))
|
||||
;; WORKAROUND Hide mode-line of the lsp-ui-imenu buffer
|
||||
;; https://github.com/emacs-lsp/lsp-ui/issues/243
|
||||
(defadvice lsp-ui-imenu (after hide-lsp-ui-imenu-mode-line activate)
|
||||
(setq mode-line-format nil)))
|
||||
;; -LSPUI
|
||||
|
||||
;; DAPPac
|
||||
(use-package dap-mode
|
||||
:diminish
|
||||
:bind
|
||||
(:map dap-mode-map
|
||||
(("<f12>" . dap-debug)
|
||||
("<f8>" . dap-continue)
|
||||
("<f9>" . dap-next)
|
||||
("<M-f11>" . dap-step-in)
|
||||
("C-M-<f11>" . dap-step-out)
|
||||
("<f7>" . dap-breakpoint-toggle)))
|
||||
:hook ((after-init . dap-mode)
|
||||
(dap-mode . dap-ui-mode)
|
||||
(python-mode . (lambda () (require 'dap-python)))
|
||||
(ruby-mode . (lambda () (require 'dap-ruby)))
|
||||
(go-mode . (lambda () (require 'dap-go)))
|
||||
(java-mode . (lambda () (require 'dap-java)))
|
||||
((c-mode c++-mode objc-mode swift) . (lambda () (require 'dap-lldb)))
|
||||
(php-mode . (lambda () (require 'dap-php)))
|
||||
(elixir-mode . (lambda () (require 'dap-elixir)))
|
||||
((js-mode js2-mode typescript-mode) . (lambda () (require 'dap-chrome)))))
|
||||
;; -DAPPac
|
||||
|
||||
(provide 'init-lsp)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-lsp.el ends here
|
51
elisp/init-magit.el
Normal file
51
elisp/init-magit.el
Normal file
@ -0,0 +1,51 @@
|
||||
;;; init-magit.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-magit.el
|
||||
;; Description: Initialize Magit
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Fri Mar 15 08:40:27 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Thu Aug 8 16:07:17 2019 (-0400)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d magit
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes magit
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(require 'init-const))
|
||||
|
||||
;; MagitPac
|
||||
(use-package magit
|
||||
:if *git*
|
||||
:bind ("C-x g" . magit-status))
|
||||
;; -MagitPac
|
||||
|
||||
(provide 'init-magit)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-magit.el ends here
|
130
elisp/init-mu4e.el
Normal file
130
elisp/init-mu4e.el
Normal file
@ -0,0 +1,130 @@
|
||||
;;; init-mu4e.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-mu4e.el
|
||||
;; Description: Initialize mu4e
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Mon Dec 2 15:17:14 2019 (-0500)
|
||||
;; Version: 2.0.0
|
||||
;; Package-Requires: (mu4e)
|
||||
;; Last-Updated:
|
||||
;; By:
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d mu mu4e
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes mu4e for Email clients in Emacs
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
;; Mu4ePac
|
||||
(use-package mu4e
|
||||
:ensure nil
|
||||
:commands (mu4e)
|
||||
:init
|
||||
(use-package mu4e-alert
|
||||
:defer t
|
||||
:config
|
||||
(when (executable-find "notify-send")
|
||||
(mu4e-alert-set-default-style 'libnotify))
|
||||
:hook
|
||||
((after-init . mu4e-alert-enable-notifications)
|
||||
(after-init . mu4e-alert-enable-mode-line-display)))
|
||||
(use-package mu4e-overview :defer t)
|
||||
:bind ("M-z m" . mu4e)
|
||||
:custom
|
||||
(mu4e-maildir (expand-file-name "~/Maildir"))
|
||||
(mu4e-get-mail-command "mbsync -c ~/.emacs.d/mu4e/.mbsyncrc -a")
|
||||
(mu4e-view-prefer-html t)
|
||||
(mu4e-update-interval 180)
|
||||
(mu4e-headers-auto-update t)
|
||||
(mu4e-compose-signature-auto-include nil)
|
||||
(mu4e-compose-format-flowed t)
|
||||
(mu4e-view-show-images t)
|
||||
(mu4e-sent-messages-behavior 'delete)
|
||||
(mu4e-change-filenames-when-moving t) ; work better for mbsync
|
||||
(mu4e-attachment-dir "~/Downloads")
|
||||
(message-kill-buffer-on-exit t)
|
||||
(mu4e-compose-dont-reply-to-self t)
|
||||
(mu4e-view-show-addresses t)
|
||||
(mu4e-confirm-quit nil)
|
||||
(mu4e-use-fancy-chars t)
|
||||
:hook
|
||||
((mu4e-view-mode . visual-line-mode)
|
||||
(mu4e-compose-mode . (lambda ()
|
||||
(visual-line-mode)
|
||||
(use-hard-newlines -1)
|
||||
(flyspell-mode)))
|
||||
(mu4e-view-mode . (lambda() ;; try to emulate some of the eww key-bindings
|
||||
(local-set-key (kbd "<tab>") 'shr-next-link)
|
||||
(local-set-key (kbd "<backtab>") 'shr-previous-link)))
|
||||
(mu4e-headers-mode . (lambda ()
|
||||
(interactive)
|
||||
(setq mu4e-headers-fields
|
||||
`((:human-date . 25) ;; alternatively, use :date
|
||||
(:flags . 6)
|
||||
(:from . 22)
|
||||
(:thread-subject . ,(- (window-body-width) 70)) ;; alternatively, use :subject
|
||||
(:size . 7))))))
|
||||
:config
|
||||
(add-to-list 'mu4e-view-actions
|
||||
'("ViewInBrowser" . mu4e-action-view-in-browser) t)
|
||||
(setq mu4e-contexts
|
||||
(list
|
||||
(make-mu4e-context
|
||||
:name "gmail"
|
||||
:enter-func (lambda () (mu4e-message "Entering context gmail"))
|
||||
:leave-func (lambda () (mu4e-message "Leaving context gmail"))
|
||||
:match-func
|
||||
(lambda (msg)
|
||||
(when msg
|
||||
(mu4e-message-contact-field-matches
|
||||
msg '(:from :to :cc :bcc) user-mail-address))) ; Set to your email address
|
||||
:vars '((mu4e-refile-folder "/gmail/Archive")
|
||||
(mu4e-sent-folder . "/gmail/[email].Sent Mail")
|
||||
(mu4e-drafts-folder . "/gmail/[email].Drafts")
|
||||
(mu4e-trash-folder . "/gmail/[email].Trash")
|
||||
(mu4e-compose-signature . user-full-name)
|
||||
(mu4e-compose-format-flowed . t)
|
||||
(smtpmail-queue-dir . "~/Maildir/gmail/queue/cur")
|
||||
(message-send-mail-function . smtpmail-send-it)
|
||||
(smtpmail-smtp-user . "matthewzmd") ; Set to your username
|
||||
(smtpmail-starttls-credentials . (("smtp.gmail.com" 587 nil nil)))
|
||||
(smtpmail-auth-credentials . (expand-file-name "~/.authinfo.gpg"))
|
||||
(smtpmail-default-smtp-server . "smtp.gmail.com")
|
||||
(smtpmail-smtp-server . "smtp.gmail.com")
|
||||
(smtpmail-smtp-service . 587)
|
||||
(smtpmail-debug-info . t)
|
||||
(smtpmail-debug-verbose . t)
|
||||
(mu4e-maildir-shortcuts . ( ("/gmail/INBOX" . ?i)
|
||||
("/gmail/[email].Sent Mail" . ?s)
|
||||
("/gmail/[email].Trash" . ?t)
|
||||
("/gmail/[email].All Mail" . ?a)
|
||||
("/gmail/[email].Starred" . ?r)
|
||||
("/gmail/[email].Drafts" . ?d))))))))
|
||||
;; -Mu4ePac
|
||||
|
||||
(provide 'init-mu4e)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-mu4e.el ends here
|
114
elisp/init-org.el
Normal file
114
elisp/init-org.el
Normal file
@ -0,0 +1,114 @@
|
||||
;;; init-org.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-org.el
|
||||
;; Description: Initialize Org, Toc-org, HTMLize, OX-GFM
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Fri Mar 15 11:09:30 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Tue Dec 24 14:05:45 2019 (-0500)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d org toc-org htmlize ox-gfm
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes org toc-org htmlize ox-gfm
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
;; OrgPac
|
||||
(use-package org
|
||||
:ensure nil
|
||||
:defer t
|
||||
:bind
|
||||
("C-c l" . org-store-link)
|
||||
("C-c a" . org-agenda)
|
||||
("C-c c" . org-capture)
|
||||
("C-c b" . org-switch)
|
||||
(:map org-mode-map ("C-c C-p" . org-export-as-pdf-and-open))
|
||||
:custom
|
||||
(org-log-done 'time)
|
||||
(org-export-backends (quote (ascii html icalendar latex md odt)))
|
||||
(org-use-speed-commands t)
|
||||
(org-confirm-babel-evaluate 'nil)
|
||||
(org-todo-keywords
|
||||
'((sequence "TODO" "IN-PROGRESS" "REVIEW" "|" "DONE")))
|
||||
(org-agenda-window-setup 'other-window)
|
||||
:config
|
||||
(unless (version< org-version "9.2")
|
||||
(require 'org-tempo))
|
||||
(when (file-directory-p "~/org/agenda/")
|
||||
(setq org-agenda-files (list "~/org/agenda/")))
|
||||
|
||||
(defun org-export-turn-on-syntax-highlight ()
|
||||
"Setup variables to turn on syntax highlighting when calling `org-latex-export-to-pdf'."
|
||||
(interactive)
|
||||
(setq org-latex-listings 'minted
|
||||
org-latex-packages-alist '(("" "minted"))
|
||||
org-latex-pdf-process
|
||||
'("pdflatex -shelnl-escape -interaction nonstopmode -output-directory %o %f"
|
||||
"pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f")))
|
||||
|
||||
(defun org-export-as-pdf-and-open ()
|
||||
"Run `org-latex-export-to-pdf', delete the tex file and open pdf in a new buffer."
|
||||
(interactive)
|
||||
(save-buffer)
|
||||
(let* ((pdf-path (org-latex-export-to-pdf))
|
||||
(pdf-name (file-name-nondirectory pdf-path)))
|
||||
(if (try-completion pdf-name (mapcar #'buffer-name (buffer-list)))
|
||||
(progn
|
||||
(kill-matching-buffers (concat "^" pdf-name) t t)
|
||||
(find-file-other-window pdf-name))
|
||||
(find-file-other-window pdf-name))
|
||||
(delete-file (concat (substring pdf-path 0 (string-match "[^\.]*\/?$" pdf-path)) "tex")))))
|
||||
;; -OrgPac
|
||||
|
||||
;; TocOrgPac
|
||||
(use-package toc-org
|
||||
:hook (org-mode . toc-org-mode))
|
||||
;; -TocOrgPac
|
||||
|
||||
;; HTMLIZEPac
|
||||
(use-package htmlize :defer t)
|
||||
;; -HTMLIZEPac
|
||||
|
||||
;; OXGFMPac
|
||||
(use-package ox-gfm :defer t)
|
||||
;; -OXGFMPac
|
||||
|
||||
;; PlantUMLPac
|
||||
(use-package plantuml-mode
|
||||
:defer t
|
||||
:custom
|
||||
(org-plantuml-jar-path (expand-file-name "~/tools/plantuml/plantuml.jar"))
|
||||
:config
|
||||
(org-babel-do-load-languages
|
||||
'org-babel-load-languages
|
||||
'(;; other Babel languages
|
||||
(plantuml . t))))
|
||||
;; -PlantUMLPac
|
||||
|
||||
(provide 'init-org)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-org.el ends here
|
100
elisp/init-package.el
Normal file
100
elisp/init-package.el
Normal file
@ -0,0 +1,100 @@
|
||||
;;; init-package.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-package.el
|
||||
;; Description: Initialize Package Management for M-EMACS
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Thu Mar 14 10:53:00 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Thu Dec 26 03:37:58 2019 (-0500)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d packages use-package
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This file initializes packages from melpa using use-package macro
|
||||
;; as well as auto-package-update, diminish, gnu-elpa-keyring-update
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
;; MelpaPackages
|
||||
;; Select the folder to store packages
|
||||
;; Comment / Uncomment to use desired sites
|
||||
(setq package-user-dir (expand-file-name "elpa" user-emacs-directory)
|
||||
package-archives
|
||||
'(("gnu" . "http://elpa.gnu.org/packages/")
|
||||
("melpa" . "https://melpa.org/packages/")
|
||||
("cselpa" . "https://elpa.thecybershadow.net/packages/")
|
||||
;; ("melpa-cn" . "http://mirrors.cloud.tencent.com/elpa/melpa/")
|
||||
;; ("gnu-cn" . "http://mirrors.cloud.tencent.com/elpa/gnu/")
|
||||
))
|
||||
;; -MelpaPackages
|
||||
|
||||
;; ConfigurePackageManager
|
||||
(unless (bound-and-true-p package--initialized)
|
||||
(setq package-enable-at-startup nil) ; To prevent initializing twice
|
||||
(package-initialize))
|
||||
|
||||
;; set use-package-verbose to t for interpreted .emacs,
|
||||
;; and to nil for byte-compiled .emacs.elc.
|
||||
(eval-and-compile
|
||||
(setq use-package-verbose (not (bound-and-true-p byte-compile-current-file))))
|
||||
;; -ConfigurePackageManager
|
||||
|
||||
;; ConfigureUsePackage
|
||||
;; Install use-package if not installed
|
||||
(unless (package-installed-p 'use-package)
|
||||
(package-refresh-contents)
|
||||
(package-install 'use-package))
|
||||
|
||||
(eval-and-compile
|
||||
(setq use-package-always-ensure t)
|
||||
(setq use-package-expand-minimally t)
|
||||
(setq use-package-compute-statistics t)
|
||||
(setq use-package-enable-imenu-support t))
|
||||
|
||||
(eval-when-compile
|
||||
(require 'use-package)
|
||||
(require 'bind-key))
|
||||
;; -ConfigureUsePackage
|
||||
|
||||
;; AutoPackageUpdate
|
||||
(use-package auto-package-update
|
||||
:if (not (daemonp))
|
||||
:custom
|
||||
(auto-package-update-interval 7) ;; in days
|
||||
(auto-package-update-prompt-before-update t)
|
||||
(auto-package-update-delete-old-versions t)
|
||||
(auto-package-update-hide-results t)
|
||||
:config
|
||||
(auto-package-update-maybe))
|
||||
;; -AutoPackageUpdate
|
||||
|
||||
;; DimPac
|
||||
(use-package diminish)
|
||||
;; -DimPac
|
||||
|
||||
(provide 'init-package)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-package.el ends here
|
116
elisp/init-parens.el
Normal file
116
elisp/init-parens.el
Normal file
@ -0,0 +1,116 @@
|
||||
;;; init-parens.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-parens.el
|
||||
;; Description: Initialize Parenthesis
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Fri Mar 15 10:17:13 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Tue Dec 24 11:48:49 2019 (-0500)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d parenthesis smartparens delete-block
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes parenthesis smartparens delete-block
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(require 'init-global-config))
|
||||
|
||||
;; SmartParensPac
|
||||
(use-package smartparens
|
||||
:hook (prog-mode . smartparens-mode)
|
||||
:diminish smartparens-mode
|
||||
:bind
|
||||
(:map smartparens-mode-map
|
||||
("C-M-f" . sp-forward-sexp)
|
||||
("C-M-b" . sp-backward-sexp)
|
||||
("C-M-a" . sp-backward-down-sexp)
|
||||
("C-M-e" . sp-up-sexp)
|
||||
("C-M-w" . sp-copy-sexp)
|
||||
("C-M-k" . sp-change-enclosing)
|
||||
("M-k" . sp-kill-sexp)
|
||||
("C-M-<backspace>" . sp-splice-sexp-killing-backward)
|
||||
("C-S-<backspace>" . sp-splice-sexp-killing-around)
|
||||
("C-]" . sp-select-next-thing-exchange))
|
||||
:custom
|
||||
(sp-escape-quotes-after-insert nil)
|
||||
:config
|
||||
;; Stop pairing single quotes in elisp
|
||||
(sp-local-pair 'emacs-lisp-mode "'" nil :actions nil)
|
||||
(sp-local-pair 'org-mode "[" nil :actions nil)
|
||||
;; Smartparens is broken in `cc-mode' as of Emacs 27. See
|
||||
;; https://github.com/Fuco1/smartparens/issues/963
|
||||
(unless (version< emacs-version "27")
|
||||
(dolist (fun '(c-electric-paren c-electric-brace))
|
||||
(add-to-list 'sp--special-self-insert-commands fun))))
|
||||
;; -SmartParensPac
|
||||
|
||||
;; MatchParens
|
||||
;; Show matching parenthesis
|
||||
(show-paren-mode 1)
|
||||
;; we will call `blink-matching-open` ourselves...
|
||||
(remove-hook 'post-self-insert-hook
|
||||
#'blink-paren-post-self-insert-function)
|
||||
|
||||
;; this still needs to be set for `blink-matching-open` to work
|
||||
(setq blink-matching-paren 'show)
|
||||
(let ((ov nil)) ; keep track of the overlay
|
||||
(advice-add
|
||||
#'show-paren-function
|
||||
:after
|
||||
(defun show-paren--off-screen+ (&rest _args)
|
||||
"Display matching line for off-screen paren."
|
||||
(when (overlayp ov)
|
||||
(delete-overlay ov))
|
||||
;; check if it's appropriate to show match info,
|
||||
;; see `blink-paren-post-self-insert-function'
|
||||
(when (and (overlay-buffer show-paren--overlay)
|
||||
(not (or cursor-in-echo-area
|
||||
executing-kbd-macro
|
||||
noninteractive
|
||||
(minibufferp)
|
||||
this-command))
|
||||
(and (not (bobp))
|
||||
(memq (char-syntax (char-before)) '(?\) ?\$)))
|
||||
(= 1 (logand 1 (- (point)
|
||||
(save-excursion
|
||||
(forward-char -1)
|
||||
(skip-syntax-backward "/\\")
|
||||
(point))))))
|
||||
;; rebind `minibuffer-message' called by
|
||||
;; `blink-matching-open' to handle the overlay display
|
||||
(cl-letf (((symbol-function #'minibuffer-message)
|
||||
(lambda (msg &rest args)
|
||||
(let ((msg (apply #'format-message msg args)))
|
||||
(setq ov (display-line-overlay+
|
||||
(window-start) msg))))))
|
||||
(blink-matching-open))))))
|
||||
;; -MatchParens
|
||||
|
||||
(provide 'init-parens)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-parens.el ends here
|
60
elisp/init-pdf.el
Normal file
60
elisp/init-pdf.el
Normal file
@ -0,0 +1,60 @@
|
||||
;;; init-pdf.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-pdf.el
|
||||
;; Description: Initialize pdf-tools
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Tue Jun 4 00:26:09 2019 (-0400)
|
||||
;; Version: 1.0.0
|
||||
;; Last-Updated: Tue Dec 24 12:11:20 2019 (-0500)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d pdf-tools
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes pdf-tools
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(require 'init-const))
|
||||
|
||||
;; PDFToolsPac
|
||||
(use-package pdf-tools-install
|
||||
:ensure pdf-tools
|
||||
:if (and *sys/gui* (not *sys/win32*))
|
||||
:mode "\\.pdf\\'"
|
||||
:commands (pdf-loader-install)
|
||||
:custom
|
||||
(TeX-view-program-selection '((output-pdf "pdf-tools")))
|
||||
(TeX-view-program-list '(("pdf-tools" "TeX-pdf-tools-sync-view")))
|
||||
:hook
|
||||
(pdf-view-mode . (lambda () (display-line-numbers-mode -1)))
|
||||
:config
|
||||
(pdf-loader-install))
|
||||
;; -PDFToolsPac
|
||||
|
||||
(provide 'init-pdf)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-pdf.el ends here
|
47
elisp/init-popup-kill-ring.el
Normal file
47
elisp/init-popup-kill-ring.el
Normal file
@ -0,0 +1,47 @@
|
||||
;;; init-popup-kill-ring.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-popup-kill-ring.el
|
||||
;; Description: Initialize Popup-Kill-Ring
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Thu Mar 14 15:15:40 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Thu Aug 8 16:07:32 2019 (-0400)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d popup-kill-ring
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes popup-kill-ring
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
;; PopKillRing
|
||||
(use-package popup-kill-ring
|
||||
:bind ("M-y" . popup-kill-ring))
|
||||
;; -PopKillRing
|
||||
|
||||
(provide 'init-popup-kill-ring)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-popup-kill-ring.el ends here
|
60
elisp/init-projectile.el
Normal file
60
elisp/init-projectile.el
Normal file
@ -0,0 +1,60 @@
|
||||
;;; init-projectile.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-projectile.el
|
||||
;; Description: Initialize Projectile
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Fri Mar 15 09:10:23 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Thu Aug 8 16:07:35 2019 (-0400)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d projectile
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes projectile
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(require 'init-const))
|
||||
|
||||
;; ProjPac
|
||||
(use-package projectile
|
||||
:bind
|
||||
("C-c p" . projectile-command-map)
|
||||
("C-z o" . projectile-find-file)
|
||||
("C-z p" . projectile-add-known-project)
|
||||
:custom
|
||||
(projectile-completion-system 'ivy)
|
||||
:config
|
||||
(projectile-mode 1)
|
||||
(when (and *sys/win32* *tr*)
|
||||
(setq projectile-indexing-method 'alien))
|
||||
(add-to-list 'projectile-globally-ignored-directories "node_modules"))
|
||||
;; -ProjPac
|
||||
|
||||
(provide 'init-projectile)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-projectile.el ends here
|
69
elisp/init-pyim.el
Normal file
69
elisp/init-pyim.el
Normal file
@ -0,0 +1,69 @@
|
||||
;;; init-pyim.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-pyim.el
|
||||
;; Description: Initialize Pyim
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Thu Jun 20 00:36:05 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Thu Dec 26 21:54:20 2019 (-0500)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d init
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes pyim
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
;; PyimPac
|
||||
(use-package pyim
|
||||
:init
|
||||
(use-package posframe :defer t)
|
||||
:custom
|
||||
(default-input-method "pyim")
|
||||
(pyim-default-scheme 'quanpin)
|
||||
(pyim-page-tooltip 'posframe)
|
||||
(pyim-page-length 9)
|
||||
:config
|
||||
(pyim-isearch-mode 1)
|
||||
(setq-default pyim-english-input-switch-functions
|
||||
'(pyim-probe-isearch-mode
|
||||
pyim-probe-org-structure-template))
|
||||
(setq-default pyim-punctuation-half-width-functions
|
||||
'(pyim-probe-punctuation-line-beginning
|
||||
pyim-probe-punctuation-after-punctuation))
|
||||
:bind
|
||||
("M-j" . pyim-convert-string-at-point)) ; M-j 强制将光标前的拼音字符串转换为中文。
|
||||
;; -PyimPac
|
||||
|
||||
;; PyimBaseDictPac
|
||||
(use-package pyim-basedict
|
||||
:after pyim
|
||||
:config (pyim-basedict-enable))
|
||||
;; -PyimBaseDictPac
|
||||
|
||||
(provide 'init-pyim)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-pyim.el ends here
|
91
elisp/init-python.el
Normal file
91
elisp/init-python.el
Normal file
@ -0,0 +1,91 @@
|
||||
;;; init-python.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-python.el
|
||||
;; Description: Initialize Python
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Mon Jun 10 18:58:02 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: lun. janv. 13 14:24:17 2020 (+0100)
|
||||
;; By: Mikaël Capelle
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: lsp-python-ms
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes lsp-python-ms
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(require 'init-flycheck)
|
||||
(require 'init-const))
|
||||
|
||||
;; PythonConfig
|
||||
;; (use-package python-mode
|
||||
;; :ensure nil
|
||||
;; :after flycheck
|
||||
;; :mode "\\.py\\'"
|
||||
;; :custom
|
||||
;; (python-indent-offset 4)
|
||||
;; (flycheck-python-pycompile-executable "python3")
|
||||
;; (python-shell-interpreter "python3"))
|
||||
;; ;; -PythonConfig
|
||||
|
||||
(add-hook 'python-mode-hook (lambda () (setq-local whitespace-line-column 100)))
|
||||
|
||||
(use-package flycheck-mypy
|
||||
:after flycheck
|
||||
:config
|
||||
(flycheck-add-next-checker 'python-flake8 'python-mypy))
|
||||
|
||||
(use-package elpy
|
||||
:custom
|
||||
(flycheck-python-flake8-executable "python")
|
||||
(python-indent-offset 4)
|
||||
(python-shell-interpreter "ipython")
|
||||
(python-shell-interpreter-args "-i --simple-prompt")
|
||||
:config
|
||||
(setq elpy-modules (delq 'elpy-module-flymake elpy-modules))
|
||||
(add-hook 'elpy-mode-hook 'flycheck-mode)
|
||||
:init
|
||||
(setq elpy-rpc-backend "jedi")
|
||||
(elpy-enable))
|
||||
|
||||
(use-package ein
|
||||
:custom
|
||||
(ein:polymode t)
|
||||
(ein:use-auto-complete t)
|
||||
:commands (ein:notebooklist-open))
|
||||
|
||||
;; LSPPythonPac
|
||||
;; (use-package lsp-python-ms
|
||||
;; :after lsp-mode python
|
||||
;; :if (or *python3* *python*)
|
||||
;; :custom
|
||||
;; (lsp-python-executable-cmd "python3"))
|
||||
;; ;; -LSPPythonPac
|
||||
|
||||
(provide 'init-python)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-python.el ends here
|
49
elisp/init-quickrun.el
Normal file
49
elisp/init-quickrun.el
Normal file
@ -0,0 +1,49 @@
|
||||
;;; init-quickrun.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-quickrun.el
|
||||
;; Description: Initialize quickrun
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Sun Jul 7 16:32:16 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Thu Aug 8 16:07:44 2019 (-0400)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d init
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes quickrun
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
;; QuickrunPac
|
||||
(use-package quickrun
|
||||
:bind
|
||||
(("<f5>" . quickrun)
|
||||
("M-<f5>" . quickrun-shell)))
|
||||
;; -QuickrunPac
|
||||
|
||||
(provide 'init-quickrun)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-quickrun.el ends here
|
58
elisp/init-scroll.el
Normal file
58
elisp/init-scroll.el
Normal file
@ -0,0 +1,58 @@
|
||||
;;; init-scroll.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-scroll.el
|
||||
;; Description: Initialize Smooth Scroll
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Fri Mar 15 08:30:08 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Thu Aug 8 16:07:50 2019 (-0400)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d smooth-scroll
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes smooth scroll
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
;; SmoothScroll
|
||||
;; Vertical Scroll
|
||||
(setq scroll-step 1)
|
||||
(setq scroll-margin 1)
|
||||
(setq scroll-conservatively 101)
|
||||
(setq scroll-up-aggressively 0.01)
|
||||
(setq scroll-down-aggressively 0.01)
|
||||
(setq auto-window-vscroll nil)
|
||||
(setq fast-but-imprecise-scrolling nil)
|
||||
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1)))
|
||||
(setq mouse-wheel-progressive-speed nil)
|
||||
;; Horizontal Scroll
|
||||
(setq hscroll-step 1)
|
||||
(setq hscroll-margin 1)
|
||||
;; -SmoothScroll
|
||||
|
||||
(provide 'init-scroll)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-scroll.el ends here
|
114
elisp/init-search.el
Normal file
114
elisp/init-search.el
Normal file
@ -0,0 +1,114 @@
|
||||
;;; init-search.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-search.el
|
||||
;; Description: Initialize Packages for Searching
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Thu Mar 14 11:01:43 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Sun Nov 10 14:31:56 2019 (-0500)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d color-rg rg
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes ivy swiper counsel color-rg snails
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(require 'init-global-config)
|
||||
(require 'init-const))
|
||||
|
||||
;; IvyPac
|
||||
(use-package ivy
|
||||
:diminish
|
||||
:init
|
||||
(use-package amx :defer t)
|
||||
(use-package counsel :diminish :config (counsel-mode 1))
|
||||
(use-package swiper :defer t)
|
||||
(ivy-mode 1)
|
||||
:bind
|
||||
(("C-s" . swiper-isearch)
|
||||
("C-z s" . counsel-rg)
|
||||
("C-z b" . counsel-buffer-or-recentf)
|
||||
("C-z C-b" . counsel-ibuffer)
|
||||
(:map ivy-minibuffer-map
|
||||
("C-r" . ivy-previous-line-or-history)
|
||||
("M-RET" . ivy-immediate-done))
|
||||
(:map counsel-find-file-map
|
||||
("C-~" . counsel-goto-local-home)))
|
||||
:custom
|
||||
(ivy-use-virtual-buffers t)
|
||||
(ivy-height 10)
|
||||
(ivy-on-del-error-function nil)
|
||||
(ivy-magic-slash-non-match-action 'ivy-magic-slash-non-match-create)
|
||||
(ivy-count-format " [%d/%d] ")
|
||||
(ivy-wrap t)
|
||||
:config
|
||||
(defun counsel-goto-local-home ()
|
||||
"Go to the $HOME of the local machine."
|
||||
(interactive)
|
||||
(ivy--cd "~/")))
|
||||
;; -IvyPac
|
||||
|
||||
;; ColorRGPac
|
||||
(use-package color-rg
|
||||
:load-path (lambda () (expand-file-name "site-elisp/color-rg" user-emacs-directory))
|
||||
:if *rg*
|
||||
:bind ("C-M-s" . color-rg-search-input))
|
||||
;; -ColorRGPac
|
||||
|
||||
;; SnailsPac
|
||||
(use-package snails
|
||||
:load-path (lambda () (expand-file-name "site-elisp/snails/" user-emacs-directory))
|
||||
:if *sys/gui*
|
||||
:custom-face
|
||||
(snails-content-buffer-face ((t (:background "#111" :height 110))))
|
||||
(snails-input-buffer-face ((t (:background "#222" :foreground "gold" :height 110))))
|
||||
(snails-header-line-face ((t (:inherit font-lock-function-name-face :underline t :height 1.1))))
|
||||
:config
|
||||
(use-package exec-path-from-shell
|
||||
:if (featurep 'cocoa) :defer t)
|
||||
|
||||
;; Functions for specific backends
|
||||
(defun snails-current-project ()
|
||||
(interactive)
|
||||
(snails '(snails-backend-projectile snails-backend-rg snails-backend-fd)))
|
||||
(defun snails-active-recent-buffers ()
|
||||
(interactive)
|
||||
(snails '(snails-backend-buffer snails-backend-recentf)))
|
||||
(defun snails-everywhere ()
|
||||
(interactive)
|
||||
(snails '(snails-backend-everything snails-backend-mdfind)))
|
||||
:bind
|
||||
(("M-s s" . snails)
|
||||
("M-s g" . snails-current-project)
|
||||
("M-s b" . snails-active-recent-buffers)
|
||||
("M-s e" . snails-everywhere)))
|
||||
;; -SnailsPac
|
||||
|
||||
(provide 'init-search)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-ag.el ends here
|
79
elisp/init-shell.el
Normal file
79
elisp/init-shell.el
Normal file
@ -0,0 +1,79 @@
|
||||
;;; init-shell.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-shell.el
|
||||
;; Description: Initialize Shell
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Tue Mar 19 09:20:19 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Tue Oct 8 00:20:32 2019 (-0400)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d shell shell-here
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes shell-here, term-keys, multi-term, aweshell
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(require 'init-const))
|
||||
|
||||
;; AweshellPac
|
||||
(use-package aweshell
|
||||
:load-path (lambda () (expand-file-name "site-elisp/aweshell" user-emacs-directory))
|
||||
:commands (aweshell-new aweshell-dedicated-open)
|
||||
:bind
|
||||
(("M-#" . aweshell-dedicated-open)
|
||||
(:map eshell-mode-map ("M-#" . aweshell-dedicated-close))))
|
||||
;; -AweshellPac
|
||||
|
||||
;; ShellHerePac
|
||||
(use-package shell-here
|
||||
:bind ("M-~" . shell-here)
|
||||
:config
|
||||
(when *sys/linux*
|
||||
(setq explicit-shell-file-name "/bin/bash")))
|
||||
;; -ShellHerePac
|
||||
|
||||
;; MultiTermPac
|
||||
(use-package multi-term
|
||||
:load-path (lambda () (expand-file-name "site-elisp/multi-term" user-emacs-directory))
|
||||
:commands (multi-term)
|
||||
:bind
|
||||
(("M-$" . multi-term)
|
||||
(:map dired-mode-map ("M-$" . multi-term)))
|
||||
:custom
|
||||
(multi-term-program (executable-find "bash")))
|
||||
;; -MultiTermPac
|
||||
|
||||
;; TermKeysPac
|
||||
(use-package term-keys
|
||||
:if (not *sys/gui*)
|
||||
:config (term-keys-mode t))
|
||||
;; -TermKeysPac
|
||||
|
||||
(provide 'init-shell)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-shell.el ends here
|
79
elisp/init-theme.el
Normal file
79
elisp/init-theme.el
Normal file
@ -0,0 +1,79 @@
|
||||
;;; init-theme.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-theme.el
|
||||
;; Description: Initialize Doom Themes and Modeline
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Thu Mar 14 17:11:56 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Tue Jan 7 10:15:29 2020 (+0100)
|
||||
;; By: Mikaël Capelle
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d doom-themes doom-modeline
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes doom-themes and doom-modeline
|
||||
;; This is NOT Doom, but doom-themes and doom-modeine
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(require 'init-const))
|
||||
|
||||
;; DoomThemes
|
||||
(use-package doom-themes
|
||||
:custom-face
|
||||
(cursor ((t (:background "BlanchedAlmond"))))
|
||||
:config
|
||||
(setq doom-themes-treemacs-enable-variable-pitch nil)
|
||||
(setq doom-themes-treemacs-theme "doom-colors")
|
||||
(doom-themes-treemacs-config)
|
||||
(with-eval-after-load 'treemacs
|
||||
(remove-hook 'treemacs-mode-hook #'doom-themes-hide-modeline))
|
||||
|
||||
;; flashing mode-line on errors
|
||||
(doom-themes-visual-bell-config)
|
||||
;; Corrects (and improves) org-mode's native fontification.
|
||||
(doom-themes-org-config)
|
||||
(load-theme 'doom-one t))
|
||||
;; -DoomThemes
|
||||
|
||||
;; DoomModeline
|
||||
(use-package doom-modeline
|
||||
:hook (after-init . doom-modeline-mode)
|
||||
:custom
|
||||
;; Don't compact font caches during GC. Windows Laggy Issue
|
||||
(inhibit-compacting-font-caches t)
|
||||
(doom-modeline-minor-modes t)
|
||||
(doom-modeline-icon t)
|
||||
(doom-modeline-major-mode-color-icon t)
|
||||
(doom-modeline-height 15))
|
||||
;; -DoomModeline
|
||||
|
||||
(use-package hide-mode-line
|
||||
:hook (((completion-list-mode completion-in-region-mode) . hide-mode-line-mode)))
|
||||
|
||||
(provide 'init-theme)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-theme.el ends here
|
62
elisp/init-tramp.el
Normal file
62
elisp/init-tramp.el
Normal file
@ -0,0 +1,62 @@
|
||||
;;; init-tramp.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-tramp.el
|
||||
;; Description: Initialize Tramp
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Fri Aug 9 21:48:32 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Wed Oct 16 16:05:51 2019 (-0400)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d tramp
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes Tramp
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
;; TrampPac
|
||||
(use-package tramp
|
||||
:ensure nil
|
||||
:defer 1
|
||||
:config
|
||||
(add-to-list 'tramp-remote-path 'tramp-own-remote-path)
|
||||
;; TRAMP gcloud ssh
|
||||
(add-to-list 'tramp-methods
|
||||
'("gssh"
|
||||
(tramp-login-program "gcloud compute ssh")
|
||||
(tramp-login-args (("%h")))
|
||||
(tramp-async-args (("-q")))
|
||||
(tramp-remote-shell "/bin/bash")
|
||||
(tramp-remote-shell-args ("-c"))
|
||||
(tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null")
|
||||
("-o" "UserKnownHostsFile=/dev/null")
|
||||
("-o" "StrictHostKeyChecking=no")))
|
||||
(tramp-default-port 22))))
|
||||
;; -TrampPac
|
||||
|
||||
(provide 'init-tramp)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-tramp.el ends here
|
105
elisp/init-treemacs.el
Normal file
105
elisp/init-treemacs.el
Normal file
@ -0,0 +1,105 @@
|
||||
;;; init-treemacs.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-treemacs.el
|
||||
;; Description: Initialize Treemacs
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Fri Mar 15 09:56:12 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Tue Dec 24 11:56:52 2019 (-0500)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d treemacs
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes treemacs
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
;; TreemacsPac
|
||||
(use-package treemacs
|
||||
:init
|
||||
(with-eval-after-load 'winum
|
||||
(define-key winum-keymap (kbd "M-0") #'treemacs-select-window))
|
||||
:custom
|
||||
(treemacs-collapse-dirs 3)
|
||||
(treemacs-deferred-git-apply-delay 0.5)
|
||||
(treemacs-display-in-side-window t)
|
||||
(treemacs-file-event-delay 5000)
|
||||
(treemacs-file-follow-delay 0.2)
|
||||
(treemacs-follow-after-init t)
|
||||
(treemacs-follow-recenter-distance 0.1)
|
||||
(treemacs-git-command-pipe "")
|
||||
(treemacs-goto-tag-strategy 'refetch-index)
|
||||
(treemacs-indentation 2)
|
||||
(treemacs-indentation-string " ")
|
||||
(treemacs-is-never-other-window nil)
|
||||
(treemacs-max-git-entries 5000)
|
||||
(treemacs-no-png-images nil)
|
||||
(treemacs-no-delete-other-windows t)
|
||||
(treemacs-project-follow-cleanup nil)
|
||||
(treemacs-persist-file (expand-file-name ".cache/treemacs-persist" user-emacs-directory))
|
||||
(treemacs-recenter-after-file-follow nil)
|
||||
(treemacs-recenter-after-tag-follow nil)
|
||||
(treemacs-show-cursor nil)
|
||||
(treemacs-show-hidden-files t)
|
||||
(treemacs-silent-filewatch nil)
|
||||
(treemacs-silent-refresh nil)
|
||||
(treemacs-sorting 'alphabetic-desc)
|
||||
(treemacs-space-between-root-nodes t)
|
||||
(treemacs-tag-follow-cleanup t)
|
||||
(treemacs-tag-follow-delay 1.5)
|
||||
(treemacs-width 35)
|
||||
:config
|
||||
;; The default width and height of the icons is 22 pixels. If you are
|
||||
;; using a Hi-DPI display, uncomment this to double the icon size.
|
||||
;;(treemacs-resize-icons 44)
|
||||
(treemacs-follow-mode t)
|
||||
(treemacs-filewatch-mode t)
|
||||
(treemacs-fringe-indicator-mode t)
|
||||
:bind
|
||||
(("M-0" . treemacs-select-window)
|
||||
("C-x t 1" . treemacs-delete-other-windows)
|
||||
("C-x t t" . treemacs)
|
||||
("C-x t B" . treemacs-bookmark)
|
||||
("C-x t C-t" . treemacs-find-file)
|
||||
("C-x t M-t" . treemacs-find-tag))
|
||||
(:map treemacs-mode-map ("C-p" . treemacs-previous-line)))
|
||||
;; -TreemacsPac
|
||||
|
||||
;; TreeMagit
|
||||
(use-package treemacs-magit
|
||||
:defer t
|
||||
:after (treemacs magit))
|
||||
;; -TreeMagit
|
||||
|
||||
;; TreeProj
|
||||
(use-package treemacs-projectile
|
||||
:defer t
|
||||
:after (treemacs projectile))
|
||||
;; -TreeProj
|
||||
|
||||
(provide 'init-treemacs)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-treemacs.el ends here
|
103
elisp/init-ui-config.el
Normal file
103
elisp/init-ui-config.el
Normal file
@ -0,0 +1,103 @@
|
||||
;;; init-ui-config.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-ui-config.el
|
||||
;; Description: Initialize UI Configurations
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Thu Mar 14 16:12:56 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Sat Dec 28 18:48:31 2019 (+0100)
|
||||
;; By: Mikaël Capelle
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d ui
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes prettify-symbols-mode and other UI configurations
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(require 'init-const))
|
||||
|
||||
;; PreSym
|
||||
;; (global-prettify-symbols-mode 1)
|
||||
;; (defun add-pretty-lambda ()
|
||||
;; "Make some word or string show as pretty Unicode symbols. See https://unicodelookup.com for more."
|
||||
;; (setq prettify-symbols-alist
|
||||
;; '(
|
||||
;; ("lambda" . 955)
|
||||
;; ("delta" . 120517)
|
||||
;; ("epsilon" . 120518)
|
||||
;; ("->" . 8594)
|
||||
;; ("<=" . 8804)
|
||||
;; (">=" . 8805)
|
||||
;; )))
|
||||
;; (add-hook 'prog-mode-hook 'add-pretty-lambda)
|
||||
;; (add-hook 'org-mode-hook 'add-pretty-lambda)
|
||||
;; ;; -PreSym
|
||||
|
||||
;; TitleBar
|
||||
(setq-default frame-title-format '("M-EMACS - " user-login-name "@" system-name " - %b"))
|
||||
;; -TitleBar
|
||||
|
||||
;; YorN
|
||||
(fset 'yes-or-no-p 'y-or-n-p)
|
||||
;; -YorN
|
||||
|
||||
;; StartupScreen
|
||||
(setq inhibit-startup-screen t)
|
||||
(setq initial-major-mode 'text-mode)
|
||||
(setq initial-scratch-message "Present Day, Present Time...\n")
|
||||
;; -StartupScreen
|
||||
|
||||
;; DisLineNum
|
||||
;; Hook line numbers to only when files are opened, also use linum-mode for emacs-version< 26
|
||||
(if (version< emacs-version "26")
|
||||
(global-linum-mode)
|
||||
(add-hook 'text-mode-hook #'display-line-numbers-mode)
|
||||
(add-hook 'prog-mode-hook #'display-line-numbers-mode))
|
||||
;; Display column numbers in modeline
|
||||
(column-number-mode 1)
|
||||
;; -DisLineNum
|
||||
|
||||
;; Whitespace
|
||||
(setq-default fill-column 95)
|
||||
(setq-default whitespace-line-column 95)
|
||||
(add-hook 'python-mode-hook (lambda () (setq-local whitespace-line-column 100)))
|
||||
(add-hook 'LaTeX-mode-hook (lambda () (setq-local whitespace-line-column -1)))
|
||||
(add-hook 'markdown-mode-hook (lambda () (setq-local whitespace-line-column -1)))
|
||||
(add-hook 'web-mode-hook (lambda () (setq-local whitespace-line-column -1)))
|
||||
(add-hook 'text-mode-hook #'whitespace-mode)
|
||||
(add-hook 'prog-mode-hook #'whitespace-mode)
|
||||
(add-hook 'before-save-hook 'whitespace-cleanup)
|
||||
;; -Whitespace
|
||||
|
||||
;; DisTimeBat
|
||||
(display-time-mode 1)
|
||||
(display-battery-mode 1)
|
||||
;; -DisTimeBat
|
||||
|
||||
(provide 'init-ui-config)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-ui-config.el ends here
|
49
elisp/init-undo-tree.el
Normal file
49
elisp/init-undo-tree.el
Normal file
@ -0,0 +1,49 @@
|
||||
;;; init-undo-tree.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-undo-tree.el
|
||||
;; Description: Initialize Undo Tree
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Thu Mar 14 15:28:48 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Thu Aug 8 16:08:13 2019 (-0400)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d undo-tree
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes undo-tree
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
;; UndoTreePac
|
||||
(use-package undo-tree
|
||||
:defer t
|
||||
:diminish undo-tree-mode
|
||||
:init (global-undo-tree-mode))
|
||||
;; -UndoTreePac
|
||||
|
||||
(provide 'init-undo-tree)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-undo-tree.el ends here
|
81
elisp/init-webdev.el
Normal file
81
elisp/init-webdev.el
Normal file
@ -0,0 +1,81 @@
|
||||
;;; init-webdev.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-webdev.el
|
||||
;; Description: Initialize Web, Emmet, JS2, TypeScript, Tide
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Fri Mar 15 11:03:43 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Tue Dec 24 12:03:28 2019 (-0500)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d web-mode js2-mode typescript-mode emmet instant-rename-tag json-mode
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes web-mode js2-mode typescript-mode emmet instant-rename-tag instant-rename-tag
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
;; WebModePac
|
||||
(use-package web-mode
|
||||
:custom-face
|
||||
(css-selector ((t (:inherit default :foreground "#66CCFF"))))
|
||||
(font-lock-comment-face ((t (:foreground "#828282"))))
|
||||
:mode
|
||||
("\\.phtml\\'" "\\.tpl\\.php\\'" "\\.[agj]sp\\'" "\\.as[cp]x\\'"
|
||||
"\\.erb\\'" "\\.mustache\\'" "\\.djhtml\\'" "\\.[t]?html?\\'"))
|
||||
;; -WebModePac
|
||||
|
||||
;; Js2Pac
|
||||
(use-package js2-mode
|
||||
:mode "\\.js\\'"
|
||||
:interpreter "node")
|
||||
;; -Js2Pac
|
||||
|
||||
;; TypeScriptPac
|
||||
(use-package typescript-mode
|
||||
:mode "\\.ts\\'"
|
||||
:commands (typescript-mode))
|
||||
;; -TypeScriptPac
|
||||
|
||||
;; EmmetPac
|
||||
(use-package emmet-mode
|
||||
:hook ((web-mode . emmet-mode)
|
||||
(css-mode . emmet-mode)))
|
||||
;; -EmmetPac
|
||||
|
||||
;; InstantRenameTagPac
|
||||
(use-package instant-rename-tag
|
||||
:load-path (lambda () (expand-file-name "site-elisp/instant-rename-tag" user-emacs-directory))
|
||||
:bind ("C-z <" . instant-rename-tag))
|
||||
;; -InstantRenameTagPac
|
||||
|
||||
;; JsonPac
|
||||
(use-package json-mode
|
||||
:mode "\\.json\\'")
|
||||
;; -JsonPac
|
||||
|
||||
(provide 'init-webdev)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-webdev.el ends here
|
52
elisp/init-which-key.el
Normal file
52
elisp/init-which-key.el
Normal file
@ -0,0 +1,52 @@
|
||||
;;; init-which-key.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-which-key.el
|
||||
;; Description: Initialize Which-key
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Thu Mar 14 15:06:27 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Thu Aug 8 16:08:23 2019 (-0400)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d which-key
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes which-key
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
;; WhichKeyPac
|
||||
(use-package which-key
|
||||
:diminish
|
||||
:custom
|
||||
(which-key-separator " ")
|
||||
(which-key-prefix-prefix "+")
|
||||
:config
|
||||
(which-key-mode))
|
||||
;; -WhichKeyPac
|
||||
|
||||
(provide 'init-which-key)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-which-key.el ends here
|
61
elisp/init-winner.el
Normal file
61
elisp/init-winner.el
Normal file
@ -0,0 +1,61 @@
|
||||
;;; init-winner.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-winner.el
|
||||
;; Description: Initialize Winner Mode
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Thu Mar 14 14:39:31 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Thu Aug 8 16:08:26 2019 (-0400)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d winner
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes winner mode
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
;; WinnerPac
|
||||
(use-package winner
|
||||
:ensure nil
|
||||
:custom
|
||||
(winner-boring-buffers
|
||||
'("*Completions*"
|
||||
"*Compile-Log*"
|
||||
"*inferior-lisp*"
|
||||
"*Fuzzy Completions*"
|
||||
"*Apropos*"
|
||||
"*Help*"
|
||||
"*cvs*"
|
||||
"*Buffer List*"
|
||||
"*Ibuffer*"
|
||||
"*esh command on file*"))
|
||||
:config
|
||||
(winner-mode 1))
|
||||
;; -WinnerPac
|
||||
|
||||
(provide 'init-winner)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-winner.el ends here
|
66
elisp/init-yasnippet.el
Normal file
66
elisp/init-yasnippet.el
Normal file
@ -0,0 +1,66 @@
|
||||
;;; init-yasnippet.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-yasnippet.el
|
||||
;; Description: Initialize YASnippet
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Tue Apr 23 23:08:17 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Sat Dec 14 20:56:21 2019 (-0500)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d yasnippet
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes YASnippet
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
;; YASnippetPac
|
||||
(use-package yasnippet
|
||||
:diminish yas-minor-mode
|
||||
:init
|
||||
(use-package yasnippet-snippets :after yasnippet)
|
||||
:hook ((prog-mode LaTeX-mode org-mode) . yas-minor-mode)
|
||||
:bind
|
||||
(:map yas-minor-mode-map ("C-c C-n" . yas-expand-from-trigger-key))
|
||||
(:map yas-keymap
|
||||
(("TAB" . smarter-yas-expand-next-field)
|
||||
([(tab)] . smarter-yas-expand-next-field)))
|
||||
:config
|
||||
(yas-reload-all)
|
||||
(defun smarter-yas-expand-next-field ()
|
||||
"Try to `yas-expand' then `yas-next-field' at current cursor position."
|
||||
(interactive)
|
||||
(let ((old-point (point))
|
||||
(old-tick (buffer-chars-modified-tick)))
|
||||
(yas-expand)
|
||||
(when (and (eq old-point (point))
|
||||
(eq old-tick (buffer-chars-modified-tick)))
|
||||
(ignore-errors (yas-next-field))))))
|
||||
;; -YASnippetPac
|
||||
|
||||
(provide 'init-yasnippet)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-yasnippet.el ends here
|
59
elisp/init-zone.el
Normal file
59
elisp/init-zone.el
Normal file
@ -0,0 +1,59 @@
|
||||
;;; init-zone.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init-zone.el
|
||||
;; Description: Initialize Zone
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Thu Mar 14 17:38:34 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Fri Sep 13 00:41:28 2019 (-0400)
|
||||
;; By: Mingde (Matthew) Zeng
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d zone
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This initializes zone mode
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
;; ZonePac
|
||||
(use-package zone
|
||||
:ensure nil
|
||||
:defer 5
|
||||
:config
|
||||
;; (zone-when-idle 600) ; in seconds
|
||||
(defun zone-choose (pgm)
|
||||
"Choose a PGM to run for `zone'."
|
||||
(interactive
|
||||
(list
|
||||
(completing-read
|
||||
"Program: "
|
||||
(mapcar 'symbol-name zone-programs))))
|
||||
(let ((zone-programs (list (intern pgm))))
|
||||
(zone))))
|
||||
;; -ZonePac
|
||||
|
||||
(provide 'init-zone)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init-zone.el ends here
|
BIN
images/KEC_Dark_BK.png
Normal file
BIN
images/KEC_Dark_BK.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 86 KiB |
BIN
images/KEC_Dark_BK_Small.png
Normal file
BIN
images/KEC_Dark_BK_Small.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 92 KiB |
BIN
images/KEC_Light_BK.png
Normal file
BIN
images/KEC_Light_BK.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 92 KiB |
BIN
images/KEC_Light_BK_Small.png
Normal file
BIN
images/KEC_Light_BK_Small.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 94 KiB |
232
init.el
Normal file
232
init.el
Normal file
@ -0,0 +1,232 @@
|
||||
;;; init.el --- -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Filename: init.el
|
||||
;; Description: Initialize M-EMACS
|
||||
;; Author: Mingde (Matthew) Zeng
|
||||
;; Copyright (C) 2019 Mingde (Matthew) Zeng
|
||||
;; Created: Thu Mar 14 10:15:28 2019 (-0400)
|
||||
;; Version: 2.0.0
|
||||
;; Last-Updated: Sat Dec 28 18:41:54 2019 (+0100)
|
||||
;; By: Mikaël Capelle
|
||||
;; URL: https://github.com/MatthewZMD/.emacs.d
|
||||
;; Keywords: M-EMACS .emacs.d init
|
||||
;; Compatibility: emacs-version >= 26.1
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This is the init.el file for M-EMACS
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
;; CheckVer
|
||||
(cond ((version< emacs-version "26.1")
|
||||
(warn "M-EMACS requires Emacs 26.1 and above!"))
|
||||
((let* ((early-init-f (expand-file-name "early-init.el" user-emacs-directory))
|
||||
(early-init-do-not-edit-d (expand-file-name "early-init-do-not-edit/" user-emacs-directory))
|
||||
(early-init-do-not-edit-f (expand-file-name "early-init.el" early-init-do-not-edit-d)))
|
||||
(and (version< emacs-version "27")
|
||||
(or (not (file-exists-p early-init-do-not-edit-f))
|
||||
(file-newer-than-file-p early-init-f early-init-do-not-edit-f)))
|
||||
(make-directory early-init-do-not-edit-d t)
|
||||
(copy-file early-init-f early-init-do-not-edit-f t t t t)
|
||||
(add-to-list 'load-path early-init-do-not-edit-d)
|
||||
(require 'early-init))))
|
||||
;; -CheckVer
|
||||
|
||||
;; BetterGC
|
||||
(defvar better-gc-cons-threshold 67108864 ; 64mb
|
||||
"The default value to use for `gc-cons-threshold'.
|
||||
|
||||
If you experience freezing, decrease this. If you experience stuttering,
|
||||
increase this.")
|
||||
|
||||
(add-hook 'emacs-startup-hook
|
||||
(lambda ()
|
||||
(setq gc-cons-threshold better-gc-cons-threshold)
|
||||
(setq file-name-handler-alist file-name-handler-alist-original)
|
||||
(makunbound 'file-name-handler-alist-original)))
|
||||
;; -BetterGC
|
||||
|
||||
;; AutoGC
|
||||
(add-hook 'emacs-startup-hook
|
||||
(lambda ()
|
||||
(if (boundp 'after-focus-change-function)
|
||||
(add-function :after after-focus-change-function
|
||||
(lambda ()
|
||||
(unless (frame-focus-state)
|
||||
(garbage-collect))))
|
||||
(add-hook 'after-focus-change-function 'garbage-collect))
|
||||
;; -AutoGC MinibufferGC
|
||||
(defun gc-minibuffer-setup-hook ()
|
||||
(setq gc-cons-threshold (* better-gc-cons-threshold 2)))
|
||||
|
||||
(defun gc-minibuffer-exit-hook ()
|
||||
(garbage-collect)
|
||||
(setq gc-cons-threshold better-gc-cons-threshold))
|
||||
|
||||
(add-hook 'minibuffer-setup-hook #'gc-minibuffer-setup-hook)
|
||||
(add-hook 'minibuffer-exit-hook #'gc-minibuffer-exit-hook)))
|
||||
;; -MinibufferGC
|
||||
|
||||
;; LoadPath
|
||||
(defun update-to-load-path (folder)
|
||||
"Update FOLDER and its subdirectories to `load-path'."
|
||||
(let ((base folder))
|
||||
(unless (member base load-path)
|
||||
(add-to-list 'load-path base))
|
||||
(dolist (f (directory-files base))
|
||||
(let ((name (concat base "/" f)))
|
||||
(when (and (file-directory-p name)
|
||||
(not (equal f ".."))
|
||||
(not (equal f ".")))
|
||||
(unless (member base load-path)
|
||||
(add-to-list 'load-path name)))))))
|
||||
|
||||
(update-to-load-path (expand-file-name "elisp" user-emacs-directory))
|
||||
(update-to-load-path (expand-file-name "one-file-mode" user-emacs-directory))
|
||||
;; -LoadPath
|
||||
|
||||
;; Constants
|
||||
|
||||
(require 'init-const)
|
||||
|
||||
;; Packages
|
||||
|
||||
;; Package Management
|
||||
(require 'init-package)
|
||||
|
||||
;; Global Functionalities
|
||||
(require 'init-global-config)
|
||||
|
||||
(require 'init-func)
|
||||
|
||||
(require 'init-search)
|
||||
|
||||
(require 'init-crux)
|
||||
|
||||
(require 'init-avy)
|
||||
|
||||
(require 'init-winner)
|
||||
|
||||
(require 'init-which-key)
|
||||
|
||||
(require 'init-popup-kill-ring)
|
||||
|
||||
(require 'init-undo-tree)
|
||||
|
||||
(require 'init-discover-my-major)
|
||||
|
||||
(require 'init-ace-window)
|
||||
|
||||
(require 'init-shell)
|
||||
|
||||
(require 'init-dired)
|
||||
|
||||
;; User Interface Enhancements
|
||||
(require 'init-ui-config)
|
||||
|
||||
(require 'init-all-the-icons)
|
||||
|
||||
(require 'init-theme)
|
||||
|
||||
(require 'init-dashboard)
|
||||
|
||||
(require 'init-fonts)
|
||||
|
||||
(require 'init-scroll)
|
||||
|
||||
;; General Programming
|
||||
(require 'init-magit)
|
||||
|
||||
(require 'init-projectile)
|
||||
|
||||
(require 'init-treemacs)
|
||||
|
||||
(require 'init-yasnippet)
|
||||
|
||||
(require 'init-flycheck)
|
||||
|
||||
(require 'init-dumb-jump)
|
||||
|
||||
(require 'init-parens)
|
||||
|
||||
(require 'init-indent)
|
||||
|
||||
(require 'init-quickrun)
|
||||
|
||||
(require 'init-format)
|
||||
|
||||
(require 'init-comment)
|
||||
|
||||
(require 'init-edit)
|
||||
|
||||
(require 'init-header)
|
||||
|
||||
(require 'init-ein)
|
||||
|
||||
;; (require 'init-lsp)
|
||||
|
||||
(require 'init-company)
|
||||
|
||||
;; Programming
|
||||
|
||||
(require 'init-java)
|
||||
|
||||
(require 'init-cc)
|
||||
|
||||
(require 'init-python)
|
||||
|
||||
(require 'init-latex)
|
||||
|
||||
(require 'init-ess)
|
||||
|
||||
;; Web Development
|
||||
(require 'init-webdev)
|
||||
|
||||
;; Miscellaneous
|
||||
(require 'init-org)
|
||||
|
||||
(require 'init-eaf)
|
||||
|
||||
(require 'init-erc)
|
||||
|
||||
(require 'init-eww)
|
||||
|
||||
;; (require 'init-mu4e)
|
||||
|
||||
(require 'init-tramp)
|
||||
|
||||
(require 'init-pdf)
|
||||
|
||||
(require 'init-leetcode)
|
||||
|
||||
(require 'init-pyim)
|
||||
|
||||
(require 'init-epaint)
|
||||
|
||||
(require 'init-games)
|
||||
|
||||
(require 'init-zone)
|
||||
|
||||
(provide 'init)
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; init.el ends here
|
413
one-file-mode/bind-key.el
Normal file
413
one-file-mode/bind-key.el
Normal file
@ -0,0 +1,413 @@
|
||||
;;; bind-key.el --- A simple way to manage personal keybindings
|
||||
|
||||
;; Copyright (c) 2012-2015 john wiegley
|
||||
|
||||
;; Author: John Wiegley <jwiegley@gmail.com>
|
||||
;; Maintainer: John Wiegley <jwiegley@gmail.com>
|
||||
;; Created: 16 Jun 2012
|
||||
;; Version: 1.0
|
||||
;; Keywords: keys keybinding config dotemacs
|
||||
;; URL: https://github.com/jwiegley/use-package
|
||||
|
||||
;; 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 2, 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 gnu emacs; see the file copying. if not, write to the
|
||||
;; free software foundation, inc., 59 temple place - suite 330,
|
||||
;; boston, ma 02111-1307, usa.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; If you have lots of keybindings set in your .emacs file, it can be hard to
|
||||
;; know which ones you haven't set yet, and which may now be overriding some
|
||||
;; new default in a new emacs version. This module aims to solve that
|
||||
;; problem.
|
||||
;;
|
||||
;; Bind keys as follows in your .emacs:
|
||||
;;
|
||||
;; (require 'bind-key)
|
||||
;;
|
||||
;; (bind-key "C-c x" 'my-ctrl-c-x-command)
|
||||
;;
|
||||
;; If you want the keybinding to override all minor modes that may also bind
|
||||
;; the same key, use the `bind-key*' form:
|
||||
;;
|
||||
;; (bind-key* "<C-return>" 'other-window)
|
||||
;;
|
||||
;; If you want to rebind a key only in a particular keymap, use:
|
||||
;;
|
||||
;; (bind-key "C-c x" 'my-ctrl-c-x-command some-other-mode-map)
|
||||
;;
|
||||
;; To unbind a key within a keymap (for example, to stop your favorite major
|
||||
;; mode from changing a binding that you don't want to override everywhere),
|
||||
;; use `unbind-key':
|
||||
;;
|
||||
;; (unbind-key "C-c x" some-other-mode-map)
|
||||
;;
|
||||
;; To bind multiple keys at once, or set up a prefix map, a `bind-keys' macro
|
||||
;; is provided. It accepts keyword arguments, please see its documentation
|
||||
;; for a detailed description.
|
||||
;;
|
||||
;; To add keys into a specific map, use :map argument
|
||||
;;
|
||||
;; (bind-keys :map dired-mode-map
|
||||
;; ("o" . dired-omit-mode)
|
||||
;; ("a" . some-custom-dired-function))
|
||||
;;
|
||||
;; To set up a prefix map, use `:prefix-map' and `:prefix' arguments (both are
|
||||
;; required)
|
||||
;;
|
||||
;; (bind-keys :prefix-map my-customize-prefix-map
|
||||
;; :prefix "C-c c"
|
||||
;; ("f" . customize-face)
|
||||
;; ("v" . customize-variable))
|
||||
;;
|
||||
;; You can combine all the keywords together. Additionally,
|
||||
;; `:prefix-docstring' can be specified to set documentation of created
|
||||
;; `:prefix-map' variable.
|
||||
;;
|
||||
;; To bind multiple keys in a `bind-key*' way (to be sure that your bindings
|
||||
;; will not be overridden by other modes), you may use `bind-keys*' macro:
|
||||
;;
|
||||
;; (bind-keys*
|
||||
;; ("C-o" . other-window)
|
||||
;; ("C-M-n" . forward-page)
|
||||
;; ("C-M-p" . backward-page))
|
||||
;;
|
||||
;; After Emacs loads, you can see a summary of all your personal keybindings
|
||||
;; currently in effect with this command:
|
||||
;;
|
||||
;; M-x describe-personal-keybindings
|
||||
;;
|
||||
;; This display will tell you if you've overriden a default keybinding, and
|
||||
;; what the default was. Also, it will tell you if the key was rebound after
|
||||
;; your binding it with `bind-key', and what it was rebound it to.
|
||||
|
||||
(require 'cl-lib)
|
||||
(require 'easy-mmode)
|
||||
|
||||
(defgroup bind-key nil
|
||||
"A simple way to manage personal keybindings"
|
||||
:group 'emacs)
|
||||
|
||||
(defcustom bind-key-column-widths '(18 . 40)
|
||||
"Width of columns in `describe-personal-keybindings'."
|
||||
:type '(cons integer integer)
|
||||
:group 'bind-key)
|
||||
|
||||
(defcustom bind-key-segregation-regexp
|
||||
"\\`\\(\\(C-[chx] \\|M-[gso] \\)\\([CM]-\\)?\\|.+-\\)"
|
||||
"Regular expression used to divide key sets in the output from
|
||||
\\[describe-personal-keybindings]."
|
||||
:type 'regexp
|
||||
:group 'bind-key)
|
||||
|
||||
(defcustom bind-key-describe-special-forms nil
|
||||
"If non-nil, extract docstrings from lambdas, closures and keymaps if possible."
|
||||
:type 'boolean
|
||||
:group 'bind-key)
|
||||
|
||||
;; Create override-global-mode to force key remappings
|
||||
|
||||
(defvar override-global-map (make-keymap)
|
||||
"override-global-mode keymap")
|
||||
|
||||
(define-minor-mode override-global-mode
|
||||
"A minor mode so that keymap settings override other modes."
|
||||
t "")
|
||||
|
||||
;; the keymaps in `emulation-mode-map-alists' take precedence over
|
||||
;; `minor-mode-map-alist'
|
||||
(add-to-list 'emulation-mode-map-alists
|
||||
`((override-global-mode . ,override-global-map)))
|
||||
|
||||
(defvar personal-keybindings nil
|
||||
"List of bindings performed by `bind-key'.
|
||||
|
||||
Elements have the form ((KEY . [MAP]) CMD ORIGINAL-CMD)")
|
||||
|
||||
;;;###autoload
|
||||
(defmacro bind-key (key-name command &optional keymap predicate)
|
||||
"Bind KEY-NAME to COMMAND in KEYMAP (`global-map' if not passed).
|
||||
|
||||
KEY-NAME may be a vector, in which case it is passed straight to
|
||||
`define-key'. Or it may be a string to be interpreted as
|
||||
spelled-out keystrokes, e.g., \"C-c C-z\". See documentation of
|
||||
`edmacro-mode' for details.
|
||||
|
||||
If PREDICATE is non-nil, it is a form evaluated to determine when
|
||||
a key should be bound. It must return non-nil in such cases.
|
||||
Emacs can evaluate this form at any time that it does redisplay
|
||||
or operates on menu data structures, so you should write it so it
|
||||
can safely be called at any time."
|
||||
(let ((namevar (make-symbol "name"))
|
||||
(keyvar (make-symbol "key"))
|
||||
(kdescvar (make-symbol "kdesc"))
|
||||
(bindingvar (make-symbol "binding")))
|
||||
`(let* ((,namevar ,key-name)
|
||||
(,keyvar (if (vectorp ,namevar) ,namevar
|
||||
(read-kbd-macro ,namevar)))
|
||||
(,kdescvar (cons (if (stringp ,namevar) ,namevar
|
||||
(key-description ,namevar))
|
||||
(quote ,keymap)))
|
||||
(,bindingvar (lookup-key (or ,keymap global-map) ,keyvar)))
|
||||
(add-to-list 'personal-keybindings
|
||||
(list ,kdescvar ,command
|
||||
(unless (numberp ,bindingvar) ,bindingvar)))
|
||||
,(if predicate
|
||||
`(define-key (or ,keymap global-map) ,keyvar
|
||||
'(menu-item "" nil :filter (lambda (&optional _)
|
||||
(when ,predicate
|
||||
,command))))
|
||||
`(define-key (or ,keymap global-map) ,keyvar ,command)))))
|
||||
|
||||
;;;###autoload
|
||||
(defmacro unbind-key (key-name &optional keymap)
|
||||
"Unbind the given KEY-NAME, within the KEYMAP (if specified).
|
||||
See `bind-key' for more details."
|
||||
`(progn
|
||||
(bind-key ,key-name nil ,keymap)
|
||||
(setq personal-keybindings
|
||||
(cl-delete-if #'(lambda (k)
|
||||
,(if keymap
|
||||
`(and (consp (car k))
|
||||
(string= (caar k) ,key-name)
|
||||
(eq (cdar k) ',keymap))
|
||||
`(and (stringp (car k))
|
||||
(string= (car k) ,key-name))))
|
||||
personal-keybindings))))
|
||||
|
||||
;;;###autoload
|
||||
(defmacro bind-key* (key-name command &optional predicate)
|
||||
"Similar to `bind-key', but overrides any mode-specific bindings."
|
||||
`(bind-key ,key-name ,command override-global-map ,predicate))
|
||||
|
||||
(defun bind-keys-form (args)
|
||||
"Bind multiple keys at once.
|
||||
|
||||
Accepts keyword arguments:
|
||||
:map MAP - a keymap into which the keybindings should be
|
||||
added
|
||||
:prefix KEY - prefix key for these bindings
|
||||
:prefix-map MAP - name of the prefix map that should be created
|
||||
for these bindings
|
||||
:prefix-docstring STR - docstring for the prefix-map variable
|
||||
:menu-name NAME - optional menu string for prefix map
|
||||
:filter FORM - optional form to determine when bindings apply
|
||||
|
||||
The rest of the arguments are conses of keybinding string and a
|
||||
function symbol (unquoted)."
|
||||
;; jww (2016-02-26): This is a hack; this whole function needs to be
|
||||
;; rewritten to normalize arguments the way that use-package.el does.
|
||||
(if (and (eq (car args) :package)
|
||||
(not (eq (car (cdr (cdr args))) :map)))
|
||||
(setq args (cons :map (cons 'global-map args))))
|
||||
(let* ((map (plist-get args :map))
|
||||
(doc (plist-get args :prefix-docstring))
|
||||
(prefix-map (plist-get args :prefix-map))
|
||||
(prefix (plist-get args :prefix))
|
||||
(filter (plist-get args :filter))
|
||||
(menu-name (plist-get args :menu-name))
|
||||
(pkg (plist-get args :package))
|
||||
(key-bindings (progn
|
||||
(while (keywordp (car args))
|
||||
(pop args)
|
||||
(pop args))
|
||||
args)))
|
||||
(when (or (and prefix-map (not prefix))
|
||||
(and prefix (not prefix-map)))
|
||||
(error "Both :prefix-map and :prefix must be supplied"))
|
||||
(when (and menu-name (not prefix))
|
||||
(error "If :menu-name is supplied, :prefix must be too"))
|
||||
(let ((args key-bindings)
|
||||
saw-map first next)
|
||||
(while args
|
||||
(if (keywordp (car args))
|
||||
(progn
|
||||
(setq next args)
|
||||
(setq args nil))
|
||||
(if first
|
||||
(nconc first (list (car args)))
|
||||
(setq first (list (car args))))
|
||||
(setq args (cdr args))))
|
||||
(cl-flet
|
||||
((wrap (map bindings)
|
||||
(if (and map pkg (not (eq map 'global-map)))
|
||||
(if (boundp map)
|
||||
bindings
|
||||
`((eval-after-load
|
||||
,(if (symbolp pkg) `',pkg pkg)
|
||||
'(progn ,@bindings))))
|
||||
bindings)))
|
||||
(append
|
||||
(when prefix-map
|
||||
`((defvar ,prefix-map)
|
||||
,@(when doc `((put ',prefix-map 'variable-documentation ,doc)))
|
||||
,@(if menu-name
|
||||
`((define-prefix-command ',prefix-map nil ,menu-name))
|
||||
`((define-prefix-command ',prefix-map)))
|
||||
,@(if (and map (not (eq map 'global-map)))
|
||||
(wrap map `((bind-key ,prefix ',prefix-map ,map ,filter)))
|
||||
`((bind-key ,prefix ',prefix-map nil ,filter)))))
|
||||
(wrap map
|
||||
(cl-mapcan
|
||||
(lambda (form)
|
||||
(if prefix-map
|
||||
`((bind-key ,(car form) ',(cdr form) ,prefix-map ,filter))
|
||||
(if (and map (not (eq map 'global-map)))
|
||||
`((bind-key ,(car form) ',(cdr form) ,map ,filter))
|
||||
`((bind-key ,(car form) ',(cdr form) nil ,filter)))))
|
||||
first))
|
||||
(when next
|
||||
(bind-keys-form
|
||||
(if pkg
|
||||
(cons :package (cons pkg next))
|
||||
next))))))))
|
||||
|
||||
;;;###autoload
|
||||
(defmacro bind-keys (&rest args)
|
||||
"Bind multiple keys at once.
|
||||
|
||||
Accepts keyword arguments:
|
||||
:map MAP - a keymap into which the keybindings should be
|
||||
added
|
||||
:prefix KEY - prefix key for these bindings
|
||||
:prefix-map MAP - name of the prefix map that should be created
|
||||
for these bindings
|
||||
:prefix-docstring STR - docstring for the prefix-map variable
|
||||
:menu-name NAME - optional menu string for prefix map
|
||||
:filter FORM - optional form to determine when bindings apply
|
||||
|
||||
The rest of the arguments are conses of keybinding string and a
|
||||
function symbol (unquoted)."
|
||||
(macroexp-progn (bind-keys-form args)))
|
||||
|
||||
;;;###autoload
|
||||
(defmacro bind-keys* (&rest args)
|
||||
(macroexp-progn
|
||||
(bind-keys-form `(:map override-global-map ,@args))))
|
||||
|
||||
(defun get-binding-description (elem)
|
||||
(cond
|
||||
((listp elem)
|
||||
(cond
|
||||
((eq 'lambda (car elem))
|
||||
(if (and bind-key-describe-special-forms
|
||||
(stringp (nth 2 elem)))
|
||||
(nth 2 elem)
|
||||
"#<lambda>"))
|
||||
((eq 'closure (car elem))
|
||||
(if (and bind-key-describe-special-forms
|
||||
(stringp (nth 3 elem)))
|
||||
(nth 3 elem)
|
||||
"#<closure>"))
|
||||
((eq 'keymap (car elem))
|
||||
"#<keymap>")
|
||||
(t
|
||||
elem)))
|
||||
;; must be a symbol, non-symbol keymap case covered above
|
||||
((and bind-key-describe-special-forms (keymapp elem))
|
||||
(let ((doc (get elem 'variable-documentation)))
|
||||
(if (stringp doc) doc elem)))
|
||||
((symbolp elem)
|
||||
elem)
|
||||
(t
|
||||
"#<byte-compiled lambda>")))
|
||||
|
||||
(defun compare-keybindings (l r)
|
||||
(let* ((regex bind-key-segregation-regexp)
|
||||
(lgroup (and (string-match regex (caar l))
|
||||
(match-string 0 (caar l))))
|
||||
(rgroup (and (string-match regex (caar r))
|
||||
(match-string 0 (caar r))))
|
||||
(lkeymap (cdar l))
|
||||
(rkeymap (cdar r)))
|
||||
(cond
|
||||
((and (null lkeymap) rkeymap)
|
||||
(cons t t))
|
||||
((and lkeymap (null rkeymap))
|
||||
(cons nil t))
|
||||
((and lkeymap rkeymap
|
||||
(not (string= (symbol-name lkeymap) (symbol-name rkeymap))))
|
||||
(cons (string< (symbol-name lkeymap) (symbol-name rkeymap)) t))
|
||||
((and (null lgroup) rgroup)
|
||||
(cons t t))
|
||||
((and lgroup (null rgroup))
|
||||
(cons nil t))
|
||||
((and lgroup rgroup)
|
||||
(if (string= lgroup rgroup)
|
||||
(cons (string< (caar l) (caar r)) nil)
|
||||
(cons (string< lgroup rgroup) t)))
|
||||
(t
|
||||
(cons (string< (caar l) (caar r)) nil)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun describe-personal-keybindings ()
|
||||
"Display all the personal keybindings defined by `bind-key'."
|
||||
(interactive)
|
||||
(with-output-to-temp-buffer "*Personal Keybindings*"
|
||||
(princ (format (concat "Key name%s Command%s Comments\n%s %s "
|
||||
"---------------------\n")
|
||||
(make-string (- (car bind-key-column-widths) 9) ? )
|
||||
(make-string (- (cdr bind-key-column-widths) 8) ? )
|
||||
(make-string (1- (car bind-key-column-widths)) ?-)
|
||||
(make-string (1- (cdr bind-key-column-widths)) ?-)))
|
||||
(let (last-binding)
|
||||
(dolist (binding
|
||||
(setq personal-keybindings
|
||||
(sort personal-keybindings
|
||||
(lambda (l r)
|
||||
(car (compare-keybindings l r))))))
|
||||
|
||||
(if (not (eq (cdar last-binding) (cdar binding)))
|
||||
(princ (format "\n\n%s\n%s\n\n"
|
||||
(cdar binding)
|
||||
(make-string (+ 21 (car bind-key-column-widths)
|
||||
(cdr bind-key-column-widths)) ?-)))
|
||||
(if (and last-binding
|
||||
(cdr (compare-keybindings last-binding binding)))
|
||||
(princ "\n")))
|
||||
|
||||
(let* ((key-name (caar binding))
|
||||
(at-present (lookup-key (or (symbol-value (cdar binding))
|
||||
(current-global-map))
|
||||
(read-kbd-macro key-name)))
|
||||
(command (nth 1 binding))
|
||||
(was-command (nth 2 binding))
|
||||
(command-desc (get-binding-description command))
|
||||
(was-command-desc (and was-command
|
||||
(get-binding-description was-command)))
|
||||
(at-present-desc (get-binding-description at-present))
|
||||
)
|
||||
(let ((line
|
||||
(format
|
||||
(format "%%-%ds%%-%ds%%s\n" (car bind-key-column-widths)
|
||||
(cdr bind-key-column-widths))
|
||||
key-name (format "`%s\'" command-desc)
|
||||
(if (string= command-desc at-present-desc)
|
||||
(if (or (null was-command)
|
||||
(string= command-desc was-command-desc))
|
||||
""
|
||||
(format "was `%s\'" was-command-desc))
|
||||
(format "[now: `%s\']" at-present)))))
|
||||
(princ (if (string-match "[ \t]+\n" line)
|
||||
(replace-match "\n" t t line)
|
||||
line))))
|
||||
|
||||
(setq last-binding binding)))))
|
||||
|
||||
(provide 'bind-key)
|
||||
|
||||
;; Local Variables:
|
||||
;; indent-tabs-mode: nil
|
||||
;; End:
|
||||
|
||||
;;; bind-key.el ends here
|
56
one-file-mode/c++1x-minor-mode.el
Normal file
56
one-file-mode/c++1x-minor-mode.el
Normal file
@ -0,0 +1,56 @@
|
||||
(require 'font-lock)
|
||||
;;###autoload
|
||||
(define-minor-mode c++1x-minor-mode
|
||||
"Extra highlighting for c++-mode that includes c++11 and c++14 keywords and features"
|
||||
:lighter "c++1x"
|
||||
|
||||
(defun --copy-face (new-face face)
|
||||
"Define NEW-FACE from existing FACE."
|
||||
(copy-face face new-face)
|
||||
(eval `(defvar ,new-face nil))
|
||||
(set new-face new-face))
|
||||
|
||||
(--copy-face 'font-lock-label-face ; labels, case, public, private, proteced, namespace-tags
|
||||
'font-lock-keyword-face)
|
||||
(--copy-face 'font-lock-doc-markup-face ; comment markups such as Javadoc-tags
|
||||
'font-lock-doc-face)
|
||||
(--copy-face 'font-lock-doc-string-face ; comment markups
|
||||
'font-lock-comment-face)
|
||||
|
||||
(global-font-lock-mode t)
|
||||
(setq font-lock-maximum-decoration t)
|
||||
|
||||
|
||||
(font-lock-add-keywords
|
||||
nil '(;; complete some fundamental keywords
|
||||
("\\<\\(void\\|unsigned\\|signed\\|char\\|short\\|bool\\|int\\|long\\|float\\|double\\)\\>" . font-lock-keyword-face)
|
||||
;; add the new C++11 keywords
|
||||
("\\<\\(alignof\\|alignas\\|constexpr\\|noexcept\\|\\|static_assert\\|thread_local\\|override\\|final\\)\\>" . font-lock-keyword-face)
|
||||
("\\<\\(decltype\\)\\>" . font-lock-builtin-face)
|
||||
("\\<\\(nullptr\\)\\>" . font-lock-constant-face)
|
||||
("\\<\\(char[0-9]+_t\\)\\>" . font-lock-keyword-face)
|
||||
;; PREPROCESSOR_CONSTANT
|
||||
("\\<[A-Z]+[A-Z_]+\\>" . font-lock-constant-face)
|
||||
;; hexadecimal numbers
|
||||
("\\<0[xX][0-9A-Fa-f]+\\>" . font-lock-constant-face)
|
||||
;; integer/float/scientific numbers
|
||||
("\\<[\\-+]*[0-9]*\\.?[0-9]+\\([ulUL]+\\|[eE][\\-+]?[0-9]+\\)?\\>" . font-lock-constant-face)
|
||||
;; c++11 string literals
|
||||
;; L"wide string"
|
||||
;; L"wide string with UNICODE codepoint: \u2018"
|
||||
;; u8"UTF-8 string", u"UTF-16 string", U"UTF-32 string"
|
||||
("\\<\\([LuU8]+\\)\".*?\"" 1 font-lock-keyword-face)
|
||||
;; R"(user-defined literal)"
|
||||
;; R"( a "quot'd" string )"
|
||||
;; R"delimiter(The String Data" )delimiter"
|
||||
;; R"delimiter((a-z))delimiter" is equivalent to "(a-z)"
|
||||
("\\(\\<[uU8]*R\"[^\\s-\\\\()]\\{0,16\\}(\\)" 1 font-lock-keyword-face t) ; start delimiter
|
||||
( "\\<[uU8]*R\"[^\\s-\\\\()]\\{0,16\\}(\\(.*?\\))[^\\s-\\\\()]\\{0,16\\}\"" 1 font-lock-string-face t) ; actual string
|
||||
( "\\<[uU8]*R\"[^\\s-\\\\()]\\{0,16\\}(.*?\\()[^\\s-\\\\()]\\{0,16\\}\"\\)" 1 font-lock-keyword-face t) ; end delimiter
|
||||
|
||||
)))
|
||||
|
||||
;;###autoload
|
||||
(add-hook 'c++-mode-hook 'c++1x-minor-mode)
|
||||
|
||||
(provide 'c++1x-minor-mode)
|
928
one-file-mode/doc-mode.el
Normal file
928
one-file-mode/doc-mode.el
Normal file
@ -0,0 +1,928 @@
|
||||
;;; doc-mode.el --- convenient editing of in-code documentation
|
||||
;;
|
||||
;; Copyright (C) 2007, 2009 Nikolaj Schumacher
|
||||
;; Author: Nikolaj Schumacher <bugs * nschum de>
|
||||
;; Version: 0.2
|
||||
;; Keywords: convenience tools
|
||||
;; URL: http://nschum.de/src/emacs/doc-mode/
|
||||
;; Compatibility: GNU Emacs 22.x, GNU Emacs 23.x
|
||||
;;
|
||||
;; This file is NOT part of GNU Emacs.
|
||||
;;
|
||||
;; 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 2
|
||||
;; 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/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This mode requires the Semantic package to be installed and running:
|
||||
;; http://cedet.sourceforge.net/
|
||||
;;
|
||||
;; doc-mode allows easy creation and editing of JavaDoc or Doxygen comment
|
||||
;; blocks in your code. It also greatly improves readability of code by folding
|
||||
;; the blocks, so they don't take up precious screen lines.
|
||||
;;
|
||||
;; Add the following to your .emacs file:
|
||||
;; (require 'doc-mode)
|
||||
;; (add-hook 'c-mode-common-hook 'doc-mode)
|
||||
;;
|
||||
;; The command `doc-mode-fix-tag-doc' or "C-cdd" adds or replaces the
|
||||
;; documentation for the function, variable, or class at point.
|
||||
;; `doc-mode-remove-tag-doc' or "C-cdr" removes it.
|
||||
;;
|
||||
;; You can fold the comments by using `doc-mode-toggle-tag-doc-folding' or
|
||||
;; `doc-mode-fold-all'.
|
||||
;;
|
||||
;;; Change Log:
|
||||
;;
|
||||
;; 2009-03-22 (0.2)
|
||||
;; Added `doc-mode-keywords-from-tag-func' as customizable option.
|
||||
;; Improved parameter list change recognition.
|
||||
;; `doc-mode-jump-to-template' now enables jumping to the latest comment.
|
||||
;; `doc-mode-first-template' now jumps to the first template in this buffer.
|
||||
;;
|
||||
;; 2007-09-09 (0.1.1)
|
||||
;; Fixed return value detection.
|
||||
;; Actual keyword highlighting.
|
||||
;;
|
||||
;; 2007-09-07 (0.1)
|
||||
;; Initial release.
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile (require 'cl))
|
||||
(require 'semantic)
|
||||
(require 'cc-mode)
|
||||
(require 'newcomment) ;comment-fill-column
|
||||
|
||||
(dolist (err `("^No tag found$" "^Semantic can't parse buffer$"
|
||||
"^No template found$" "^doc-mode not enabled$"))
|
||||
(add-to-list 'debug-ignored-errors err))
|
||||
|
||||
;; semantic-after-auto-parse-hooks
|
||||
|
||||
(defgroup doc-mode nil
|
||||
"Minor mode for editing in-code documentation."
|
||||
:group 'convenience
|
||||
:group 'tools)
|
||||
|
||||
(defcustom doc-mode-auto-check-p t
|
||||
"*Should the buffer documentation be checked after a Semantic reparse."
|
||||
:group 'doc-mode
|
||||
:type '(choice (const :tag "Off" nil)
|
||||
(const :tag "On" t)))
|
||||
|
||||
(defcustom doc-mode-jump-to-template t
|
||||
"*Should the point be moved inside the template after inserting a doc."
|
||||
:group 'doc-mode
|
||||
:type '(choice (const :tag "Off" nil)
|
||||
(const :tag "On" t)))
|
||||
|
||||
(defcustom doc-mode-template-start "/**"
|
||||
"*The string to insert at the beginning of a comment."
|
||||
:group 'doc-mode
|
||||
:type 'string)
|
||||
|
||||
(defcustom doc-mode-template-end " */"
|
||||
"*The string to insert at the end of a comment."
|
||||
:group 'doc-mode
|
||||
:type 'string)
|
||||
|
||||
(defcustom doc-mode-template-continue " * "
|
||||
"*The string to insert at the beginning of each line in a comment."
|
||||
:group 'doc-mode
|
||||
:type 'string)
|
||||
|
||||
(defcustom doc-mode-template-single-line-start "/** "
|
||||
"*The string to insert at the beginning of a single-line comment.
|
||||
For using single-line comments, see `doc-mode-allow-single-line-comments'"
|
||||
:group 'doc-mode
|
||||
:type 'string)
|
||||
|
||||
(defcustom doc-mode-template-single-line-end " */"
|
||||
"*The string to insert at the end of a single-line comment.
|
||||
For using single-line comments, see `doc-mode-allow-single-line-comments'"
|
||||
:group 'doc-mode
|
||||
:type 'string)
|
||||
|
||||
(defcustom doc-mode-template-keyword-char "@"
|
||||
"*The character used to begin keywords."
|
||||
:group 'doc-mode
|
||||
:type '(choice (const :tag "@" "@")
|
||||
(const :tag "\\" "\\")
|
||||
(string :tag "Other")))
|
||||
|
||||
(defcustom doc-mode-template-empty-line-after-summary nil
|
||||
"*Whether to put an empty line after the first one in the comment."
|
||||
:group 'doc-mode
|
||||
:type '(choice (const :tag "Off" nil)
|
||||
(const :tag "On" t)))
|
||||
|
||||
(defcustom doc-mode-template-empty-line-before-keywords nil
|
||||
"*Whether to put an empty line before the keyword list in a comment."
|
||||
:group 'doc-mode
|
||||
:type '(choice (const :tag "Off" nil)
|
||||
(const :tag "On" t)))
|
||||
|
||||
(defcustom doc-mode-template-keywords
|
||||
'("deprecated" "param" "return" "author" "exception" "throws" "version"
|
||||
"since" "see" "sa" "todo")
|
||||
"*Keywords that should be listed in this order.
|
||||
All other keywords will be considered regular text."
|
||||
:group 'doc-mode
|
||||
:type '(repeat string))
|
||||
|
||||
(defcustom doc-mode-allow-single-line-comments t
|
||||
"*Whether to allow a more space-saving format for very short comments.
|
||||
When this is enabled, `doc-mode-template-single-line-start' and
|
||||
`doc-mode-template-single-line-end' will be used to format single-line
|
||||
comments instead of `doc-mode-template-start', `doc-mode-template-end' and
|
||||
`doc-mode-template-continue'."
|
||||
:group 'doc-mode
|
||||
:type '(choice (const :tag "Off" nil)
|
||||
(const :tag "On" t)))
|
||||
|
||||
(defcustom doc-mode-fold-single-line-comments nil
|
||||
"*Whether to bother folding comments that are already a single line."
|
||||
:group 'doc-mode
|
||||
:type '(choice (const :tag "Off" nil)
|
||||
(const :tag "On" t)))
|
||||
|
||||
(defcustom doc-mode-align-keyword-arguments t
|
||||
"*Whether to align the arguments to a keyword continued in the next line.
|
||||
This may also be a number, describing how far to indent the argument list."
|
||||
:group 'doc-mode
|
||||
:type '(choice (const :tag "Off" nil)
|
||||
(integer :tag "Indent" nil)
|
||||
(const :tag "On" t)))
|
||||
|
||||
(defcustom doc-mode-fill-column nil
|
||||
"*The column at which to break text when formatting it.
|
||||
If this is nil, `comment-fill-column' is used."
|
||||
:group 'doc-mode
|
||||
:type '(choice (const :tag "Default" nil)
|
||||
(integer :tag "Fill Column")))
|
||||
|
||||
(defcustom doc-mode-keywords-from-tag-func 'doc-mode-keywords-from-tag
|
||||
"*Function used to generate keywords for a tag.
|
||||
This must be a function that takes two arguments. The first argument is the
|
||||
Semantic tag for which to generate keywords, the second is a list of existing
|
||||
keywords taken from the current doc comment. It should return the new list of
|
||||
keywords. Each element in a keyword list can be either a string or a list with
|
||||
a keyword, optional argument and optional description. Additional entries with
|
||||
undetermined content should be created with `doc-mode-new-keyword'."
|
||||
:group 'doc-mode
|
||||
:type 'function)
|
||||
|
||||
;;; keywords ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defconst doc-mode-font-lock-keywords
|
||||
(eval-when-compile
|
||||
`((,(concat "[\\@]"
|
||||
(regexp-opt
|
||||
'("addindex" "addtogroup" "anchor" "arg" "author" "brief" "callgraph"
|
||||
"callergraph" "category" "code" "cond" "copydoc" "date" "defgroup"
|
||||
"deprecated" "details" "dir" "dontinclude" "dot" "dotfile" "e"
|
||||
"else" "elseif" "em" "endcode" "endcond" "enddot" "endhtmlonly"
|
||||
"endif" "endlatexonly" "endlink" "endmanonly" "endmsc" "endverbatim"
|
||||
"endxmlonly" "example" "f$" "f[" "f]" "file" "fn" "hideinitializer"
|
||||
"htmlinclude" "htmlonly" "if" "ifnot" "image" "include"
|
||||
"includelineno" "ingroup" "internal" "invariant" "latexonly" "li"
|
||||
"line" "link" "mainpage" "manonly" "msc" "name" "nosubgrouping"
|
||||
"note" "overload" "package" "page" "par" "paragraph" "post" "pre"
|
||||
"private" "privatesection" "property" "protected" "protectedsection"
|
||||
"public" "publicsection" "ref" "remarks" "return" "retval" "sa"
|
||||
"section" "see" "serial" "serialData" "serialField"
|
||||
"showinitializer" "since" "skip" "skipline" "subpage" "subsection"
|
||||
"subsubsection" "test" "typedef" "until" "defvar" "verbatim"
|
||||
"verbinclude" "version" "weakgroup" "xmlonly" "xrefitem" "$" "@"
|
||||
"\\" "&" "~" "<" ">" "#" "%") t)
|
||||
"\\>")
|
||||
(0 font-lock-keyword-face prepend))
|
||||
;; don't highlight \n, it's too common in code
|
||||
("@n" (0 font-lock-keyword-face prepend))
|
||||
(,(concat "\\([@\\]"
|
||||
(regexp-opt '("class" "struct" "union" "exception" "enum" "throw"
|
||||
"throws") t)
|
||||
"\\)\\>\\(?:[ \t]+\\(\\sw+\\)\\)?")
|
||||
(1 font-lock-keyword-face prepend)
|
||||
(3 font-lock-type-face prepend))
|
||||
(,(concat "\\([@\\]"
|
||||
(regexp-opt '("param" "param[in]" "param[out]" "param[in+out]" "a"
|
||||
"namespace" "relates" "relatesalso" "def") t)
|
||||
"\\)\\>\\(?:[ \t]+\\(\\sw+\\)\\)?")
|
||||
(1 font-lock-keyword-face prepend)
|
||||
(3 font-lock-variable-name-face prepend))
|
||||
(,(concat "\\([@\\]retval\\)\\>\\(?:[ \t]+\\(\\sw+\\)\\)?")
|
||||
(1 font-lock-keyword-face prepend)
|
||||
(2 font-lock-function-name-face prepend))
|
||||
(,(concat "[@\\]" (regexp-opt '("attention" "warning" "todo" "bug") t)
|
||||
"\\>")
|
||||
(0 font-lock-warning-face prepend))
|
||||
(,(concat "{@"
|
||||
(regexp-opt '("docRoot" "inheritDoc" "link" "linkplain" "value") t)
|
||||
"}")
|
||||
(0 font-lock-keyword-face prepend))
|
||||
("\\([@\\]b\\)[ \t\n]+\\([^ \t\n]+\\)"
|
||||
(1 font-lock-keyword-face prepend)
|
||||
(2 'bold prepend))
|
||||
("\\([@\\]em?\\)[ \t\n]+\\([^ \t\n]+\\)"
|
||||
(1 font-lock-keyword-face prepend)
|
||||
(2 'italic prepend))
|
||||
("\\([@\\][cp]\\)[ \t\n]+\\([^ \t\n]+\\)"
|
||||
(1 font-lock-keyword-face prepend)
|
||||
(2 'underline prepend)))))
|
||||
|
||||
;;; templates ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defvar doc-mode-templates nil)
|
||||
(make-variable-buffer-local 'doc-mode-templates)
|
||||
|
||||
(defun doc-mode-add-template (beg end)
|
||||
(let ((overlay (make-overlay beg (point))))
|
||||
(overlay-put overlay 'intangible t)
|
||||
(overlay-put overlay 'face 'highlight)
|
||||
(overlay-put overlay 'insert-in-front-hooks '(doc-mode-replace-overlay))
|
||||
(overlay-put overlay 'modification-hooks '(doc-mode-delete-overlay))
|
||||
(push overlay doc-mode-templates)))
|
||||
|
||||
(defvar doc-mode-temp nil)
|
||||
|
||||
(defun doc-mode-delete-overlay (ov after-p beg end &optional r)
|
||||
(unless after-p
|
||||
(mapc 'doc-mode-unfold-by-overlay
|
||||
(overlays-in (1- (overlay-start ov)) (1+ (overlay-end ov))))
|
||||
(delete-overlay ov)
|
||||
(setq doc-mode-templates (delq ov doc-mode-templates))))
|
||||
|
||||
(defun doc-mode-replace-overlay (ov after-p beg end &optional r)
|
||||
(unless after-p
|
||||
(let ((inhibit-modification-hooks nil))
|
||||
(delete-region (overlay-start ov) (overlay-end ov)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun doc-mode-next-template (&optional pos limit)
|
||||
"Jump to the next unfinished documentation template in this buffer."
|
||||
(interactive)
|
||||
(unless pos (setq pos (point)))
|
||||
(unless limit (setq limit (point-max)))
|
||||
(let ((min-start limit)
|
||||
start)
|
||||
(dolist (ov doc-mode-templates)
|
||||
(setq start (overlay-start ov))
|
||||
(and (> start pos)
|
||||
(< start min-start)
|
||||
(setq min-start start)))
|
||||
(when (= min-start limit)
|
||||
(error "End of buffer"))
|
||||
(push-mark)
|
||||
(goto-char min-start)))
|
||||
|
||||
;;;###autoload
|
||||
(defun doc-mode-previous-template (&optional pos limit)
|
||||
"Jump to the previous unfinished documentation template in this buffer."
|
||||
(interactive)
|
||||
(unless pos (setq pos (point)))
|
||||
(unless limit (setq limit (point-min)))
|
||||
(let ((max-start limit)
|
||||
start)
|
||||
(dolist (ov doc-mode-templates)
|
||||
(setq start (overlay-start ov))
|
||||
(and (< start pos)
|
||||
(> start max-start)
|
||||
(setq max-start start)))
|
||||
(when (= max-start limit)
|
||||
(error "Beginning of buffer"))
|
||||
(push-mark)
|
||||
(goto-char max-start)))
|
||||
|
||||
;;;###autoload
|
||||
(defun doc-mode-first-template ()
|
||||
"Jump to the first unfinished documentation template in this buffer."
|
||||
(interactive)
|
||||
(condition-case err
|
||||
(doc-mode-next-template (point-min))
|
||||
(error (error "No template found"))))
|
||||
|
||||
;;; mode ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defvar doc-mode-lighter " doc")
|
||||
|
||||
(defvar doc-mode-prefix-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(define-key map "d" 'doc-mode-fix-tag-doc)
|
||||
(define-key map "c" 'doc-mode-check-tag-doc)
|
||||
(define-key map "t" 'doc-mode-toggle-tag-doc-folding)
|
||||
(define-key map "f" 'doc-mode-fold-tag-doc)
|
||||
(define-key map "u" 'doc-mode-unfold-tag-doc)
|
||||
(define-key map "r" 'doc-mode-remove-tag-doc)
|
||||
(define-key map "i" 'doc-mode-add-tag-doc)
|
||||
(define-key map "e" 'doc-mode-next-faulty-doc)
|
||||
(define-key map "n" 'doc-mode-next-template)
|
||||
(define-key map "\C-c" 'doc-mode-check-buffer)
|
||||
(define-key map "\C-f" 'doc-mode-fold-all)
|
||||
(define-key map "\C-u" 'doc-mode-unfold-all)
|
||||
map))
|
||||
|
||||
(defvar doc-mode-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(define-key map "\C-c\C-d" doc-mode-prefix-map)
|
||||
map)
|
||||
"Keymap used for `doc-mode'.")
|
||||
|
||||
;;;###autoload
|
||||
(define-minor-mode doc-mode
|
||||
"Minor mode for editing in-code documentation."
|
||||
nil doc-mode-lighter doc-mode-map
|
||||
(if doc-mode
|
||||
(progn
|
||||
(font-lock-add-keywords nil doc-mode-font-lock-keywords)
|
||||
(when doc-mode-auto-check-p
|
||||
(add-hook 'semantic-after-auto-parse-hooks 'doc-mode-check-buffer
|
||||
nil t)
|
||||
(add-hook 'semantic-after-idle-scheduler-reparse-hooks
|
||||
'doc-mode-check-buffer nil t)))
|
||||
(dolist (ov doc-mode-templates)
|
||||
(delete-overlay ov))
|
||||
(kill-local-variable 'doc-mode-templates)
|
||||
(doc-mode-unfold-all)
|
||||
(font-lock-remove-keywords nil doc-mode-font-lock-keywords)
|
||||
(remove-hook 'semantic-after-auto-parse-hooks 'doc-mode-check-buffer t)
|
||||
(remove-hook 'semantic-after-idle-scheduler-reparse-hooks
|
||||
'doc-mode-check-buffer t))
|
||||
|
||||
(when font-lock-mode
|
||||
(font-lock-fontify-buffer)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defun doc-mode-current-tag ()
|
||||
(when (semantic-parse-tree-unparseable-p)
|
||||
(error "Semantic can't parse buffer"))
|
||||
(when (or (semantic-parse-tree-needs-rebuild-p)
|
||||
(semantic-parse-tree-needs-update-p))
|
||||
(condition-case nil
|
||||
(semantic-fetch-tags)
|
||||
(error (error "Semantic can't parse buffer"))))
|
||||
(save-excursion
|
||||
(or (semantic-current-tag-of-class 'function)
|
||||
(semantic-current-tag-of-class 'variable)
|
||||
(progn (beginning-of-line) (skip-chars-forward " \t\n") nil)
|
||||
(semantic-current-tag-of-class 'function)
|
||||
(semantic-current-tag-of-class 'variable)
|
||||
(if (not (looking-at "/\\*\\*"))
|
||||
(semantic-current-tag-of-class 'type)
|
||||
(progn (search-forward "*/" nil t)
|
||||
(skip-chars-forward " \t\n")
|
||||
nil))
|
||||
(semantic-current-tag-of-class 'function)
|
||||
(semantic-current-tag-of-class 'variable)
|
||||
(semantic-current-tag-of-class 'type))))
|
||||
|
||||
(defun doc-mode-current-tag-or-bust ()
|
||||
(or (doc-mode-current-tag) (error "No tag found")))
|
||||
|
||||
;;; insertion ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defun doc-mode-line-indent (keyword)
|
||||
"Determine left side offset when indenting LINE."
|
||||
(if (numberp doc-mode-align-keyword-arguments)
|
||||
doc-mode-align-keyword-arguments
|
||||
(+ 1 (length (car keyword))
|
||||
(if (equal (car keyword) "param")
|
||||
(1+ (length (cdr keyword)))
|
||||
0))))
|
||||
|
||||
(defun doc-mode-insert (text)
|
||||
"Insert TEXT if a string, or a template if 'prompt."
|
||||
(if (stringp text)
|
||||
(insert text)
|
||||
(let ((beg (point)))
|
||||
(insert (cadr text))
|
||||
(when doc-mode
|
||||
(doc-mode-add-template beg (point))))))
|
||||
|
||||
(defun doc-mode-insert-markup (markup &optional argument description)
|
||||
(insert doc-mode-template-keyword-char markup)
|
||||
(when argument
|
||||
(insert " ")
|
||||
(doc-mode-insert argument))
|
||||
(when description
|
||||
(insert " ")
|
||||
(doc-mode-insert description)))
|
||||
|
||||
(defun doc-mode-insert-line (line indent)
|
||||
(indent-to-column indent)
|
||||
(let ((beg (point)))
|
||||
(insert doc-mode-template-continue)
|
||||
(if (and (consp line) (not (eq (car line) 'prompt)))
|
||||
(apply 'doc-mode-insert-markup line)
|
||||
(doc-mode-insert line))
|
||||
(delete-char (- (skip-chars-backward " \t")))
|
||||
(when (> (point) (+ beg 2))
|
||||
(save-excursion (fill-region beg (point) 'left t)))
|
||||
(insert "\n")))
|
||||
|
||||
(defun doc-mode-insert-keyword (keyword indent)
|
||||
(indent-to-column indent)
|
||||
(let ((fill-column (or doc-mode-fill-column comment-fill-column fill-column))
|
||||
(fill-prefix (when doc-mode-align-keyword-arguments
|
||||
(concat (buffer-substring (point-at-bol) (point))
|
||||
doc-mode-template-continue
|
||||
(make-string (doc-mode-line-indent keyword)
|
||||
? )))))
|
||||
(doc-mode-insert-line keyword indent)))
|
||||
|
||||
(defun doc-mode-insert-doc (keywords &optional pos)
|
||||
"Insert a documentation at POS.
|
||||
LINES is a list of keywords."
|
||||
(save-excursion
|
||||
(if pos
|
||||
(goto-char pos)
|
||||
(setq pos (point)))
|
||||
(let ((indent (current-column)))
|
||||
|
||||
(if (and (not (cdr keywords)) doc-mode-allow-single-line-comments)
|
||||
(progn (insert doc-mode-template-single-line-start)
|
||||
(doc-mode-insert (car keywords))
|
||||
(insert doc-mode-template-single-line-end "\n"))
|
||||
(insert doc-mode-template-start "\n")
|
||||
|
||||
;; first line
|
||||
(when (or (stringp (car keywords))
|
||||
(eq 'prompt (caar keywords)))
|
||||
(doc-mode-insert-line (pop keywords) indent))
|
||||
|
||||
(when (and doc-mode-template-empty-line-after-summary
|
||||
(or (null doc-mode-template-empty-line-before-keywords)
|
||||
(stringp (cadr keywords))))
|
||||
(doc-mode-insert-line "" indent))
|
||||
|
||||
;; paragraphs
|
||||
(if (cdr keywords)
|
||||
(while (stringp (car keywords))
|
||||
(doc-mode-insert-line (pop keywords) indent)
|
||||
(when (stringp (car keywords))
|
||||
(doc-mode-insert-line "" indent)))
|
||||
(while (stringp (car keywords))
|
||||
(doc-mode-insert-line (pop keywords) indent)))
|
||||
|
||||
(when doc-mode-template-empty-line-before-keywords
|
||||
(doc-mode-insert-line "" indent))
|
||||
|
||||
;; keywords
|
||||
(while keywords
|
||||
(doc-mode-insert-keyword (pop keywords) indent))
|
||||
(indent-to-column indent)
|
||||
(insert doc-mode-template-end "\n"))
|
||||
|
||||
;; re-indent original line
|
||||
(if (< (current-column) indent)
|
||||
(indent-to-column indent)
|
||||
(move-to-column indent t))))
|
||||
|
||||
(and doc-mode-jump-to-template doc-mode-templates
|
||||
(ignore-errors (doc-mode-next-template pos (point)))))
|
||||
|
||||
(defun doc-mode-remove-doc (point)
|
||||
"Remove the documentation before POINT."
|
||||
(let* ((bounds (doc-mode-find-doc-bounds point))
|
||||
(beg (plist-get bounds :beg))
|
||||
(end (plist-get bounds :end)))
|
||||
(when bounds
|
||||
(save-excursion
|
||||
(goto-char beg)
|
||||
(incf beg (skip-chars-backward " \t"))
|
||||
(goto-char end)
|
||||
(incf end (skip-chars-forward " \t"))
|
||||
(when (eolp) (incf end))
|
||||
(delete-region beg end)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun doc-mode-remove-tag-doc (tag)
|
||||
"Remove the documentation for TAG.
|
||||
If called interactively, use the tag given by `doc-mode-current-tag'."
|
||||
(interactive (list (doc-mode-current-tag-or-bust)))
|
||||
(doc-mode-remove-doc (semantic-tag-start tag)))
|
||||
|
||||
;;; registering ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defun doc-mode-find-doc-bounds (pos)
|
||||
"Find the documentation right before POS.
|
||||
If there is anything but whitespace between the documentation and POS, nil is
|
||||
returned. Otherwise a cons of the doc's beginning and end is given."
|
||||
(let (end)
|
||||
(save-excursion
|
||||
(goto-char pos)
|
||||
(when (re-search-backward "[ \t]*\n[ \t]*\\=" nil t)
|
||||
(setq end (point))
|
||||
(cond
|
||||
;; /// Doxygen comment */
|
||||
((looking-back "[ \t]*//[/!]\\(.*\\)$")
|
||||
(forward-line -1)
|
||||
(while (looking-at "[ \t]*//[/!]\\(.*\\)$")
|
||||
(forward-line -1))
|
||||
(forward-line 1)
|
||||
(skip-chars-forward " \t")
|
||||
`(:beg ,(point) :end ,end :column ,(current-indentation)))
|
||||
;; /** JavaDoc comment */
|
||||
((looking-back "\\*/")
|
||||
(goto-char (match-beginning 0))
|
||||
;; search for /*, not allowing any */ in between
|
||||
(when (and (re-search-backward "\\(/\\*\\)\\|\\*/" nil t)
|
||||
(match-beginning 1)
|
||||
(memq (char-after (1+ (match-beginning 1))) '(?! ?*)))
|
||||
`(:beg ,(point) :end ,end :column ,(current-column)))))))))
|
||||
|
||||
;;; formating ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defun doc-mode-new-keyword (keyword &optional argument)
|
||||
(if (equal keyword "param")
|
||||
(list keyword argument '(prompt "<doc>"))
|
||||
(list keyword '(prompt "<doc>"))))
|
||||
|
||||
(defun doc-mode-has-return-value-p (tag)
|
||||
"Test if TAG has a return value to format."
|
||||
(and (eq (semantic-tag-class tag) 'function)
|
||||
(not (equal (semantic-tag-type tag) "void"))
|
||||
(not (semantic-tag-get-attribute tag :constructor-flag))
|
||||
(or (not (equal (semantic-tag-type tag) "int"))
|
||||
;; semantic bug, constructors sometimes appear to have int type
|
||||
(save-excursion (goto-char (semantic-tag-start tag))
|
||||
(and (re-search-forward "\\(\\<int\\>\\)\\|{\\|;"
|
||||
(semantic-tag-end tag) t)
|
||||
(match-beginning 1))))))
|
||||
|
||||
;;; extracting ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defun doc-mode-extract-summary (beg end)
|
||||
(let ((bounds (doc-mode-find-summary beg end)))
|
||||
(buffer-substring-no-properties (car bounds) (cdr bounds))))
|
||||
|
||||
(defun doc-mode-find-summary (beg end)
|
||||
(save-excursion
|
||||
(goto-char beg)
|
||||
(if (or (re-search-forward "^[@\\]brief \\([^\t ][^\n]*\n\\)" end t)
|
||||
(re-search-forward "\\<\\(.*\\)\\(\\*+/\\|\n\\)" end t))
|
||||
(cons (match-beginning 1) (match-end 1))
|
||||
(cons beg beg))))
|
||||
|
||||
(defconst doc-mode-begin-regexp
|
||||
(eval-when-compile (concat "[ \t\n]*"
|
||||
"\\("
|
||||
"/\\*\\(\\*+\\|!\\)"
|
||||
"\\|"
|
||||
"//[!/]"
|
||||
"\\)[ \t]*")))
|
||||
|
||||
(defun doc-mode-clean-doc (beg end)
|
||||
"Remove the comment delimiters between BEG and END."
|
||||
(save-excursion
|
||||
(goto-char beg)
|
||||
(when (looking-at doc-mode-begin-regexp)
|
||||
(setq beg (match-end 0)))
|
||||
(goto-char end)
|
||||
(when (looking-back "[ \t\n\r]*\\*+/" nil t)
|
||||
(setq end (match-beginning 0)))
|
||||
(let ((lines (split-string (buffer-substring-no-properties beg end)
|
||||
"[ \t]*\n[ \t]*\\(\\*/?\\|//[!/]\\)?[ \t]*")))
|
||||
(while (equal (car lines) "")
|
||||
(pop lines))
|
||||
(mapconcat 'identity lines "\n"))))
|
||||
|
||||
(defun doc-mode-extract-keywords (beg end)
|
||||
"Extract documentation keywords between BEG and END.
|
||||
Returns a alist of keywords, where each element is the list (keyword
|
||||
argument value) or (keyword argument)."
|
||||
(let* ((paragraphs (doc-mode-clean-doc beg end))
|
||||
(doc "")
|
||||
(pos 0)
|
||||
match results)
|
||||
|
||||
(when (string-match
|
||||
"[ \t\n]*\\(\\(.\\|\n\\)*?\\)\\([@\\]\\<\\(.\\|\n\\)*\\'\\)"
|
||||
paragraphs)
|
||||
(setq doc (match-string-no-properties 3 paragraphs)
|
||||
paragraphs (match-string-no-properties 1 paragraphs)))
|
||||
|
||||
;; first line summary
|
||||
(when (string-match "\\`[ \t\n]*\\(.+\\.\\)\\([ \n]+\\|\\'\\)" paragraphs)
|
||||
(push (match-string 1 paragraphs) results)
|
||||
(setq pos (match-end 0)))
|
||||
|
||||
;; other paragraphs
|
||||
(dolist (paragraph (split-string (substring paragraphs pos)
|
||||
"[ \t]*\n\\(\n+[ \t]*\\|$\\)" t))
|
||||
(push (replace-regexp-in-string "[\n\r]" " " paragraph) results))
|
||||
|
||||
;; keywords
|
||||
(dolist (keyword (cdr (split-string doc "[@\\]\\<")))
|
||||
(setq match (split-string keyword))
|
||||
(push (if (equal (car match) "param")
|
||||
(list (car match) (cadr match)
|
||||
(mapconcat 'identity (cddr match) " "))
|
||||
(list (car match) (mapconcat 'identity (cdr match) " ")))
|
||||
results))
|
||||
(nreverse results)))
|
||||
|
||||
(defun doc-mode-extract-keywords-for-tag (tag)
|
||||
(let ((bounds (doc-mode-find-doc-bounds (semantic-tag-start tag))))
|
||||
(when bounds (doc-mode-extract-keywords (plist-get bounds :beg)
|
||||
(plist-get bounds :end)))))
|
||||
|
||||
(defun doc-mode-find-keyword (keyword keywords)
|
||||
(when keywords
|
||||
(if (and (consp (car keywords)) (string= (car (car keywords)) keyword))
|
||||
(cons (car keywords) (doc-mode-find-keyword keyword (cdr keywords)))
|
||||
(doc-mode-find-keyword keyword (cdr keywords)))))
|
||||
|
||||
(defun doc-mode-filter-keyword (keyword keywords)
|
||||
(when keywords
|
||||
(if (and (consp (car keywords)) (string= (car (car keywords)) keyword))
|
||||
(doc-mode-filter-keyword keyword (cdr keywords))
|
||||
(cons (car keywords) (doc-mode-filter-keyword keyword (cdr keywords))))))
|
||||
|
||||
(defun doc-mode-find-eligible-tags ()
|
||||
(when buffer-file-name
|
||||
(unless (or (semantic-parse-tree-unparseable-p)
|
||||
(semantic-parse-tree-needs-rebuild-p)
|
||||
(semantic-parse-tree-needs-update-p))
|
||||
(ignore-errors
|
||||
(let (tags)
|
||||
(semantic-brute-find-tag-by-function
|
||||
(lambda (tag)
|
||||
(when (semantic-tag-start tag)
|
||||
(case (semantic-tag-class tag)
|
||||
((function variable) (push tag tags))
|
||||
(type (setq tags
|
||||
(nconc (semantic-tag-type-members tag)
|
||||
tags))))))
|
||||
(semanticdb-file-stream buffer-file-name))
|
||||
tags)))))
|
||||
|
||||
;;; checking ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defsubst doc-mode-position (element list)
|
||||
"Return the first position of ELEMENT in LIST.
|
||||
Returns (length LIST) if no occurrence was found."
|
||||
(let ((pos 0))
|
||||
(while (and list (not (equal element (pop list))))
|
||||
(incf pos))
|
||||
pos))
|
||||
|
||||
(defun doc-mode-keyword< (a b tag)
|
||||
(if (equal (car a) "param")
|
||||
(let* ((args (mapcar 'semantic-tag-name
|
||||
(semantic-tag-get-attribute tag :arguments)))
|
||||
(a-param (cadr a))
|
||||
(b-param (cadr b))
|
||||
(a-pos (doc-mode-position a-param args))
|
||||
(b-pos (doc-mode-position b-param args)))
|
||||
(if (= a-pos b-pos)
|
||||
(string< a-param b-param)
|
||||
(< a-pos b-pos)))
|
||||
(string< (cadr a) (cadr b))))
|
||||
|
||||
(defun doc-mode-sort-keywords (keywords tag)
|
||||
(let ((lists (make-vector (1+ (length doc-mode-template-keywords)) nil))
|
||||
description)
|
||||
(dolist (k keywords)
|
||||
(if (or (stringp k) (and (eq (car k) 'prompt)))
|
||||
(push k description)
|
||||
(push k (elt lists (doc-mode-position (car k)
|
||||
doc-mode-template-keywords)))))
|
||||
(let ((i (length lists)) result)
|
||||
(while (> i 0)
|
||||
(setq result (nconc (sort (elt lists (decf i))
|
||||
(lambda (a b) (doc-mode-keyword< a b tag)))
|
||||
result)))
|
||||
(nconc (nreverse description) result))))
|
||||
|
||||
(defun doc-mode-update-parameters (old new)
|
||||
"Cleanse and sort NEW parameters according to OLD parameter list."
|
||||
(let (params car-new)
|
||||
(while (setq car-new (pop new))
|
||||
(push (or (dolist (p old) ;; search for match in old
|
||||
(when (equal (cadr p) car-new)
|
||||
(setq old (delete p old))
|
||||
(return p)))
|
||||
;; this parameter wasn't there before
|
||||
(if (or (null old) (member (cadr (car old)) new))
|
||||
;; insertion, new
|
||||
(doc-mode-new-keyword "param" car-new)
|
||||
;; the old parameter at this pos isn't there anymore, rename
|
||||
(list* "param" car-new (cddr (pop old)))))
|
||||
params))
|
||||
(nreverse params)))
|
||||
|
||||
(defun doc-mode-keywords-from-tag (tag keywords)
|
||||
"Create keywords for a Semantic TAG, taking descriptions from old KEYWORDS"
|
||||
(let ((old-params (doc-mode-find-keyword "param" keywords))
|
||||
(new-params (mapcar 'semantic-tag-name
|
||||
(semantic-tag-get-attribute tag :arguments))))
|
||||
;; fix return value
|
||||
(if (doc-mode-has-return-value-p tag)
|
||||
;; add
|
||||
(unless (doc-mode-find-keyword "return" keywords)
|
||||
(push (doc-mode-new-keyword "return") keywords))
|
||||
;; remove
|
||||
(setq keywords (doc-mode-filter-keyword "return" keywords)))
|
||||
(unless (stringp (car keywords))
|
||||
(push `(prompt ,(format "Description for %s." (semantic-tag-name tag)))
|
||||
keywords))
|
||||
(doc-mode-sort-keywords (nconc (doc-mode-update-parameters old-params
|
||||
new-params)
|
||||
(doc-mode-filter-keyword "param" keywords))
|
||||
tag)))
|
||||
|
||||
;;;###autoload
|
||||
(defun doc-mode-fix-tag-doc (tag)
|
||||
(interactive (list (doc-mode-current-tag-or-bust)))
|
||||
(let ((keywords (funcall doc-mode-keywords-from-tag-func
|
||||
tag (doc-mode-extract-keywords-for-tag tag))))
|
||||
(doc-mode-remove-tag-doc tag)
|
||||
(doc-mode-insert-doc keywords (semantic-tag-start tag))
|
||||
;; update lighter
|
||||
(doc-mode-check-buffer)))
|
||||
|
||||
;;;###autoload
|
||||
(defalias 'doc-mode-add-tag-doc 'doc-mode-fix-tag-doc)
|
||||
|
||||
(defun doc-mode-format-message (type parameters)
|
||||
(when parameters
|
||||
(concat (case type
|
||||
('missing "Missing")
|
||||
('invalid "Invalid"))
|
||||
" parameter" (when (cdr parameters) "s") ": "
|
||||
(mapconcat 'identity parameters ", "))))
|
||||
|
||||
;;;###autoload
|
||||
(defun doc-mode-check-tag-doc (tag &optional print-message-p)
|
||||
(interactive (list (doc-mode-current-tag-or-bust) t))
|
||||
(let* ((actual (doc-mode-extract-keywords-for-tag tag))
|
||||
(expected (mapcar 'semantic-tag-name
|
||||
(semantic-tag-get-attribute tag :arguments))))
|
||||
(if actual
|
||||
(let ((no-doc-p (not (stringp (car actual))))
|
||||
;; we only report parameters
|
||||
(actual (mapcar 'cadr (doc-mode-find-keyword "param"
|
||||
actual)))
|
||||
invalid)
|
||||
(dolist (keyword actual)
|
||||
(if (member keyword expected)
|
||||
(setq expected (delete keyword expected))
|
||||
(push keyword invalid)))
|
||||
(when print-message-p
|
||||
(message "%s" (concat (and no-doc-p "Missing documentation")
|
||||
(and no-doc-p expected "\n")
|
||||
(doc-mode-format-message 'missing expected)
|
||||
(and (or no-doc-p expected) invalid "\n")
|
||||
(doc-mode-format-message 'invalid invalid))))
|
||||
(or no-doc-p expected invalid))
|
||||
(when print-message-p
|
||||
(message "Missing comment"))
|
||||
t)))
|
||||
|
||||
;;;###autoload
|
||||
(defun doc-mode-check-buffer ()
|
||||
(interactive)
|
||||
(kill-local-variable 'doc-mode-lighter)
|
||||
(dolist (tag (doc-mode-find-eligible-tags))
|
||||
(when (doc-mode-check-tag-doc tag)
|
||||
(set (make-local-variable 'doc-mode-lighter) " doc!")
|
||||
(return t))))
|
||||
|
||||
(defun doc-mode-first-faulty-tag-doc ()
|
||||
(dolist (tag (sort (doc-mode-find-eligible-tags)
|
||||
(lambda (a b) (< (semantic-tag-start a)
|
||||
(semantic-tag-start b)))))
|
||||
(when (doc-mode-check-tag-doc tag)
|
||||
(return tag))))
|
||||
|
||||
;;;###autoload
|
||||
(defun doc-mode-next-faulty-doc ()
|
||||
"Jump to the next faulty documentation and print error."
|
||||
(interactive)
|
||||
(let ((tag (or (doc-mode-first-faulty-tag-doc)
|
||||
(error "End of buffer"))))
|
||||
(push-mark)
|
||||
(goto-char (semantic-tag-start tag))
|
||||
;; check again with message
|
||||
(doc-mode-check-tag-doc tag t)))
|
||||
|
||||
;;; folding ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defvar doc-mode-folds nil)
|
||||
(make-variable-buffer-local 'doc-mode-folds)
|
||||
|
||||
(defun doc-mode-fold-doc (point)
|
||||
(let ((bounds (doc-mode-find-doc-bounds point)))
|
||||
(when bounds
|
||||
(let* ((beg (plist-get bounds :beg))
|
||||
(end (plist-get bounds :end))
|
||||
(summary-bounds (doc-mode-find-summary beg end))
|
||||
(before-overlay (make-overlay beg (car summary-bounds)))
|
||||
(after-overlay (make-overlay (cdr summary-bounds) end))
|
||||
(siblings (list before-overlay after-overlay)))
|
||||
(when (or doc-mode-fold-single-line-comments
|
||||
(> (count-lines beg end) 1))
|
||||
(dolist (ov siblings)
|
||||
(overlay-put ov 'invisible t)
|
||||
(overlay-put ov 'isearch-open-invisible-temporary
|
||||
'doc-mode-unfold-by-overlay-temporary)
|
||||
(overlay-put ov 'isearch-open-invisible 'doc-mode-unfold-by-overlay)
|
||||
(overlay-put ov 'doc-mode-fold siblings))
|
||||
(setq doc-mode-folds (nconc doc-mode-folds siblings)))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun doc-mode-fold-tag-doc (tag)
|
||||
"Fold the documentation for TAG.
|
||||
If called interactively, use the tag given by `doc-mode-current-tag'."
|
||||
(interactive (list (doc-mode-current-tag-or-bust)))
|
||||
(unless doc-mode
|
||||
(error "doc-mode not enabled"))
|
||||
(doc-mode-fold-doc (semantic-tag-start tag)))
|
||||
|
||||
(defun doc-mode-unfold-by-overlay (overlay &rest foo)
|
||||
"Unfold OVERLAY and its siblings permanently"
|
||||
(dolist (ov (overlay-get overlay 'doc-mode-fold))
|
||||
;; remove overlay
|
||||
(setq doc-mode-folds (delq ov doc-mode-folds))
|
||||
(delete-overlay ov)
|
||||
;; don't let isearch do anything with it
|
||||
(setq isearch-opened-overlays (delq ov isearch-opened-overlays))))
|
||||
|
||||
(defun doc-mode-unfold-by-overlay-temporary (overlay invisible)
|
||||
"Unfold OVERLAY and its siblings temporarily."
|
||||
(dolist (ov (overlay-get overlay 'doc-mode-fold))
|
||||
(overlay-put ov 'invisible invisible)))
|
||||
|
||||
;;;###autoload
|
||||
(defun doc-mode-unfold-doc (point)
|
||||
"Unfold the comment before POINT."
|
||||
(interactive "d")
|
||||
(unless doc-mode
|
||||
(error "doc-mode not enabled"))
|
||||
(let ((bounds (doc-mode-find-doc-bounds point)))
|
||||
(when bounds
|
||||
(let* ((beg (plist-get bounds :beg))
|
||||
(end (plist-get bounds :end))
|
||||
(overlays (overlays-in beg end))
|
||||
anything-done)
|
||||
(dolist (ov overlays)
|
||||
(when (overlay-get ov 'doc-mode-fold)
|
||||
(setq anything-done t)
|
||||
(delete-overlay ov)
|
||||
(setq doc-mode-folds (delq ov doc-mode-folds))))
|
||||
;; return non-nil, if anything unfolded
|
||||
;; this is used to toggle
|
||||
anything-done))))
|
||||
|
||||
;;;###autoload
|
||||
(defun doc-mode-unfold-tag-doc (tag)
|
||||
"Unfold the documentation for TAG.
|
||||
If called interactively, use the tag given by `doc-mode-current-tag'."
|
||||
(interactive (list (doc-mode-current-tag-or-bust)))
|
||||
(unless doc-mode
|
||||
(error "doc-mode not enabled"))
|
||||
(doc-mode-unfold-doc (semantic-tag-start tag)))
|
||||
|
||||
;;;###autoload
|
||||
(defun doc-mode-fold-all (&optional arg)
|
||||
(interactive "P")
|
||||
(unless doc-mode
|
||||
(error "doc-mode not enabled"))
|
||||
(if arg
|
||||
(doc-mode-unfold-all)
|
||||
(dolist (tag (doc-mode-find-eligible-tags))
|
||||
(doc-mode-fold-tag-doc tag))))
|
||||
|
||||
;;;###autoload
|
||||
(defun doc-mode-unfold-all ()
|
||||
(interactive)
|
||||
(dolist (ov doc-mode-folds)
|
||||
(delete-overlay ov))
|
||||
(kill-local-variable 'doc-mode-folds))
|
||||
|
||||
;;; toggle
|
||||
|
||||
;;;###autoload
|
||||
(defun doc-mode-toggle-tag-doc-folding (tag)
|
||||
"Toggle folding of TAG's documentation.
|
||||
If called interactively, use the tag given by `doc-mode-current-tag'."
|
||||
(interactive (list (doc-mode-current-tag-or-bust)))
|
||||
(or (doc-mode-unfold-tag-doc tag)
|
||||
(doc-mode-fold-tag-doc tag)))
|
||||
|
||||
(provide 'doc-mode)
|
||||
|
||||
;;; doc-mode.el ends here
|
168
one-file-mode/dockerfile-mode.el
Normal file
168
one-file-mode/dockerfile-mode.el
Normal file
@ -0,0 +1,168 @@
|
||||
;;; dockerfile-mode.el --- Major mode for editing Docker's Dockerfiles
|
||||
|
||||
;; Copyright (c) 2013 Spotify AB
|
||||
;;
|
||||
;; 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.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'sh-script)
|
||||
(require 'rx)
|
||||
|
||||
(declare-function cygwin-convert-file-name-to-windows "cygw32.c" (file &optional absolute-p))
|
||||
|
||||
(defvar docker-image-name nil)
|
||||
|
||||
(defgroup dockerfile nil
|
||||
"dockerfile code editing commands for Emacs."
|
||||
:link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces)
|
||||
:prefix "dockerfile-"
|
||||
:group 'languages)
|
||||
|
||||
(defcustom dockerfile-mode-hook nil
|
||||
"*Hook called by `dockerfile-mode'."
|
||||
:type 'hook
|
||||
:group 'dockerfile)
|
||||
|
||||
(defcustom dockerfile-use-sudo nil
|
||||
"Runs docker builder command with sudo.")
|
||||
|
||||
(defcustom dockerfile-build-args nil
|
||||
"List of --build-arg to pass to docker build.
|
||||
|
||||
Each element of the list will be passed as a separate
|
||||
--build-arg to the docker build command."
|
||||
:type '(repeat string)
|
||||
:group 'dockerfile)
|
||||
|
||||
(defvar dockerfile-font-lock-keywords
|
||||
`(,(cons (rx (or line-start "onbuild ")
|
||||
(group (or "from" "maintainer" "run" "cmd" "expose" "env" "arg"
|
||||
"add" "copy" "entrypoint" "volume" "user" "workdir" "onbuild"
|
||||
"label" "stopsignal"))
|
||||
word-boundary)
|
||||
font-lock-keyword-face)
|
||||
,@(sh-font-lock-keywords)
|
||||
,@(sh-font-lock-keywords-2)
|
||||
,@(sh-font-lock-keywords-1))
|
||||
"Default font-lock-keywords for `dockerfile mode'.")
|
||||
|
||||
(defvar dockerfile-mode-map
|
||||
(let ((map (make-sparse-keymap))
|
||||
(menu-map (make-sparse-keymap)))
|
||||
(define-key map "\C-c\C-b" 'dockerfile-build-buffer)
|
||||
(define-key map "\C-c\M-b" 'dockerfile-build-no-cache-buffer)
|
||||
(define-key map "\C-c\C-z" 'dockerfile-test-function)
|
||||
(define-key map "\C-c\C-c" 'comment-region)
|
||||
(define-key map [menu-bar dockerfile-mode] (cons "Dockerfile" menu-map))
|
||||
(define-key menu-map [dfc]
|
||||
'(menu-item "Comment Region" comment-region
|
||||
:help "Comment Region"))
|
||||
(define-key menu-map [dfb]
|
||||
'(menu-item "Build" dockerfile-build-buffer
|
||||
:help "Send the Dockerfile to docker build"))
|
||||
(define-key menu-map [dfb]
|
||||
'(menu-item "Build without cache" dockerfile-build-no-cache-buffer
|
||||
:help "Send the Dockerfile to docker build without cache"))
|
||||
map))
|
||||
|
||||
(defvar dockerfile-mode-syntax-table
|
||||
(let ((table (make-syntax-table)))
|
||||
(modify-syntax-entry ?# "<" table)
|
||||
(modify-syntax-entry ?\n ">" table)
|
||||
(modify-syntax-entry ?' "\"" table)
|
||||
table)
|
||||
"Syntax table for `dockerfile-mode'.")
|
||||
|
||||
(define-abbrev-table 'dockerfile-mode-abbrev-table nil
|
||||
"Abbrev table used while in `dockerfile-mode'.")
|
||||
|
||||
(unless dockerfile-mode-abbrev-table
|
||||
(define-abbrev-table 'dockerfile-mode-abbrev-table ()))
|
||||
|
||||
(defun dockerfile-build-arg-string ()
|
||||
"Create a --build-arg string for each element in `dockerfile-build-args'."
|
||||
(mapconcat (lambda (arg) (concat "--build-arg " "\"" arg "\""))
|
||||
dockerfile-build-args " "))
|
||||
|
||||
(defun standard-filename (file)
|
||||
"Convert the file name to OS standard.
|
||||
If in Cygwin environment, uses Cygwin specific function to convert the
|
||||
file name. Otherwise, uses Emacs' standard conversion function."
|
||||
(format "%s" (if (fboundp 'cygwin-convert-file-name-to-windows)
|
||||
(s-replace "\\" "\\\\" (cygwin-convert-file-name-to-windows file))
|
||||
(convert-standard-filename file))))
|
||||
|
||||
;;;###autoload
|
||||
(defun dockerfile-build-buffer (image-name)
|
||||
"Build an image based upon the buffer"
|
||||
(interactive
|
||||
(if (null docker-image-name)
|
||||
(list (read-string "image-name: " nil nil))
|
||||
(list docker-image-name)))
|
||||
(save-buffer)
|
||||
(if (stringp image-name)
|
||||
(async-shell-command
|
||||
(format "%sdocker build -t %s %s -f \"%s\" \"%s\""
|
||||
(if dockerfile-use-sudo "sudo " "")
|
||||
image-name
|
||||
(dockerfile-build-arg-string)
|
||||
(standard-filename (buffer-file-name))
|
||||
(standard-filename (file-name-directory (buffer-file-name))))
|
||||
"*docker-build-output*")
|
||||
(print "docker-image-name must be a string, consider surrounding it with double quotes")))
|
||||
|
||||
;;;###autoload
|
||||
(defun dockerfile-build-no-cache-buffer (image-name)
|
||||
"Build an image based upon the buffer without cache"
|
||||
(interactive
|
||||
(if (null docker-image-name)
|
||||
(list (read-string "image-name: " nil nil))
|
||||
(list docker-image-name)))
|
||||
(save-buffer)
|
||||
(if (stringp image-name)
|
||||
(async-shell-command
|
||||
(format "%s docker build --no-cache -t %s %s -f \"%s\" \"%s\""
|
||||
(if dockerfile-use-sudo "sudo" "")
|
||||
image-name
|
||||
(dockerfile-build-arg-string)
|
||||
(standard-filename (buffer-file-name))
|
||||
(standard-filename (file-name-directory (buffer-file-name))))
|
||||
"*docker-build-output*")
|
||||
(print "docker-image-name must be a string, consider surrounding it with double quotes")))
|
||||
|
||||
;; Handle emacs < 24, which does not have prog-mode
|
||||
(defalias 'dockerfile-parent-mode
|
||||
(if (fboundp 'prog-mode) 'prog-mode 'fundamental-mode))
|
||||
|
||||
;;;###autoload
|
||||
(define-derived-mode dockerfile-mode dockerfile-parent-mode "Dockerfile"
|
||||
"A major mode to edit Dockerfiles.
|
||||
\\{dockerfile-mode-map}
|
||||
"
|
||||
(set-syntax-table dockerfile-mode-syntax-table)
|
||||
(set (make-local-variable 'require-final-newline) mode-require-final-newline)
|
||||
(set (make-local-variable 'comment-start) "#")
|
||||
(set (make-local-variable 'comment-end) "")
|
||||
(set (make-local-variable 'comment-start-skip) "#+ *")
|
||||
(set (make-local-variable 'parse-sexp-ignore-comments) t)
|
||||
(set (make-local-variable 'font-lock-defaults)
|
||||
'(dockerfile-font-lock-keywords nil t))
|
||||
(setq local-abbrev-table dockerfile-mode-abbrev-table))
|
||||
|
||||
;;;###autoload
|
||||
(add-to-list 'auto-mode-alist '("Dockerfile.*\\'" . dockerfile-mode))
|
||||
|
||||
(provide 'dockerfile-mode)
|
||||
|
||||
;;; dockerfile-mode.el ends here
|
267
one-file-mode/go-template-mode.el
Normal file
267
one-file-mode/go-template-mode.el
Normal file
@ -0,0 +1,267 @@
|
||||
;;; go-template-mode.el --- Major mode for Go template language
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; 1) Copy this file somewhere in your Emacs `load-path'. To see what
|
||||
;; your `load-path' is, run inside emacs: C-h v load-path<RET>
|
||||
;;
|
||||
;; 2) Add the following to your .emacs file:
|
||||
;;
|
||||
;; (require 'go-template-mode)
|
||||
|
||||
;;; Known Bugs:
|
||||
|
||||
;; 1) Highlights all strings in the source file, including HTML attributes,
|
||||
;; and does not properly highlight template actions inside these strings.
|
||||
|
||||
(defvar go-template-mode-syntax-table
|
||||
(let ((st (make-syntax-table)))
|
||||
;; Add _ to :word: character class
|
||||
(modify-syntax-entry ?_ "w" st)
|
||||
|
||||
;; Operators (punctuation)
|
||||
(modify-syntax-entry ?: "." st)
|
||||
(modify-syntax-entry ?= "." st)
|
||||
(modify-syntax-entry ?| "." st)
|
||||
|
||||
;; Strings and comments are font-locked separately.
|
||||
(modify-syntax-entry ?\" "." st)
|
||||
(modify-syntax-entry ?\' "." st)
|
||||
(modify-syntax-entry ?` "." st)
|
||||
(modify-syntax-entry ?\\ "." st)
|
||||
|
||||
st)
|
||||
"Syntax table for Go template mode.")
|
||||
|
||||
(defvar go-template-mode-keywords
|
||||
'("define" "else" "end" "if" "range" "template" "with")
|
||||
"All keywords in the Go template language. Used for font locking.")
|
||||
|
||||
(defvar go-template-mode-builtins
|
||||
'("and" "html" "index" "js" "len" "not" "or" "print" "printf" "println" "urlquery")
|
||||
"All builtin functions in the Go template language. Used for font locking.")
|
||||
|
||||
|
||||
(defconst go-template-mode-pair-tag
|
||||
(regexp-opt
|
||||
'("a" "abbr" "acronym" "address" "applet" "area" "b" "bdo"
|
||||
"big" "blockquote" "body" "button" "caption" "center" "cite"
|
||||
"code" "col" "colgroup" "dd" "del" "dfn" "dif" "div" "dl"
|
||||
"dt" "em" "fieldset" "font" "form" "frame" "frameset" "h1"
|
||||
"header" "nav" "footer" "section"
|
||||
"h2" "h3" "h4" "h5" "h6" "head" "html" "i" "iframe" "ins"
|
||||
"kbd" "label" "legend" "li" "link" "map" "menu" "noframes"
|
||||
"noscript" "object" "ol" "optgroup" "option" "p" "pre" "q"
|
||||
"s" "samp" "script" "select" "small" "span" "strike"
|
||||
"strong" "style" "sub" "sup" "table" "tbody" "td" "textarea"
|
||||
"tfoot" "th" "thead" "title" "tr" "tt" "u" "ul" "var")
|
||||
t))
|
||||
(defconst go-template-mode-standalone-tag
|
||||
(regexp-opt
|
||||
'("base" "br" "hr" "img" "input" "meta" "param")
|
||||
t))
|
||||
|
||||
(defconst go-template-mode-font-lock-keywords
|
||||
`((go-template-mode-font-lock-cs-comment 0 font-lock-comment-face t)
|
||||
(go-template-mode-font-lock-cs-string 0 font-lock-string-face t)
|
||||
(,(regexp-opt '("{{" "}}")) (0 font-lock-preprocessor-face))
|
||||
("$[a-zA-Z0-9]*" (0 font-lock-variable-name-face))
|
||||
(,(regexp-opt go-template-mode-keywords 'words) . font-lock-keyword-face)
|
||||
(,(regexp-opt go-template-mode-builtins 'words) . font-lock-builtin-face)
|
||||
(,(concat "</?" go-template-mode-pair-tag ">?") (0 font-lock-function-name-face))
|
||||
(,(concat "<" go-template-mode-standalone-tag ">?") (0 font-lock-function-name-face))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Parser
|
||||
;;
|
||||
|
||||
(defvar go-template-mode-mark-cs-end 1
|
||||
"The point at which the comment/string cache ends. The buffer
|
||||
will be marked from the beginning up to this point (that is, up
|
||||
to and including character (1- go-template-mode-mark-cs-end)).")
|
||||
(make-variable-buffer-local 'go-template-mode-mark-cs-end)
|
||||
|
||||
(defvar go-template-mode-mark-nesting-end 1
|
||||
"The point at which the nesting cache ends. The buffer will be
|
||||
marked from the beginning up to this point.")
|
||||
(make-variable-buffer-local 'go-template-mode-mark-nesting-end)
|
||||
|
||||
(defun go-template-mode-mark-clear-cache (b e)
|
||||
"A before-change-function that clears the comment/string and
|
||||
nesting caches from the modified point on."
|
||||
|
||||
(save-restriction
|
||||
(widen)
|
||||
(when (<= b go-template-mode-mark-cs-end)
|
||||
;; Remove the property adjacent to the change position.
|
||||
;; It may contain positions pointing beyond the new end mark.
|
||||
(let ((b (let ((cs (get-text-property (max 1 (1- b)) 'go-template-mode-cs)))
|
||||
(if cs (car cs) b))))
|
||||
(remove-text-properties
|
||||
b (min go-template-mode-mark-cs-end (point-max)) '(go-template-mode-cs nil))
|
||||
(setq go-template-mode-mark-cs-end b)))
|
||||
(when (< b go-template-mode-mark-nesting-end)
|
||||
(remove-text-properties b (min go-template-mode-mark-nesting-end (point-max)) '(go-template-mode-nesting nil))
|
||||
(setq go-template-mode-mark-nesting-end b))))
|
||||
|
||||
(defmacro go-template-mode-parser (&rest body)
|
||||
"Evaluate BODY in an environment set up for parsers that use
|
||||
text properties to mark text. This inhibits changes to the undo
|
||||
list or the buffer's modification status and inhibits calls to
|
||||
the modification hooks. It also saves the excursion and
|
||||
restriction and widens the buffer, since most parsers are
|
||||
context-sensitive."
|
||||
|
||||
(let ((modified-var (make-symbol "modified")))
|
||||
`(let ((buffer-undo-list t)
|
||||
(,modified-var (buffer-modified-p))
|
||||
(inhibit-modification-hooks t)
|
||||
(inhibit-read-only t))
|
||||
(save-excursion
|
||||
(save-restriction
|
||||
(widen)
|
||||
(unwind-protect
|
||||
(progn ,@body)
|
||||
(set-buffer-modified-p ,modified-var)))))))
|
||||
|
||||
(defun go-template-mode-cs (&optional pos)
|
||||
"Return the comment/string state at point POS. If point is
|
||||
inside a comment or string (including the delimiters), this
|
||||
returns a pair (START . END) indicating the extents of the
|
||||
comment or string."
|
||||
|
||||
(unless pos
|
||||
(setq pos (point)))
|
||||
(when (> pos go-template-mode-mark-cs-end)
|
||||
(go-template-mode-mark-cs pos))
|
||||
(get-text-property pos 'go-template-mode-cs))
|
||||
|
||||
(defun go-template-mode-mark-cs (end)
|
||||
"Mark comments and strings up to point END. Don't call this
|
||||
directly; use `go-template-mode-cs'."
|
||||
(setq end (min end (point-max)))
|
||||
(go-template-mode-parser
|
||||
(save-match-data
|
||||
(let ((pos
|
||||
;; Back up to the last known state.
|
||||
(let ((last-cs
|
||||
(and (> go-template-mode-mark-cs-end 1)
|
||||
(get-text-property (1- go-template-mode-mark-cs-end)
|
||||
'go-template-mode-cs))))
|
||||
(if last-cs
|
||||
(car last-cs)
|
||||
(max 1 (1- go-template-mode-mark-cs-end))))))
|
||||
(while (< pos end)
|
||||
(goto-char pos)
|
||||
(let ((cs-end ; end of the text property
|
||||
(cond
|
||||
((looking-at "{{/\\*")
|
||||
(goto-char (+ pos 4))
|
||||
(if (search-forward "*/}}" (1+ end) t)
|
||||
(point)
|
||||
end))
|
||||
((looking-at "\"")
|
||||
(goto-char (1+ pos))
|
||||
(if (looking-at "[^\"\n\\\\]*\\(\\\\.[^\"\n\\\\]*\\)*\"")
|
||||
(match-end 0)
|
||||
(end-of-line)
|
||||
(point)))
|
||||
((looking-at "'")
|
||||
(goto-char (1+ pos))
|
||||
(if (looking-at "[^'\n\\\\]*\\(\\\\.[^'\n\\\\]*\\)*'")
|
||||
(match-end 0)
|
||||
(end-of-line)
|
||||
(point)))
|
||||
((looking-at "`")
|
||||
(goto-char (1+ pos))
|
||||
(while (if (search-forward "`" end t)
|
||||
(if (eq (char-after) ?`)
|
||||
(goto-char (1+ (point))))
|
||||
(goto-char end)
|
||||
nil))
|
||||
(point)))))
|
||||
(cond
|
||||
(cs-end
|
||||
(put-text-property pos cs-end 'go-template-mode-cs (cons pos cs-end))
|
||||
(setq pos cs-end))
|
||||
((re-search-forward "[\"'`]\\|{{/\\*" end t)
|
||||
(setq pos (match-beginning 0)))
|
||||
(t
|
||||
(setq pos end)))))
|
||||
(setq go-template-mode-mark-cs-end pos)))))
|
||||
|
||||
|
||||
|
||||
(defun go-template-mode-font-lock-cs (limit comment)
|
||||
"Helper function for highlighting comment/strings. If COMMENT is t,
|
||||
set match data to the next comment after point, and advance point
|
||||
after it. If COMMENT is nil, use the next string. Returns nil
|
||||
if no further tokens of the type exist."
|
||||
;; Ensures that `next-single-property-change' below will work properly.
|
||||
(go-template-mode-cs limit)
|
||||
(let (cs next (result 'scan))
|
||||
(while (eq result 'scan)
|
||||
(if (or (>= (point) limit) (eobp))
|
||||
(setq result nil)
|
||||
(setq cs (go-template-mode-cs))
|
||||
(if cs
|
||||
(if (eq (= (char-after (car cs)) ?/) comment)
|
||||
;; If inside the expected comment/string, highlight it.
|
||||
(progn
|
||||
;; If the match includes a "\n", we have a
|
||||
;; multi-line construct. Mark it as such.
|
||||
(goto-char (car cs))
|
||||
(when (search-forward "\n" (cdr cs) t)
|
||||
(put-text-property
|
||||
(car cs) (cdr cs) 'font-lock-multline t))
|
||||
(set-match-data (list (car cs) (cdr cs) (current-buffer)))
|
||||
(goto-char (cdr cs))
|
||||
(setq result t))
|
||||
;; Wrong type. Look for next comment/string after this one.
|
||||
(goto-char (cdr cs)))
|
||||
;; Not inside comment/string. Search for next comment/string.
|
||||
(setq next (next-single-property-change
|
||||
(point) 'go-template-mode-cs nil limit))
|
||||
(if (and next (< next limit))
|
||||
(goto-char next)
|
||||
(setq result nil)))))
|
||||
result))
|
||||
|
||||
(defun go-template-mode-font-lock-cs-string (limit)
|
||||
"Font-lock iterator for strings."
|
||||
(go-template-mode-font-lock-cs limit nil))
|
||||
|
||||
(defun go-template-mode-font-lock-cs-comment (limit)
|
||||
"Font-lock iterator for comments."
|
||||
(go-template-mode-font-lock-cs limit t))
|
||||
|
||||
;;;###autoload
|
||||
(define-derived-mode go-template-mode fundamental-mode "Go-Template"
|
||||
"Major mode for editing Go template text.
|
||||
|
||||
This provides basic syntax highlighting for keyword, built-ins, functions,
|
||||
and some types. It does not provide indentation."
|
||||
|
||||
;; Font lock
|
||||
(set (make-local-variable 'font-lock-defaults)
|
||||
'(go-template-mode-font-lock-keywords nil nil nil nil))
|
||||
|
||||
;; Remove stale text properties
|
||||
(save-restriction
|
||||
(widen)
|
||||
(remove-text-properties 1 (point-max)
|
||||
'(go-template-mode-cs nil go-template-mode-nesting nil)))
|
||||
|
||||
;; Reset the syntax mark caches
|
||||
(setq go-template-mode-mark-cs-end 1
|
||||
go-template-mode-mark-nesting-end 1)
|
||||
(add-hook 'before-change-functions #'go-template-mode-mark-clear-cache nil t)
|
||||
|
||||
;; Use tabs (Go style)
|
||||
(setq indent-tabs-mode t))
|
||||
|
||||
(add-to-list 'auto-mode-alist '("\\.gotmpl$" . go-template-mode))
|
||||
|
||||
(provide 'go-template-mode)
|
||||
|
||||
;;; go-template-mode.el ends here
|
1169
one-file-mode/use-package.el
Normal file
1169
one-file-mode/use-package.el
Normal file
File diff suppressed because it is too large
Load Diff
11830
one-file-mode/web-mode.el
Normal file
11830
one-file-mode/web-mode.el
Normal file
File diff suppressed because it is too large
Load Diff
1
site-elisp/aweshell
Submodule
1
site-elisp/aweshell
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 7d6afd1959194956495252abeef0c1cd39ebeee2
|
1
site-elisp/awesome-pair
Submodule
1
site-elisp/awesome-pair
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 4aa25e10b0a8bbb31f199cce41f70d35d18209bd
|
1
site-elisp/color-rg
Submodule
1
site-elisp/color-rg
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 9aa81f6c711870ae1a7c6182d911671512a48387
|
1
site-elisp/delete-block
Submodule
1
site-elisp/delete-block
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 50e1df3e273ffa049525726fb72818e859ecc9cf
|
1
site-elisp/emacs-application-framework
Submodule
1
site-elisp/emacs-application-framework
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 40d6e68085f1f2b6fc3231644e8b5a6c346982c7
|
1
site-elisp/epaint
Submodule
1
site-elisp/epaint
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 8b40f927cbb3633d41b9bb4d40d072e522fa3739
|
1
site-elisp/grep-dired
Submodule
1
site-elisp/grep-dired
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 1f532893f03728406dcf5842e49c019f6186623e
|
1
site-elisp/header2
Submodule
1
site-elisp/header2
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit e41bb4fe0e003130e8c7af199ef4546a2cf57856
|
1
site-elisp/instant-rename-tag
Submodule
1
site-elisp/instant-rename-tag
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 5909263fa697d2ca44d8fd8b2741315af02d9d9f
|
1
site-elisp/leetcode
Submodule
1
site-elisp/leetcode
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 28b78c45c86570cb1e3538f275eb4de1cf28cd04
|
1
site-elisp/multi-term
Submodule
1
site-elisp/multi-term
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 8deb0f2252399cca2426eb3cc3e9646c5de726b3
|
1
site-elisp/snails
Submodule
1
site-elisp/snails
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 44f77cc35f75e623a6e2a419629a16ec9b9c3fbf
|
5
snippets/c++-mode/acc
Normal file
5
snippets/c++-mode/acc
Normal file
@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: accumulate
|
||||
# key: acc
|
||||
# --
|
||||
std::accumulate(${1:v}.begin(), $1.end(), ${2:0});
|
8
snippets/c++-mode/accl
Normal file
8
snippets/c++-mode/accl
Normal file
@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: accumulate_lambda
|
||||
# key: accl
|
||||
# --
|
||||
auto acc = [${3:}] (${4:auto} const& ${5:r}, ${6:auto} const& ${7:v}) {
|
||||
$0
|
||||
};
|
||||
std::accumulate(${1:v}.begin(), $1.end(), ${2:0}, acc);
|
10
snippets/c++-mode/cls
Normal file
10
snippets/c++-mode/cls
Normal file
@ -0,0 +1,10 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: class
|
||||
# key: cls
|
||||
# --
|
||||
class ${1:Name} {
|
||||
public:
|
||||
${1:$(yas/substr yas-text "[^: ]*")}();
|
||||
${2:virtual ~${1:$(yas/substr yas-text "[^: ]*")}();}
|
||||
};
|
||||
$0
|
5
snippets/c++-mode/dcast
Normal file
5
snippets/c++-mode/dcast
Normal file
@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: dynamic cast
|
||||
# key: dcast
|
||||
# --
|
||||
dynamic_cast<${1:type}>(${2:v})
|
5
snippets/c++-mode/dpcast
Normal file
5
snippets/c++-mode/dpcast
Normal file
@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: dynamic pointer cast
|
||||
# key: dpcast
|
||||
# --
|
||||
std::dynamic_pointer_cast<${1:type}>(${2:v})
|
7
snippets/c++-mode/forc
Normal file
7
snippets/c++-mode/forc
Normal file
@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: for_c
|
||||
# key: forc
|
||||
# --
|
||||
for (${1:auto} ${2:i}: ${3:v}) {
|
||||
$0
|
||||
}
|
5
snippets/c++-mode/scast
Normal file
5
snippets/c++-mode/scast
Normal file
@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: static cast
|
||||
# key: scast
|
||||
# --
|
||||
static_cast<${1:type}>(${2:v})
|
9
snippets/c++-mode/sct
Normal file
9
snippets/c++-mode/sct
Normal file
@ -0,0 +1,9 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: struct
|
||||
# key: sct
|
||||
# --
|
||||
struct ${1:Name} {
|
||||
${1:$(yas/substr yas-text "[^: ]*")}();
|
||||
${2:virtual ~${1:$(yas/substr yas-text "[^: ]*")}();}
|
||||
};
|
||||
$0
|
5
snippets/c++-mode/spcast
Normal file
5
snippets/c++-mode/spcast
Normal file
@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: static pointer cast
|
||||
# key: spcast
|
||||
# --
|
||||
std::static_pointer_cast<${1:type}>(${2:v})
|
5
snippets/c++-mode/sptr
Normal file
5
snippets/c++-mode/sptr
Normal file
@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: shared_ptr
|
||||
# key: sptr
|
||||
# --
|
||||
std::shared_ptr<${1:type}> ${2:name}$0
|
5
snippets/c++-mode/todo
Normal file
5
snippets/c++-mode/todo
Normal file
@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: todo_full
|
||||
# key: todo
|
||||
# --
|
||||
`(yas-with-comment "TODO: ")`
|
5
snippets/c++-mode/uptr
Normal file
5
snippets/c++-mode/uptr
Normal file
@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: unique_ptr
|
||||
# key: uptr
|
||||
# --
|
||||
std::unique_ptr<${1:type}> ${2:name}$0
|
5
snippets/c++-mode/wptr
Normal file
5
snippets/c++-mode/wptr
Normal file
@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: weak_ptr
|
||||
# key: wptr
|
||||
# --
|
||||
std::weak_ptr<${1:type}> ${2:name}$0
|
0
snippets/latex-mode/.yas-make-groups
Normal file
0
snippets/latex-mode/.yas-make-groups
Normal file
1
snippets/latex-mode/.yas-parents
Normal file
1
snippets/latex-mode/.yas-parents
Normal file
@ -0,0 +1 @@
|
||||
text-mode
|
9
snippets/latex-mode/abstract.yasnippet
Normal file
9
snippets/latex-mode/abstract.yasnippet
Normal file
@ -0,0 +1,9 @@
|
||||
# -*- mode: snippet -*-
|
||||
# contributor : Mads D. Kristensen <madsdk@gmail.com>
|
||||
# key : abs
|
||||
# group: sections
|
||||
# name : \abstract
|
||||
# --
|
||||
\begin{abstract}
|
||||
$0
|
||||
\end{abstract}
|
9
snippets/latex-mode/align.yasnippet
Normal file
9
snippets/latex-mode/align.yasnippet
Normal file
@ -0,0 +1,9 @@
|
||||
# -*- mode: snippet -*-
|
||||
# contributor : Rasmus Borgsmidt <rasmus@borgsmidt.dk>
|
||||
# key : align
|
||||
# group: environments
|
||||
# name : \begin{align} ... \end{align}
|
||||
# --
|
||||
\begin{align}
|
||||
$0
|
||||
\end{align}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user