[vim/vim] Improve `Fortran` syntax (Discussion #13515)

38 views
Skip to first unread message

mEm

unread,
Nov 10, 2023, 8:57:48 AM11/10/23
to vim/vim, Subscribed

Hi all,

I would like to ask for some good resources from where to learn syntax for vim's syntax files.
I started editing fortran.vim, because I guess it lacks some consistency.
Got to a decent stage, but I am missing some advanced capabilities in order to make some other things to work.

Any suggestion is more than welcome.
Inded, after I can certainly open a PR if this solution might improve built-in Fortran syntax highlighting.

Thanks

PS. This also comes because I am actually using Neovim (please, don't blame me), but the syntax that comes with Fortran treesitter is even worse than the built-in one (IMO). So, I thought that providing an excellent built-in syntax highlighting in Vim would be the best option.


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/repo-discussions/13515@github.com>

Christian Brabandt

unread,
Nov 10, 2023, 9:02:21 AM11/10/23
to vim/vim, Subscribed

please check the included documentation. In particular you might be interested in :h pattern.txt and :h usr_44.txt and :h syntax.txt


Reply to this email directly, view it on GitHub,.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/repo-discussions/13515/comments/7534050@github.com>

dkearns

unread,
Nov 10, 2023, 10:53:04 AM11/10/23
to vim/vim, Subscribed

Have you reached out to the maintainer? Ajit has been maintaining the Fortran runtime files for many years, decades at this point, and some of what you're hoping to fix may not be achievable.

You can learn quite a lot from reviewing other syntax files[1] to see how they approach similar problems in other languages. There's some significant holes in the current capabilities and some de facto kludges to work around them. Feel free to just ask specific questions.


Reply to this email directly, view it on GitHub,.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/repo-discussions/13515/comments/7535074@github.com>

mEm

unread,
Nov 15, 2023, 5:03:43 AM11/15/23
to vim/vim, Subscribed

@chrisbra thanks for the suggestions. They halped a lot.
@dkearns thanks. Yes, I have sent him an email, to which he responded quickly. I then replied showing the proposed changes, but still didn't have answer to that.

To be clear, my version is highly influenced by his original (I even had an older version, coming from the Neovim installation. He kindly provided me the latest from this repo).
I just fixed some spots here and there, and grouped by main constructs.

I'll attach screenshots comparing the current vs. proposed solution, and everyone can express his opinion.
If it suits the majority, as said, I can make a simple PR.

Current syntax highlighting

immagine
immagine

Proposed

immagine
immagine

Majour changes

  1. Some language keywords are not highlighted if not in the right sematical place (see data in MODULE data)
  2. Highlight procedure names (as intrinsic ones) (in all places, at their definition or within an interface block)
  3. Highlight type parameters (as constant) in variable type declaration, keeping valid built-in language constructs (numbers, LK parameters, and old fashion declarations)
  4. Type access modifiers, parameters, and attributes highlighted as StorageClass modifiers, not as type themselves.
  5. Highlight Constant variables (which are supposed to be __ALL_UPPERCASE_LETTERS)
  6. Add highlight for derived type access operator %
  7. Fix missing keyword highlights
  8. Other small fixes

Open to discussion/criticism.

Regards


Reply to this email directly, view it on GitHub,.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/repo-discussions/13515/comments/7575214@github.com>

dkearns

unread,
Nov 23, 2023, 11:34:42 AM11/23/23
to vim/vim, Subscribed

It seems like an improvement, thanks. Can you please submit a PR if it's ready? It's easier to review the changes with access to the actual syntax file. Can you also include a plain text sample of the example source code?

It's Ajit's call to make and things can move a little slowly at times when it comes to runtime file maintenance but, irrespective, it's better to have it queued.


Reply to this email directly, view it on GitHub,.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/repo-discussions/13515/comments/7653662@github.com>

Ajit Thakkar

unread,
Dec 2, 2023, 1:01:12 PM12/2/23
to vim_dev
Michele sent me his changes.  I folded modified versions of some of his suggestions into my latest update PR#13607

Ajit

Reply all
Reply to author
Forward
0 new messages