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

Is there a simple way to move a package from start into opt? #24

Closed
chrisbra opened this issue Jun 27, 2017 · 13 comments
Closed

Is there a simple way to move a package from start into opt? #24

chrisbra opened this issue Jun 27, 2017 · 13 comments

Comments

@chrisbra
Copy link

Title says it all, I mean I can of course manually move the directory, but it would be great if I could move a package to the opt path, so that it won't get loaded next time I startup Vim.

Thanks for considering.

@k-takata
Copy link
Owner

If you don't mind losing the commit of the plugin, maybe the easiest way is: change .vimrc to add {'type': 'opt'}, source it, then call minpac#update() and minpac#clean().

Another idea is...
A user can get the directory of the plugin by minpac#getpluginfo('plugin_name').dir. So a user might be able to define a custom command using it and rename() to move the plugin.
I'm not sure whether minpac should have this feature by default.

@chrisbra
Copy link
Author

hm, it is not so easy. I tried with this approach:

    command! -nargs=1 -complete=customlist,CompletePack PackDisable
            \ let url=minpac#getpluginfo(<q-args>).url |
            \ call minpac#clean(<q-args>) |
            \ call minpac#add(url, {'type': 'opt'}) |
            \ call minpac#update()
    command! PackUpdate packadd minpac | source $MYVIMRC | call minpac#update()
    command! PackClean  packadd minpac | source $MYVIMRC | call minpac#clean()
    func! CompletePack(A, Cmd, Pos)
    return map(glob("~/.vim/pack/minpac/start/". a:A. "*", 0, 1), 'substitute(v:val, ".*/", "", "g")')
    endfunc

That works, however I still have to change the minpac#add() call...

@k-takata
Copy link
Owner

k-takata commented Jul 7, 2017

A user can get the directory of the plugin by minpac#getpluginfo('plugin_name').dir. So a user might be able to define a custom command using it and rename() to move the plugin.

Here is a snippet based on this idea:

let plugdir = minpac#getpluginfo(plugin_name).dir
call rename(plugdir, substitute(plugdir, '/start/\ze[^/]\+$', '/opt/', ''))

That works, however I still have to change the minpac#add() call...

Yes..., users should always update minpac#add() properly.

@chrisbra
Copy link
Author

chrisbra commented Jul 7, 2017

That should be put into the documentation ;)

@k-takata
Copy link
Owner

k-takata commented Jul 8, 2017

Updated example:

command! -nargs=1 -complete=customlist,CompletePack PackDisable
        \ let plugdir=minpac#getpluginfo(<q-args>).dir |
        \ call rename(plugdir, substitute(plugdir, '/start/\ze[^/]\+$', '/opt/', ''))
func! CompletePack(A, Cmd, Pos)
        return minpac#getpackages('minpac', 'start', a:A . '*', 1)
endfunc

k-takata added a commit that referenced this issue Aug 30, 2018
k-takata added a commit that referenced this issue Aug 30, 2018
@k-takata
Copy link
Owner

k-takata commented Sep 1, 2018

Fixed by #46.

@k-takata k-takata closed this as completed Sep 1, 2018
@chrisbra
Copy link
Author

chrisbra commented Sep 1, 2018

how does #46 fix it? I looked at the PR (only briefly), but don't know how this solves this problem.

@k-takata
Copy link
Owner

k-takata commented Sep 2, 2018

Edit your .vimrc and add {'type': 'opt'} to the plugin you want to move from 'start' to 'opt', then execute minpac#update(). The plugin directory will be automatically moved under the 'opt' directory.

however I still have to change the minpac#add() call...

This is still not changed, but I think this is the expected behavior.

@chrisbra
Copy link
Author

chrisbra commented Sep 2, 2018

ah thanks!

@mralusw
Copy link

mralusw commented Jul 6, 2020

So it's still not entirely clear, can I move stuff from opt/ to start/ manually and vice versa? Can I zip the pack/minpac folder and move it to another machine?

