Commit Graph

123 Commits

Author SHA1 Message Date
Lewis Russell 4d63d996b0 refactor: remove teal 2023-06-13 15:32:14 +01:00
Lewis Russell 319a248e4c feat(preview): improved version of preview_hunk_inline()
(experimental)

Uses a second buffer and a floating window in order to display syntax
highlighting in the deleted lines.

Need to set `_inline2 = true` in `setup()` to enable.
2023-04-28 11:38:38 +01:00
Lewis Russell 8ad98db42a feat: add comments to generated lua files 2023-02-16 11:09:17 +00:00
Hugo Osvaldo Barrera f5d7b441fc fix: add space at the end of blame virtual text
When using `current_line_blame = true` with a highlight that defines a
`bg`, the virtual text has a space at the beginning but not at the end.
This looks a bit off (e.g.: the virtual text looks like a small label
with the text not properly aligned).

This is invisible when using a highlight without `bg`.

This small changes adds a space at the end so that virtual text in such
situations makes better sense visually.

Fixes: https://github.com/lewis6991/gitsigns.nvim/issues/745
2023-02-15 11:31:33 +00:00
Sindre T. Strøm ec4742a7ee
feat: Enable `attach()` to work with any buffer when given context data
* feat: Enable `attach()` to work with any buffer when given context data.

* fix(test): Pattern escape file names when matching debug messages.
2023-02-03 09:25:22 +00:00
Lewis Russell 414aa7bc08 fix(highlight): several fixes from last PR 2023-01-11 10:21:45 +00:00
Lewis Russell e272fcfc99 feat!: rework highlights and document them
- Deprecated config.signs.*.[hl,numhl,linehl].

  In the future the highlight groups will be hard defined and should be
  configured directly by the user using `nvim_set_hl` or `:highlight`.

- Added documentation for all used highlights.

- Added specific highlights for 'topdelete', 'changedelete', and 'untracked'
  signs.
