mirror of
https://github.com/lewis6991/gitsigns.nvim
synced 2025-02-21 15:27:09 +00:00
feat(watcher): re-add watch_gitdir.enable
This commit is contained in:
parent
feff9d5618
commit
ca6b3220b3
@ -562,6 +562,7 @@ watch_gitdir *gitsigns-config-watch_gitdir*
|
||||
Type: `table`
|
||||
Default: >
|
||||
{
|
||||
enable = true,
|
||||
interval = 1000,
|
||||
follow_files = true
|
||||
}
|
||||
@ -571,6 +572,9 @@ watch_gitdir *gitsigns-config-watch_gitdir*
|
||||
update signs.
|
||||
|
||||
Fields: ~
|
||||
• `enable`:
|
||||
Whether the watcher is enabled.
|
||||
|
||||
• `interval`:
|
||||
Interval the watcher waits between polls of the gitdir in milliseconds.
|
||||
|
||||
|
5
lua/gitsigns/config.lua
generated
5
lua/gitsigns/config.lua
generated
@ -120,6 +120,7 @@ local M = {Config = {DiffOpts = {}, SignConfig = {}, watch_gitdir = {}, current_
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
M.config = {}
|
||||
@ -253,6 +254,7 @@ M.schema = {
|
||||
watch_gitdir = {
|
||||
type = 'table',
|
||||
default = {
|
||||
enable = true,
|
||||
interval = 1000,
|
||||
follow_files = true,
|
||||
},
|
||||
@ -262,6 +264,9 @@ M.schema = {
|
||||
update signs.
|
||||
|
||||
Fields: ~
|
||||
• `enable`:
|
||||
Whether the watcher is enabled.
|
||||
|
||||
• `interval`:
|
||||
Interval the watcher waits between polls of the gitdir in milliseconds.
|
||||
|
||||
|
4
lua/gitsigns/manager.lua
generated
4
lua/gitsigns/manager.lua
generated
@ -305,6 +305,10 @@ end
|
||||
|
||||
|
||||
M.watch_gitdir = function(bufnr, gitdir)
|
||||
if not config.watch_gitdir.enable then
|
||||
return
|
||||
end
|
||||
|
||||
dprintf('Watching git dir')
|
||||
local w = uv.new_fs_poll()
|
||||
w:start(gitdir, config.watch_gitdir.interval, void(function(err)
|
||||
|
@ -61,6 +61,7 @@ local record M
|
||||
_on_attach_pre: function(bufnr: integer, callback: function(table))
|
||||
on_attach: function(bufnr: integer)
|
||||
record watch_gitdir
|
||||
enable: boolean
|
||||
interval: integer
|
||||
follow_files: boolean
|
||||
end
|
||||
@ -253,6 +254,7 @@ M.schema = {
|
||||
watch_gitdir = {
|
||||
type = 'table',
|
||||
default = {
|
||||
enable = true,
|
||||
interval = 1000,
|
||||
follow_files = true
|
||||
},
|
||||
@ -262,6 +264,9 @@ M.schema = {
|
||||
update signs.
|
||||
|
||||
Fields: ~
|
||||
• `enable`:
|
||||
Whether the watcher is enabled.
|
||||
|
||||
• `interval`:
|
||||
Interval the watcher waits between polls of the gitdir in milliseconds.
|
||||
|
||||
|
@ -305,6 +305,10 @@ end
|
||||
|
||||
|
||||
M.watch_gitdir = function(bufnr: integer, gitdir: string): uv.FSPollObj
|
||||
if not config.watch_gitdir.enable then
|
||||
return
|
||||
end
|
||||
|
||||
dprintf('Watching git dir')
|
||||
local w = uv.new_fs_poll()
|
||||
w:start(gitdir, config.watch_gitdir.interval, void(function(err: string)
|
||||
|
Loading…
Reference in New Issue
Block a user