Commit Graph

202 Commits

Author SHA1 Message Date
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
f7678884f0
Race condition: make sure we're still in same buffer
Fixes #207.
2017-01-23 13:37:53 +01:00
Marco Hinz
e43155f3e1
Fix typo in callback_stdout_nvim()
Fixes #206.
2017-01-23 12:50:16 +01:00
Marco Hinz
0db69f4658
Fix CVS
References #205.
2017-01-23 02:58:41 +01:00
Marco Hinz
9ced2cf73f
Fix arguments of a few diff functions
Fixes #205.
2017-01-23 02:02:03 +01:00
Marco Hinz
faf5240823
Fix exit callback
Vim provides 2 arguments to the exit handler whereas Neovim always provides 3.
Change function signature to handle an optional third argument, even if it never
gets used.

Fixes #204.
2017-01-22 20:42:31 +01:00
Marco Hinz
8f3fc1c023
Simplify a few verbose messages 2017-01-18 17:27:44 +01:00
Marco Hinz
295e449db6
Add sy#util#chdir() 2017-01-18 17:15:15 +01:00
Marco Hinz
304a2b9c27
Simplify sign ID handling 2017-01-18 16:28:35 +01:00
Marco Hinz
b839e8092f
Add s:initialize_job() 2017-01-18 13:40:34 +01:00
Marco Hinz
3aa8eb9ec6
Jump to correct window in exit handler 2017-01-18 11:07:21 +01:00
Marco Hinz
f6a0a50e06
Only run s:set_signs() if diff was found 2017-01-18 03:43:59 +01:00
Marco Hinz
6c2b6c4f08
Refactoring 2017-01-18 02:42:00 +01:00
Marco Hinz
fcecc3c868
Remove rather useless :SignifyDebugDiff 2017-01-18 00:14:36 +01:00
Marco Hinz
31d4c55187
Make sy#verbose() slightly more useful 2017-01-17 23:57:29 +01:00
Marco Hinz
0e609fdf1d
Make Vim and job_start() work 2017-01-17 23:12:00 +01:00
Marco Hinz
72c7ba9e2b
Make all supported VCS work 2017-01-17 20:37:58 +01:00
Marco Hinz
d2fda2847f
Propagate the correct VCS 2017-01-17 19:45:03 +01:00
Marco Hinz
0df130ac6e
Make Vim + system() work 2017-01-17 19:41:55 +01:00
Marco Hinz
a67b613acf
Add more calls to sy#verbose() 2017-01-17 17:04:19 +01:00
Marco Hinz
e72ccb952d
PoC: make async work with git and Neovim 2017-01-17 16:17:16 +01:00
Marco Hinz
3ad10c65b5
First changes 2017-01-17 14:22:19 +01:00
Marco Hinz
79d867a7a6
Remove unused argument
Temporarily changing directories is cheap.
2016-12-30 14:27:12 +01:00
Marco Hinz
4aca2ee9c5 Don't rely on :language
Fixes #187.
2016-12-15 14:56:20 +01:00
Marco Hinz
fab2a9d878 SignifyRefresh: use window ID instead of number
`win_getid()` and `win_gotoid()` were introduced in 7.4.1557.

Older versions will continue using the less accurate window number instead.
2016-12-11 01:02:35 +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
9c0e901579 TFS: support incomplete lines
Add support for incomplete lines according to:

    http://www.gnu.org/software/diffutils/manual/diffutils.html#Incomplete-Lines

Closes #183.
2016-06-01 18:12:29 +02:00
James McCoy
37376d9970 Treat v:shell_error >= 2 as "not version controlled" for AccuRev
When a user isn't logged in, "accurev diff" will return an exit code of
52.  Since the only well defined values are 0 or 1, treat anything else
as unversioned.
2016-04-08 11:16:14 -04:00
James McCoy
6b4abcd754 Detect AccuRev controlled, but unmodified, files properly
"accurev diff" returns 0 for no diff, 1 for differences, and 2 for error
(like not being run from a workspace).  Use 2 to indicate the file isn't
being versioned by AccuRev so Sy properly sets the vcs type to AccuRev
for unmodified files.
2016-03-31 10:16:54 -04:00
James McCoy
ca302f7233 Replace all modifiers in a vcs_cmd string, not just the first.
Closes #176

