tpope / vim-fireplace

fireplace.vim: Clojure REPL support
https://www.vim.org/scripts/script.php?script_id=4978
1.74k stars 139 forks source link

Fireplace commands not available while editing Clojure file #346

Closed gizmo385 closed 5 years ago

gizmo385 commented 5 years ago

I've installed vim-fireplace, but cannot seem to access any of the commands inside of Vim while editing a Clojure file. I have verified that the plugin is installed and is loaded in :scriptnames:

I've used the same set of dotfiles on plenty of other hosts, so I'm assuming it might be something that is different about the particular host that I'm running this on. However, I'm not sure where to look further for configuration differences beyond the steps I've mentioned below. Any help or ideas that you could provide would be much appreciated!

59: ~/.dotfiles/dotfiles/.vim/bundle/vim-fireplace/plugin/fireplace.vim

Additionally, I'm able to pull up the :help documentation for fireplace. I've tried installing vim-salve, vim-classpath, and vim-dispatch to see if any of those might have assisted in getting the REPL to connect properly. I've also verified that the .nrepl-port file is getting created. It doesn't even appear as though the :Connect command is even available from within Vim (while editing a Clojure file):

image

Here is the output of :verbose set path?:

path=~/workspace/proj/test,~/workspace/proj/src,~/workspace/proj/dev-resources,~/workspace/proj/resources,~/workspace/proj/target/classes,~/.m2/repository/org/clojure/clojure/1.10.0/clojure-1.10.0.jar,~/.m2/repository/org/clojure/
tools.namespace/0.3.0/tools.namespace-0.3.0.jar,~/.m2/repository/clojure-complete/clojure-complete/0.2.4/clojure-complete-0.2.4.jar,~/.m2/repository/http-kit/http-kit/2.3.0/http-kit-2.3.0.jar,~/.m2/repository/org/clojure/tools.reader/0.10.0/tools.reader-0.10.0.jar,~/.m2/r
epository/org/clojure/data.json/0.2.6/data.json-0.2.6.jar,~/.m2/repository/org/clojure/tools.nrepl/0.2.13/tools.nrepl-0.2.13.jar,~/.m2/repository/org/clojure/java.classpath/0.2.3/java.classpath-0.2.3.jar,~/.m2/repository/org/clojure/core.specs.alpha/0.2.44/core.specs.alph
a-0.2.44.jar,~/.m2/repository/org/clojure/spec.alpha/0.2.176/spec.alpha-0.2.176.jar
Last set from ~/.dotfiles/dotfiles/.vim/bundle/vim-classpath/plugin/classpath.vim

And my vim --version output:

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 24 2016 22:32:42)
Included patches: 1-1829
Extra patches: 8.0.0056
Modified by pkg-vim-maintainers@lists.alioth.debian.org
Compiled by pkg-vim-maintainers@lists.alioth.debian.org
Huge version without GUI.  Features included (+) or not (-):
+acl             +farsi           +mouse_netterm   +tag_binary
+arabic          +file_in_path    +mouse_sgr       +tag_old_static
+autocmd         +find_in_path    -mouse_sysmouse  -tag_any_white
-balloon_eval    +float           +mouse_urxvt     -tcl
-browse          +folding         +mouse_xterm     +termguicolors
++builtin_terms  -footer          +multi_byte      +terminfo
+byte_offset     +fork()          +multi_lang      +termresponse
+channel         +gettext         -mzscheme        +textobjects
+cindent         -hangul_input    +netbeans_intg   +timers
-clientserver    +iconv           +packages        +title
-clipboard       +insert_expand   +path_extra      -toolbar
+cmdline_compl   +job             -perl            +user_commands
+cmdline_hist    +jumplist        +persistent_undo +vertsplit
+cmdline_info    +keymap          +postscript      +virtualedit
+comments        +langmap         +printer         +visual
+conceal         +libcall         +profile         +visualextra
+cryptv          +linebreak       -python          +viminfo
+cscope          +lispindent      +python3         +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con      -lua             +rightleft       +windows
+diff            +menu            -ruby            +writebackup
+digraphs        +mksession       +scrollbind      -X11
-dnd             +modify_fname    +signs           -xfontset
-ebcdic          +mouse           +smartindent     -xim
+emacs_tags      -mouseshape      +startuptime     -xsmp
+eval            +mouse_dec       +statusline      -xterm_clipboard
+ex_extra        +mouse_gpm       -sun_workshop    -xterm_save
+extra_search    -mouse_jsbterm   +syntax          -xpm
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H   -Wdate-time  -g -O2 -fdebug-prefix-map=/build/vim-vY1bx1/vim-7.4.1829=. -fPIE -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim        -lm -ltinfo -lnsl  -lselinux  -lacl -lattr -lgpm -ldl     -L/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu -lpython3.5m -lpthread -ldl -lutil -lm

Any ideas what might be happening here?

tpope commented 5 years ago

Fireplace recently switched to using jobs/channels for asynchronous execution, which necessitated dropping support for Vim versions lower than 8.0. I'm afraid you'll have to upgrade Vim.

gizmo385 commented 5 years ago

@tpope Thanks for the quick response! Do you know when that change was made? I don't know if it would be feasible for me to upgrade vim on the host in question so to not break my workflow on those hosts, I'll likely fork and pin at that older version.

As a sidenote, I'd recommend adding something to the top of the README that makes a mention of only supporting version 8.0 and higher, since I think there are going to be quite an number of folks who are using older versions of vim who find their vim-fireplace breaking upon upgrading the plugin :)

tpope commented 5 years ago

Based on your :version output you're in luck: the patch level is high enough that I can tweak the version check to allow you in.

I think the number of people running Fireplace server side is probably pretty small, and those running a Debian release from 2015 smaller still, but I agree silently not loading is not a very graceful way to fail. I'll look into improving the user experience there.

gizmo385 commented 5 years ago

Hmmm. Now I get this error when first loading a Clojure file:

No matching autocommands
Error detected while processing function <SNR>60_path[1]..<SNR>60_connect[10]..fireplace#register_port_file[10]..fireplace#transport#connect[29]..<SNR>104_json_callback:
line    1:
E121: Undefined variable: v:t_list
E15: Invalid expression: type(a:msg) ==# v:t_list && len(a:msg) == 2
tpope commented 5 years ago

Okay, looks like you're still a tad too old. 8da2d76fe4973364b9cc0643f246f1c73b7cbc95 was the commit that added the version check so you'll have to go back to before that. I'm going to restore the Vim 8 requirement.

tpope commented 5 years ago

It's possible changing v:t_list to type([]) (and similar substitutions for the other v:t_ constants) will get it to work on your Vim version. If so, please feel free to send a PR with the necessary changes and I'll update the conditional again.