Enable antlr4 syntax for vim

Signed-off-by: Tiago Garcia <tiago.rgarcia@ua.pt>
This commit is contained in:
Tiago Garcia 2025-02-25 16:41:22 +00:00
parent 1e345277ce
commit 8043b50da6
Signed by: TiagoRG
GPG Key ID: DFCD48E3F420DB42
7 changed files with 22 additions and 5 deletions

View File

@ -9,9 +9,9 @@ require("autoclose").setup({
["]"] = { escape = true, close = false, pair = "[]", disabled_filetypes = {} },
["}"] = { escape = true, close = false, pair = "{}", disabled_filetypes = {} },
['"'] = { escape = true, close = true, pair = '""', disabled_filetypes = {"gitcommit", "tex", "asciidoc"} },
["'"] = { escape = true, close = true, pair = "''", disabled_filetypes = {"gitcommit", "tex", "asciidoc"} },
["`"] = { escape = true, close = true, pair = "``", disabled_filetypes = {"gitcommit", "tex", "asciidoc"} },
['"'] = { escape = true, close = true, pair = '""', disabled_filetypes = {"markdown", "gitcommit", "tex", "asciidoc"} },
["'"] = { escape = true, close = true, pair = "''", disabled_filetypes = {"markdown", "gitcommit", "tex", "asciidoc"} },
["`"] = { escape = true, close = true, pair = "``", disabled_filetypes = {"markdown", "gitcommit", "tex", "asciidoc"} },
["$"] = { escape = true, close = true, pair = "$$", enabled_filetypes = {"tex"} },
},

View File

@ -5,7 +5,7 @@ require("tabset").setup({
},
languages = {
{
filetypes = { "html", "json", "yaml", "xml", "markdown", "bash", "sh", "zsh" },
filetypes = { "cmake", "html", "json", "yaml", "xml", "markdown", "bash", "sh", "zsh" },
config = {
tabwidth = 2
}

View File

@ -1,4 +1,5 @@
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
-- Trim trailing whitespace on save
vim.api.nvim_create_autocmd("BufWritePre", {
pattern = {"*"},
callback = function()
local save_cursor = vim.fn.getpos(".")
@ -7,6 +8,7 @@ vim.api.nvim_create_autocmd({ "BufWritePre" }, {
end,
})
-- Highlight search results
vim.api.nvim_create_autocmd({"CmdlineLeave", "CmdlineChanged"}, {
group = vim.api.nvim_create_augroup("SearchHighlight", { clear = true }),
pattern = { "/", "\\?" },
@ -15,6 +17,7 @@ vim.api.nvim_create_autocmd({"CmdlineLeave", "CmdlineChanged"}, {
end
})
-- Highlight yanked text
vim.api.nvim_create_autocmd("TextYankPost", {
desc = "Highlight yanked text",
group = vim.api.nvim_create_augroup("HighlightYank", { clear = true}),
@ -22,3 +25,9 @@ vim.api.nvim_create_autocmd("TextYankPost", {
vim.highlight.on_yank()
end
})
-- Set filetype for antlr4 files
vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, {
pattern = {"*.g4"},
command = "set filetype=antlr4"
})

View File

@ -86,4 +86,7 @@ return require('packer').startup(function(use)
-- Little friend
use("github/copilot.vim")
-- Temp
use("dylon/vim-antlr")
end)

1
.gitignore vendored
View File

@ -1,6 +1,7 @@
# Vim stuff
.vim/.netrwhist
.vim/undodir/
.vim/syntax/
.vim/pack/
.vim/plugged/
.vim/autoload/plug.vim

1
.vimrc
View File

@ -90,3 +90,4 @@ call plug#end()
syntax on
colorscheme rosepine
au BufRead,BufNewFile *.g4 set filetype=antlr4

View File

@ -339,3 +339,6 @@ export LD_LIBRARY_PATH=/home/tiagorg/.dotfiles/.local/lib:$LD_LIBRARY_PATH
export SSH_AUTH_SOCK=$XDG_RUNTIME_DIR/gcr/ssh
eval "$(fzf --zsh)"
export CLASSPATH=".:/usr/local/lib/antlr-4.13.2-complete.jar:/usr/local/lib/ST-4.3.4.jar"
export ANTLR4_PATH="/usr/local/lib"