Commit Graph

442 Commits

Author SHA1 Message Date
Junegunn Choi
e300178a0e
Change the default plugin directory for Neovim
And suggest users to call plug#begin() without an argument to avoid
confusion.
2022-01-03 23:05:08 +09:00
Jaehwang Jerry Jung
68488fd7a3
Fix unexpected cursor movement on on-demand imap loading (#1147)
`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.
2021-12-06 14:26:19 +09:00
Gibson Fahnestock
c9971346bb
Set --origin=origin for git clone commands (#1117)
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.
2021-08-31 17:14:37 +09:00
Gerald
fc2813ef44
Recognize pwsh(.exe) as PowerShell (#1090)
Fix #1065
2021-04-30 16:29:04 +09:00
Rosen Stoyanov
cffcfe150b
Add GV.vim-style q mapping (#827)
* Add GV.vim-style q mapping

* Fix test cases

Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
2021-02-08 16:23:21 +09:00
mattn
8b45742540
Disable credential.helper for git fetch (#1046) 2020-12-14 14:30:44 +09:00
Junegunn Choi
2f4e28161e
Set empty credential.helper only when git 2.0 or above is available
Fix #1031
2020-11-03 22:55:17 +09:00
Subhaditya Nath
ab940f624a
Fix syntax matches (#1028)
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
2020-10-23 00:05:18 +09:00
mattn
c44422460e
Disable credential-helper (#1026) 2020-10-20 20:48:58 +09:00
Junegunn Choi
d16273e072
Code cleanup 2020-09-08 22:39:56 +09:00
mattn
b17f477585
Reduce the number of git processes for faster operation (#937)
* 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>
2020-09-08 22:13:21 +09:00
Junegunn Choi
a9bf5bd722 "non-master branch" -> "non-default branch" 2020-08-30 02:05:50 +09:00
Junegunn Choi
49be3a8ca9 Use branch name of origin if not specified 2020-08-30 02:05:50 +09:00
Junegunn Choi
95ef5e8d5f PlugDiff should be able to find pending updates
# We need the name of the default branch of origin
  git checkout some-tag-or-commit
  git log ..origin/master
2020-08-30 02:05:50 +09:00
Junegunn Choi
6fa6475fee User-specified branch name should not be empty 2020-08-30 02:05:50 +09:00
Yasuhiro Matsumoto
588467903b Use branch 2020-08-30 02:05:50 +09:00
Yasuhiro Matsumoto
5706f70f8f Add missing function 2020-08-30 02:05:50 +09:00
Yasuhiro Matsumoto
4a3c5e7ac2 Support non-master default branch 2020-08-30 02:05:50 +09:00
Jan Edmund Lazo
b2133cf2ec
Support Windows shell without extension (#997)
Close https://github.com/junegunn/vim-plug/issues/995

Vim supports omitting file extensions for its option.
I omitted the file extension in Neovim's documentation for powershell.
2020-07-20 07:59:29 -04:00
Wolf Honore
3aa3b5a4e8
Report when PlugClean fails to remove a directory (#985) 2020-06-25 20:56:47 +09:00
Jan Edmund Lazo
6583b99032
:Plug throws error for invalid option (#961)
":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
2020-06-03 07:34:44 -04:00
Junegunn Choi
54d837fa54
Load plugin before running funcref hook
Fix #964
Fix https://github.com/junegunn/fzf.vim/issues/1008
2020-05-03 16:59:22 +09:00
Jan Edmund Lazo
e718868e85
Use list type for command in s:spawn() (#959)
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.
2020-04-11 10:49:47 -04:00
Jan Edmund Lazo
668bc0fd2a
Support list type command for s:system to reduce batchfiles on Windows (#956)
* 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.
2020-04-10 15:40:28 -04:00
Henré Botha
c3b6b7c297 Clarify error message (#931)
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.
2020-01-27 22:48:16 +09:00
Jan Edmund Lazo
2f5f74e5e6
Validate last buffer line of g:plug_window (#927)
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.
2020-01-05 19:59:59 -05:00
Jan Edmund Lazo
b2aa5724c0
Use iconv() only if +iconv is enabled. (#921)
TODO: Avoid iconv() for commands using ascii only.
2019-12-27 22:35:49 -05:00
Jan Edmund Lazo
359ce90b9b
Encode batchfile in current codepage. (#913)
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
2019-12-11 08:28:49 -05:00
Jan Edmund Lazo
e6ed2e5658
Do not show git signatures in diff window (#918)
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
2019-12-09 23:26:56 -05:00
Jan Edmund Lazo
897ce5e2fa
Set/unset shellslash on jobstart (#917) 2019-12-07 01:05:57 -05:00
Jan Edmund Lazo
d2f8ca2dbc
Detect shellslash on Windows (#916)
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
2019-12-05 19:34:41 -05:00
Jan Edmund Lazo
93b702512d
Fix shellescaping for git refs and batchfile on Windows (#909)
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, #908 
Close #890
2019-12-01 21:01:17 -05:00
Jan Edmund Lazo
68fef9c2fd
Delete batchfile only if it exists (#901)
Close #900
2019-11-03 21:10:37 -05:00
Daniel Hahler
eee50c55bf Use s:path with s:rtp always (#694)
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.
2019-10-20 21:52:29 -04:00
Jan Edmund Lazo
96046c01c3
Detect WSL (Neovim only) (#887)
`has('wsl')` works since Neovim v0.3.0 (5d2dd2ebe2)

Fix: https://github.com/junegunn/vim-plug/issues/821
2019-10-14 13:38:26 -04:00
Jan Edmund Lazo
fcfd5b7e1f
Use chcp only if sed is in PATH (#891)
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.
2019-10-14 07:55:41 -04:00
Jan Edmund Lazo
849b76be90
Fix chcp parsing for the current codepage (#888)
Relying on delimiters or token positions is fragile.
Last value of 'chcp' output is always a number.
2019-10-03 21:19:11 -04:00
gh4w
68b31a4a66 output of chcp was not parsed correctly (#886)
* 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.
2019-09-28 20:10:13 -04:00
Jan Edmund Lazo
8a44109329 Fix Windows support for Unix shells and powershell (#860)
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
2019-08-16 17:55:17 +09:00
Jan Edmund Lazo
226d6abeb2 Don't override shell on Windows (#856)
Assume that the user set the shell options correctly
before running vim-plug so that the user can use bash or powershell
as their shell.

Close #815
2019-07-16 09:06:27 +09:00
Jan Edmund Lazo
f1ad2d864a Escape batchfile path on Windows (#850)
Close #832
2019-06-17 23:00:59 +02:00
Junegunn Choi
08e78d8a5e
Avoid downward search when using finddir
Close #750
2019-05-29 18:29:11 +09:00
Junegunn Choi
518a3566c3
Escape arguments to git command during PlugUpgrade
Fix #832
2019-04-11 17:53:13 +09:00
Nate Fischer
734d9a11b5 Use 'rtp' option to filter diff (#798)
Previously, `:PlugDiff` would show every new commit to a plugin's git
repo. This makes sense for the general case, but makes less sense when a
plugin lives in a subdirectory of the repo (and is configured with the
'rtp' option). This makes it difficult to determine which commits relate
to the plugin and which are unrelated.

This changes `:PlugDiff` to filter out any commits outside of the 'rtp'
folder.

Some consequences:

 * This does not change the `:PlugUpdate` UI. This means `:PlugUpdate`
   may pull down non-plugin commits, display that it has updated the
   plugin, and then `:PlugDiff` will show no updates (since such commits
   fall out of the 'rtp' path).
 * It also means there's no UI to revert non-plugin updates, as they
   don't show up in `:PlugDiff`.
2018-11-04 03:00:00 +09:00
Junegunn Choi
b6050d6f03
Allow cloning into an empty directory (#782)
Close #766

We can rely on git to check if the destination directory is empty.
2018-09-12 13:45:38 +09:00
Junegunn Choi
7f8fdd0444
Ignore useless use of on-demand loading (#786) 2018-09-12 13:40:33 +09:00
Samuel D. Leslie
8ed2617ba0 Add support for parallel fetching of Git submodules (#784)
Git v2.8 introduced support for parallel fetching of submodules. This
can result in a substantial performance boost when performing a "git
submodule update" in a repository with many submodules, potentially
further magnified when updating submodules recursively.

This commit introduces a check on the Git version to see if it supports
parallel submodule fetching. If it does, we add the '--jobs=N' argument
to our call to "git submodule update", where N is g:plug_threads or the
vim-plug default of 16.
2018-09-06 14:48:54 +09:00
Árni Dagur
0a255ee62d Clear colorcolumn in vim-plug buffer (#779) 2018-08-08 10:52:00 +09:00
dohq
e0ca037a4f has('win32') is enough for detecting Windows (#765) 2018-06-20 18:18:50 +09:00
Junegunn Choi
f80eed7379
Add <plug>(plug-preview) map (#769)
This allows you to override the default behavior of `o' or `<cr>'
binding in PlugDiff window.

e.g.
    " Move to preview window
    autocmd! FileType vim-plug nmap <buffer> o <plug>(plug-preview)<c-w>P

Close #749
Close #768
2018-06-20 18:09:06 +09:00