Giter VIP home page Giter VIP logo

Comments (12)

junegunn avatar junegunn commented on July 3, 2024 1

Anyhow, I think this is more a question for @junegunn and how to use vim-plug

Yeah, it is. After the initial clone, vim-plug executes do block before loading the plugin, so the command is not yet available at the point. There's no good explanation for the decision. I would say it was not an issue as the option was mainly added to run shell commands such as make. Unfortunately it's not easy to change the order of the operations at this stage, as it concerns me that it might break some (hypothetical) user's configuration.

Anyway, in this case you can load the plugin in advance using plug#load function.

function! DoUnicode(arg)
  call plug#load('unicode.vim')
  UnicodeDownload
endfunction
Plug 'chrisbra/unicode.vim', { 'do': function('DoUnicode') }

But as you have noted, the way the command works is not compatible with the subsequent buffer manipulation of vim-plug. The part of the installer was written with the assumption that the cursor stays in its window. It'll be an easy fix, I'll look into it later in the day.

from unicode.vim.

chrisbra avatar chrisbra commented on July 3, 2024

Hi Evan!

On Mi, 15 Jun 2016, Evan Sosenko wrote:

I'd like the download of UnicodeData.txt to happen on plugin install / update. I'm trying this with vim-plug:

function! DoUnicode(arg)
  UnicodeDownload
endfunction
Plug 'chrisbra/unicode.vim', { 'do': function('DoUnicode') }

which fails with

x Post-update hook for unicode.vim ... Vim:E492: Not an editor command:   UnicodeDownload

I also tried

function! DoUnicode(arg)
  call unicode#Download(1)
endfunction
Plug 'chrisbra/unicode.vim', { 'do': function('DoUnicode') }

which seems to run, but not actually download anything and breaks the vim-plug install process.

I don't know vim-plug very well. I would either force sourcing the
plugin/unicode.vim file or postpone the call until the VimEnter event.

Best,

Christian

Glück ist Selbstgenügsamkeit.
-- Aristoteles, 384-322 v. Chr.

from unicode.vim.

razor-x avatar razor-x commented on July 3, 2024

IMO, force sourcing the file goes against the grain of using a plugin manager (path resolution is non-trivial). Trying that does run the command, however it has the same issue as just calling unicode#Download(1) as in the second example.

It would be nice if the Download function could work with this, but a workaround is

let unicode_src = 'http://unicode.org/Public/UNIDATA/UnicodeData.txt'
let unicode_dest = './autoload/unicode/UnicodeData.txt'
Plug 'chrisbra/unicode.vim',
     \ { 'do': join(['curl --create-dirs -o', unicode_dest, unicode_src], ' ')}

from unicode.vim.

chrisbra avatar chrisbra commented on July 3, 2024

downloading depends on netrw. Perhaps that is not initialized, when vim-plug runs? Anyhow, I think this is more a question for @junegunn and how to use vim-plug

from unicode.vim.

chrisbra avatar chrisbra commented on July 3, 2024

Thanks @junegunn for the info. I am closing this then.

from unicode.vim.

junegunn avatar junegunn commented on July 3, 2024

@razor-x Should be fixed now.

function! DoUnicode(...)
  call plug#load('unicode.vim')
  silent! UnicodeDownload
endfunction

I found that silent! is necessary due to an error in UnicodeDownload (lcd to a non-existing directory).

from unicode.vim.

razor-x avatar razor-x commented on July 3, 2024

@junegunn Right, silent! fixes the issue where UnicodeDownload breaks PlugInstall, now the issue is with the UnicodeDownload function itself.

@chrisbra Perhaps I should open a new issue for this, but basically UnicodeDownload fails (with or without netrw) with the non-existing directory error. What's weird is that if you try to insert a character for the first time (<C-X><C-Z>) then it will trigger the initial download, succeed, and then open the popup. (There is actually another bug where once the popup has opened in this way, the only way to close it is to restart vim).

For reference, I'm using Neovim.

from unicode.vim.

chrisbra avatar chrisbra commented on July 3, 2024

I'll fix that. The second bug you mentioned, I haven't seen, can you check, if this happens with Vim as well please?

from unicode.vim.

razor-x avatar razor-x commented on July 3, 2024

Yes, the popup bug happens in vim and gvim as well. The popup is unfocused as well as stuck open.

from unicode.vim.

chrisbra avatar chrisbra commented on July 3, 2024

The popup bug is a Vim bug. I have posted a patch. Let's hope it will get fixed soon.

from unicode.vim.

junegunn avatar junegunn commented on July 3, 2024

@razor-x With the latest vim-plug, you can now do this (note the : prefix):

Plug 'chrisbra/unicode.vim', { 'do': ':silent! UnicodeDownload' }

from unicode.vim.

chrisbra avatar chrisbra commented on July 3, 2024

Am 2016-07-13 16:10, schrieb Junegunn Choi:

@razor-x [1] With the latest vim-plug, you can now do this (note the :
prefix):

Plug 'chrisbra/unicode.vim', { 'do': ':silent! UnicodeDownload' }

Great, thanks!

Note: the sil! shouldn't be necessary anymore with the latest version of
unicode.vim

Best,
Christian

from unicode.vim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.