Is it dolphin or kate? --> Kate's syntax detection isn't working properly

Dolphin recognizes various files of different types:

.bashrc as “Plain text document”:

#
# ~/.bashrc
#

# If not running interactively, don't do anything
[[ $- != i ]] && return
...bla...

.bash_aliases as “Shell script”

#!/bin/bash

alias ls='\ls --color'
alias ll='ls -l'
alias la='ls -lA'
...bla again...
  • Right-clicking on .bashrc shows as first option “Open with Kate”.
    The opened file is then recognized as type “bash”, and syntax highlighting is enabled.
  • In contrast, the script file .bash_aliases shows “Open with Vim” as first entry, not Kate (not either in “Open with >”). When opened (via Open menu or DnD) it is recognized as type “normal”, and syntax highlighting is disabled.

I would expect Kate to automatically recognizes when it’s opening a script file (it even contains a shebang).

My system is somewhat older, but I’m pretty sure this is already the case with a fresh installation.

Do you have any idea if this is due to Dolphin or Kate, or maybe some other reason entirely? And how can I set this up so that it works as expected?

With .zsh_aliases, I had to set the file association text/plain to open in kate and then I had to set the highlighting to zsh in kate.

For the first go to System Settings → File Associations → text → plain and set it to kate
For the second, go to Tools → Highlight → Scripts in kate

Yeah, like the first comment alludes to, even when you set an app to open all files of a certain type (not extension), other “competing” apps may be their defaults.
So, manually setting “Open with… yourPreferredApp” is sometimes necessary.