tyru / open-browser.vim

Open URI with your favorite browser from your most favorite editor
http://www.vim.org/scripts/script.php?script_id=3133
Other
509 stars 48 forks source link

using List as a String error(on Neovim) #98

Closed zchee closed 7 years ago

zchee commented 7 years ago

I'd hitting below error on 2ed22fe722e745e1e2f4b11c462ba457887908f4. Sorry, I do not debug and test yet(testing with vim, git bisect or etc), but I wanted to send it out early and see what you thought @tyru.

Ran <Plug>(openbrowser-smart-search) on 'http://9p.io/sys/doc/asm.html'. Occur on NVIM v0.2.1-444-gc07e144c8.

open-browser failed to open URI...
v:exception = Vim(throw):E730: using List as a String
v:throwpoint = function openbrowser#_keymapping_smart_search[1]..openbrowser#_keymapping_open[6]..openbrowser#open[60]..openbrowser#__open_browser__[43]..openbrowser#__system__[1]..<SNR>211_system, line 53
open-browser doesn't know how to open 'http://9p.io/sys/doc/asm.html'.
tyru commented 7 years ago

@zchee Hmm, it seems to work on my environment with neovim.

  1. Downloaded nvim-win64.zip from https://github.com/neovim/neovim/wiki/Installing-Neovim
  2. Create junction file C:\Users\%USERNAME%\AppData\Local\nvim for %USERPROFILE%\vimfiles
  3. Create %USERPROFILE%\vimfiles\init.vim with the following content:
set rtp+=$HOME/vimfiles/bundle/open-browser.vim
tomsteg commented 7 years ago

I have the same problem. I use neovim on macos sierra and Plug for Plugin-Control.

Plug 'tyru/open-browser.vim'

I use the settings

let g:netrw_nogx = 1 " disable netrw's gx mapping.
nmap gx <Plug>(openbrowser-smart-search)
vmap gx <Plug>(openbrowser-smart-search)
let g:openbrowser_default_search = 'duckduckgo'

and I get the error message

opening 'http://duckduckgo.com/?q=joonty%2Fvdebug' ...
open-browser failed to open URI...
v:exception = Vim(throw):E730: using List as a String
v:throwpoint = function openbrowser#_keymapping_smart_search[13]..openbrowser#search[16]..openbrowser#open[60]..openbrowser#__open_browser__[43]..openbrowser#__system__[1]..<SNR>147_system, line 53
open-browser doesn't know how to open 'http://duckduckgo.com/?q=joonty%2Fvdebug'.
tyru commented 7 years ago

@tomsteg oh, I forgot g:netrw_nogx, thanks. but I can not reproduce both... my whole init.vim is:

let g:netrw_nogx = 1 " disable netrw's gx mapping.
nmap gx <Plug>(openbrowser-smart-search)
vmap gx <Plug>(openbrowser-smart-search)
let g:openbrowser_default_search = 'duckduckgo'

set rtp+=$HOME/vimfiles/bundle/open-browser.vim

and the OS is Windows 10.

yuttie commented 7 years ago

I can reproduce the problem in my environment.

opening 'http://9p.io/sys/doc/asm.html' ...
open-browser failed to open URI...
v:exception = Vim(throw):E730: using List as a String
v:throwpoint = function openbrowser#_keymapping_smart_search[1]..openbrowser#_keymapping_open[6]..openbrowser#open[60]..openbrowser#__open_browser__[43]..openbrowser#__system__[1]..<SNR>203_system, line 53
open-browser doesn't know how to open 'http://9p.io/sys/doc/asm.html'.
Press ENTER or type command to continue

Environment

Optional features included (+) or not (-): +acl +iconv +jemalloc +tui For differences from Vim, see :help vim-differences

system vimrc file: "/etc/vim/sysinit.vim" fall-back for $VIM: "/usr/share/nvim"

Press ENTER or type command to continue

tomsteg commented 7 years ago

My whole init.vim can be downloaded here: https://github.com/tomsteg/dotfiles/blob/master/config/nvim/init.vim

and my version is

NVIM v0.2.1-7-g13ec5214
Build type: RelWithDebInfo
Compilation: /usr/local/Homebrew/Library/Homebrew/shims/super/clang -Wconversion -U_FORTIFY_SOURCE -D_FORTIFY
_SOURCE=1 -DNVIM_MSGPACK_HAS_FLOAT32 -O2 -g -DDISABLE_LOG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstr
ict-prototypes -std=gnu99 -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARA
TIONS -I/tmp/neovim-20170502-61364-7ej51/build/config -I/tmp/neovim-20170502-61364-7ej51/src -I/usr/local/inc
lude -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include
 -I/usr/local/opt/gettext/include -I/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOS
X.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include -I/tmp/neovim-20170502-61364-7ej51/build/src/nvim/auto
-I/tmp/neovim-20170502-61364-7ej51/build/include
tomsteg commented 7 years ago

in vim with almost the same settings it works

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jul 16 2017 17:38:30)
MacOS X (unix) version
Included patches: 1-717
Shougo commented 7 years ago

I will test it later.

Shougo commented 7 years ago

https://github.com/tyru/open-browser.vim/blob/master/autoload/vital/_openbrowser/Process.vim#L154

It must be string(a:str).

tyru commented 7 years ago

@mattn @Shougo Thanks! I will create a fixed branch for it.

josephholsten commented 7 years ago

turns out that this is really just hiding a bug introduced by https://github.com/josephholsten/open-browser.vim/commit/7e336cb5c49a2c333cd30810fe5dc2d49801b67d#diff-ba9e646c7d0ac2e1814a7ff377e7b838R152

Looks like we'll need to disable background for nvim.

josephholsten commented 7 years ago

Workaround for mac users:

let g:openbrowser_browser_commands = [
    \ {"name": "open",
    \  "args": ["{browser}", "{uri}"],
    \  "background": 0}
    \]
josephholsten commented 7 years ago

longterm, the Right Way is https://github.com/vim-jp/vital.vim/issues/533

tomsteg commented 7 years ago

The workaround for macusers works for me. Thanks a lot.

tyru commented 7 years ago

Fixed in #100. Thanks a lot!! >@zchee @tomsteg @yuttie @mattn @Shougo @josephholsten

zchee commented 7 years ago

@tyru Wow! Thanks!! I'll test it!