Commit Graph

189 Commits

Author SHA1 Message Date
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
8cef26186e Make sure b:sy_path is always set
References #136.
2014-10-04 19:48:10 +02:00
Marco Hinz
a149ad9510 README: update 2014-10-04 16:20:17 +02:00
Marco Hinz
fe3bafce11 Introduce smarter sign management 2014-10-04 15:56:10 +02:00
Marco Hinz
5baf161ae4 Skip help files by default 2014-09-18 15:39:50 +02:00
Marco Hinz
0725f93014 Fix help filetype skipping 2014-09-18 15:34:26 +02:00
Marco Hinz
0261a6af2c Improve :SyDebug 2014-09-18 13:11:33 +02:00
Marco Hinz
4d3674d431 Perforce: check for server availability before requesting a diff
References #131.
2014-09-07 16:11:07 +02:00
Kevin
9ca274d792 Fix error when toggling on a new file
Toggling on a new file lead to an error since b:sy wouldn't exist at
that time.

Closes #124.
2014-06-13 16:36:08 +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
e270560349 Replace all uses of "cd … && do_something" with sy#util#run_in_dir
Signed-off-by: James McCoy <vega.james@gmail.com>
2014-01-30 23:04:39 -05:00
James McCoy
f38cebd791 Add sy#util#run_in_dir to run system() within a specific directory
Signed-off-by: James McCoy <vega.james@gmail.com>
2014-01-30 23:03:55 -05:00
Marco Hinz
0e66e0963f Fix matching of the "first line deleted" sign
Closes #112.
2014-01-15 09:48:43 +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
a7c83f6e2e Set noshellslash only for cmd.exe
Thanks @Haroogan.

Closes #99.
2013-11-30 14:33:47 +01:00
Marko Tibold
dcae627181 Improve speed of :vimgrep by using a global lock 2013-11-26 11:11:52 +01:00
James McCoy
c9007b894b Use 1-based indexing for buffer ranges
`:SyDebug` is displaying info if an alternate buffer is set.  This
occurs because a buffer number of 0 represents the alternate buffer.
Using a 1-based range in sy#debug#list_active_buffers fixes this.

Signed-off-by: James McCoy <vega.james@gmail.com>

References #97.
2013-11-22 20:51:37 +01:00
Marco Hinz
824b186ce5 Perforce: make it use g:signify_diffoptions
References #89.
2013-11-22 19:50: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
Marco Hinz
a2b0de3359 Fix :SyDebug for certain corner cases 2013-11-22 14:05:18 +01:00
James McCoy
5211c19ee7 Move Sy's data from g:sy to b:sy 2013-11-22 13:48:49 +01:00
Marco Hinz
1c762af02e Fix typo 2013-11-20 19:39:53 +01:00
Marco Hinz
2fbdc52ad7 Fix handling of certain git implementations
Closes #87.
2013-11-20 16:31:53 +01:00
Marco Hinz
6fab9cc2d7 Merge pull request 90 from @talmuth
Closes #90.
2013-11-19 08:24:43 +01:00
Denys Lózko
f4b2350458 Fix sign_overwrite for non-EN locales 2013-11-19 08:24:19 +01:00
Marco Hinz
5817de27c8 Merge pull request 86 from @thallett
Closes #86.
2013-11-18 23:36:56 +01:00
Timothy Hallett
ea5d13ce46 Dynamically re-apply diff options on every diff
Prior to this patch, it was not possible to dynamically apply arguments
to diff commands.  The g:signify_diffoptions variable was only read when
the plugin was loaded.

This patch changes the behavior so that before each diff it checks
g:signify_diffoptions to see what arguments should be passed to the diff
tool.

The motivating use case behind this change is to be able to diff against
a different branch in Git via a key mapping. However, This change will
also allow any other arbitrary diff options to be dynamically updated,
such as whitespace, etc.

Example: Show diff against master instead of against HEAD in Git
  nnoremap \u :let g:signify_diffoptions = { 'git': 'master'}<CR>:SignifyToggle<CR>
