vim-plug
vim-plug copied to clipboard
Use the default branch instead of master when branch isn't set explicitly
As several repositories are already moving away from having the default branch named master
, I suggest that vim-go
should use the repository default branch when the user hasn't explicitly set a branch.
I'm using https://github.com/govim/govim (installed via vim-plug
) that recently changed from master
to main
as the default branch. A workaround to get things working was to rename the local branch inside .vim/plugged/govim
but I recently noticed that vim-plug
changes branch back to master
if I don't have a branch name set.
i.e.
" This will give me the default branch instead of 'master'
Plug 'govim/govim'
" .. while this still works
Plug 'govim/govim', { 'branch': 'development' }
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Jun 7 2020 01:33:04)
macOS version
Included patches: 1-916
Compiled by [email protected]
Huge version without GUI. Features included (+) or not (-):
+acl +cryptv +fork() +modify_fname +persistent_undo +syntax +visualextra
+arabic -cscope -gettext +mouse +popupwin +tag_binary +viminfo
+autocmd +cursorbind -hangul_input -mouseshape +postscript -tag_old_static +vreplace
+autochdir +cursorshape +iconv +mouse_dec +printer -tag_any_white +wildignore
-autoservername +dialog_con +insert_expand -mouse_gpm +profile -tcl +wildmenu
-balloon_eval +diff +ipv6 -mouse_jsbterm -python +termguicolors +windows
+balloon_eval_term +digraphs +job +mouse_netterm -python3 +terminal +writebackup
-browse -dnd +jumplist +mouse_sgr +quickfix +terminfo -X11
++builtin_terms -ebcdic +keymap -mouse_sysmouse +reltime +termresponse -xfontset
+byte_offset +emacs_tags +lambda +mouse_urxvt +rightleft +textobjects -xim
+channel +eval +langmap +mouse_xterm -ruby +textprop -xpm
+cindent +ex_extra +libcall +multi_byte +scrollbind +timers -xsmp
-clientserver +extra_search +linebreak +multi_lang +signs +title -xterm_clipboard
+clipboard -farsi +lispindent -mzscheme +smartindent -toolbar -xterm_save
+cmdline_compl +file_in_path +listcmds +netbeans_intg -sound +user_commands
+cmdline_hist +find_in_path +localmap +num64 +spell +vartabs
+cmdline_info +float -lua +packages +startuptime +vertsplit
+comments +folding +menu +path_extra +statusline +virtualedit
+conceal -footer +mksession -perl -sun_workshop +visual
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
defaults file: "$VIMRUNTIME/defaults.vim"
fall-back for $VIM: "/usr/local/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X -DMACOS_X_DARWIN -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -o vim -lm -lncurses -liconv -framework AppKit
- Type:
- [ ] Bug
- [x] Enhancement
- [ ] Feature Request
- [x] Question
- OS:
- [x] All/Other
- [ ] Linux
- [ ] OS X
- [ ] Windows
- Vim:
- [x] Terminal Vim
- [x] GVim
- [x] Neovim
Also see https://github.com/junegunn/vim-plug/issues/854.
Also see #854.
Oh, thanks. I did look through the issues but must have missed it, apologies for that!
With regards to the current work by GitHub related to this, it might be time to give it another round of thoughts?
from https://github.com/junegunn/vim-plug/issues/854#issuecomment-511287991:
This was discussed several times in the past. You should be able to find some related issues here. While I do not disagree with the suggestion, implementing it correctly without complicating the code too much is actually not trivial (e.g. branch validation in PlugStatus, how to find out if the default branch has been changed in the origin after we cloned it, etc.), so it's not exactly something I'd like to look into now. But patches are welcome.
FWIW - It seems like git remote set-head origin -a
is a way to set the local default branch to whatever it is/has changed to remotely.
git remote set-head origin -a
This is an excellent tip in general, but seems like the perfect solution here?
Fixed in #1007
I suggest re-opening this as per https://github.com/junegunn/vim-plug/pull/1007#issuecomment-683393634
@leitzler Are you interested in sending a pull request?
@junegunn I don't think I know vimscript well enough to get it right unfortunately (and I seem to have missed the notification for this one, sorry about it).
Revisited this since a govim user recently ran into this issue again.
@junegunn I just ran into this issue dealing with the Black plugin. Are there plans to tag a new release of vim-plug
soon to get this out, or are you waiting on the git remote set-head origin -a
fix proposed above (and in the merged PR)?
I would say this is more of a bug than a feature, because I can't install a third of the required plugins.
@mangelozzi: What do you mean? Can you give an example of a plugin you 'can't install' due to this issue (incl. the corresponding section from your config)?
From https://github.com/junegunn/vim-plug/pull/1007#issuecomment-683393634
Since a lot of repositories also follow GitHubs rename instructions I suggest that vim-plug also run
git remote set-head origin -a
each update to ensure that the remote default branch isn't stale.
This is probably the only way to solve the changed default branch problem. It will make the update slower though.