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

Detect nyaovim with has command #113

Open
techhazard opened this issue Apr 21, 2017 · 6 comments
Open

Detect nyaovim with has command #113

techhazard opened this issue Apr 21, 2017 · 6 comments

Comments

@techhazard
Copy link

I would like to be able to detect if nyaovim is running or not so I can load plugins conditionally.
E.g. withhas('nyaovim') just like has('nvim') and has('python')

Expected Behavior

running nyaovim: :echo has('nyaovim') -> 1
running gui or terminal: :echo has('nyaovim') -> 0

Actual Behavior

running nyaovim: :echo has('nyaovim') -> 0
running gui or terminal: :echo has('nyaovim') -> 0

Steps to Reproduce (including precondition)

  1. Start nyaovim
  2. run the following command: :echo has('nyaovim')
  3. output should return 0 (I would have expected 1)

Screenshot on This Problem (if possible)

I do not think that is neccessary

Your Environment

  • OS: OSX
  • NyaoVim version: 0.0.22
  • nvim version: 0.1.7
  • Keyboard layout: programmer-dvorak
@rhysd
Copy link
Owner

rhysd commented Apr 21, 2017

has() is a built-in function. So we can't change it's behavior. Instead, we can check if g:nyaovim_version variable exists or not.

if exists('g:nyaovim_version')
  " Code for NyaoVim
endif

The variable is set in command line argument: https://github.com/rhysd/NyaoVim/blob/master/renderer/nyaovim-app.ts#L253

@techhazard
Copy link
Author

techhazard commented Apr 21, 2017

That would work. Sadly it doesn't for me. :echo exists('g:nyaovim_version') returns 0 :-(
I do not have to use that command line argument manually, right?

@rhysd
Copy link
Owner

rhysd commented Apr 21, 2017

Hmm... I don't have any idea why the variable does not exist.

You don't need to set the command line argument manually. It is automatically set by NyaoVim.

@techhazard
Copy link
Author

techhazard commented Apr 21, 2017

Anything I can do to debug the issue?

NyaoVim version 0.0.22
  electron : 1.4.13
  chrome : 53.0.2785.143
  node : 6.5.0
  v8 : 5.3.332.47
NVIM 0.1.7
Build type: Release
Compilation: /nix/store/yxg0zzcyjndcp6ilixv8wc50sg89b5r3-clang-wrapper-4.0.0/bin/clang -Wconversion -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2 -DNDEBUG -DDISABLE_LOG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -DHAVE_CONFIG_H -I/private/var/tmp/nix-build-neovim-0.1.7.drv-0/neovim-v0.1.7-src/build/config -I/private/var/tmp/nix-build-neovim-0.1.7.drv-0/neovim-v0.1.7-src/src -I/nix/store/lgprhs9d1bi8s9y06ccfmg1nksn4wbdm-libuv-1.11.0/include -I/nix/store/iinrspsbs43lwrcjgs52wgsjw10vxclv-libmsgpack-2.0.0/include -I/nix/store/8gjpvb1my8iczkinsqd7zmbidf0w0xn9-unibilium-1.2.0/include -I/nix/store/7skb10mc11rclwzni6798agb00d0rxsi-libtermkey-0.19/include -I/nix/store/xj64af8sfrlyggvl63z0byj2b7ng17d3-neovim-libvterm-2016-10-07/include -I/nix/store/i6smd9fqcp1wk4ihgypp3zflqqicvkfb-jemalloc-4.5.0/include -I/nix/store/410ya8c9f25n9vpqhb4n05891hq9nr1d-gettext-0.19.8/include -I/private/var/tmp/nix-build-neovim-0.1.7.drv-0/neovim-v0.1.7-src/build/src/nvim/auto -I/private/var/tmp/nix-build-neovim-0.1.7.drv-0/neovim-v0.1.7-src/build/include
Compiled by nixbld4

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

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "
/nix/store/aznha3w0mdsv46mg42kn4zz04ifh0aiw-neovim-0.1.7/share/nvim"

@rhysd
Copy link
Owner

rhysd commented Apr 21, 2017

Thank you for your information and offer. But I need to try to reproduce at first with the latest neovim.

@bimlas
Copy link

bimlas commented May 21, 2017

Same issue here: on Linux it's exists, while on Windows it isn't.

Linux (Ubuntu 16.04 LTS "Xenial Xerus" x64)

  • Neovim 0.2.1-dev
  • NyaoVim 0.0.22
  • Node 4.2.6

Windows 7 x64

  • Neovim 0.2.1.190
  • NyaoVim 0.0.22
  • Node 6.9.5

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