2013-11-18 23:34:47 +01:00
Marco Hinz
79cb027b35 Perforce: diff -du0 -> diff -dU0
Closes #89.
2013-11-18 10:26:09 +01:00
Ed Page
9b7ad65ea9 Remove double-dash from perforce call
Closes #85.
2013-11-09 14:22:01 +01:00
Øystein Walle
22515a370c Stylistic change 2013-11-03 20:10:21 +01:00
Marco Hinz
1499f548a2 Improve repo detection
Prior to this patch a VCS was only detected by checking if a potential
diff was empty or not. Now the combination of return value and diff is
checked, so it detects an underlying VCS properly even when there are no
changes.

This can save many useless calls to the wrong version control systems.

Simple test:

 - open a version-controlled file without any changes
 - :SyDebug should show the correct VCS now (instead of 'unknown')

Closes #82.
2013-11-03 19:31:46 +01:00
Marco Hinz
8fd2d3ce76 Do not use certain VCS if no difftool is available
References #83.
2013-11-03 16:07:15 +01:00
Marco Hinz
ec4d88eb1c Change default value for sign overwriting
References #81.
2013-10-30 12:16:07 +01:00
Marco Hinz
c2cce93b13 Change warning message for sign overwriting
References #81.
2013-10-30 12:12:54 +01:00
Marco Hinz
531d3abd87 Remove misplaced modeline 2013-10-02 14:56:01 +02:00
Dario Sneidermanis
e398fc4856 Repo.vim: use correct variable
After one of the recent changes 'deleted' was used in a place where
'removed' should have been used. This could lead errors:

Error detected while processing function
   sy#toggle..sy#start..sy#repo#process_diff..sy#sign#set:
line   10:
E155: Unknown sign: SignifyChangeDelete12
2013-10-01 09:34:17 +02: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
5f36c16ff5 Test if 'sign unplace *' is supported 2013-09-30 09:40:46 +02:00
Marco Hinz
b579bd9f8c Code cleanup in repo.vim 2013-09-27 10:45:35 +02:00
James McCoy
ded8213bf6 Calculate correct ChangeDelete sign to use
Using deleted was causing the sign to reflect all the deleted lines so
far in the buffer instead of the deleted line count for this hunk.
2013-09-27 00:13:28 -04:00
James McCoy
fb2f2405e6 Fix double counting of deleted lines in a ChangeDelete hunk 2013-09-26 23:48:07 -04: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
c299dc5c1c Git: use --no-color
ANSI escape sequences in a patch would confuse Sy. People are advised to
set their color settings to 'auto' instead of 'always', so color codes
would only be used if the output is meant for the terminal.

Thus we just ignore color.diff settings now.