2023-01-10 15:07:59 +00:00
Lewis Russell 8164179143 feat: remove FFI diff implementation 2023-01-03 15:27:43 +00:00
Lewis Russell 0ca581e4f0 doc: ts syntax highlighting 2022-12-15 13:15:45 +00:00
Lewis Russell a4e2275532 feat: add greedy option to actions 2022-11-07 13:00:46 +00:00
Lewis Russell 4313a1f9c2 feat: add b:gitsigns_line_blame
Resolves #573
2022-11-07 11:59:55 +00:00
Lewis Russell fa1e8c589a feat(signs): different add signs for untracked files
Resolves #569
2022-11-07 10:40:47 +00:00
Lewis Russell 2b4fc5e2ae docs: update README.md 2022-11-04 10:13:48 +00:00
Lewis Russell 88d7aae293 feat(diff): support for linematch
Requires https://github.com/neovim/neovim/pull/14537
2022-11-04 10:05:20 +00:00
Lewis Russell d3a8ba0b0d chore: update version in help 2022-10-31 16:22:11 +00:00
Lewis Russell fe6b09be22 feat(nav): support preview_inline 2022-10-31 16:10:36 +00:00
Lewis Russell 9110ea15a1 feat(preview): add preview_hunk_inline() 2022-10-29 11:56:14 +01:00
Evgeni Chasnovski 467073b412
feat: issue GitsignsUpdate event when appropriate (#641)
Co-authored-by: Lewis Russell <me@lewisr.dev>
2022-10-07 11:43:00 +01:00
Sebastian Lyng Johansen 2300e4eadb
feat(preview): attach to popup if already open (#622)
Co-authored-by: Lewis Russell <lewis6991@gmail.com>
2022-09-14 11:16:08 +01:00
Lewis Russell a0cd6ccd73 chore!: remove deprecated fields 2022-09-13 09:28:42 +01:00
Lewis Russell ef8a79b2cb fix(watch): deep extend config table 2022-08-10 12:33:36 +01:00
Lewis Russell ca6b3220b3 feat(watcher): re-add watch_gitdir.enable 2022-08-10 12:06:52 +01:00
Lewis Russell 50e32c6309 feat: support for detached working trees
Added config.worktrees.

Array of tables with the keys 'gitdir' and 'toplevel'.

If attaching normally fails, then each entry in the table is attempted.

Example:

  worktrees = {
    {
      toplevel = vim.env.HOME,
      gitdir = vim.env.HOME .. '/projects/dotfiles/.git'
    }
  }

Resolves #397
2022-08-10 11:15:42 +01:00
Andrew Ferrier 8b817e76b6
doc: document max_file_length fully (#597)
Co-authored-by: Lewis Russell <me@lewisr.dev>
2022-07-25 10:10:07 +01:00
Lewis Russell fb99e93ce4 feat(command): better processing of command args
When running an action via the :Gitsigns command, the internal plumbing
can now pass the entire command context/options directly to a
specialised action command (per action) that knows how to translate
command parameters to the specific action parameters.

Example #1: `:belowright Gitsigns diffthis` now translates to
`diffthis(nil, {split='belowright'}`.

Example #2: `:6,10Gitsigns stage_hunk` now translates to
`stage_hunk({6,10})`.

Note this change reverts the behaviour of the previous commit that
respects 'splitright'

Fixes #585
2022-06-20 14:11:48 +01:00
Lewis Russell 3b2e7b668c feat: add `show` action
Similar to diffthis, except diff mode is not enabled.
2022-05-26 11:44:35 +01:00
Lewis Russell 13f811e8eb fix: don't set default for GitSignsDeleteLn
Setting GitSignsDeleteLn to anything by default doesn't make much sense
since it ends up highlighting lines not related to the hunk. This is
especially confusing when show_deleted is enabled.

+ Fix incorrect docs.

Fixes #565
2022-05-22 10:15:25 +01:00
Lewis Russell ef153188e8 doc: fix indent_heuristic type
Closes: #509
2022-05-02 14:56:01 +01:00
Lewis Russell 0c7da98aab refactor(preview): use format string for windows 2022-04-17 12:59:58 +01:00
Lewis Russell 318a93bc92 doc: update 2022-04-15 17:03:36 +01:00
Lewis Russell dd60a8845d feat(blame): added config.current_line_blame_formatter_nc
Used to format uncommitted lines.

Resolves: #476
2022-04-14 16:14:09 +01:00
Lewis Russell d2e531bb3f feat(blame): control priority of blame
Added config.current_line_blame_opts.virt_text_priority

Resolves #513
2022-04-13 10:15:22 +01:00
Lewis Russell 4a68d2a373 feat(toggle): return current value
Fixes #506
2022-04-10 10:52:03 +01:00
Lewis Russell acdd74bc6c feat(diffthis): various improvements
- When running diffthis (or vim-fugitive's Gdiffsplit), hunk operations
  to the index will now update the diff buffer.

- Similar to vim-fugitive's Gdiffsplit, buffers of a file in the git
  index can now be edited. When the buffer is written, it updates the
  git index accordingly. Likewise the index buffer can also be reloaded
  (via 'edit').

- Moved all diffthis code to a separate module.

Fixes #501
2022-04-09 08:23:31 +01:00
Lewis Russell 8fce869b67 doc(mappings): update 2022-03-28 14:58:32 +01:00
Lewis Russell 7ff03e1eba feat(nav): add option to auto preview
Resolves #494
2022-03-25 17:03:52 +00:00
Lewis Russell 420db8ddb9 feat(blame): support format strings
- config.current_line_blame_formatter can now be specified as a format
string.

- changed default of `config.current_line_blame_formatter` to
  '<author>, <author_time:%R> - <summary>' which is equivalent to the
  previous function default.

- deprecated config.current_line_blame_formatter_opts

Resolves #291
2022-02-13 15:23:41 +00:00
Lewis Russell 4a2d30f5fb fix(actions): diffthis fixes
- Added config.diff_opt.vertical
- When running diffthis, only enable diffmode on the correct windows.

Fixes: #456, #455
2022-01-26 18:02:18 +00:00
Lewis Russell 79fd1ec426 chore(config)!: hard deprecate fields
Any fields that were deprecated during v0.4 cycle are now
hard-deprecated. They can still be used, but now a warning will appear
on startup.
2022-01-26 17:41:19 +00:00
Lewis Russell b4548e4c60 refactor(highlights)!: rework highlights
- Added GitSigns*Inline and GitSigns*LnInline to be used with word diff
    - GitSigns*LnInline is used for word diff with config.word_diff
    - GitSigns*Inline is used for word diff in hunk previews

- Added GitSigns*VirtLn and GitSigns*VirtLnInline to be used with
  `config.show_deleted`.

- Define GitSigns highlights conditionally as opposed to only defining
  them if certain features are enabled.
2022-01-26 17:33:24 +00:00
Lewis Russell 58e5d6d85e refactor!: deprecate config.keymaps
BREAKING CHANGE: Removed default keymaps. Instead on_attach should be
used. See README.md.
2022-01-22 09:26:27 +00:00
Lewis Russell 584e1abfb9 feat(): show old version of hunks via virtual lines
Use virtual lines to show the old version of hunks inline in the buffer.

- Added config.show_deleted
- Added toggle_deleted()
2022-01-14 17:05:25 +00:00
Lewis Russell 5eb87a0b05 Automate docs more
- Move function docs to comments in actions.tl
- Rewrite gen_help.lua to use a template
- Keep README and help full setup example in sync
2021-12-06 18:02:22 +00:00
Lewis Russell edbc935f50 feat(setqflist): Add 'open' option
If true, open the qf/loc list viewer. Defaults to true.

Resolves #415
2021-12-04 18:48:47 +00:00
Lewis Russell f362e54e11 feat(actions): true partial hunk staging
Resolves #338
2021-12-04 18:38:52 +00:00
Lewis Russell 0ffa5a082e Change mappings to use Gitsigns command 2021-12-04 18:38:52 +00:00
Andreas Schneider 1805679095 fix(blame): Adapt default config to latest blame changes 2021-11-18 15:30:14 +00:00
Lewis Russell ba1932ab3e feat(blame): Allow to ignore whitespace
- blame_line() now takes a table as it's first argument (instead of a
boolean) with the fields "full" and "ignore_whitespace"

- Added config.current_line_blame_opts.ignore_whitespace

Resolves #400
2021-11-16 19:21:23 +00:00
Lewis Russell d12442a924 fix(doc): remove <buffer> as a map argument 2021-10-22 15:52:35 +01:00
Lewis Russell fc81385888 feat(integration): Use trouble.nvim
If installed and enabled (via `config.trouble`; defaults to true if
installed), `:Gitsigns setqflist` and `:Gitsigns seqloclist` will
open Trouble instead of Neovim's built-in quickfix or location list
windows.
2021-10-15 13:18:30 +01:00