Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Vim8 #11

Open
eraserhd opened this issue Apr 16, 2018 · 8 comments
Open

Add support for Vim8 #11

eraserhd opened this issue Apr 16, 2018 · 8 comments

Comments

@eraserhd
Copy link

"profiles.clj" [New File]
Error detected while processing function replant#insert_ns_definition_maybe[3]..replant#ui#expected_ns:
line    1:
E117: Unknown function: nvim_get_current_buf
E15: Invalid expression: a:000 is 1 ? a:1 : nvim_get_current_buf()
Press ENTER or type command to continue
@SevereOverfl0w
Copy link
Owner

Makes sense, I haven't put any effort into supporting vim8. I think this is the automatic (ns) insertion feature.

I'm not sure that the plugin will work, generally, with vim8, I haven't tested. Maybe it would with https://github.com/roxma/vim-hug-neovim-rpc or similar.

This could potentially be rewritten to not use the nvim_ functions, but I'm reluctant to where the resultant code is otherwise confusing/complicated.

@SevereOverfl0w SevereOverfl0w changed the title Vim8: error when editing new (non-existent) file Add support for Vim8 Apr 18, 2018
@tpope
Copy link

tpope commented Jul 29, 2019

replant#ui#expected_ns() looks like a re-implementation of fireplace#ns(), maybe use that instead? It won't fix everything but it will at least let you have the plugin installed without constantly getting yelled at.

Edit: Use the newly tweaked fireplace#platform().BufferNs() if you don't want to deal with user.

  let platform = fireplace#platform()
  return call(platform.BufferNs, a:000, platform)

@tpope
Copy link

tpope commented Jul 29, 2019

Adding the namespace also doesn't play nice if another template is applied first (from salve.vim for example). Consider clearing the buffer with silent %delete _ first.

@SevereOverfl0w
Copy link
Owner

One of the issues I previously had (and I'm not sure I fixed it with my impl - but was an eventual goal) was that :p wasn't reliably finding a repl for me due to it not working in new directories (e.g. :e src/newdir/foo.clj couldn't find an nrepl).

This is more obvious for this particular task.

I'll have a go at porting this over to fireplace#ns(), as I know there's bugs in my implementation anyway.

@tpope
Copy link

tpope commented Aug 3, 2019

I really recommend against editing a file before creating a directory - Vim does not like it when you do that - but I think it would be okay to tweak fireplace#ns() to do what you mean in this case. The key is to prepend getcwd() but guard against both absolute paths and both real and pseudo URLs http://localhost but also zipfile:whatever.zip::file.txt. Something like path !~# '^/\|^\a\+: should do the trick.

tpope added a commit to tpope/vim-fireplace that referenced this issue Aug 3, 2019
@tpope
Copy link

tpope commented Aug 3, 2019

As often happens, deciding what needs to be done means I went ahead and did it. This also means I had to automatically connect based on that busted buffer name which is a bit discomforting but I guess we'll see if anything breaks.

@SevereOverfl0w
Copy link
Owner

If there's no repl running then replant#ns() returns 'user'. I think there's a few subtle differences where fireplace#ns is intending something different than what the expected ns would be based on the classpath.

I think this functionality has overlap with salve.vim.

@tpope
Copy link

tpope commented Aug 15, 2019

I would blacklist user, or use fireplace#platform().BufferNs() to get a version with a blank string instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants