signify cmds for git

This commit is contained in:
Christian Nieves
2025-03-14 13:45:12 +00:00
parent 4c5bd3505f
commit 758afadb6f
2 changed files with 63 additions and 52 deletions

View File

@ -2,15 +2,26 @@ return {
"LunarVim/bigfile.nvim", "LunarVim/bigfile.nvim",
opts = { opts = {
filesize = 2, -- size of the file in MiB, the plugin round file sizes to the closest MiB filesize = 2, -- size of the file in MiB, the plugin round file sizes to the closest MiB
pattern = { "*" }, -- autocmd pattern or function see <### Overriding the detection of big files> pattern = function(bufnr, filesize_mib)
vim.cmd(":NoAutoFormatBuffer")
vim.cmd(":FormatDisable")
-- you can't use `nvim_buf_line_count` because this runs on BufReadPre
local file_contents = vim.fn.readfile(vim.api.nvim_buf_get_name(bufnr))
local file_lines = #file_contents
local filetype = vim.filetype.match({ buf = bufnr })
if file_lines > 1000 and (filetype == "c" or filetype == "cpp") then
return true
end
return filesize_mib > 1
end,
features = { -- features to disable features = { -- features to disable
"indent_blankline", "indent_blankline",
"illuminate", -- "illuminate",
"lsp", "lsp",
"treesitter", "treesitter",
"syntax", -- "syntax",
"matchparen", -- "matchparen",
"vimopts", -- "vimopts",
"filetype", "filetype",
}, },
} }

View File

@ -1,7 +1,7 @@
local use_google = require("utils").use_google local use_google = require("utils").use_google
local function setup_mercurial(hg_revision) local function change_diffbase(hg_revision, git_revision)
local git_cmd = "git diff --no-color --no-ext-diff -U0 -- %f" local git_cmd = "git diff --no-color --no-ext-diff -U0" .. git_revision .. " -- %f"
local rcs_cmd = "rcsdiff -U0 %f 2>%n" local rcs_cmd = "rcsdiff -U0 %f 2>%n"
local svn_cmd = "svn diff --diff-cmd %d -x -U0 -- %f" local svn_cmd = "svn diff --diff-cmd %d -x -U0 -- %f"
local hg_diff = hg_revision .. " --color=never config aliases.diff= --nodates -U0 -- %f" local hg_diff = hg_revision .. " --color=never config aliases.diff= --nodates -U0 -- %f"
@ -28,25 +28,25 @@ let g:signify_vcs_cmds_diffmode = {
end end
_G.signify_dtup = function() _G.signify_dtup = function()
setup_mercurial('-r ".^"') change_diffbase('-r ".^"', 'HEAD^')
vim.cmd([[:SignifyEnable]]) vim.cmd([[:SignifyEnable]])
vim.cmd([[:SignifyRefresh]]) vim.cmd([[:SignifyRefresh]])
end end
_G.signify_normal = function() _G.signify_normal = function()
setup_mercurial("-r .") change_diffbase("-r .", "")
vim.cmd([[:SignifyEnable]]) vim.cmd([[:SignifyEnable]])
vim.cmd([[:SignifyRefresh]]) vim.cmd([[:SignifyRefresh]])
end end
_G.signify_dtp4 = function() _G.signify_dtp4 = function()
setup_mercurial("-r p4head") change_diffbase("-r p4head", "HEAD^")
vim.cmd([[:SignifyEnable]]) vim.cmd([[:SignifyEnable]])
vim.cmd([[:SignifyRefresh]]) vim.cmd([[:SignifyRefresh]])
end end
_G.signify_dtex = function() _G.signify_dtex = function()
setup_mercurial("-r exported(.)") change_diffbase("-r exported(.)", "origin/main")
vim.cmd([[:SignifyEnable]]) vim.cmd([[:SignifyEnable]])
vim.cmd([[:SignifyRefresh]]) vim.cmd([[:SignifyRefresh]])
end end