Recently I wrote a text file without a file extension with the vim text editor and got text highlightning for all words between singel quotes like 'word'
and all words ending with a colon like word:
I like this kind of highlightning.
But because I havent typed any command, which usually starts with ESC
:command
, I was surprised how this could happen.
Is there a command to display the actual syntax highlight which is in use?
I already have tried the command :set syntax=php
which seems simliar only with different color for words like word:
Does anyone have suggestions?
VIM is an alternative and advanced version of VI editor that enables Syntax highlighting feature in VI. Syntax highlighting means it can show some parts of text in another fonts and colors. VIM doesn't show whole file but have some limitations in highlighting particular keywords or text matching a pattern in a file.
Press 1 to highlight the current visually selected text, or the current word (if nothing is selected). Highlight group hl1 is used. Press 2 for highlight hl2 , 3 for highlight hl3 , etc. Press 0 to remove all highlights from the current visually selected text, or the current word.
Syntax highlighting is a feature of text editors that are used for programming, scripting, or markup languages, such as HTML. The feature displays text, especially source code, in different colours and fonts according to the category of terms.
Just type :e ~/. vimrc to vim, type in the line and save (:w).
Try entering the command
:echo &syntax
This will display the value that the syntax
variable has been set to.
set option=value "set the option with value
set option? "read/print the current value of the option
set option! "set the option with opposite value, like set nu and set nu!
the option value is also saved in variable &option
so you can read in script way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With