Skip to content

Commit 5d6dfdb

Browse files
committed
Make highlighting UTF-8 compatible (suggested by Lukas Muehlethaler)
1 parent 23861b0 commit 5d6dfdb

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

plugin/notes.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ if &cp || exists('g:loaded_notes')
1111
finish
1212
endif
1313

14-
let g:notes_version = '0.9.3'
14+
let g:notes_version = '0.9.4'
1515

1616
" Make sure the default paths below are compatible with Pathogen.
1717
let s:plugindir = expand('<sfile>:p:h') . '/../misc/notes'

syntax/notes.vim

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
" Vim syntax script
22
" Author: Peter Odding <peter@peterodding.com>
3-
" Last Change: June 4, 2011
3+
" Last Change: June 24, 2011
44
" URL: http://peterodding.com/code/vim/notes/
55

66
" Note: This file is encoded in UTF-8 including a byte order mark so
@@ -28,7 +28,7 @@ syntax cluster notesInline add=notesName
2828
highlight def link notesName Underlined
2929

3030
" Highlight @tags as hyperlinks. {{{2
31-
syntax match notesTagName /\(^\|\s\)\@<=@\w\+/
31+
syntax match notesTagName /\(^\|\s\)\@<=@\k\+/
3232
highlight def link notesTagName Underlined
3333

3434
" Highlight list bullets and numbers. {{{2
@@ -47,26 +47,29 @@ highlight def link notesQuotedFragment Special
4747

4848
" Highlight text emphasized in italic font. {{{2
4949
if has('conceal')
50-
syntax region notesItalic matchgroup=notesItalicMarker start=/\<_[A-Za-z]\@=/ end=/_\>\|\n/ contains=@Spell concealends
50+
syntax region notesItalic matchgroup=notesItalicMarker start=/\<_\k\@=/ end=/_\>\|\n/ contains=@Spell concealends
5151
highlight link notesItalicMarker notesHiddenMarker
5252
else
53-
syntax match notesItalic /\<_\w[^_]*\w_\>/
53+
syntax match notesItalic /\<_\k[^_]*\k_\>/
5454
endif
5555
syntax cluster notesInline add=notesItalic
5656
highlight notesItalic gui=italic
5757

5858
" Highlight text emphasized in bold font. {{{2
5959
if has('conceal')
60-
syntax region notesBold matchgroup=notesBoldMarker start=/\*\w\@=/ end=/\w\@<=\*/ contains=@Spell concealends
60+
syntax region notesBold matchgroup=notesBoldMarker start=/\*\k\@=/ end=/\k\@<=\*/ contains=@Spell concealends
6161
highlight link notesBoldMarker notesHiddenMarker
6262
else
63-
syntax match notesBold /\*\w[^*]*\w\*/
63+
syntax match notesBold /\*\k[^*]*\k\*/
6464
endif
6565
syntax cluster notesInline add=notesBold
6666
highlight notesBold gui=bold
6767

6868
" Highlight domain names, URLs, e-mail addresses and filenames. {{{2
69+
70+
" FIXME This setting is lost once the user switches color scheme!
6971
highlight notesSubtleURL gui=underline guifg=fg
72+
7073
syntax match notesTextURL @\<www\.\(\S*\w\)\+/\?@
7174
syntax cluster notesInline add=notesTextURL
7275
highlight def link notesTextURL notesSubtleURL
@@ -80,12 +83,12 @@ endif
8083
syntax match notesEmailAddr /\<\w[^@ \t\r]*\w@\w[^@ \t\r]\+\w\>/
8184
syntax cluster notesInline add=notesEmailAddr
8285
highlight def link notesEmailAddr notesSubtleURL
83-
syntax match notesUnixPath /\w\@<![\/~]\S\+\(\/\|[^ [:punct:]]\)/ contains=notesName | " <- UNIX style pathnames
86+
syntax match notesUnixPath /\k\@<![\/~]\S\+\(\/\|[^ [:punct:]]\)/
8487
syntax cluster notesInline add=notesUnixPath
8588
highlight def link notesUnixPath Directory
8689
syntax match notesPathLnum /:\d\+/ contained containedin=notesUnixPath
8790
highlight def link notesPathLnum Comment
88-
syntax match notesWindowsPath /\w\@<![A-Za-z]:\S\+\([\\/]\|[^ [:punct:]]\)/ contains=notesName | " <- Windows style pathnames
91+
syntax match notesWindowsPath /\k\@<![A-Za-z]:\S\+\([\\/]\|[^ [:punct:]]\)/
8992
syntax cluster notesInline add=notesWindowsPath
9093
highlight def link notesWindowsPath Directory
9194

@@ -113,7 +116,7 @@ syntax match notesTitle /^.*\%1l.*$/ contains=@notesInline
113116
highlight def link notesTitle ModeMsg
114117

115118
" Short sentences ending in a colon are considered headings. {{{2
116-
syntax match notesShortHeading /^\s*\zs\u.\{1,50}\w:\ze\(\s\|$\)/ contains=@notesInline
119+
syntax match notesShortHeading /^\s*\zs\u.\{1,50}\k:\ze\(\s\|$\)/ contains=@notesInline
117120
highlight def link notesShortHeading Title
118121

119122
" Atx style headings are also supported. {{{2

0 commit comments

Comments
 (0)