Commit Graph

45 Commits

Author SHA1 Message Date
Marco Hinz
b8a1b656c6
Fossil: add note about non-conventional diff fix
References https://github.com/mhinz/vim-signify/issues/282
2019-02-10 16:41:55 +01:00
Marco Hinz
768f523192
Fossil: fix detection of deleted lines (second try)
References https://github.com/mhinz/vim-signify/issues/282
2019-02-04 18:45:45 +01:00
Marco Hinz
99a57ebd49
Revert "Fossil: fix detection of deleted lines"
This reverts commit 6ab96c13937754e3078076c7fb6996a404f04459.

Unfortunately the situation is a tad more complicated than I thought. Revert for
now and have an eye on https://fossil-scm.org/forum/forumpost/834ce0f1e1
2019-02-04 18:45:41 +01:00
Marco Hinz
64b226cf1b Fossil: fix detection of deleted lines
Assuming line 28 was deleted, the block header for a unified diff looks like:

    +28,1 -27,0

This is true for usual suspects like `diff -U0` and `git diff -U0`, but
unfortunately not for Fossil. It would report this instead:

    +28,1 -0,0

This lead our code to believe that line 1 instead of line 28 was deleted. And
maybe it's right about that. There does not seem to be a standard for patch/diff
output, but according to my knowledge Fossil is the only VCS doing that.

Anyway, this commit's change should make the detection of a deleted first line
work for every VCS again.

Fixes https://github.com/mhinz/vim-signify/issues/282
2019-02-04 15:41:34 +01:00
Marco Hinz
8351e5212f
Improve detection of nested repos managed by different VCS
Assume a hg repo below a git repo. `git diff` on a file managed by hg, will
return a successful exit value, but no output.

So, if we got a successful exit value from multiple VCS tools, and none of them
gave any output, keep them all as potential candidates. The next time Sy is run,
only these candidates will be tested again.

If one of them returns a proper diff, set b:sy.updated_by to that VCS and prune
all other candidates.

References #235
2018-04-17 17:35:08 +02:00
Nikita Kouevda
b699eb540c MacVim: Do not remap ^L
`feedkeys` remaps keys by default, so if a mapping exists for `<C-l>`,
then `call feedkeys("\<C-l>")` will not result in the desired behavior.
2017-08-19 16:43:34 -07:00
Marco Hinz
ed51cb2599 Signs: do not exceed two cells
This is only enforced for dynamically created signs, namely
g:signify_sign_delete and g:signify_sign_changedelete, if
g:signify_sign_show_count is on.

References https://github.com/mhinz/vim-signify/issues/105
2017-07-19 16:10:59 +02:00
Marco Hinz
1bdf100aad
Do not make option defaults depend on each other
Having default values for options that depend on another option's value is a bad
practice. Be more explicit:

  g:signify_sign_show_text  is ON by default
  g:signify_sign_show_count is ON by default

So, people who want just background colors and no text at all in their signs
have to set both:

  let g:signify_sign_show_text  = 0
  let g:signify_sign_show_count = 0

Before this change, only the first line was needed.

This also fixes a bug that happened with:

  let g:signify_sign_show_text  = 0
  let g:signify_sign_show_count = 1

Removed lines wouldn't show a count whereas changed + removed lines would.
2017-07-18 16:47:03 +02:00
Marco Hinz
952920b92d
Always set sy.updated_by
References #235.
2017-04-21 13:34:02 +02:00
Marco Hinz
179fe50edf
Improve debug output 2017-04-18 17:18:19 +02:00
Marco Hinz
b119f8d81b
Allow multiple active VCS
When you have nested repos of different VCS and you edit a file from the inner
repo, more than one VCS can return a valid diff. Only one VCS should return a
non-empty diff, though.

Once a non-empty diff is found, all other VCS get disabled to reduce overhead.

