-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c621758
commit 14bbad6
Showing
3 changed files
with
31 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
local config = { | ||
colors = { | ||
diff = "#555522", | ||
origin = "#225555", | ||
}, | ||
} | ||
|
||
function config.update(user_config) | ||
config.colors = vim.tbl_deep_extend("force", config.colors, user_config.colors or {}) | ||
end | ||
|
||
return config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,21 @@ | ||
local myTint = require("colorful_diff.tint") | ||
myTint.InitHighlightGroup("#444422", "#224444") | ||
local config = require("colorful_diff.config") | ||
local buffer_change = require("colorful_diff.buffer_change") | ||
|
||
-- Set up autocmd to call our function on buffer change and when a file is opened | ||
vim.api.nvim_create_autocmd({ "TextChanged", "TextChangedI", "BufRead" }, { | ||
pattern = "*", | ||
callback = buffer_change.on_buffer_change, | ||
}) | ||
local M = {} | ||
|
||
function M.setup(user_config) | ||
-- Merge user config with default config | ||
config.update(user_config or {}) | ||
|
||
-- Initialize highlight groups | ||
myTint.InitHighlightGroup(config.colors.diff, config.colors.origin) | ||
|
||
-- Set up autocmd to call our function on buffer change and when a file is opened | ||
vim.api.nvim_create_autocmd({ "TextChanged", "TextChangedI", "BufRead" }, { | ||
pattern = "*", | ||
callback = buffer_change.on_buffer_change, | ||
}) | ||
end | ||
|
||
return M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
require("colorful_diff") | ||
print("Hello, this is ColorfulDiff.nvim") | ||
-- put any code you want to execute onstart here |