@k-takata
Copy link
Owner

k-takata commented Jul 7, 2020

As I wrote above, if you want to move a plugin from opt/ to start/, edit your .vimrc and remove {'type': 'opt'} from the plugin setting, then execute minpac#update().

Can I zip the pack/minpac folder and move it to another machine?

It doesn't seem to related this, but yes, you can.

@mralusw
Copy link

mralusw commented Jul 7, 2020

Thanks. I don't actually configure plugins (other than minpac#init) in my .vimrc at all, I just use minpac#add to install, then :packadd to load them from vim when needed. Maybe this should be a separate issue though.

@k-takata
Copy link
Owner

k-takata commented Jul 7, 2020

If you have a line call minpac#add('user/plugin') in your .vimrc, the plugin will be installed into the start/ directory.
If you change the line to call minpac#add('user/plugin', {'type': 'opt'}), then execute minpac#update(), the directory will be moved into the opt/ directory.

k-takata added a commit that referenced this issue Apr 21, 2021
0fb846e avoid has_key check for on_stdout
236debf Merge pull request #43 from prabirshrestha/fix-retry
c4d6144 Set waittime
8fc5956 Increment l:retry
f6b87c1 Trim null
69a4a5c Merge pull request #42 from mattn/fix-null
35b369f Trim null
36e97f0 Merge pull request #41 from mattn/tcp
2addfc3 Skip neovim
625cd40 Add test for async#job#connect
fa1b82d Retry
a4f4005 Add async#job#connect
6102020 Add :AsyncEmbed
d15123a Add default value when reading 'close_stdin' from input options
bb3aceb Make `opts` argument of `async#job#send`, optional
732cf48 Pass `close_stdin` as a Dictionary rather than bool argument
ab499e8 Better / safer management of non-blocking channels
a0f4e4e Wait for transmit buffer to be empty, before calling `ch_close_in`
ada658f Add support for sending data and closing stdin at the same time
42371b5 fix not restoring cpoptions
f67ecb5 Support 'cwd' option in jobstart
627a8c4 Do NOT remove job in job_stop but on_exit
8998efb Add tests for Neovim
91c3f2b Do NOT raise E900 on invalid jobid
f301455 doc: Update Embedding section
8da445b default to noblock if supported by vim 8 to avoid deadlocks causing vim to hang (#31)
4bde72e Don't use workaround (#30)
ff9177c add async#job#pid() (#28)
0521409 Fix variable name in example (#19)
d721851 Merge pull request #25 from prabirshrestha/add-test
633414e Use partial argument
79d54f4 Merge pull request #27 from prabirshrestha/revert-22
c980166 Revert #22
d7c52bc Fix test
d5e8819 Install vim
2a883ee Fix test
519430b Add tests
7627c81 Merge pull request #24 from prabirshrestha/fix-heavy
ca41dab Buffer size must be more large
300493e Merge pull request #22 from mattn/fix-block
017c6a8 Fix .travis.yml
7b1dfec Fix .travis.yml
d10fdb9 Start timer to read lazy
89bec95 Add "sleep 1m" to read blocked channel

git-subtree-dir: autoload/minpac
git-subtree-split: 0fb846e1eb3c2bf04d52a57f41088afb3395212e
k-takata added a commit that referenced this issue Apr 21, 2021
0fb846e avoid has_key check for on_stdout
236debf Merge pull request #43 from prabirshrestha/fix-retry
c4d6144 Set waittime
8fc5956 Increment l:retry
f6b87c1 Trim null
69a4a5c Merge pull request #42 from mattn/fix-null
35b369f Trim null
36e97f0 Merge pull request #41 from mattn/tcp
2addfc3 Skip neovim
625cd40 Add test for async#job#connect
fa1b82d Retry
a4f4005 Add async#job#connect
6102020 Add :AsyncEmbed
d15123a Add default value when reading 'close_stdin' from input options
bb3aceb Make `opts` argument of `async#job#send`, optional
732cf48 Pass `close_stdin` as a Dictionary rather than bool argument
ab499e8 Better / safer management of non-blocking channels
a0f4e4e Wait for transmit buffer to be empty, before calling `ch_close_in`
ada658f Add support for sending data and closing stdin at the same time
42371b5 fix not restoring cpoptions
f67ecb5 Support 'cwd' option in jobstart
627a8c4 Do NOT remove job in job_stop but on_exit
8998efb Add tests for Neovim
91c3f2b Do NOT raise E900 on invalid jobid
f301455 doc: Update Embedding section
8da445b default to noblock if supported by vim 8 to avoid deadlocks causing vim to hang (#31)
4bde72e Don't use workaround (#30)
ff9177c add async#job#pid() (#28)
0521409 Fix variable name in example (#19)
d721851 Merge pull request #25 from prabirshrestha/add-test
633414e Use partial argument
79d54f4 Merge pull request #27 from prabirshrestha/revert-22
c980166 Revert #22
d7c52bc Fix test
d5e8819 Install vim
2a883ee Fix test
519430b Add tests
7627c81 Merge pull request #24 from prabirshrestha/fix-heavy
ca41dab Buffer size must be more large
300493e Merge pull request #22 from mattn/fix-block
017c6a8 Fix .travis.yml
7b1dfec Fix .travis.yml
d10fdb9 Start timer to read lazy
89bec95 Add "sleep 1m" to read blocked channel

git-subtree-dir: autoload/minpac
git-subtree-split: 0fb846e1eb3c2bf04d52a57f41088afb3395212e
k-takata added a commit that referenced this issue May 5, 2021
0fb846e avoid has_key check for on_stdout
236debf Merge pull request #43 from prabirshrestha/fix-retry
c4d6144 Set waittime
8fc5956 Increment l:retry
f6b87c1 Trim null
69a4a5c Merge pull request #42 from mattn/fix-null
35b369f Trim null
36e97f0 Merge pull request #41 from mattn/tcp
2addfc3 Skip neovim
625cd40 Add test for async#job#connect
fa1b82d Retry
a4f4005 Add async#job#connect
6102020 Add :AsyncEmbed
d15123a Add default value when reading 'close_stdin' from input options
bb3aceb Make `opts` argument of `async#job#send`, optional
732cf48 Pass `close_stdin` as a Dictionary rather than bool argument
ab499e8 Better / safer management of non-blocking channels
a0f4e4e Wait for transmit buffer to be empty, before calling `ch_close_in`
ada658f Add support for sending data and closing stdin at the same time
42371b5 fix not restoring cpoptions
f67ecb5 Support 'cwd' option in jobstart
627a8c4 Do NOT remove job in job_stop but on_exit
8998efb Add tests for Neovim
91c3f2b Do NOT raise E900 on invalid jobid
f301455 doc: Update Embedding section
8da445b default to noblock if supported by vim 8 to avoid deadlocks causing vim to hang (#31)
4bde72e Don't use workaround (#30)
ff9177c add async#job#pid() (#28)
0521409 Fix variable name in example (#19)
d721851 Merge pull request #25 from prabirshrestha/add-test
633414e Use partial argument
79d54f4 Merge pull request #27 from prabirshrestha/revert-22
c980166 Revert #22
d7c52bc Fix test
d5e8819 Install vim
2a883ee Fix test
519430b Add tests
7627c81 Merge pull request #24 from prabirshrestha/fix-heavy
ca41dab Buffer size must be more large
300493e Merge pull request #22 from mattn/fix-block
017c6a8 Fix .travis.yml
7b1dfec Fix .travis.yml
d10fdb9 Start timer to read lazy
89bec95 Add "sleep 1m" to read blocked channel

git-subtree-dir: autoload/minpac
git-subtree-split: 0fb846e1eb3c2bf04d52a57f41088afb3395212e
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