sponsor Vim development Vim logo Vim Book Ad

intermediate Tip #501: View character class

 tip karma   Rating -4/4, Viewed by 620 

Read and edit this tip on the Vim tip wiki. The wiki may have a more recent version of this tip.

created:   July 2, 2003 18:05      complexity:   intermediate
author:   beo      as of Vim:   6.0

This one shows the definition of a predefined character class. ([:alpha:], [:graph:] etc.) The cursor is assumed to point to the name of the character class one wants to examine. Press "cc" ...

fun! s:Show()
  norm! viwy
  echo 'class [:' . @" . ':]' . "\n"
  let pat = '[[:' . @" . ':]]'
  let i = 0
  while i < 256
    let ch = nr2char(i)
    if ch =~ pat | echon ch . '(' . i . ')' . "\t" | endif
    let i = i + 1

nn cc :call <SID>Show()<Cr>

 rate this tip  Life Changing Helpful Unfulfilling 

<< View character class | View character class >>

Additional Notes

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to vim@vim.org after searching the archive. Help Bram help Uganda.
Sponsored by Web Concept Group Inc. SourceForge.net Logo