spacemacs/layers/+lang/nim/packages.el
Miciah Masters e0b751bee3 Avoid non-idempotent use of push in init code
Replace push with add-to-list in layer init functions and related code.

Modify spacemacs|add-toggle to check for and update an existing toggle in
spacemacs-toggles and only create a new toggle if none already existed.

Replace a conditional push onto erc-packages with use of :toggle.

When initializing which-key, set which-key-replacement-alist to its default
or customized setting before adding all the Spacemacs replacements.  We
want to keep the stock replacements but avoid adding duplicates of the
Spacemacs replacements.

Replace the emacs-lisp-mode-hook lambda with a named function to avoid
adding duplicate hooks (which can add duplicate definitions of the
evil-surround pair).
2018-06-05 22:17:13 -04:00

36 lines
940 B
EmacsLisp

(setq nim-packages
'(company
flycheck
flycheck-nim
nim-mode))
(defun nim/post-init-company ()
(spacemacs|add-company-backends
:backends company-capf
:modes nim-mode nimscript-mode))
(defun nim/post-init-flycheck ()
(spacemacs/enable-flycheck 'nim-mode))
(defun nim/init-flycheck-nim ()
(use-package flycheck-nim
:if (configuration-layer/package-used-p 'flycheck)))
(defun nim/init-nim-mode ()
(use-package nim-mode
:defer t
:init
(progn
(add-hook 'nim-mode-hook 'nimsuggest-mode)
(add-to-list 'spacemacs-jump-handlers-nim-mode 'nimsuggest-find-definition))
:config
(progn
(defun spacemacs/nim-compile-run ()
(interactive)
(shell-command "nim compile --run main.nim"))
(spacemacs/set-leader-keys-for-major-mode 'nim-mode
"cr" 'spacemacs/nim-compile-run
"gb" 'pop-tag-mark
"hh" 'nimsuggest-show-doc))))