References #235.
2017-04-18 17:00:12 +02:00
Marco Hinz
b1e58456cf
MacVim: don't use ^L in insert mode
References #234.
2017-04-12 11:18:38 +02:00
Marco Hinz
0a09008179
Remove now useless workarounds 2017-02-24 18:09:06 +01:00
Marco Hinz
d155dffd9d
GUI: use :redraw for all GUIs except MacVim 2017-02-20 16:47:35 +01:00
Marco Hinz
2778fd928c
GUIs: redraw screen after sign update
Some GUIs (MacVim, gVim) wouldn't show placed signs after updating. Force a
redraw.

References #228.
2017-02-20 01:15:50 +01:00
Marco Hinz
82d6df9f71
Don't switch window in exit handler
Since we don't switch the window anymore, we can't simply refer to b:sy as we
used to do while Sy worked only synchronously.

Now we provide the buffer number to each job and the exit handler gets a pointer
to the b:sy of that buffer and passes it to all the subsequent functions.

References #209, #210.
2017-01-30 14:50:32 +01:00
Marco Hinz
68013238b4
Restrict to be removed sign IDs to buffer 2017-01-29 02:22:35 +01:00
Marco Hinz
304a2b9c27
Simplify sign ID handling 2017-01-18 16:28:35 +01:00
Marco Hinz
0e609fdf1d
Make Vim and job_start() work 2017-01-17 23:12:00 +01:00
Marco Hinz
4aca2ee9c5 Don't rely on :language
Fixes #187.
2016-12-15 14:56:20 +01:00
Marco Hinz
faf7a03071
New option: g:signify_sign_show_text
This makes all Signify signs use a non-breaking space as text. This is
convenient if only the background colors of the signs are important.

References #188.
2016-09-28 17:05:40 +02:00
James McCoy
f708bc475f Stop clearing stats in sy#sign#remove_all_the_signs 2016-06-01 21:13:33 -04:00
Marco Hinz
a58fbe93df Useless use of :execute 2015-05-25 16:37:37 +02:00
James McCoy
c61dded98a Add the buffer number as an argument to sy#stop()
sy#stop() is called by the BufDelete autocmd so b: variables may not
correspond to the buffer actually being deleted.  Instead, we must use
<abuf> to determine which buffer is being deleted and pass that into
sy#stop().

There are some ripple effects, causing sy#sign#remove_all_signs to also
gain a buffer number argument.

Signed-off-by: James McCoy <vega.james@gmail.com>
2014-11-25 11:25:40 -05:00
Marco Hinz
c2f3b364d2 Introduce g:signify_sign_show_count
This option replaces g:signify_sign_delete_use_count and works for both,
delete and change/delete.

Referenes #125.
2014-10-07 23:02:17 +02:00
Benjamin Thomas
bdc0c5eb15 Add finer grained control over signs and highlights
I wanted to be able to customize signify in a way that wasn't possible
with the current set of options.  This commit adds 2 new options and 2
new highlight groups.

Specifically, we can now

1.  differentiate between changes, deletes AND signs that have both
    with the `signify_sign_changedelete` option.
2.  disable showing the number of deleted lines in the sign column with
    the `signify_sign_delete_use_count` option.
3.  highlight lines with changes and deletes specifically with the
    `SignifySignChangeDelete` highlight group.
4.  highlight the first line differently with the
    `SignifySignDeleteFirstLine` highlight group.

All of these default to existing settings/highlight groups, so
everything should continue working the way it does now.

--------------------------------------------------------------------------------

For those that are curious, I wanted to configure signify to show no
symbols in the sign column, and to just use the highlight groups to give
me all the information I needed.  I am able to achieve that now with the
following settings and the Solarized colorscheme:

let g:signify_sign_add = "\<Char-0xa0>\<Char-0xa0>"
let g:signify_sign_change = "\<Char-0xa0>\<Char-0xa0>"
let g:signify_sign_changedelete = "__"
let g:signify_sign_delete = "__"
let g:signify_sign_delete_first_line = "‾‾"
let g:signify_sign_delete_use_count = 0

