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 8608763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:41:57+00:00 2026-06-12T03:41:57+00:00

I am quite new to Vim and have the following problem: In my .gvimrc

  • 0

I am quite new to Vim and have the following problem:

In my .gvimrc I defined

syn keyword Todo PMID

to highlight every PMID in the files I edit. This works quite well as long as no general syntax highlighting is applied to the file (via setf or autocmd BufRead,BufNewFile …)

My question: How do I maintain a list of individual keywords which are highlighted no matter what file I edit and which syntax highlight I use for that file?

  • 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-06-12T03:41:58+00:00Added an answer on June 12, 2026 at 3:41 am

    In this case matches come handy:

    let s:kwreg='\v<%(PMID|OTHER|OTHER2)>'
    let s:kwsyn='Todo'
    augroup MyKeywords
        autocmd!
        autocmd WinEnter * if !exists('w:my_keyword_mnr') | 
                         \    let w:my_keyword_mnr=matchadd(s:kwsyn, s:kwreg) |
                         \ endif
    augroup END
    let s:curtab=tabpagenr()
    for s:tab in range(1, tabpagenr('$'))
        execute 'tabnext' s:tab
        let s:curwin=winnr()
        for s:win in range(1, winnr('$'))
            execute s:win.'wincmd w'
            let w:my_keyword_mnr=matchadd(s:kwsyn, s:kwreg)
        endfor
        execute s:curwin.'wincmd w'
    endfor
    execute 'tabnext' s:curtab
    unlet s:curtab s:curwin s:tab s:win
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im quite new to Java and i have stumbled upon the following problem. Im
I'm quite new to using NetBeans and today I faced a problem. I have
I'm quite new to vim. I'm trying tuning vim up by following a book
quite new to JQuery and Ive run into a problem. I have a form
Still quite new to Python. I have a problem similar to this question .
I am quite new to mongoid and rails. So I have some troubles to
Am quite new to namespacing etc so hopefully this will be straightforward. I have
Quite new to this mocking thing, I have a couple of questions. Correct me
I'm quite new to Linq and have had some problems updating my dabase. I
I often have to paste some stuff on a new line in vim. What

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.