Public Access
diff support in treesitter/fold
This commit is contained in:
@@ -24,6 +24,18 @@ vim.api.nvim_create_autocmd({ "FocusGained", "BufEnter", "CursorHold", "CursorHo
|
|||||||
command = "if mode() != 'c' | checktime | endif",
|
command = "if mode() != 'c' | checktime | endif",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- `git show`/`git diff`/`git log -p` piped into nvim (e.g. `git show <hash> | nvim -`)
|
||||||
|
-- arrive as stdin with no filename, so normal filetype detection never fires
|
||||||
|
-- and folding/highlighting silently stay off. Sniff the content instead.
|
||||||
|
vim.api.nvim_create_autocmd("StdinReadPost", {
|
||||||
|
callback = function()
|
||||||
|
local first = vim.fn.getline(1)
|
||||||
|
if first:match("^commit %x+") or first:match("^diff %-%-git ") or first:match("^From %x+") then
|
||||||
|
vim.bo.filetype = "diff"
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
vim.filetype.add({ extension = { asm = "asm", s = "asm", S = "asm" } })
|
vim.filetype.add({ extension = { asm = "asm", s = "asm", S = "asm" } })
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
pattern = "asm",
|
pattern = "asm",
|
||||||
|
|||||||
+1
-1
@@ -275,7 +275,7 @@ require("nvim-treesitter").install({
|
|||||||
"lua", "vim", "vimdoc", "bash", "c", "cpp", "rust", "python",
|
"lua", "vim", "vimdoc", "bash", "c", "cpp", "rust", "python",
|
||||||
"javascript", "typescript", "tsx", "svelte", "css", "html",
|
"javascript", "typescript", "tsx", "svelte", "css", "html",
|
||||||
"json", "toml", "yaml", "markdown", "markdown_inline",
|
"json", "toml", "yaml", "markdown", "markdown_inline",
|
||||||
"java", "typst", "vala",
|
"java", "typst", "vala", "diff",
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
|||||||
Reference in New Issue
Block a user