Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax highlighting needs to be turned on manually for certain languages #28793

Open
vmchale opened this issue May 16, 2024 · 5 comments
Open
Labels
bug issues reporting wrong behavior highlight needs:repro We need minimal steps to reproduce the issue needs:response waiting for reply from the author syntax regex syntax or non-regex parsing, lpeg, grammars

Comments

@vmchale
Copy link

vmchale commented May 16, 2024

Problem

Syntax highlighting isn't there when I open a file on the command-line. I have to pull it up by :syntax enable; after that it works.

Steps to reproduce

The syntax highlighting plugin in question is here: https://github.com/vmchale/jacinda-vim

As an example, open a *.jac file, e.g.: https://github.com/vmchale/jacinda/blob/main/examples/nmCtx.jac

Running nvim nmCtx.jac opens the file but with no syntax highlighting until :syntax enable. Curiously, running nvim following by :edit nmCtx.jac works.

Many other languages do work, e.g. Haskell syntax highlighting, Rust syntax highlighting, but occasionally others fail.

Expected behavior

I would expect syntax highlighting to be on when opening a file from the command-line.

Neovim version (nvim -v)

0.10.0

Vim (not Nvim) behaves the same?

Vim 9.0.639 works correctly, syntax is turned on in my .vimrc

Operating system/version

MacOS 14.5

Terminal name/version

Iterm2

$TERM environment variable

xterm-256color

Installation

Github tarball

@vmchale vmchale added the bug issues reporting wrong behavior label May 16, 2024
@clason
Copy link
Member

clason commented May 16, 2024

You need to provide a reproducible config with nvim --clean -u test.lua. (And just to save some time, you cannot lazy-load filetype plugins.)

@clason clason added needs:response waiting for reply from the author needs:repro We need minimal steps to reproduce the issue labels May 16, 2024
@vmchale
Copy link
Author

vmchale commented May 16, 2024

The problem happens even with vim-plug

Seems to have been around at least a year: https://www.reddit.com/r/neovim/comments/11banfa/cant_get_syntax_highlighting_to_work_correctly/ja0ptzq/

@github-actions github-actions bot removed the needs:response waiting for reply from the author label May 16, 2024
@clason
Copy link
Member

clason commented May 17, 2024

That doesn't absolve you from the need to provide a minimal reproducible config here. Reddit posts are virtually useless as actionable bug reports.

@clason clason added needs:response waiting for reply from the author syntax regex syntax or non-regex parsing, lpeg, grammars highlight labels May 17, 2024
@justinmk
Copy link
Member

Vim 9.0.639 works correctly, syntax is turned on in my .vimrc

Depends on when your config calls :syntax enable.

A workaround might be to put your syntax file in after/syntax/ instead of syntax/. Example: https://github.com/justinmk/vim-syntax-extra/tree/master/after/syntax

@icholy
Copy link
Contributor

icholy commented May 29, 2024

@vmchale I cannot reproduce issue on 0.10.0 or master. https://github.com/icholy/nvim-bug-28793

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug issues reporting wrong behavior highlight needs:repro We need minimal steps to reproduce the issue needs:response waiting for reply from the author syntax regex syntax or non-regex parsing, lpeg, grammars
Projects
None yet
Development

No branches or pull requests

4 participants