Signed-off-by: James McCoy <jamessan@jamessan.com>
2016-03-02 13:03:38 -05:00
Marco Hinz
051dc1a853 Add support for Team Foundation Server
The actual patch is courtesy of @Grueslayer. Thanks!

Closes #177.
2016-02-25 01:21:12 +01:00
Marco Hinz
2dc2526426 SignifyToggleFold -> SignifyFold! 2015-12-09 00:31:59 +01:00
Marco Hinz
75cdb17d99 Use :mkview for restoring manual folds 2015-12-08 23:47:15 +01:00
Marco Hinz
a0e061a5cf Refactoring 2015-12-08 22:19:46 +01:00
albfan
64a6dbd5d8 Add bang option to SignifyToggleFold
Without bang open folds on a new tab, with it on current buffer
2015-12-08 13:48:07 +01:00
albfan
2033f3ce4e Restore previous foldmethod 2015-12-08 12:26:10 +01:00
albfan
d5e72e0ae7 Toggle folding on same buffer
resolves #169
2015-12-08 11:22:25 +01:00
Marco Hinz
3ea223ac76 Redraw screen on :SignifyToggleHighlight 2015-12-06 14:00:35 +01:00
Marco Hinz
6333c7f140 Do not cache g:signify_vcs_cmds
Now you can change this option on the fly.

Closes #168.
2015-11-04 15:12:08 +01:00
Ben Jackon
10ec6c1a40 Fix shell redirection when detecting perforce
Previously, when using *nix csh-like (or probably ksh-like) shells, perforce
detection would fail with E484. This was due to hard-coded bash-like
redirection.

This change obeys the vim `shellredir` option when detecting perforce.
2015-07-29 01:38:38 +02:00
Marco Hinz
dc09aa72ad Handle errors more gracefully
References #164.
2015-07-06 22:36:43 +02:00
Marco Hinz
021b801eb4 Work around separator issues
Use split() instead of substitute(), since the latter simply parses strings
and doesn't understand the notion of path separators. Backslashes would be
interpreted as beginning escape sequences.

Using split() works around this problem.

Closes #163.
2015-06-04 09:51:48 +02:00
Marco Hinz
8c5ad74a7b Add :SignifyFold
References #118.
2015-06-02 15:12:57 +02:00
Marco Hinz
50a3161bd5 Update b:sy_info more often
This avoids outdated cache entries if paths changed between calls to Sy.

References #162.
2015-06-01 11:13:28 +02:00
Marco Hinz
0867de3ac3 Escape cwd 2015-05-28 19:24:40 +02:00
Marco Hinz
c0da740d7e Don't cache cwd 2015-05-28 18:40:30 +02:00
Marco Hinz
a05b780c33 Add :SignifyDebugUnknown 2015-05-26 10:59:29 +02:00
Marco Hinz
a58fbe93df Useless use of :execute 2015-05-25 16:37:37 +02:00
Marco Hinz
a1cfbc8b70 Perforce: use difftool modifier 2015-05-25 09:25:23 +02:00
Marco Hinz
2e1fd54601 Make :SignifyDebugDiff more robust and add it to help 2015-05-24 10:52:28 +02:00
Marco Hinz
3f1f9c17fd Add :SignifyDebugDiff
References #161
2015-05-24 10:40:18 +02:00
Marco Hinz
4ed7b37205 Merge branch 'cmd-options'
This merge removes g:signify_diffoptions and replaces it by the much more
general g:signify_vcs_commands. Users can customize the entire command to be
run now.
2015-05-24 09:42:03 +02:00
James McCoy
0001094dea Copy stdout fd to stderr only after stdout is redirected
Signed-off-by: James McCoy <vega.james@gmail.com>
2015-05-24 00:56:44 -04:00
James McCoy
c2fc1dc78a Revert "Escape 2>&1 in the p4 detection"
This reverts commit 5cdf72acd1.

