Commit Graph

133 Commits

Author SHA1 Message Date
rafascar af0f583cd3 fix(README): add default config.current_line_blame_opts.virt_text_priority 2023-10-26 12:06:58 +01:00
Lewis Russell d05a21795c chore: tidying 2023-10-05 14:14:33 +01:00
Lewis Russell 317c98d64c feat(diff): allow to diff against the working version
The `base` can now be set to `FILE` to diff against the working version.

Resolves #164
2023-10-02 12:14:20 +01:00
Lewis Russell 8aedc8b15a feat(diffopt): add support for whitespace flags in diffopt
Resolves #696
2023-10-02 11:22:42 +01:00
Lewis Russell e308a4f5dd build: add doc and lint check 2023-09-23 11:13:14 +01:00
Lewis Russell b018a2b139 perf(blame): run blame for entire file instead of per line
Previously current_line_blame would run a git-blame process per line
(via the `-L` flag) in an attempt to be more efficient. However after
some investigation it seems that running git-blame for the entire file
rarely exceeds 2x the time it takes to run for a single line, even for
large files.

This change alters current_line_blame to run git-blame for the entire
file after each buffer edit and caches that in memory. This makes the
first git-blame after an edit ~2x slower, but makes any cursor movements
after that instant.

A follow-up to this would be for current_line_blame to track buffer
updates to avoid the cache needing to be invalidated on every edit.
2023-09-22 12:24:42 +01:00
Lewis Russell c7d963b257 docs: annotate codeblocks with lang 2023-09-22 12:24:42 +01:00
Lewis Russell fd4d953614 docs: make gen_help.lua emmy aware 2023-07-10 13:52:01 +01:00
Lewis Russell 3a6f1e296d docs: update 2023-06-19 13:22:31 +01:00
Lewis Russell 256569c2fe feat!: remove config.keymaps 2023-06-16 16:57:41 +01:00
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