vim-better-sml
vim-better-sml copied to clipboard
SMLReplStart with 'use' requires incorrect filename
Suppose I'm editing the file test.sml
and decide to launch REPL. I call :SMLReplStart
and it works but does this:
val _ = use "SMLNJ";
val _ = use "SMLNJ";
Standard ML of New Jersey v110.85 [built: Thu Dec 27 20:00:48 2018]
- [opening SMLNJ]
[use failed: Io: openIn failed on "SMLNJ", No such file or directory]
-
I think the problem is in bettersml#repl#ReplUse(). expand('%')
evaluates to "SMLNJ"
because it is the name of the opened buffer which contains the REPL. There has to be a way to find out the name of the buffer that invoked the REPL, so that we do use "test.sml";
. It should also happen only once, I don't know why it seems to require "SMLNJ"
twice.
I'm using neovim 0.3.2 and don't have anything special in my init.vim. Healthcheck results:
health#bettersml#check
========================================================================
## REPL
- OK: REPL backend is available and valid: neovim
- OK: SML/NJ is executable at '/usr/bin/smlnj'.
- OK: rlwrap is available and will be used to launch REPLs
## Type information
- OK: MLton is executable at 'mlton'.
- OK: Support files are executable at '/home/interpreter/.vim/plugged/vim-better-sml/bin/vbs-util'.
## General
- OK: Asynchronous jobs are available.
- WARNING: def-use files will not be auto-built
- ADVICE:
- We did not find an MLBasis file for your project, and you have
- g:sml_auto_create_def_use = 'mlb'. This means that def-use files
- will only be auto-built for multi-file projects.
- See :help |g:sml_auto_create_def_use| for more information.
- OK: Either ALE or Syntastic is installed.
👋 Thanks for the bug report! I'll take a look at this later tonight and see what I find. In the mean time, I can't reproduce with these steps:
- No
test.sml
file exists. -
vim test.sml
-
:w
to create the file -
:SMLReplStart
-
REPL buffer opens with these contents:
val _ = use "test.sml"; Standard ML of New Jersey v110.84 [built: Fri Sep 28 19:40:37 2018] - [opening test.sml] -
-
I only get use "SMLNJ"
when my cursor is in an already created REPL buffer and I run :SMLReplStart
. The various :SML...
commands are meant to be run from an SML file.
Interesting. I tried to disable all plugins except this one and the issue was still present. Then I copied your settings and it solved the issue, although it still does val _ = use "test.sml";
twice. I wonder what this magical option is that changes behavior in this way.
In any case it seems to be fragile and it would be good to find a way to perform this initial use
more reliably.
Hi, I'm also seeing the same issue with :SMLReplStart
.
I'm using the .vimrc
created from your vim-as-an-ide
workshop. The one I'm using is at https://github.com/pbashyal-nmdp/dotfiles/blob/master/vimrc
I'm using the following version of neovim:
$ nvim --version
NVIM v0.3.8
Build type: Release
LuaJIT 2.0.5
Incidentally, the key bindings don't work for me as well. It just goes into insert mode when I do \is
I am encountering the same issue when I use :SMLReplStart
. This is the output I see following the steps in https://github.com/jez/vim-better-sml/issues/12#issuecomment-451527362
val _ = use "SMLNJ";
Standard ML of New Jersey (64-bit) v110.99.1 [built: Mon Apr 12 18:45:14 2021]
- [use failed: SMLNJ' does not exist or is unreadable]
-
After that, using :SMLReplBuild
on the empty test.sml
buffer runs Repo correctly
val _ = use "test.sml";
- [opening test.sml]
-
what worked for me was
:set splitbelow
:set splitright
Forcing the new window to appear as B (to the bottom or the right) fixed it for me. I believe Repl is trying to open itself if its the main window (A)