`shellescape()`, which is what `sy#util#escape()` is a front-end to, is
only supposed to escape a single element of an argv list. In this case,
it's being used to escape multiple -- `p4 info 2>&1 >`. None of that
should be escaped anyway, because they need to be interpreted by the
shell.
2015-05-24 00:41:21 -04:00
Marco Hinz
8955952295 /dev/null -> %n 2015-05-20 14:22:52 +02:00
Marco Hinz
23ddfa87a0 Use b:sy_info 2015-05-20 14:00:39 +02:00
Marco Hinz
ae38ddc7f6 Move variables to the bottom 2015-05-20 13:11:26 +02:00
Marco Hinz
1469ecb05f g:signify_diffcmds -> g:signify_vcs_cmds 2015-05-19 15:39:04 +02:00
Marco Hinz
7d022eb5fd Introduce g:signify_diffcmds 2015-05-19 15:26:22 +02:00
Marco Hinz
57f51d197d Remove useless fnamemodify() 2015-05-19 15:07:25 +02:00
Marco Hinz
74068229f0 Cleanup 2015-05-19 14:57:40 +02:00
Marco Hinz
e32f685640 Cache difftool and devnull 2015-05-19 14:48:33 +02:00
Marco Hinz
bed28c1db5 Add %n modifier 2015-05-19 14:09:48 +02:00
Marco Hinz
883f3a1cd3 system() -> s:run() 2015-05-19 14:06:52 +02:00
Marco Hinz
330dffd2dd Refactoring + %d and %f modifiers for commands
%d gets replaced by the difftool
%f gets replaced by the actual file
2015-05-19 14:01:29 +02:00
Stephan Steinbach
5cdf72acd1 Escape 2>&1 in the p4 detection
References #157.
2015-04-16 00:44:48 +02:00
James McCoy
06c51319c0 Detect valid Perforce configurations with “p4 info”
“p4 monitor info” isn't always available and can impose a heavy runtime
cost when it is if the server isn't responsive.

Closes mhinz/vim-signify#153

Signed-off-by: James McCoy <vega.james@gmail.com>
2015-02-23 22:26:39 -05:00
Ed Page
9c94652917 Making the cross-platform /dev/null reusable 2014-12-30 15:10:43 -06:00
Ed Page
3cade031b6 Fix Perforce support on Windows 2014-12-30 14:45:15 -06: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
52cb36801d get_diff_hg: Disable color extension
This handles the case where a user forces colors from the color extension via
hgrc:

    [extensions]
    color =

    [defaults]
    diff = --colors=always

Sy disables these for its 'hg diff' call, otherwise the output would be
riddled with color escape sequences and couldn't be parsed properly which
would result in no signs shown.

References #146.
2014-11-23 07:34:20 +01:00
James McCoy
6d45797393 get_diff_hg: Run diff from the file's parent directory
Mercurial's detection for where a file's containing repo is doesn't work
well when the working directory is a different Mercurial repo (c.f.,
mhinz/vim-signify#146).  Run "hg diff" from the target file's parent
directory to work around this.

Signed-off-by: James McCoy <vega.james@gmail.com>
2014-11-23 00:03:26 -05:00
Marco Hinz
bd0956eee6 Remove all default mappings except for ]c / [c
References #142.
2014-11-05 14:16:44 +01:00
Alex Rodionov
de297820bc Expose sy#util#refresh_windows()
References #141.
2014-11-05 13:07:59 +01:00
Marco Hinz
a03bee658f Add support for lazy loading 2014-11-02 09:28:54 +01:00
James McCoy
75c8b4d54a Preserve user's order in vcs_list
Signed-off-by: James McCoy <vega.james@gmail.com>
2014-10-23 17:44:32 -04:00
Marco Hinz
64c3b60a98 Revert "Use 'git -C'"
This reverts commit 8fa7aea4b3.

Although -C was introduced in git 1.8.5, over a year ago, it still might be
too new for some of us.
2014-10-09 22:35:17 +02:00
Marco Hinz
8fa7aea4b3 Use 'git -C' 2014-10-09 18:58:23 +02:00
Benjamin Thomas
8128ea2c9c Make use of SignifySignDeleteFirstLine
Closes #137.
2014-10-08 08:47:01 +02: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
8cef26186e Make sure b:sy_path is always set
References #136.
2014-10-04 19:48:10 +02:00
Marco Hinz
fe3bafce11 Introduce smarter sign management 2014-10-04 15:56:10 +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
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
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