References #72.
2013-09-25 01:36:08 +02:00
Marco Hinz
fcfb40c456 Avoid variable type mismatch 2013-09-16 01:29:11 +02:00
Carl Henrik Lunde
d3ead7128d Avoid useless calls to executable()
get() is not lazy and will always evaluate the expression in the default
value.
2013-09-15 23:00:04 +02:00
Marco Hinz
79bf0c4d0f Fix CVS handling 2013-09-15 18:54:41 +02:00
Marco Hinz
f084f1d599 CVS returns 1 on diff and error 2013-09-15 15:17:12 +02:00
Marco Hinz
0b6ffd8d00 Add simple directory cache 2013-09-13 01:23:05 +02:00
pekepeke
6a157ebd75 Fix backwards logic in filter() 2013-09-12 09:36:24 +02:00
Marco Hinz
fcf5d14460 Refactor VCS detection #2 2013-09-12 00:26:43 +02:00
Marco Hinz
a2b96beff7 Refactor VCS detection 2013-09-12 00:16:09 +02:00
Bailey Ling
3133fce524 Improve detection performance (#67) 2013-09-11 21:16:38 +00:00
Marco Hinz
b91bac6b24 Remove Sy signs first before getting others
References #64.
2013-09-06 17:11:02 +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
3c370e93c0 Change init stats for disabled plugin 2013-08-22 19:06:02 +02:00
Marco Hinz
273fbfc63a Reset stats when the plugin is toggled off 2013-08-22 18:58:37 +02:00
Marco Hinz
d496a8dc76 Fix problem on :SignifyToggleHighlight
It was possible to run the command before the variable
signify_line_highlight was set. It's disabled by default now.

Closes #59.
2013-08-21 19:13:03 +02:00
Marco Hinz
fa72eb2658 New function: sy#repo#get_stats()
It returns a list of numbers of additions, modifications and deletions
and is intended to be used by other plugins.
2013-08-20 16:45:29 +02:00
killphi
9dc86c9bf6 Add stats property to g:sy 2013-08-20 15:48:46 +02:00
Bailey Ling
9cbe9e1e90 Remove redundant path modification for diff on win32 2013-08-19 20:27:45 +02:00
Marco Hinz
b29cd71f6d Set encoding for plugin files
Closes #54.
2013-08-19 17:36:16 +02:00
Dario Sneidermanis
0bde67c6c8 Allow highlight groups overriding
The [default] argument is used for setting the default highlighting for a group. If highlighting has already been specified for the group the command will be ignored. Also when there is an existing link.
2013-08-17 20:57:41 -03:00
Marco Hinz
839232423b Fix quoting in darcs detection 2013-08-08 23:08:39 +02:00
Marco Hinz
9a78f90e1a Remove useless calls to executable() 2013-08-07 18:56:13 +02:00
Marco Hinz
78a96c4b49 Minor syntactic style changes 2013-08-07 15:46:37 +02:00
killphi
52d025975b Add forgotten let to fix startup up 2013-08-07 13:22:43 +02:00
killphi
43ca708c99 Add variable option to pass to VCS diff command 2013-08-07 12:59:26 +02:00
Marco Hinz
c916c03210 Improve 'disabled by default' behaviour
Closes #47.
2013-08-01 11:40:41 +02:00
Marco Hinz
82f3be224c Check for 'p4' instead of 'perforce'
References #46.
2013-07-30 01:50:22 +02:00
Marco Hinz
747e12aed3 Add experimental perforce support 2013-07-29 21:15:07 +02:00
Marco Hinz
c4df9a3895 Improve cursorhold handling 2013-07-29 16:53:51 +02:00
Marco Hinz
a1668bab51 Avoid creating the useless highlight group NONE #2
I forgot to change one line..

References #45.
2013-07-29 15:09:00 +02:00
Marco Hinz
7ae3a0f5ff Avoid creating the useless highlight group NONE
By using the wrong :sign-define syntax, a highlighting group NONE was
created by accident.

Closes #45.
2013-07-28 20:38:38 +02:00
Marco Hinz
9733f6cfac Improve jumping once again
References #4.
2013-07-22 00:21:34 +02:00
deris0126
3b96ea5cbe Make jumping behaviour more pragmatic
This patch makes jumps go the the first/last hunk when the given count
was bigger than the available hunks.

E.g. when there are only 2 hunks and you use 4]c, the cursor jumps to
the last hunk nevertheless. Before this patch the cursor wouldn't move
at all (which mimics the standard behaviour of ]c/[c).

Closes #41.
2013-07-21 15:21:34 +02:00
Marco Hinz
c2770af9f1 Correct comment 2013-07-19 22:33:23 +02:00
Marco Hinz
0b337dd38e Don't sy diffing buffers 2013-07-17 13:45:06 +02:00
Marco Hinz
7d56e9aac1 Minor corrections 2013-07-17 12:44:21 +02:00
Marco Hinz
ea331d6065 Populate autoload/ 2013-07-17 12:30:58 +02:00
Marco Hinz
0718c1a2a9 Add sy#repo.vim 2013-07-17 10:14:43 +02:00
Marco Hinz
7d4759866a New sy#utils.vim 2013-07-17 09:54:03 +02:00