* Open vim-plug window in a new tab not to disrupt the current window layout
* Open preview window on the right to better show the diff
If you prefer the old layout, use the following configuration:
let g:plug_window = 'vertical topleft new'
let g:plug_pwindow = 'above 12new'
Fix#1005
vim-plug will now run `git remote set-head origin -a` on PlugUpdate to
keep track of the default branch of the origin, so that it can still
update a plugin even if its default branch has changed.
This additional command will slow down the update process, but this is
an unavoidable price to pay for the correctness of the task. However,
vim-plug will run checkout and merge commands in parallel, so this
improvement will slightly offset the slowdown.
Neovim 0.5.0 allows lua files to be used in runtime files (such as
plugin, ftdetect, etc.) as well as vimscript files. Indeed, some
plugins have `plugin/*.lua` scripts only, but not `plugin/*.vim`;
such plugins cannot be sourced and work properly if it is lazy-loaded.
`i_CTRL-O` may change the cursor position in an unexpected way.
For example, when `autoindent` is set, the user will expect that
`i asdf<CR><C-O>` will place the cursor right below `a`.
However, `<C-O>` moves the cursor to the first column of line 2.
Expected:
```
asdf
█
```
Actual:
```
asdf
█
```
Therefore, it's desirable to use `i_CTRL-\_CTRL-O`, the variant of
`i_CTRL-O` that does not move the cursor.
Otherwise if the user has set a `git config clone.defaultRemoteName
foo`, then vim-plug will fail to detect the latest upstream changes as
the remote will be incorrect, and will repeatedly state that the plugin
repo needs to be cleaned.
Previously, the highlight of the `------------` line below the `Last Update:`
changed from `plugH2` on the whole line to `plugDash` on the first `-`
when the cursor moved over it and went below it. This commit updates the
`syn match` commands a bit to correct that issue.
Close#1027
* Make git operation faster
When using many plugins, vim-plug may spawn many git processes for them.
* get revision
* get branch
* get remote.origin.url
This is too heavy. especially on Windows. This change get revision, branch,
remote origin url directly from .git directory.
This idea is borrowed from @k-takata's commit for minpac.
Executing external programs is slow especially on Windows.
Read the information directly from .git directory.
* Copied from devel branch of minpac
* Avoid errors
* Show errors
* Use empty()
* Use empty string instead of v:null
* Check spec.branch is empty
* Use branch
* Fix branch and revision
* Remove l: and use s:trim
* Fix and simplify s:git_get_remote_origin_url
* Do not cut off commit hash for correctness
Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
":Plug" performs a quick type check for most options so that the user can check which plugin has invalid configuration on startup. This does not prevent errors, resulting from modiying "g:plugs" after running "plug#end()". Plugin repo is added to the error message for convenience. Most users should expect no noticeable difference in startup time.
Close: #930
Related: #936
This allows Neovim to bypass the shell and run git directly.
Vim still needs the shell because of how commands are collapsed on Windows and because setting the job's working directory via "cwd" does not work.
Refactored s:clone_opt to a list to make this possible.
* s:system supports list type for command
Objective is to reduce batchfiles on Windows.
List type gives more flexibility on s:system()
on how to pass the shell command to the builtin system().
If system() supports list type for command
and there is no working directory, run it directly on system().
Targets Neovim only.
Else, convert the list to an escaped command
so that the user's shell can execute it.
Neovim's system() does not support working directory system()
so consider refactoring s:system to use a synchronous job.
* Do not escape simple shell arguments
Regexp taken from vim-fugitive s:shellesc().
* Set shellredir on Windows
Prep to use list type for command passed to s:system() within s:spawn()
* Internalize shellredir for s:spawn
s:spawn needs to redirect stderr to stdout for jobs callbacks
but s:system (for old Vim versions) sets shellredir if needed.
* Leverage job api for cwd and stderr
Vim/Neovim support stderr redirection and support error callbacks.
Vim 8 and Neovim can set a job's working directory via 'cwd' key
but it cannot be used as is on Vim because CI fails for the Vim release in Ubuntu Bionic and the latest Vim release.
The existing error message printed when plug#end() is called without
calling plug#begin() doesn't make the dependence on plug#begin()
obvious; I had to go digging in the vim-plug code to discover what I'd
done wrong. This attempts to clarify the error a bit, to make it more
obvious to a user.
Close#926
This fix shouldn't be necessary
because vim-plug's buffer should always have 4 lines
but a buffer can be modified in some cases
before nvim 0.4.0 and vim v8.1.1360.
Changing chcp breaks cmd.exe if switching from multi-byte to 65001.
cmd.exe depends on codepage to parse batchfile
so batchfile cannot have unicode characters.
Target powershell if unicode support is required.
User should fix their terminal font to display unicode characters.
Terminal programs can only use Wide String APIs.
For Vim, this requires +multi_byte feature and `set encoding=utf-8`
in the user's vimrc.
Neovim always defaults to `set encoding=utf-8`.
https://dev.to/mattn/please-stop-hack-chcp-65001-27db
git v2.10.0 adds "log.showSignature" config
so that "git log --show-signature" runs by default.
Changing the commit format via "--pretty" does not prevent the signature
from appearing.
Only "--no-show-signature" prevents this.
Close#728
Warn user if shellslash and shell are incompatible.
Set/unset shellslash for file functions on Windows. Based on 16fc6862a8/plugin/fzf.vim (L30-L107)
Support shellescape for git-bash
Windows user may not set shellslash but wish to use git-bash.
This requires custom shellescape for sh,bash shells
because builtin shellescape() depends on shellslash.
Tested on Vim
It was using s:esc() which escapes spaces with a backslash.
This does not work on Windows.
&shell could be escaped on because of spaces.
See patch-8.0.1455 and related 8.1.x patches that address this
for $SHELL on Unix and git-bash on Windows.
Related #852, #908Close#890
Having a trailing slash with &rtp entries is problematic when removing
them later: if loading on demand is used, s:reorg_rtp might fail to
remove the previous runtime paths.
Test case has been using maktaba (which triggers unsetting s:middle in
s:reorg_rtp), but because of the trailing slashes being used, the
previous rtp entries were not removed.
chcp parsing is fragile because of the system locale. There's no convenient way to parse out the codepage value without regex just by relying on cmd.exe builtins and default binaries in PATH.
Vim can be used to parse chcp output but it requires an additional `system` per `s:system` and `chcp` can change within the same console so caching the value won't work on the terminal.
Powershell supports regex but it has a long startup even with `-NoProfile` so running it when `&shell` is not powershell slows down `:PlugInstall` more.
* output of chcp was not parsed correctly
On Windows, when wrapping a batch command with the function s:wrap_cmds(),
when calling 'chcp' to get the current code page, the code assumed that
the output was in the format "active code page: XXX" (where XXX is the
code page), whereas the actual output is localized (for instance, in
French, the output would be: "page de code active: XXX").
The parsing of the output relied on that, and this failed for a
message different from "active code page" (i.e., English).
This patch changes the parsing to split the output of chcp on the colon
instead of spaces. Assuming that the output is always in the format
"<localized message>: XXX", regardless of the locale, hopefully, this is
a bit more robust.
Excerpt from `:h shell-powershell`:
To use powershell (on Windows):
set shell=powershell shellquote=( shellpipe=\| shellxquote=
set shellcmdflag=-NoLogo\ -NoProfile\ -ExecutionPolicy\ RemoteSigned\ -Command
set shellredir=\|\ Out-File\ -Encoding\ UTF8