Questions tagged [syntax-highlighting]

Syntax highlighting is the use of colours, size, typeface, or other attributes to visually indicate it has a special meaning and therefore make it easier to understand the text. For example, marking language keywords with a specific colour.

Filter by
Sorted by
Tagged with
1
vote
1answer
152 views

Enabling Syntax in Vim Creates Lag

I was trying to learn javascript the other day and was using emacs as I have been trying to learn emacs as well. But after sometimes my left wrist started to hurt(as one's does) so I switched to ...
2
votes
1answer
475 views

How do I make vim highlight math properly in the align environment?

Sorry if this is the wrong place to ask this, I'm new to the site :/ I asked the same question in TeX StackExchange, and I was pointed here. My issue is this: when editing in vim, my syntax file ...
0
votes
1answer
43 views

How to affect the syntax highliting filetype from local vimrc?

I am editing a source code in language1. It doesn't have a built-in syntax highliting configuration into my vim. However, its syntax is very similar to language2, which has. I think, syntax ...
2
votes
0answers
81 views

How can I change Javascript syntax to higlight objects?

I am trying to emulate the Atom JavaScript syntax highlighting in vim, but there are a few things missing. Namely, I'd like to highlight objects and their chains in red. It'd be dandy if I could ...
0
votes
1answer
313 views

Cursorline/Columnline slowdown

I have recently recompiled vim, and ever since, when I have a big file, the scrolling gets slow. cursorline seems to be the problem; it doesn't matter if I use any of my plugins, if I have cursorline ...
0
votes
1answer
280 views

Strange Highlighting during Git Commit

What can I do to have proper highlighting on a .git file? I chose Vim as my default editor when I commit files, the color scheme(Gruvbox) is applied, but I get strange colors as I start typing. I ...
1
vote
2answers
495 views

Syntax highlighting of underscores in LaTeX, even though they only appear in filenames

I'm using nvim and LaTeX together, and for the most part it's been great. However, nvim appears to be incorrectly highlighting underscores that appear in filenames I include as part of the subfiles ...
0
votes
1answer
300 views

How to only load a certain syntax file

Okay, so I have a syntax file asciidoc.vim in ~/.vim/syntax and this file is actually loaded, as I checked with scriptnames. But for some reason, it only works, if the builtin syntax files haven't ...
2
votes
1answer
161 views

Inverted syntax highlighting of multiline strings in Python

I'm editing a ~1000 line Python file containing long docstrings. Occasionally, when I'm in editing the middle of a file, the syntax highlighting will 'invert' so that everything outside the docstrings ...
0
votes
1answer
71 views

Vim highlights word “mktemp” in Bash script

I'm programming Bash scripts using Vim in Ubuntu 16.04 (on Windows Subsystem for Linux). The filename ends in .sh and the first line of the file is #!/bin/bash When I wrote this command rm -rf /...
1
vote
1answer
31 views

Contents are all selected by default

First, I don't know what happed, which means the cause may not as the title suggests. I was editing with vim. one or two mis-key strokes, now whenever I open file with vim. All the Contents are all ...
0
votes
1answer
242 views

How to highlight todo in a comment line?

I'll leave ? at the beginning of a commented line to mark a todo item. -- ? TODO ... This line will be marked as comment. How to highlight the ? and the remaining text by Todo color while keep the -- ...
2
votes
1answer
454 views

Why local syntax file is not working?

I've created a local syntax file def.vim and saved in ~/.vim/syntax. First it's working, but just after I closed gvim and several other windows, it stops working. First I checked :scriptnames. Local ...
1
vote
1answer
379 views

Syntax highlighting gone when using buffer

At work I usually keep only a few files in buffer, typically a Yang file, a Java file, and possibly something like a readme file. In such an environment, the Yang syntax highlighting does not work. ...
1
vote
2answers
59 views

Does exist BSD's make syntax file?

There are many make-variant, maybe the most popular is the GNU make. The vim package contains syntax/make.vim which related to GNU make. Many people use different make, for example FreeBSD's make ...
1
vote
1answer
266 views

How to edit all vim highlight groups?

I am going through the unfortunate process of making keybinds to change colorschemes, but different plugins have their own highlight groups which is making this difficult. Is there a way to set the ...
2
votes
1answer
303 views

CMake syntax highlighting not working as expected

For most files, Vim (terminal) is syntax highlighting properly without any issues. However, I am unable to get it to work for CMakeLists.txt: Neovim has no trouble with syntax highlighting, neither ...
1
vote
0answers
20 views

Determining syntax group type from output of 'syn list' (doesn't appear to work for regions)

Why does the output of syn list not include region in the syntax group definition line, like it does for 'match' type groups? What is the meaning of the xxx in that line? I've got a vim 8.0 function ...
0
votes
1answer
132 views

why I am losing syntax highlighting when vim is invoked within a script?

If I initiate vim from command line prompt, everything works as expected, but when it is initiated from a script, then syntax color highlighting is lost. The script can be as simple as the following, ...
3
votes
1answer
300 views

Get back regular vim colors

I just installed Linux Mint 18.3 and to my surprise colors in vim changed! Vim in the terminal on the left has the color scheme I've always seen and got used to. Vim in the terminal on the right has ...
3
votes
1answer
1k views

How to set value of cterm to both bold and underline?

Currently, my vimrc has set cursorline hi CursorLine cterm=underline ctermbg=none ctermfg=none I want to be set cterm to both underline and bold
0
votes
1answer
33 views

Do syntax patterns let you use very magic or not?

Quoting syn-pattern: See |pattern| for the explanation of what a pattern is. Syntax patterns are always interpreted like the 'magic' option is set, no matter what the actual value of 'magic' ...
3
votes
1answer
33 views

How to syntax highlight line with three parts?

I am trying to highlight lines like these: -> Some text without a domain -> Some other text with a domain (example.com) I would like: a) the leading "->" not to be highlighted; b) the text to ...
1
vote
1answer
348 views

