Make `spacemacs/nim-compile-run` work with current buffer file.

Naming the main file `main.nim` is a `C` convention, not a `Nim` convention. In
fact, `Nimble` defaults to naming the main file after the project at
initialization. I will soon add a function that parses the Nimble configuration
for project entry point and compiles that. Until then, this is a solid
compromise between flexibility and reliability. I also added a doc-string to the
function.
This commit is contained in:
Uros Perisic 2019-02-04 07:42:20 -08:00 committed by smile13241324
parent 4f765f4a3f
commit 66b3a0ba01
2 changed files with 4 additions and 1 deletions

View File

@ -1649,6 +1649,8 @@ Other:
**** Nim
- Added key binding ~SPC m h h~ to show symbol documentation (thanks to Valts
Liepiņš)
- Make =spacemacs/nim-compile-run= work with current buffer file instead of
defaulting to =main.nim= (thanks to Uroš Perišić)
- Replace =company-capf= with =company-nimsuggest= in
=company-backends-nim-mode= to improve responsiveness (thanks to Uroš Perišić)
- Declare all prefix names (='(compile goto help)=) for =nim-mode= (thanks to

View File

@ -39,8 +39,9 @@
:config
(progn
(defun spacemacs/nim-compile-run ()
"Compile current buffer file."
(interactive)
(shell-command "nim compile --run main.nim"))
(shell-command (concat "nim compile --run " (buffer-file-name))))
(spacemacs/declare-prefix-for-mode 'nim-mode "mc" "compile")
(spacemacs/declare-prefix-for-mode 'nim-mode "mg" "goto")