加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
packages.el 42.93 KB
一键复制 编辑 原始数据 按行查看 历史
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324
;;; packages.el --- my-config layer packages file for Spacemacs.
;;
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
;;
;; Author: heyun <heyun@localhost.localdomain>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
;;; Commentary:
;; See the Spacemacs documentation and FAQs for instructions on how to implement
;; a new layer:
;;
;; SPC h SPC layers RET
;;
;;
;; Briefly, each package to be installed or configured by this layer should be
;; added to `my-config-packages'. Then, for each package PACKAGE:
;;
;; - If PACKAGE is not referenced by any other Spacemacs layer, define a
;; function `my-config/init-PACKAGE' to load and initialize the package.
;; - Otherwise, PACKAGE is already referenced by another Spacemacs layer, so
;; define the functions `my-config/pre-init-PACKAGE' and/or
;; `my-config/post-init-PACKAGE' to customize the package as it is loaded.
;;; Code:
(defconst my-config-packages
'(
auto-complete
;; graphviz-dot-mode ;; it has been configured by graphviz layer
;;blink-cursor-mode
;; psvn
(my-verilog :location local)
(verilog-mode :location local)
;;(mmm-mode :location local)
mmm-mode
highlight-symbol
(tcl-dc-mode :location local)
;;htmlize
electric-spacing
(my-electric-spacing :location local)
;; ctags
ctags-update
;; auctex
;; auto-complete-auctex
plantuml-mode
;; a tool to generate relevatn Mindmap or structrue diagram from org/json/yaml
(my-plantuml :location local)
(plantuml :location local)
(ob-json :location local)
;; tabbar
;; tabbar-ruler
(sos-mode :location local)
(org :location built-in)
;; org-appear
(compilation-mode :location built-in)
flycheck
flycheck-plantuml
(company-verilog :location local)
(company-english-helper :location local)
;; (awesome-tab :location (recipe
;; :fetcher github
;; :repo manateelazycat/awesome-tab)) ;;from [https://github.com/manateelazycat/awesome-tab]
;; header2
(awesome-pair :location (recipe
:fetcher github
:repo manateelazycat/awesome-pair))
pyim-wbdict
pyim
posframe
company-posframe
;; cnfonts
beacon
;; company-tabnine
(thing-edit :location (recipe
:fetcher github
:repo manateelazycat/thing-edit))
;; (thing-edit :location local)
;; (aweshell :location (recipe
;; :fetcher github
;; :repo manateelazycat/aweshell))
(color-rg :location (recipe
:fetcher github
:repo manateelazycat/color-rg))
(auto-save :location (recipe
:fetcher github
:repo manateelazycat/auto-save))
;; (eaf :location local)
;; magit-todos
;; (magit-gerrit :location (recipe
;; :fetcher github
;; :repo zeph1e/magit-gerrit)) ;; https://github.com/terranpro/magit-gerrit/pull/56
separedit
;; (snails :location (recipe
;; :fetcher github
;; :repo manateelazycat/snails))
rime
(vc-msg :location (recipe
:fetcher github
:repo redguardtoo/vc-msg))
(flywrap :location local)
(avy-thing-edit :location (recipe
:fetcher github
:repo lyjdwh/avy-thing-edit))
chinese-word-at-point
bing-dict
google-translate
youdao-dictionary
sdcv
(multi-translate :location (recipe
:fetcher github
:repo twlz0ne/multi-translate.el))
;; org-roam
;; org-roam-server
;; mermaid-mode
;; (hideshowvis :location local)
atomic-chrome
(liberty-mode :location local)
(citre :location (recipe
:fetcher github
:repo my2817/citre) )
(citre-auto-update :location local)
(all-the-icons :location (recipe
:fetcher github
:repo domtronn/all-the-icons.el.git))
gitlab
ivy-gitlab
(my-gitlab :location local)
(psvn :location local)
evil
cc-mode
c-mode
json-mode
yaml-mode
;; orderless
(vba-mode :location local)
consult
)
"The list of Lisp packages required by the my-config layer.
Each entry is either:
1. A symbol, which is interpreted as a package to be installed, or
2. A list of the form (PACKAGE KEYS...), where PACKAGE is the
name of the package to be installed or loaded, and KEYS are
any number of keyword-value-pairs.
The following keys are accepted:
- :excluded (t or nil): Prevent the package from being loaded
if value is non-nil
- :location: Specify a custom installation location.
The following values are legal:
- The symbol `elpa' (default) means PACKAGE will be
installed using the Emacs package manager.
- The symbol `local' directs Spacemacs to load the file at
`./local/PACKAGE/PACKAGE.el'
- A list beginning with the symbol `recipe' is a melpa
recipe. See: https://github.com/milkypostman/melpa#recipe-format")
(defun my-config/post-init-auto-complete()
"initial my-config/auto-complete"
(use-package auto-complete
:defer t
:config
(progn
;; (global-auto-complete-mode 1)
(add-to-list 'ac-modes 'graphviz-dot-mode)
(add-to-list 'ac-modes 'makefile-gmake-mode)
(add-to-list 'ac-modes 'TeX-latex-mode)
(add-to-list 'ac-modes 'verilog-mode)
(add-to-list 'ac-modes 'tcl-dc-mode)
(add-to-list 'ac-dictionary-directories (concat
(or (file-name-directory #$) (car load-path))
"local/ac-dict/"))
(add-to-list 'ac-sources 'ac-source-filename)
(add-to-list 'ac-sources 'ac-source-abbrev)
(setq ac-source-time
'((candidates . (list (format "%s" (format-time-string "%Y-%m-%d-%H:%M:%S"))))
(prefix . "@\\(.*\\)")))
(add-to-list 'ac-sources 'ac-source-time)
;;(add-to-list 'ac-dictionary-directories (expand-file-name "local/ac-dict/" user-emacs-directory))
(setq-default ac-sources ac-sources);;make sure the default value is what I seeted previous
(setq-default ac-disable-faces nil))))
;; (defun my-config/init-graphviz-dot-mode ()
;; "Initialize my package"
;; (use-package graphviz-dot-mode
;; :defer t
;; :init
;; (progn
;; (setq graphviz-dot-preview-extension "jpg")
;; )))
;; (defun my-config/init-psvn ()
;; "Initialize psvn"
;; (use-package psvn
;; :defer t
;; :init
;; ))
(defun my-config/init-htmlize ()
"Initialize htmlize"
(use-package htmlize
:defer t
))
(defun my-config/init-my-verilog ()
"Initialize my package"
(use-package my-verilog
:defer t
:init
(progn
(add-hook 'verilog-mode-hook 'my-verilog)
(autoload 'my-verilog "my-verilog" "my configuration of verilog-mode " t)
)))
(defun my-config/init-verilog-mode ()
(use-package verilog-mode
:defer t
:config
;; (modify-syntax-entry ?` "." verilog-mode-syntax-table)
;; `electric-verilog-tab' error while excute `verilog-calculate-indent'
;; because "`" is not a word-constituent from the last line, we need to move "`" outside of "\\<" in verilog-directive-re-1
;; (defconst verilog-directive-re-1 "[ ]*`\\<\\(\\(?:__\\(?:FILE__\\|LINE\\)\\|begin_keywords\\|c\\(?:\\(?:as\\|elldefin\\)e\\)\\|def\\(?:ault\\(?:_nettype\\)?\\|ine\\)\\|e\\(?:ls\\(?:e\\|if\\)\\|nd\\(?:_keywords\\|celldefine\\|for\\|if\\|protect\\|switch\\|while\\)\\)\\|for\\(?:mat\\)?\\|i\\(?:f\\(?:n?def\\)?\\|nclude\\)\\|l\\(?:et\\|ine\\)\\|nounconnected_drive\\|pr\\(?:agma\\|otect\\)\\|resetall\\|switch\\|time\\(?:_?scale\\)\\|u\\(?:n\\(?:connected_drive\\|def\\(?:ineall\\)?\\)\\|selib\\)\\|while\\)\\)\\>")
(add-hook 'verilog-mode
(lambda ()
;; use citre, don't need this
(remove-hook 'completion-at-point-functions
'verilog-completion-at-point t)))
;; use electric-spaceing but not 'electric-verilog-colon
(define-key verilog-mode-map [remap electric-verilog-colon] 'self-insert-command)
))
(defun my-config/post-init-mmm-mode ()
"Initialize my package"
(use-package mmm-mode
:defer t
:config
(progn
;;(autoload 'mmm-mode "mmm-mode" "Multiple Major Modes" t)
;;(autoload 'mmm-parse-buffer "mmm-mode" "Automatic MMM-ification" t)
(setq mmm-global-mode 'maybe))
))
(defun my-config/init-highlight-symbol ()
"Initialize my package"
(use-package highlight-symbol
:defer t
:init
(progn
;;(require 'highlight-symbol)
;;(autoload 'highlight-symbol "highlight-symbol" "Highlight-Func Mode" t)
)
))
(defun my-config/init-tcl-dc-mode ()
"Initialize my package"
(use-package tcl-dc-mode
:defer t
:init
(progn
(autoload 'tcl-dc-mode "tcl-dc-mode" "Tcl DC Mode" t)
(add-to-list 'auto-mode-alist '("\\.tcl\\'" . tcl-dc-mode))
(add-to-list 'auto-mode-alist '("\\.sdc\\'" . tcl-dc-mode))
)
:config
(progn
(company-mode)
(add-hook 'tcl-mode-hook
(lambda ()
(company-mode)
(setq-local company-backends '(company-files
(company-yasnippet company-dabbrev-code company-capf company-gtags company-keywords)
company-oddmuse company-dabbrev)))
)
)
))
(defun my-config/init-electric-spacing()
"Initialize my package"
(use-package electric-spacing
:defer t
:init
:config
(setq electric-spacing-operators '(?= ?< ?> ?% ?+ ?- ?* ?/ ?& ?| ?: ?? ?, ?~ ?. ?\( ?^ ?\; ?! ?@))
))
(defun my-config/init-my-electric-spacing()
(use-package my-electric-spacing
:defer t
:init
(autoload 'my-electric-spacing "my-electric-spacing" "customize of electric-spacing" t)
(add-hook 'electric-spacing-mode-hook 'my-electric-spacing)))
(defun my-config/init-ctags()
(use-package ctags
:defer t
:init ))
(defun my-config/init-ctags-update()
(use-package ctags-update
:defer t
:config
(progn
(autoload 'turn-on-ctags-auto-update-mode "ctags-update" "turn on `ctags-auto-update-mode'." t)
)
:init ))
(defun my-config/init-plantuml-mode()
(use-package plantuml-mode
:defer t
:init
(progn
(setq plantuml-jar-path (expand-file-name "~/.spacemacs.d/plantuml.jar"))
)
:config
(progn
(setq plantuml-default-exec-mode 'jar)
(add-hook 'plantuml-mode-hook (lambda ()
(set (make-local-variable 'indent-line-function)
#'plantuml-indent-line)))
(add-hook 'plantuml-mode-hook 'company-mode)
(add-hook 'plantuml-mode-hook 'electric-spacing-mode)
(add-hook 'plantuml-mode-hook 'my-plantuml)
)
))
(defun my-config/init-my-plantuml ()
(use-package my-plantuml
:defer t
:init (progn
(autoload 'my-plantuml "my-plantuml" "my configuration of plantuml-mode " t)
)
:config
)
)
(defun my-config/init-auctex()
(use-package auctex
:defer t
:init (progn
(load "auctex.el")
(add-hook 'LaTeX-mode-hook (lambda()
(add-to-list 'TeX-command-list '("XeLaTeX" "%`xelatex%(mode)%' %t" TeX-run-TeX nil t))
(setq TeX-command-default "XeLaTeX")
(setq TeX-save-query nil )
(setq TeX-show-compilation t)
)))
))
(defun my-config/init-auto-complete-auctex()
(use-package auto-complete-auctex
:defer t))
(defun my-config/init-tabbar ()
(use-package tabbar
:defer t
))
(defun my-config/init-tabbar-ruler ()
(use-package tabbar-ruler
:defer t
:config
(progn
(setq tabbar-ruler-global-tabbar t) ; If you want tabbar
(setq tabbar-ruler-global-ruler t) ; if you want a global ruler
(setq tabbar-ruler-popup-menu t) ; If you want a popup menu.
(setq tabbar-ruler-popup-toolbar t) ; If you want a popup toolbar
(setq tabbar-ruler-popup-scrollbar t) ; If you want to only show the
; scroll bar when your mouse is moving.
)
))
(defun my-config/init-sos-mode()
(use-package sos-mode
:defer t
:init
(progn
(autoload 'sos-mode "sos-mode.el" "some sos command." t)
(autoload 'my-verilog-get-last-history-log "my-verilog" "get change log of today" t)
(sos-mode)
)))
(defun my-config/post-init-org()
(with-eval-after-load 'org
(progn
(setq org-confirm-babel-evaluate nil)
;; if emacs prompt that the launguages can't be evaluate and the setting of following is OK, please do spacemacs/recompile-elpa and try agin
(setq org-plantuml-jar-path
(expand-file-name "~/.spacemacs.d/plantuml.jar"))
(setq org-json-plantuml-jar-path
(expand-file-name "~/.spacemacs.d/plantuml.jar"))
(setq org-ditaa-jar-path "~/.spacemacs.d/ditaa.jar")
(org-babel-do-load-languages
'org-babel-load-languages
'((perl . t)
(ruby . t)
(shell . t)
(dot . t)
(js . t)
(latex . t)
(python . t)
(emacs-lisp . t)
(plantuml . t)
(C . t)
(awk . t)
(ditaa . t)
(json . t)
;; (mermaid . t)
))
(setq ob-mermaid-cli-path "~/node_modules/.bin/mmdc")
(setq org-todo-keywords
'((type "WORK(!)" "STUDY(!)" "|")
(sequence "TODO(t!)" "ONGOING(o!)" "|" "DONE(d!)")
;; debug sequence
(sequence "REPORT(r@/!)" "DEBUG(b@/!)" "KNOWNCAUSE(k@/!)" "|" "FIXED(f@/!)" "NOT_FIX(@/!)")
(sequence "|" "CANCEL(c@/!)")
))
(setq org-tag-alist '(
(:startgroup . nil)
("product" . nil)
(:grouptags . nil)
("develop" . ?d)
("debug" . ?D)
(:endgroup . nil)
(:startgroup . nil)
("DFE" . nil)
("DV" . nil)
("DBE" . nil)
(:grouptags . nil)
("HeYun" . ?h)
("YuYisong" . ?y)
("WangJunjie" . ?w)
("JiangSongzuo" . ?j)
("HuangQin" . ?H)
("LiuWanhang" . ?l)
("SunYahui" . ?s)
("BaiBo" . ?b)
("ShuXin" . ?S)
("LanTing" . ?L)
("ZhuoKang" . ?z)
("ZhangXing" . ?Z)
("ZhangJianguo" . ?J)
("FengYang" . ?f)
(:endgroup . nil)
))
;; 让中文也可以不加空格就使用行内格式
(setcar (nthcdr 0 org-emphasis-regexp-components) " \t('\"{[:nonascii:]")
(setcar (nthcdr 1 org-emphasis-regexp-components) "- \t.,:!?;'\")}\\[[:nonascii:]")
(org-set-emph-re 'org-emphasis-regexp-components org-emphasis-regexp-components)
(org-element-update-syntax)
;; 规定上下标必须加 {},否则中文使用下划线时它会以为是两个连着的下标
(setq org-use-sub-superscripts "{}")
(require 'org-crypt)
;; 當被加密的部份要存入硬碟時,自動加密回去
(org-crypt-use-before-save-magic)
;; 設定要加密的 tag 標籤為 secret
(setq org-crypt-tag-matcher "secret")
;; 避免 secret 這個 tag 被子項目繼承 造成重複加密
;; (但是子項目還是會被加密喔)
(setq org-tags-exclude-from-inheritance (quote ("secret")))
;; 用於加密的 GPG 金鑰
;; 可以設定任何 ID 或是設成 nil 來使用對稱式加密 (symmetric encryption)
(setq org-crypt-key nil)
;; (custom-set-variables '(org-superstar-headline-bullets-list '("Ⅰ" "Ⅱ" "Ⅲ" "Ⅳ" "Ⅴ" "Ⅵ" "Ⅶ" "Ⅷ" "Ⅸ" "Ⅹ" "Ⅺ" "Ⅻ" "Ⅼ" "Ⅽ" "Ⅾ" "Ⅿ" )))
(custom-set-variables '(org-superstar-headline-bullets-list '("○" "✿" "✸" "◉")))
;; after org9.2 [[https://orgmode.org/Changes.html][changlog]]
;; prefer using previous patterns, e.g. <s, goto org-tempo.el for more information
(add-to-list 'org-modules 'org-tempo)
;; export into freemind *.mm file, and open with freemplane
;; to support chinese in freeplane, should do the following
;; - linux
;; export _JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Dsun.java2d.xrender=true -Dfile.encoding=UTF8 $_JAVA_OPTIONS"
;; - window 需要找到Freeplane的安装路径(我的为D:\Program Files\Freeplane),将其加入到启动配置文件freeplane.l4j.ini中
;; #+begin_example
;; -Dawt.useSystemAAFontSettings=on
;; -Dswing.aatext=true
;; -Dsun.java2d.xrender=true
;; -Dfile.encoding=UTF8
;; #+end_example
;;
(add-to-list 'org-modules 'ox-freemind)
(setq org-hide-emphasis-markers t)
))
)
(defun my-config/init-compilation-mode()
(use-package compilation-mode
:defer t
:init
(progn
(setq fm-error-regexp-emacs-alist
'(
(fm-WARNING
"\\([^ \t\n,]+\\):\\([0-9]+\\):.*\[WARNING\]" 1 2 nil 2)
(fm-ERROR
"\\([^ \t\n,]+\\):\\([0-9]+\\):.*\[ERROR\]" 1 2 nil 2)
))
(require 'compile)
(my-config-error-regexp-add-emacs fm-error-regexp-emacs-alist))
)
)
(defun my-config/post-init-flycheck ()
(dolist (mode '(verilog-mode))
(spacemacs/enable-flycheck mode))
(require 'flycheck)
(flycheck-define-checker verilog-leda
"A verilog coding style check by synopsys LEDA "
:command ("leda" "+v2k" "-nobanner" "-nocompilemessage" "-nocode" "-work" temporary-file-name "-log_dir" temporary-directory source)
:error-patterns (
;; (error line-start (file-name) ":" line ":" column ":" (1+ "a-zA-Z_") ":" (message) line-end))
(error line-start (file-name) ":" line ":" (message) line-end))
:modes verilog-mode
)
(flycheck-define-checker verilog-verilator
"A Verilog syntax checker using the Verilator Verilog HDL simulator.
See URL `https://www.veripool.org/wiki/verilator'.
The original checker(verilog-verilator) doesn't work because of it chechouted that the verilator should be run by `start-process-shell-command',
for the reasion described above, use bash to start verilator
"
:command ("verilator_bin" "--lint-only" "-Wall" "-Wno-ASSIGNDLY" source)
:error-patterns
((warning line-start "%Warning-" (zero-or-more not-newline) ": "
(file-name) ":" line ": " (message) line-end)
(error line-start "%Error: " (file-name) ":"
line ": " (message) line-end)
(error line-start "%Error: " (message)))
:modes verilog-mode)
(flycheck-define-checker verilog-iverilog
"A verilog syntax checker using icarus-verilog.
See URL `https://github.com/steveicarus/iverilog'"
:command ("iverilog" "-tnull" source)
:error-patterns
(
(warning line-start (file-name) ":" line ": " "warning:" (message))
(error line-start (file-name) ":" line ": " "error:" (message))
)
:modes verilog-mode
)
(flycheck-define-checker verilog-irun
"A verilog syntax checker using irun
See URL `irun -helpall'"
:command ("irun" "-nocopy" "-nclibdirname" temporary-directory "-nolog" "-nohistory" "-compile" source)
:error-patterns
(
;; (error line-start "ncvlog: *E," (id (1+ "A-Z")) "(" (file-name) "," line "|" column "):" (message))
;; ncvlog: *E,EXPLPA (SYN_CODE_GEN_tb.sv,25|14): expecting a left parenthesis ('(') [12.1.2][7.1(IEEE)]
(error line-start "ncvlog: *E," (id (* (char "A-Z"))) " " "(" (file-name) "," line "|" (* (char "0-9")) ")" ":" (message))
(error line-start "irun: *E," (id (* (char "A-Z"))) ": " (message))
)
:modes verilog-mode
)
(add-to-list 'flycheck-checkers 'verilog-leda)
(add-to-list 'flycheck-checkers 'verilog-verilator)
(add-to-list 'flycheck-checkers 'verilog-iverilog)
(add-to-list 'flycheck-checkers 'verilog-irun)
)
(defun my-config/init-company-verilog ()
(use-package company-verilog
:defer t
:init
(progn
(autoload 'company-verilog "company-verilog" "company-mode in verilog-mode " t)
(add-hook 'verilog-mode-hook 'company-verilog)
))
)
(defun my-config/init-header2 ()
(use-package header2
:defer t
:init
)
)
(defun my-config/init-flycheck-plantuml ()
(use-package flycheck-plantuml
:defer t
:init
)
)
(defun my-config/init-company-english-helper ()
(use-package company-english-helper
:defer t
:init
(progn
;; (autoload 'company-english-helper "company-english-helper" "En-helper" t)
(require 'company-english-helper)
(toggle-company-english-helper)
)
))
(defun my-config/init-awesome-tab ()
(use-package awesome-tab
:init
(progn
;; need all-the-icon fonts: https://github.com/domtronn/all-the-icons.el/tree/master/fonts
(require 'awesome-tab)
;; (awesome-tab-mode)
)
:config
(custom-set-variables '(awesome-tab-height 120))
))
(defun my-config/init-awesome-pair()
(use-package awesome-pair
:defer t
:init (require 'awesome-pair)
:config (progn
(dolist (hook (list
'c-mode-common-hook
'c-mode-hook
'c++-mode-hook
'java-mode-hook
'haskell-mode-hook
'emacs-lisp-mode-hook
'lisp-interaction-mode-hook
'lisp-mode-hook
'maxima-mode-hook
'ielm-mode-hook
'sh-mode-hook
'makefile-gmake-mode-hook
'php-mode-hook
'python-mode-hook
'js-mode-hook
'go-mode-hook
'qml-mode-hook
'jade-mode-hook
'css-mode-hook
'ruby-mode-hook
'coffee-mode-hook
'rust-mode-hook
'qmake-mode-hook
'lua-mode-hook
'swift-mode-hook
'minibuffer-inactive-mode-hook
'verilog-mode-hook
))
(add-hook hook '(lambda () (awesome-pair-mode 1)))
;; the following keybindings is conflict with `electric-spacing-mode
;; (define-key awesome-pair-mode-map (kbd "(") 'awesome-pair-open-round)
;; (define-key awesome-pair-mode-map (kbd "[") 'awesome-pair-open-bracket)
;; (define-key awesome-pair-mode-map (kbd "{") 'awesome-pair-open-curly)
;; (define-key awesome-pair-mode-map (kbd ")") 'awesome-pair-close-round)
;; (define-key awesome-pair-mode-map (kbd "]") 'awesome-pair-close-bracket)
;; (define-key awesome-pair-mode-map (kbd "}") 'awesome-pair-close-curly)
;; (define-key awesome-pair-mode-map (kbd "=") 'awesome-pair-equal)
;; (define-key awesome-pair-mode-map (kbd "%") 'awesome-pair-match-paren)
;; (define-key awesome-pair-mode-map (kbd "\"") 'awesome-pair-double-quote)
;; (define-key awesome-pair-mode-map (kbd "M-o") 'awesome-pair-backward-delete)
;; (define-key awesome-pair-mode-map (kbd "C-d") 'awesome-pair-forward-delete)
;; (define-key awesome-pair-mode-map (kbd "C-k") 'awesome-pair-kill)
;; (define-key awesome-pair-mode-map (kbd "M-\"") 'awesome-pair-wrap-double-quote)
;; (define-key awesome-pair-mode-map (kbd "M-[") 'awesome-pair-wrap-bracket)
;; (define-key awesome-pair-mode-map (kbd "M-{") 'awesome-pair-wrap-curly)
;; (define-key awesome-pair-mode-map (kbd "M-(") 'awesome-pair-wrap-round)
;; (define-key awesome-pair-mode-map (kbd "M-)") 'awesome-pair-unwrap)
;; (define-key awesome-pair-mode-map (kbd "M-p") 'awesome-pair-jump-right)
;; (define-key awesome-pair-mode-map (kbd "M-n") 'awesome-pair-jump-left)
;; (define-key awesome-pair-mode-map (kbd "M-:") 'awesome-pair-jump-out-pair-and-newline)
)
)))
(defun my-config/init-pyim ()
(use-package pyim
:defer nil
:demand t
:ensure nil
:init
(progn
(require 'pyim)
)
:bind
(("C-c M-j" . pyim-convert-string-at-point) ;与 pyim-probe-dynamic-english 配合
)
:config
(defun pyim-add-unread-command-events (key &optional reset)
" \"no record\" in mini buffer"
(when reset
(setq unread-command-events nil))
(setq unread-command-events
(if (characterp key)
(cons key unread-command-events)
(append (mapcan (lambda (e) (list e))
(append key nil))
unread-command-events))))
(progn
(setq default-input-method "pyim")
;; 设置 pyim 探针设置,这是 pyim 高级功能设置,可以实现 *无痛* 中英文切换 :-)
;; 我自己使用的中英文动态切换规则是:
;; 1. 光标只有在注释里面时,才可以输入中文。
;; 2. 光标前是汉字字符时,才能输入中文。
;; 3. 使用 M-j 快捷键,强制将光标前的拼音字符串转换为中文。
(setq-default pyim-english-input-switch-functions
'(pyim-probe-dynamic-english
pyim-probe-isearch-mode
pyim-probe-program-mode
pyim-probe-org-speed-commands
pyim-probe-org-structure-template))
(setq-default pyim-punctuation-half-width-functions
'(pyim-probe-punctuation-line-beginning
pyim-probe-punctuation-after-punctuation))
;; 使用 pupup-el 来绘制选词框, 如果用 emacs26, 建议设置
;; 为 'posframe, 速度很快并且菜单不会变形,不过需要用户
;; 手动安装 posframe 包。
;; (setq pyim-page-tooltip 'popup)
(setq pyim-page-tooltip 'posframe)
;; 选词框显示5个候选词
(setq pyim-page-length 5)
;; (setq pyim-default-scheme 'wubi)
(setq pyim-default-scheme 'xiaohe-shuangpin)
(if (featurep 'pyim)
(pyim-extra-dicts-add-dict
`(:name "pyim-bigdict" :file "~/.spacemacs.d/layers/my-config/local/pyim-dict/pyim-bigdict.pyim" :elpa t )))
)))
(defun my-config/init-pyim-wbdict ()
(use-package pyim-wbdict
:defer t
:after pyim
:init
(pyim-wbdict-v98-enable)
:config
(progn
(setq pyim-assistant-scheme-enable t)
(if (featurep 'pyim)
(pyim-extra-dicts-add-dict
`(:name "electric-wbdict" :file "~/.spacemacs.d/layers/my-config/local/pyim-dict/electric-wbdict.pyim" :elpa t))
(message "electric-wbdict 没有安装,pyim-wbdict 启用失败。"))
(if (featurep 'pyim)
(pyim-extra-dicts-add-dict
`(:name "wbdict-use" :file ,"~/.spacemacs.d/layers/my-config/local/pyim-dict/pyim-wbdict-user.pyim" :elpa t))
(message "wbdict-user 没有安装,pyim-wbdict 启用失败。"))
)
)
)
(defun my-config/init-posframe ()
(use-package posframe
:defer t
:init
)
)
(defun my-config/init-company-posframe ()
(use-package company-posframe
:if (display-graphic-p)
:after company
:defer t
:init
:config
)
)
(defun my-config/init-cnfonts ()
(use-package cnfonts
:defer t
:init
(progn
(cnfonts-enable)
(cnfonts-set-spacemacs-fallback-fonts))
))
(defun my-config/init-beacon ()
(use-package beacon
:defer t
:init
(progn
;; (beacon-mode)
)))
(defun my-config/init-company-tabnine ()
(use-package company-tabnine
:defer t
:init
;; (progn
;; (require 'company-tabnine))
)
)
;;; 配置company-tabnine作为company的后端
(defun tabnine/post-init-company-tabnine()
(with-eval-after-load 'company
(add-to-list 'company-backends #'company-tabnine)
)
)
(defun my-config/init-thing-edit ()
(use-package thing-edit
:defer t
:ensure t
:init
(progn
(require 'thing-edit)
)))
(defun my-config/init-avy-thing-edit ()
(use-package avy-thing-edit
:defer t
:init
(progn
(require 'avy-thing-edit)
)))
(defun my-config/init-aweshell ()
(use-package aweshell
:defer t
:init
(progn
(require 'aweshell)
)))
(defun my-config/init-magit-todos ()
(use-package magit-todos
:defer t
:init
(progn
(setq magit-todos-nice (if (executable-find "nice") t nil))
(magit-todos-mode 1)
;;performance, this will check todos in all branches
(setq magit-todos-branch-list nil)
)))
(defun my-config/init-magit-gerrit ()
(use-package magit-gerrit
:defer t
:init
(progn
;; (setq-default magit-gerrit-ssh-creds "myid@gerrithost.org")
;; DONT compile magit-gerrit.el into elc file(remove it if)
(require 'magit-gerrit)
)))
(defun my-config/init-separedit ()
(use-package separedit
:init
(progn
(require 'separedit)
(define-key prog-mode-map (kbd "C-c '") #'separedit)
(setq separedit-default-mode 'org-mode))
:config
(progn
;; add verilog-mode into separedit
(setq separedit-code-lang-modes
'(("C" . c-mode)
("C++" . c++-mode)
("asymptote" . asy-mode)
("bash" . sh-mode)
("calc" . fundamental-mode)
("cpp" . c++-mode)
("ditaa" . artist-mode)
("dot" . fundamental-mode)
("elisp" emacs-lisp-mode lisp-interaction-mode)
("ocaml" . tuareg-mode)
("screen" . shell-script-mode)
("shell" . sh-mode)
("sqlite" . sql-mode)
("verilog" . verilog-mode)))
(setq separedit-comment-delimiter-alist
'((("//+" "\\*+")
c-mode c++-mode csharp-mode css-mode go-mode java-mode js-mode objc-mode php-mode swift-mode verilog-mode)
(("//+!" "//+" "\\*+")
. rust-mode)
(("--")
applescript-mode haskell-mode lua-mode)
(("//+")
pascal-mode fsharp-mode)
((";+")
emacs-lisp-mode lisp-interaction-mode common-lisp racket-mode scheme-mode)
(("#+")
python-mode ruby-mode)))
(setq separedit-comment-encloser-alist
'((("/\\*+" "\\*/")
c-mode c++-mode csharp-mode css-mode go-mode java-mode js-mode objc-mode php-mode rust-mode swift-mode verilog-mode)
(("{-" "-}")
. haskell-mode)
(("{" "}")
. pascal-mode)
(("(\\*" "\\*)")
applescript-mode fsharp-mode ocaml-mode)
(("#|" "#|")
common-lisp racket-mode scheme-mode)
(("<!--" "-->")
html-mode xml-mode)
(("--\\[[" "--\\]\\]")
. lua-mode)
(("=begin" "=end")
. ruby-mode)))
)))
(defun my-config/init-snails ()
(use-package snails
:defer t
:init
(progn
(require 'snails)
)))
(defun my-config/init-rime ()
(use-package rime
:defer t
:init
(require 'rime)
:config
(progn
(setq rime-user-data-dir "~/.config/fcitx/rime")
;; (setq rime--module-path "~/.emacs.d/.cache/quelpa/build/rime/librime-emacs.so")
(setq rime-posframe-properties
(list :background-color "#333333"
:foreground-color "#dcdccc"
:font "WenQuanYi Micro Hei Mono-14"
:internal-border-width 10))
;; (setq default-input-method "rime"
;; rime-show-candidate 'posframe)
(setq rime-disable-predicates
'(rime-predicate-evil-mode-p
rime-predicate-after-alphabet-char-p
;rime-predicate-prog-in-code-p
rime-predicate-auto-english-p))
)))
(defun my-config/init-vc-msg ()
(use-package vc-msg
:defer t
))
(defun my-config/init-flywrap ()
(use-package flywrap
:defer t
:init
(progn
(require 'flywrap)
))
)
(defun my-config/init-chinese-word-at-point ()
(use-package chinese-word-at-point
:defer t
))
(defun my-config/init-bing-dict ()
(use-package bing-dict
:defer t
))
(defun my-config/init-google-translate ()
(use-package google-translate
:defer t
))
(defun my-config/init-youdao-dictionary ()
(use-package youdao-dictionary
:defer t
))
(defun my-config/init-sdcv ()
(use-package sdcv
:defer t
))
(defun my-config/init-multi-translate ()
(use-package multi-translate
:defer t
))
(defun my-config/init-org-roam()
(use-package org-roam
:defer t
:config
(progn (setq org-roam-directory "/mnt/c/Users/User/Documents/gtd"))
:init
(progn (org-roam-mode))
))
(defun my-config/init-org-roam-server()
(use-package org-roam-server
:defer t
:init
(progn (org-roam-server-mode))
))
(defun my-config/init-eaf()
"wsl:
git clone eaf into ./local/eaf
apt install -y pyqt5 pyqt5-dev
pip install PyQt5 PyQtWebEngine
shell:
eval $(dbus-launch)
export DBUS_SESSION_BUS_ADDRESS
emacs
win10:
git clone eaf
install python3
install pip
install node
win10菜单搜索【管理应用执行别名】关闭下面两个 python/python3的选项
PowerShell: cd to eaf
node install-eaf-win32.js
"
(use-package eaf
:load-path "~/.spacemacs.d/layers/my-config/local/eaf" ; Set to "/usr/share/emacs/site-lisp/eaf" if installed from AUR
:init
(use-package epc :defer t :ensure t)
(use-package ctable :defer t :ensure t)
(use-package deferred :defer t :ensure t)
(use-package s :defer t :ensure t)
:custom
(eaf-browser-continue-where-left-off t)
:config
;; (eaf-setq eaf-browser-enable-adblocker "true")
;; (eaf-bind-key scroll_up "C-n" eaf-pdf-viewer-keybinding)
;; (eaf-bind-key scroll_down "C-p" eaf-pdf-viewer-keybinding)
;; (eaf-bind-key take_photo "p" eaf-camera-keybinding)
;; (eaf-bind-key nil "M-q" eaf-browser-keybinding)
)
)
(defun my-config/init-mermaid-mode()
(use-package mermaid-mode
:defer t
:config
(setq ob-mermaid-cli-path "~/node_modules/.bin/mmdc")
))
(defun my-config/init-hideshowvis()
(use-package hideshowvis
:defer t
:init
(autoload 'hideshowvis-enable "hideshowvis" "Highlight foldable regions")
(autoload 'hideshowvis-minor-mode
"hideshowvis"
"Will indicate regions foldable with hideshow in the fringe."
'interactive)
(dolist (hook (list 'emacs-lisp-mode-hook
'c++-mode-hook
'verilog-mode-hook
))
(add-hook hook 'hideshowvis-enable))
))
(defun my-config/init-atomic-chrome()
;; 浏览器文本编辑区域调用外部编辑器
;; firefox extension: GhostText
(use-package atomic-chrome
:defer t
:config
(atomic-chrome-start-server)
))
(defun my-config/init-org-appear()
(use-package org-appear
:defer t
:init
(add-hook 'org-mode-hook 'org-appear-mode)
:config
(setq org-appear-autolinks t)
))
(defun my-config/init-liberty-mode()
(use-package liberty-mode
:defer t
:init
(progn
(autoload 'liberty-mode "liberty-mode.el" "Edite Synopsys liberty library file." t)
;; (sos-mode)
)
:config
))
(defun my-config/init-citre()
(use-package citre
:init
(require 'citre)
(require 'citre-config)
:defer t
:config
;;;;;
;; the folloing code has been implemented by citre
;; (defun my-verilog-get-symbol-atpt ()
;; (let* ((sym (symbol-at-point))
;; (char (substring (symbol-name sym) 0 1))
;; )
;; (if (string= "`" char)
;; (substring (symbol-name sym) 1)
;; (symbol-name sym))
;; )
;; )
;; (defvar citre-lang-verilog-plist
;; `(:get-symbol
;; my-verilog-get-symbol-atpt
;; )
;; "Verilog language support for Citre.")
;; (setf (alist-get 'verilog-mode citre-language-support-alist)
;; citre-lang-verilog-plist)
;; TODO: when add a third directory, imenu error with submodule env
(setq citre-ctags-cmd-buf-default-cmd
(concat "ctags
-o
%TAGSFILE%
--languages=all
--kinds-all=*
--fields=*
--extras=*
--extras=-{qualified}
-R
.
"
;; ;; add dirs/files to scan here, one line per dir/file
;; ;; see \"citre-edit-cmd-buf-default-cmd\" to change the default value
"/md3200/tools/tools2/cadence2015/INCISIVE152/tools/methodology/UVM/CDNS-1.1d/sv/src"
)
)
(setq citre-completion-case-sensitive nil)
(setq citre-tags-completion-case-sensitive nil)
(custom-set-variables '(citre-completion-backends '(tags global))
'(citre-find-definition-backends '(tags global))
'(citre-find-reference-backends '(tags global))
'(citre-tags-in-buffer-backends '(tags global))
'(citre-auto-enable-citre-mode-backends '(tags global))
'(citre-capf-optimize-for-popup nil))
(defun citre-jump+ ()
(interactive)
(condition-case _
(citre-jump)
(error (call-interactively #'xref-find-definitions))))
))
(defun my-config/init-citre-auto-update()
(use-package citre-auto-update
:defer t
:init (progn
(require 'citre-auto-update)
(require 'consult-citre))
:config
(citre-auto-update-enable)
))
(defun my-config/init-all-the-icons()
(use-package all-the-icons
:defer t
:init
:config
))
(defun my-config/init-gitlab()
(use-package gitlab
:defer t
:init
:config
))
(defun my-config/init-ivy-gitlab()
(use-package ivy-gitlab
:defer t
:init
:config
))
(defun my-config/init-my-gitlab ()
(use-package my-gitlab
:defer t
:init (require 'my-gitlab))
)
(defun my-config/init-psvn ()
;; 如果需要保存密码:
;; ~/.subversion/config: password-stores = gpg-agent,gnome-keyring,kwallet
;; ~/.subversion/servers: store-passwords = yes
;; gpg-agent --daemon
(use-package psvn
:defer t
:init (require 'psvn))
)
(defun my-config/init-liberty-mode ()
(use-package liberty-mode
:defer t
:init
(progn
(add-to-list 'auto-mode-alist '("\\.lib\\'" . liberty-mode))
(autoload 'liberty-mode "liberty-mode" "Synopsys NLDM" t))
))
(defun my-config/init-color-rg ()
(use-package color-rg
:defer t
:init (require 'color-rg))
)
(defun my-config/init-auto-save ()
(use-package auto-save
:defer t
:init (require 'auto-save)
:config
(auto-save-enable)
(setq auto-save-silent t) ; quietly save
(setq auto-save-delete-trailing-whitespace t) ; automatically delete spaces at the end of the line when saving
;;; custom predicates if you don't want auto save.
;;; disable auto save mode when current filetype is an gpg file.
(setq auto-save-disable-predicates
'((lambda ()
(string-suffix-p
"gpg"
(file-name-extension (buffer-name)) t))
(lambda () (string= major-mode "snippet-mode"))
(lambda () (buffer-live-p (get-buffer " *undo-tree*")))
(lambda () (string= (buffer-name) "COMMIT_EDITMSG"))))
)
)
(defun my-config/post-init-evil ()
(with-eval-after-load 'evil
(progn
(define-key evil-normal-state-map [remap find-file-at-point] 'xah-open-file-at-cursor)
(evil-set-initial-state 'gitlab-mrs-mode 'normal)
(evil-set-initial-state 'gitlab-projects-mode 'normal)
(evil-set-initial-state 'gitlab-issues-mode 'normal)
))
)
(defun my-config/post-init-cc-mode ()
(with-eval-after-load 'cc-mode
(progn
(defun my-c++-indent/hs ()
"work around `c-indent-line-or-region', indent or hide/show fring.
If `buffer-read-only' is non-nil, execute `my-hideshowvis-fringe'.
If `c-indent-line-or-region' don't change position, execute `my-hideshowvis-fringe'.
"
(interactive)
(if (or buffer-read-only
(let* ((old-position (point))
(new-position (progn (c-indent-line-or-region)
(point))))
(= old-position new-position))
)
(my-hideshowvis-fringe)))
(defun my-c-indent/hs ()
"work around `c-indent-line-or-region', indent or hide/show fring.
If `buffer-read-only' is non-nil, execute `my-hideshowvis-fringe'.
If `c-indent-line-or-region' don't change position, execute `my-hideshowvis-fringe'.
"
(interactive)
(if (or buffer-read-only
(let* ((old-position (point))
(new-position (progn (c-indent-line-or-region)
(point))))
(= old-position new-position))
)
(my-hideshowvis-fringe)))
(define-key c-mode-map [remap c-indent-line-or-region] 'my-c-indent/hs)
(define-key c++-mode-map [remap c-indent-line-or-region] 'my-c++-indent/hs)
))
)
(defun my-config/init-plantuml ()
(use-package plantuml
:defer t
:init (require 'plantuml))
)
(defun my-config/init-json-mode ()
(use-package json-mode
:defer t
))
(defun my-config/init-ob-json ()
(use-package ob-json
:init (require 'ob-json)
:defer t
))
(defun my-config/init-yaml-mode ()
(use-package yaml-mode
:defer t
))
(defun my-config/init-orderless ()
(use-package orderless
:ensure t
:custom
(completion-styles '(orderless basic))
(completion-category-overrides '((file (styles basic partial-completion))))))
(defun my-config/init-vba-mode ()
(use-package vba-mode
:defer t
:init (require 'vba-mode)
:config (setq vba-mode-indent 4)
))
(defun my-config/init-consult ()
(use-package consult
:defer t
))
;;; packages.el ends here
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化