mirror of
https://gitlab.com/dwt1/dotfiles.git
synced 2026-04-23 19:40:24 +10:00
Moving to Doom Emacs!
This commit is contained in:
52
.emacs.d/modules/lang/nim/README.org
Normal file
52
.emacs.d/modules/lang/nim/README.org
Normal file
@@ -0,0 +1,52 @@
|
||||
#+TITLE: :lang Nim
|
||||
|
||||
#+begin_quote
|
||||
This module is a work in progress.
|
||||
#+end_quote
|
||||
|
||||
This module adds [[https://nim-lang.org][Nim]] support to Emacs.
|
||||
|
||||
+ Code completion (nimsuggest + company)
|
||||
+ Syntax checking (nimsuggest + flycheck)
|
||||
+ Babel support (~ob-nim~)
|
||||
|
||||
* Table of Contents :TOC:
|
||||
- [[#module-flags][Module Flags]]
|
||||
- [[#prerequisites][Prerequisites]]
|
||||
- [[#nim][Nim]]
|
||||
- [[#configuration][Configuration]]
|
||||
|
||||
* Module Flags
|
||||
This module provides no flags.
|
||||
|
||||
* Prerequisites
|
||||
+ ~nim~ (for building & evaluation)
|
||||
+ ~nimsuggest~ (for code completion, syntax checking & jump-to-definition functionality)
|
||||
|
||||
** Nim
|
||||
=choosenim= is an installer and version manager for the Nim programming
|
||||
language. You can install the latest stable release of Nim by running the
|
||||
following in your terminal and following the onscreen instructions:
|
||||
|
||||
#+BEGIN_SRC bash
|
||||
curl https://nim-lang.org/choosenim/init.sh -sSf | sh
|
||||
#+END_SRC
|
||||
|
||||
Alternatively, nim is usually available through your OS's package manager:
|
||||
|
||||
*** MacOS
|
||||
#+BEGIN_SRC sh :tangle (if (doom-system-os 'macos) "yes")
|
||||
brew install nim
|
||||
#+END_SRC
|
||||
|
||||
*** Arch Linux
|
||||
#+BEGIN_SRC sh :dir /sudo:: :tangle (if (doom-system-os 'arch) "yes")
|
||||
sudo pacman --needed --noconfirm -S nim nimble
|
||||
#+END_SRC
|
||||
|
||||
*** openSUSE
|
||||
#+BEGIN_SRC sh :dir /sudo::
|
||||
sudo zypper install nim
|
||||
#+END_SRC
|
||||
|
||||
* Configuration
|
||||
30
.emacs.d/modules/lang/nim/config.el
Normal file
30
.emacs.d/modules/lang/nim/config.el
Normal file
@@ -0,0 +1,30 @@
|
||||
;;; lang/nim/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(after! nim-mode
|
||||
(add-hook! 'nim-mode-hook
|
||||
(defun +nim-init-nimsuggest-mode-h ()
|
||||
"Conditionally load `nimsuggest-mode', instead of clumsily erroring out if
|
||||
nimsuggest isn't installed."
|
||||
(unless (stringp nimsuggest-path)
|
||||
(setq nimsuggest-path (executable-find "nimsuggest")))
|
||||
(when (and nimsuggest-path (file-executable-p nimsuggest-path))
|
||||
(nimsuggest-mode))))
|
||||
|
||||
(when IS-WINDOWS
|
||||
;; TODO File PR/report upstream (https://github.com/nim-lang/nim-mode)
|
||||
(defadvice! +nim--suggest-get-temp-file-name-a (path)
|
||||
"Removes invalid characters from the temp file path, including the unicode
|
||||
character that colon is replaced with, which is known to cause issues on
|
||||
windows."
|
||||
:filter-return #'nimsuggest--get-temp-file-name
|
||||
(replace-regexp-in-string "[꞉* |<>\"?*]" "" path)))
|
||||
|
||||
(map! :localleader
|
||||
:map nim-mode-map
|
||||
"b" #'nim-compile))
|
||||
|
||||
|
||||
(use-package! flycheck-nim
|
||||
:when (featurep! :tools flycheck)
|
||||
:after nim-mode)
|
||||
|
||||
9
.emacs.d/modules/lang/nim/doctor.el
Normal file
9
.emacs.d/modules/lang/nim/doctor.el
Normal file
@@ -0,0 +1,9 @@
|
||||
;; -*- lexical-binding: t; no-byte-compile: t; -*-
|
||||
;;; lang/nim/doctor.el
|
||||
|
||||
(unless (executable-find "nimsuggest")
|
||||
(warn! "Could not find nimsuggest executable; code-completion, syntax checking and jump-to-definition functionality will be disabled."))
|
||||
|
||||
(unless (executable-find "nim")
|
||||
(warn! "Could not find nim executable; build commands will be disabled."))
|
||||
|
||||
9
.emacs.d/modules/lang/nim/packages.el
Normal file
9
.emacs.d/modules/lang/nim/packages.el
Normal file
@@ -0,0 +1,9 @@
|
||||
;; -*- no-byte-compile: t; -*-
|
||||
;;; lang/nim/packages.el
|
||||
|
||||
;;; requires nim nimsuggest nimble
|
||||
|
||||
(package! nim-mode)
|
||||
|
||||
(when (featurep! :tools flycheck)
|
||||
(package! flycheck-nim))
|
||||
Reference in New Issue
Block a user