Ignore pattern inside of a region

:h region bring me very little help. I need to exclude a pattern inside a region that should be ignored for example: don't apply match/highlight begin from # to the end of line $ I try to ignore #.*$ ...
15
votes
0answers
341 views

How does `\zs` interact with syntax matches?

Consider the text: foobarbaz First we highlight the regular expression /foobar/: :syntax match Special /foobar/ Next we highlight the regular expression /foobarbaz/: :syntax match Error /...
1
vote
2answers
337 views

Highlight exported Go functions

Golang uses naming convention to separate functions visibility: exported (public) starts with a capital letter, non-exported (private) with a lower letter. I would like to highlight exported functions,...
0
votes
1answer
331 views

Highlight function's keyword and parameters

Follow here @muru point out how to highlight keyword in a function and function name but I want also highlight parameters, for example: abc = myFunc(Green, Orange=Green, Green, abcd(Orange=Green), ...
1
vote
2answers
114 views

How to write a syntax file

This is an example of my file format basically it follows this layout: <word> <wordWithNumbers> <wraped text> Examples: sadfa 23eafa asdfasdf asdfdsf sflsdkjf ;lkja flksad ks ...
2
votes
0answers
64 views

vim cpp syntax contained region

I define four key words and two regions in vim scripts syn keyword KeywordA A nextgroup=rangeA skipwhite skipnl skipempty syn keyword KeywordB B contained containedin=rangeA nextgroup=rangeB ...
1
vote
0answers
50 views

Match through nested function

I have this sample: I expect arg3 to be colored green as arg1, arg2 and FunCall with my current setting: syn match pyFun "xxxx" contains=xxx syn region pyFunCall start="(" end=")" contained contains=...
1
vote
1answer
2k views

Vim in terminal is black-&-white but vim launched from dash shows colors

I am using Vim 7 on Ubuntu 16.04 (gnome) and the terminal emulator I am using is terminator. I really like the aristocrat/brogrammer colorscheme for Python and so I copy-pasted it in ~/.vim/colors/...
1
vote
1answer
81 views

Weird highlight behavior: Can't match pythonBuiltin

python builtin function like print, len, sum... i can match and highlight other function and its argument. but with builtin function i can't change color. my setup: syn keyword pythonStatement def ...
0
votes
1answer
369 views

how to get the color theme right with vi on java

I'm currently using zenburn on android studio (java) and it looks very colorful (note: I'm using iTerm2.. not sure if that changes anything) but if I add zenburn color to my vimrc, the same file ...
2
votes
1answer
877 views

