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 **** Nim
- Added key binding ~SPC m h h~ to show symbol documentation (thanks to Valts - Added key binding ~SPC m h h~ to show symbol documentation (thanks to Valts
Liepiņš) 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 - Replace =company-capf= with =company-nimsuggest= in
=company-backends-nim-mode= to improve responsiveness (thanks to Uroš Perišić) =company-backends-nim-mode= to improve responsiveness (thanks to Uroš Perišić)
- Declare all prefix names (='(compile goto help)=) for =nim-mode= (thanks to - Declare all prefix names (='(compile goto help)=) for =nim-mode= (thanks to

View file

@ -39,8 +39,9 @@
:config :config
(progn (progn
(defun spacemacs/nim-compile-run () (defun spacemacs/nim-compile-run ()
"Compile current buffer file."
(interactive) (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 "mc" "compile")
(spacemacs/declare-prefix-for-mode 'nim-mode "mg" "goto") (spacemacs/declare-prefix-for-mode 'nim-mode "mg" "goto")