Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6880717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:00:36+00:00 2026-05-27T05:00:36+00:00

I’m trying to edit the python.vim syntax file to duplicate the syntax highlighting for

  • 0

I’m trying to edit the python.vim syntax file to duplicate the syntax highlighting for python in Textmate. The attached image illustrates the highlighting of function parameters which i’m struggling to achieve.

imgur pic of code

The self, a, b is highlighted in Textmate but not in Vim. I figured that I have to do the following.

  1. Match a new region

    syn region pythonFunction start="(" end=")" contains=pythonParameters skipwhite transparent
    
  2. Try to match a string followed by a comma

    syn match pythonParameters ".*" contained
    

So in point 2 the “.*” will match any string at the moment and must be expanded further to be correct. However i’m not sure if i’m on the right path since the match in 2 is not constrained
to region between the brackets (). Any tips or input will be appreciated.

EDIT 1: If anyone wondered how it turned out eventually.

Here is my vim syntax highlighting for python.

imgur pic of code

EDIT 2: So just for ultimate thoroughness I created a github page for it.

http://pfdevilliers.github.com/Pretty-Vim-Python/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T05:00:37+00:00Added an answer on May 27, 2026 at 5:00 am

    Ok, you’ve got a couple problems.

    1. There is already a region called pythonFunction, for highlighting def and function names.
    2. This region will match any parenthesis, anywhere

    So, find the pythonFunction match, and change it to this:

    syn match   pythonFunction
          \ "\%(\%(def\s\|class\s\|@\)\s*\)\@<=\h\%(\w\|\.\)*" contained nextgroup=pythonVars
    

    Adding nextgroup tells vim to match pythonVars after a function definition.

    Then add:

    syn region pythonVars start="(" end=")" contained contains=pythonParameters transparent keepend
    syn match pythonParameters "[^,]*" contained skipwhite
    

    Finally, to actually highlight it, find the HiLink section, and add:

    HiLink pythonParameters       Comment
    

    Change Comment to the grouping you want, or add your own. I’m using Statement myself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
i want to parse a xhtml file and display in UITableView. what is the
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.