How can I highlight variable/arguments inside method/function in Python files?

An expansion of this question: How can I highlight all function names in Python files? i have a sample: src_file = replacement_file.replace(header_dir, source_dir) here i need to match variable/...
5
votes
1answer
2k views

How can I highlight all function names in Python files?

I try to make python.vim color similar to material theme (sublime text 3), see pictures: https://imgur.com/a/wOgH7 expected is material theme and current is mine. You may noticed that all method, ...
1
vote
0answers
34 views

How to access syntax elements

I try to inline one syntax in another syntax (to be explicit: CSS in JS template strings). I'd like to build on top of the existing CSS definitions and not create new ones. Question: Is it possible ...
2
votes
0answers
292 views

vim in tmux lose highlighting

I'm using vim 8.0 and tmux 2.5 on ubuntu. And I have set the TERM environment export TERM=screen-256color and run as tmux -2. Normally, nothing goes wrong. It's like the following picture: But ...
2
votes
0answers
39 views

Define region in region with same end match

Let's see an example: block property Property1 key: value end property Property2 key: value end end I would like to let property/end pair highlight only in block/end ...
3
votes
0answers
72 views

Can I change the highlight of specific conceals?

I'm using :syn-cchar to replace certain syntactic elements with Unicode characters (à la vim-haskellConcealPlus). Since I'm replacing several different elements, I'd like to be able to highlight some ...
1
vote
1answer
239 views

How to highlight region over region

Let's think we are going to render html file. We highlight <a> and <img> tags, so a and img will be highlighted as Keywords. We assume <a> accepts attribute href but not src, while &...
2
votes
1answer
871 views

How do I make vim highlight unused variables

I want vim to tell me (only when I ask it to) if there are variables not used in the current file. Is this possible given that for now I need it in my javascript/php projects?
5
votes
1answer
308 views

What are the global settings for syntax highlighting?

I'm troubleshooting syntax highlighting in my .vimrc settings. My setup is a little complex because I have some filetype settings for plain text and other settings for programming files (using ...
3
votes
1answer
415 views

How to identify the highlight groups in use on a particular character? [duplicate]

I'm new to vim and bumped into a problem. Short question -- will vim tell me why it chose to highlight certain text in a certain way? Long question -- I'm using vimdiff to compare two files, and ...
0
votes
2answers
333 views

Vi/Vim 8 on debian stretch : filetype “bindzone” not loaded automatically

When opening a bind zone file, I have to type by hand :set ft=bindzone to get syntax highlighting. It's not set automatically on load. On another hand others filetypes (such as php, perl or kind) are ...
4
votes
2answers
938 views

Exclude start and end match from region

I'm trying to establish syntax coloring for a certain lexical syntax: a "buffer literal". A buffer literal begins with #b' and ends with '. Between the single quotes, there can be undivided pairs of ...
2
votes
1answer
276 views

ruby syntax highlighting lost on long files

With a "long" ruby file (896 lines in my case) the ruby syntax highlighting is lost when I G to the bottom of the file. Once that happens and I go back to the top with gg, the syntax highlighting ...
2
votes
0answers
486 views

Prevent fold background color to override gutter

Here's what my colorscheme looks like: But when there are folds, it looks ugly like this: The fold background overrides the "gutter" color, but I would like the gutter to remain gray. Is there any ...
2
votes
1answer
630 views

vim 8.0 not honoring custom colors

I updated from 7.4 to 8.0 last night and vim stopped honoring the highlight commands in my .vimrc file. Minimal complete example: with a .vimrc that contains only the following " a comment sy enable ...
2
votes
1answer
352 views

How can I remove a syntax keyword?

In Python3, file is no longer a builtin. It's just a plain ol' name that isn't even associated with anything until you do. But all the syntax files that I've used have it as a builtin. Is there a ...
2
votes
2answers
345 views

How can I override a syntax keyword match?

I would like the html tag attribute id to be highlighted differently from the rest of the tag attributes. Like the Atom editor: Given this line from the html5.vim plugin syn keyword htmlArg ...