When working in large repositories, 9 characters can be ambiguous.
Bumping it to 40, which is the length of SHA-1. (The algorithm is not
that relevant though. Even when SHA-256 takes over, 40 characters should
still be enough for most repositories.)
- When computing the center line, 'exit' on failure instead of 'return'.
- Open vim in read-only mode to avoid a non-zero exit code if the file is
already opened.
Signed-off-by: Nicolas VINCENT <nico.vince@gmail.com>
* Remove dependency of fzf#vim#helptags on grep.
The grep command was used here only to dump file contents prefixed
with the filename and a colon. Since the function generates a temporary
Perl script anyway, it is simpler to do this directly in the Perl
script. This removes the dependency on grep and makes it easier to get
:Helptags to work on Windows.
A subsequent commit will also move the sorting of the helptags into the
Perl script. I did not do it in this commit, since the OS's "sort"
command can give a different sort order than Perl's sort function,
so I'm not sure what is preferred here.
Note: 'use autodie' is recommended over 'use Fatal' but the autodie
module has only been in Perl core since v5.10.1 (2009-08-22) while
Fatal is in core since 1996. The three-argument open requires v5.6
(2000).
* Remove dependency of fzf#vim#helptags on external sort command.
This moves the sorting of helptags into the generated Perl script and
thereby removes the dependency on an external "sort" command.
Note that Perl's sort function used here may give a different sort
order than the OS's sort command. (It does so for me on Windows but
I actually like Perl's ASCII sort order better, anyway.)
---------
Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
The boolean value tells the function if the output of the command
contains column numbers, but we can just see the selected lines if they
contain column numbers.
The argument is now removed from the documentation, and will be silently
ignored for backward compatibility.
Close#1480
* [[B]Commits] Support arguments for git-log
Add support for command arguments that are passed to git-log (e.g.
:Commits -S foo -3).
The place of insertion is relevant. Generally the arguments should come
at the end to overwrite existing flags if necessary, but need to come
before the pathspec (i.e. `fzf#shellescape(current)`) in BCommits.
* [[B]Commits] Make sure all positional arguments are optional
Test cases:
" With default options
%call fzf#vim#commits()
" Full screen
%call fzf#vim#commits(1)
" Not full screen
%call fzf#vim#commits(0)
" With extra fzf options
%call fzf#vim#commits({ 'up': '50%', 'options': '--no-color' })
" With extra fzf options (with preview) and in full screen
%call fzf#vim#commits(fzf#vim#with_preview({ 'options': '--no-color', 'placeholder': '' }), 1)
" With extra git log options
%call fzf#vim#commits('-S foo')
" With extra git log options in full screen
%call fzf#vim#commits('-S foo', 1)
" With extra git log options and fzf options
%call fzf#vim#commits('-S foo', { 'options': '--no-color' })
" In full-screen
%call fzf#vim#commits('-S foo', { 'options': '--no-color' }, 1)
" Command form
Commits
Commits!
Commits -S foo
Commits! -S foo
* [Commits] Enable file completion for arguments
This gets handy when BCommits is too narrow (e.g. multiple files or a
folder is specified).
Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
The commit linked below removed `a:args` from the `git ls-files` command, making it
unable to take any options like `--cached`, `--others` and
`--exclude-standard`
531dd67350
With some delta configurations (e.g. color-only = true, diff-highlight =
true), delta doesn't add its own coloring and keeps that from git diff,
and thus we need to turn that on.
Additionally, delta doesn't do its own detection of moved lines and
relies on git diff's colorMoved, which also needs enabling of colors.
Since 85ae745910,
fzf opens in a terminal buffer (in my setup) and that breaks commands
that end up showing the hit-enter or more prompt, such as :scriptnames
or :ALEInfo. No idea why those commands break (I tried to diagnose this
but gave up unfortunately), but executing them using feedkeys fixes
this.
* Fix preview on GFiles? on Windows+WSL
* Fix preview on GFiles? on Windows using gitInstallFolder\usr/bin\bash.exe
Co-authored-by: Minh-Tam TRAN <c_mtran@capsuletech.com>
Co-authored-by: Minh-Tam TRAN <minh-tam.tran@younited-credit.fr>
+ In `fzf#vim#helptags`, we now also parse out the ex-command in the
perl script so it's available for the preview (this is just an
extra `\t(.*)` appended to the original regex).
+ Add the `--tag` placeholder to `:Helptags` with corresponding
arguments.
In 161da95, [B]Commits were changed to range commands with -range=%, now
Vim jumps to the first line when these two commands are called directly
without specifying range.
This fixes it by saving window view in a temporary variable and
restoring it later. Reference: [1].
[1] https://vi.stackexchange.com/a/6037/33583
As the code was written before, if we do this:
let s:opts = {
\ 'window': {'width': 0.6, 'height': 0.6, 'relative': v:false},
\ 'options': ['--layout=reverse', '--info=inline'],
\}
call fzf#vim#files('', s:opts, 0)
...then s:opts will get mutated by the call to fzf#vim#files, cloberring
any persistent configuration established this way.
Making a defensive copy solves the problem.