Andy Stewart
84bc2d68c0
Fix base_path() to handle filenames with colons
...
This bug was introduced when teaching gitgutter to handle file moves
in #872 .
Fixes #877 .
2024-01-03 16:06:27 +00:00
Andy Stewart
4b49965897
Warn user when unable to list renamed files
2023-12-07 13:56:55 +00:00
Andy Stewart
3b5acc05a1
Guard config flag in file moves check
2023-11-10 18:23:47 +00:00
Andy Stewart
1e7be38a3c
Make command line config flag global
2023-11-10 18:19:48 +00:00
Andy Stewart
b9e9ad2ae2
Fix -c flag to apply to git command not diff subcommand
...
Fixes #874 .
2023-11-10 18:09:44 +00:00
Andy Stewart
6efb835aa2
Suppress crlf warning when obtaining file moves
...
See comment above gitgutter#diff#run_diff() for rationale.
2023-11-10 15:55:55 +00:00
Andy Stewart
952dbc34f7
Move base_path() to gitgutter#utility
2023-11-10 12:09:33 +00:00
Nikita Kouevda
28d463f199
mv restore into gitgutter#utility#system
2023-08-31 07:50:14 -07:00
Andy Stewart
458603713d
Cast variable getter to match setter
2023-07-31 12:40:24 +01:00
Andy Stewart
6ebc0fd233
Extract function to reduce duplication
2023-06-05 09:50:17 +01:00
Andy Stewart
f7f1286aac
Use filename in clean_smudge_filter_applies() function
...
And move function to utility.
Since we change directory to the file's directory we can just use its
name rather than it path from the repo root.
2023-06-03 10:26:32 +01:00
Andy Stewart
cefbe30aa9
Make filename() function public
2023-06-03 10:22:20 +01:00
Andy Stewart
988a6dbad9
Use a reliable regexp operator for lower case
...
It turns out =~ depends on 'ignorecase'. Big sigh.
2022-04-25 20:41:43 +01:00
Andy Stewart
57000a73ab
Use reliable regexp character class for lower case
...
It turns out [:lower:] does not always mean lower case (it depends
on 'ignorecase'). Sigh.
2022-04-25 20:26:21 +01:00
Andy Stewart
5dd8ab6211
Fix parsing of 'git ls-files -v' for filenames with spaces
...
Fixes #829 .
2022-04-25 13:33:45 +01:00
Andy Stewart
2f359076bc
Whitespace
2022-04-23 08:30:47 +01:00
Andy Stewart
626541edeb
Heeds git's "assume unchanged" bit
...
I.e. does not diff files which should be assumed unchanged.
See:
git update-index --[no-]assume-unchanged -- <file>
git ls-files -v
Closes #826 .
2022-04-23 08:25:46 +01:00
Andy Stewart
23a65f370b
Fix enabling buffer when plugin disabled
...
Fixes #803 .
2022-02-02 10:58:53 +00:00
Vincent Cordobes
602a5ba19e
Clean up warning messages
2021-04-22 12:03:06 +01:00
acelya
2e3cd54ed6
Fix pwsh/powershell test when used with a parameters
...
Like `set shell=pwsh\ -NoLogo`.
2021-02-11 09:13:02 +00:00
acelya
512e2999ed
Force cmd.exe to be used by system() instead of pwsh or powershell on Windows
2020-12-11 16:13:05 +00:00
Andy Stewart
011fca3f02
Only use '/d' flag for 'cd' in DOS shell
...
Closes #678 .
2020-04-27 10:38:35 +01:00
Andy Stewart
2b62481d38
Only diff against parent commit in Fugitive revision buffers
...
Fixes #695 .
2020-04-18 17:13:15 +01:00
Andy Stewart
5f6048da13
Bypass sticky type checking on older Vims
...
Until Vim 7.5.1546 the type of a variable could not be changed.
Fixes #693 .
2020-04-14 15:42:07 +01:00
Andy Stewart
b7db78b258
Simplify getting and setting buffer variables
...
This also avoids the getbufvar(bufnr, '') pattern which is subject to a
Vim bug in certain versions.
Closes #691 .
2020-04-03 14:50:15 +01:00
Andy Stewart
0e509fb0ac
Set diff base when viewing file versions with Fugitive
...
When you look at previous versions of a file, e.g. with Fugitive's
:0Gclog, gitgutter will set the diff base to the current version's
parent so that diff markers appear as expected.
Thannks to @rcreasi for the idea and initial implementation.
2020-03-12 10:38:58 +00:00
Andy Stewart
8e368ae8d1
Extract has_repo_path() function
2020-02-24 15:16:51 +00:00
Andy Stewart
669357bb92
Fix #repo_path() return value when path not set
...
This change makes it an empty string, as documented, not 0.
2020-02-24 15:10:55 +00:00
Andy Stewart
91471746fe
Avoid asynchronous job while vim is starting.
...
An asynchronous job at startup evidently triggers a Vim (not NeoVim)
rendering bug in some terminals and/or with certain colorschemes.
Terminals reported to be affected: libvte-based ones such as
gnome-terminal, xfce4-terminal, lxterminal, kitty.
Terminals reported to be unaffected: xterm, urxvt.
Closes #619 .
2019-07-01 11:24:45 +01:00
Andy Stewart
dc3c0dcd2a
Ensure git calls always use configured args for git.
...
See #628 .
2019-06-14 12:52:13 +01:00
Daniel Hahler
a4e8d3f188
gitgutter#utility#getbufvar: handle not existing buffer
2019-06-03 11:58:08 +01:00
Daniel Hahler
d7777b325a
gitgutter#utility#getbufvar: handle not existing buffer
...
`getbufvar(a:buffer, '')` returns '' then, resulting in an error.
2019-06-03 11:55:54 +01:00
Andy Stewart
a7650790ea
Work around older Vims not accepting arguments for function().
...
Fixes #618 .
2019-05-31 07:17:36 +01:00
Andy Stewart
222b1a2fde
Extract setting of path.
2019-05-29 14:37:16 +01:00
Andy Stewart
064a3d6b10
Move #init_buffer() into #process_buffer().
2019-05-29 14:36:53 +01:00
Daniel Hahler
50932df59a
Simplify async callbacks for setting repo path.
2019-05-29 13:06:05 +01:00
Andy Stewart
2dce8e032b
Add commands to enable/disable/toggle GitGutter per buffer.
2019-01-08 12:47:10 +00:00
Andy Stewart
c2651aefbd
Do not pass a default value to getbufvar().
...
That was introduced in Vim 7.3.831 but there are a few Vims older than
that still around.
See:
af1e674155 (commitcomment-31431773)
2018-11-26 16:46:51 +00:00
Andy Stewart
947737c76f
Handle non-ASCII paths.
...
This prevents git-ls-files from escaping "unusual" characters in
pathnames. When this happened, gitgutter would feed the escaped name
back to git-show but git-show would not recognise it.
This commit makes git-ls-files use the -z option to output pathnames
verbatim. These pathnames also become null terminated so we have to
ensure we remove the null terminator too.
Closes #562 .
2018-11-17 11:24:36 +00:00
Daniel Hahler
af1e674155
Fix gitgutter#utility#setbufvar for nonexistent buffers
...
Use a default with `getbufvar` to not get an empty string.
Fixes:
> Error detected while processing function <SNR>163_on_stderr_nvim[1]..<lambda>10[1]..gitgutter#utility#setbufvar:
> line 1:
> E712: Argument of get() must be a List or Dictionary
I can trigger it using https://github.com/AndrewRadev/linediff.vim when
closing the windows / the tab.
Likely triggered with/through Neomake.
2018-10-11 11:30:26 +01:00
John Kurkowski
f363799550
Support files with a leading -
...
Git treats anything past the `--` as filenames.
2018-05-05 23:05:31 -07:00
Daniel Hahler
22c3fc0bf5
gitgutter#utility#setbufvar: ensure bufnr is a number with setbufvar
...
Otherwise you might get "E93: More than one match for X" if there is a
buffer with "X" in its name besides buffer number X.
2018-05-02 08:06:48 -07:00
Andy Stewart
5481318fc1
Prevent infinite loop when running non-async on Windows.
...
Closes #505 .
2018-04-11 09:56:43 +01:00
Andy Stewart
37bdd03d17
Do not deactivate gitgutter when &diff is set.
...
In #303 there was a request to deactivate gitgutter when &diff is set,
although no reason was given initially. Then it was reported that
gitgutter showed signs, in the wrong place, during Fugitive's Gdiff.
However I cannot reproduce signs showing in Gdiff's index buffer. And
the signs in the working tree buffer are correct.
Furthermore the commit which deactivated gitgutter (85f6e136 ) had the
side-effect of breaking `:redir` and clearing Vim's startup message
(see #500 ).
Therefore since that change had no benefit, and a couple of drawbacks,
it makes sense to undo it.
Closes #500 .
2018-03-16 18:49:22 +00:00
Andy Stewart
2f736d58b4
Backward compatibility for nvim-0.1.7.
...
NeoVim 0.1.7 does not support the `function()` function accepting an
optional argument list.
Fixes #496 .
2018-03-14 11:43:36 +00:00
Chayoung You
538e07882a
Handle files in different drive on Windows
2018-03-06 03:07:42 -08:00
Andy Stewart
b87aacbbfe
Do not treat win32unix as Windows.
...
This reverts 16568f4815 which was, I believe now, mistaken.
See #471 .
2018-03-06 10:55:47 +00:00
Daniel Hahler
41b951e64e
Fix gitgutter#utility#warn_once: use echom
...
This a) logs the message to be seen in `:mess` and b) avoids the
hit-ENTER prompt (which is likely caused by the message not being
logged and Vim deciding that you need to see it then).
So a) fixes b).
2018-03-01 10:11:03 +00:00
Daniel Hahler
4931dd1a82
Conditionally define s:vimdiff
...
This optimizes it a bit since the `exists()` is not called always.
2018-02-21 11:46:36 +00:00
Daniel Hahler
18f6d0ffe1
gitgutter#utility#setbufvar: skip unnecessary setbufvar
...
An existing dict gets returned by reference, so changing it does not
need a call to `setbufvar` afterwards.
2018-02-21 11:39:42 +00:00