hi SignifySignDelete term=bold,underline cterm=bold,underline ctermfg=1 ctermbg=12
hi SignifySignDeleteFirstLine ctermfg=1 ctermbg=12
hi SignifySignChangeDelete term=bold,underline cterm=bold,underline ctermfg=1 ctermbg=3

You can see it in action here:

https://twitter.com/_bentomas/status/486266117204090880
2014-10-07 23:02:17 +02:00
Marco Hinz
fe3bafce11 Introduce smarter sign management 2014-10-04 15:56:10 +02:00
blacksand
2b05c7fd04 Fix locale setting for Chinese Windows versions
On the Chinese version of Windows, v:lang is "zh_CN", but execute
":language zh_CN" will fail and ":language chinese_china" must be used
to change the locale instead.

Closes #116.
2014-02-05 22:07:27 +01:00
James McCoy
159b171e4a Use _> for more than 99 deletes lines (again)
Closes #110.
2014-01-04 09:40:10 +01:00
Marco Hinz
5db82c4d2a Let counter overflow if more than 100 lines deleted
If there are more than 99 deleted lines, the actual count isn't being
important anymore. Thus we just let it overflow and save another
conditional.

100 deleted lines -> "00"

Closes #109.
2014-01-01 22:54:49 +01:00
Marco Hinz
9e83f243e7 Fix unicode + subscripting bug
This bug happened when a unicode character was used for the delete sign.
Prior to this patch we used string subscripting which worked fine for
ASCII characters, but see yourself:

    :echo '«5'[-2:]
2013-12-29 19:18:54 +01:00
James McCoy
7f57ee5af6 Use two digit numbers for SignifyDelete signs
Defining the SignifyDelete set of signs on the fly provides the ability
to specify the exact line deletion count for up to 99 lines, rather than
the current limit of 9 lines.

This also has the benefit of reducing the number of signs defined when
there aren't many hunks of deleted lines.  On the flip side, if there
are other sign-placing plugins in use, then it also increases the chance
of nearing the ~120 sign definition limit if there are many hunks of
varying line deletions.
2013-12-11 10:04:52 +01:00
Marco Hinz
2f1def6b9d Don't remember the dummy sign
References #102.
2013-12-06 22:43:51 +01:00
Marco Hinz
6ecab1b621 Prevent potential regressions
References #95.
2013-11-22 16:44:06 +01:00
Marco Hinz
f7dc63e819 Remove 3-argument getbufvar() for better compatibility
References #95.
2013-11-22 16:14:28 +01:00
James McCoy
5211c19ee7 Move Sy's data from g:sy to b:sy 2013-11-22 13:48:49 +01:00
Denys Lózko
f4b2350458 Fix sign_overwrite for non-EN locales 2013-11-19 08:24:19 +01:00
Marco Hinz
50496311c5 Remove guards from autoload files 2013-09-30 10:22:20 +02:00
Marco Hinz
a9284f363c Move modelines to the top 2013-09-30 10:19:31 +02:00
Marco Hinz
be4d622bb9 Don't reset signs when another window gets updated
References #73.
2013-09-25 11:17:52 +02:00
Marco Hinz
da5eabe3c9 Relocate emptying of other signs dict
References #64.
2013-09-06 16:43:08 +02:00
Marco Hinz
4167fa0373 Fix sign overwrite issue
References #64.
2013-09-06 15:34:13 +02:00
Bailey Ling
a8f67e0f0f Reset stats when signs are cleared 2013-08-26 15:52:29 +00:00
Marco Hinz
b29cd71f6d Set encoding for plugin files
Closes #54.
2013-08-19 17:36:16 +02:00
Marco Hinz
ea331d6065 Populate autoload/ 2013-07-17 12:30:58 +02:00