Skip to content

Commit 5616b08

Browse files
committed
Merge pull request #104: Make concealing configurable
I made a few changes while merging this pull request: 1. I changed the logic inside syntax/notes.vim to use the function xolox#misc#option#get() with a default option value of true (1). In my mind this makes a lot more sense than checking for the existence of variables without checking their actual values. 2. I renamed notes_conceal_italics to notes_conceal_italic to be consistent with the other options (IMHO). 3. I rewrote the documentation additions because A) doc/notes.txt is generated from README.md so the changes by @naddeoa would have gone lost and B) because there were typos in the additions (s/coneal/conceal/g). 4. The documentation for notes_conceal_code was incorrect because the code changes by @naddeoa only apply to the markers for inline code fragments, not the markers for multi line code blocks. I kept the implementation as is and updated the documentation to match the implementation. See also pull request 104 on GitHub: #104
2 parents 1757bf6 + 76e0042 commit 5616b08

4 files changed

Lines changed: 75 additions & 7 deletions

File tree

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,30 @@ This option defines the pathname of the text file that stores the list of known
130130

131131
The `:NoteToHtml` command requires the [Markdown] [markdown] program. By default the name of this program is assumed to be simply `markdown`. If you want to use a different program for Markdown to HTML conversion, set this option to the name of the program.
132132

133+
### The `g:notes_conceal_code` option
134+
135+
By default the backticks that mark inline code snippets are hidden when your version of Vim supports concealing of text. By setting this option to zero you stop vim-notes from hiding those backticks. In the following example, the backticks would be visible in the editor when this option is set to zero:
136+
137+
This is a sentence with an `inline code` fragment.
138+
139+
### The `g:notes_conceal_italic` option
140+
141+
By default the underscores that mark italic text are hidden when your version of Vim supports concealing of text. By setting this option to zero you stop vim-notes from hiding those underscores. In the following example, the underscores would be visible in the editor when this option is set to zero:
142+
143+
This is a sentence with _italic_ text.
144+
145+
### The `g:notes_conceal_bold` option
146+
147+
By default the stars that mark bold text are hidden when your version of Vim supports concealing of text. By setting this option to zero you stop vim-notes from hiding those stars. In the following example, the stars would be visible in the editor when this option is set to zero:
148+
149+
This is a sentence with *bold* text.
150+
151+
### The `g:notes_conceal_url` option
152+
153+
By default URL schemes (text fragments like `http://`) are hidden when your version of Vim supports concealing of text. By setting this option to zero you stop vim-notes from hiding URL schemes. In the following example, the `https://` text would be visible in the editor when this option is set to zero:
154+
155+
You can find the vim-notes plug-in at https://github.com/xolox/vim-notes.
156+
133157
## Commands
134158

135159
To edit one of your existing notes (or create a new one) you can use Vim commands such as [:edit] [edit], [:split] [split] and [:tabedit] [tabedit] with a filename that starts with *note:* followed by (part of) the title of one of your notes, e.g.:

autoload/xolox/notes.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
" Vim auto-load script
22
" Author: Peter Odding <peter@peterodding.com>
3-
" Last Change: March 5, 2015
3+
" Last Change: March 15, 2015
44
" URL: http://peterodding.com/code/vim/notes/
55

66
" Note: This file is encoded in UTF-8 including a byte order mark so
77
" that Vim loads the script using the right encoding transparently.
88

9-
let g:xolox#notes#version = '0.31.1'
9+
let g:xolox#notes#version = '0.32'
1010
let g:xolox#notes#url_pattern = '\<\(mailto:\|javascript:\|\w\{3,}://\)\(\S*\w\)\+/\?'
1111
let s:scriptdir = expand('<sfile>:p:h')
1212

doc/notes.txt

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ Contents ~
2222
13. The |g:notes_indexscript| option
2323
14. The |g:notes_tagsindex| option
2424
15. The |g:notes_markdown_program| option
25+
16. The |g:notes_conceal_code| option
26+
17. The |g:notes_conceal_italic| option
27+
18. The |g:notes_conceal_bold| option
28+
19. The |g:notes_conceal_url| option
2529
4. Commands |notes-commands|
2630
1. The |:Note| command
2731
2. The |:NoteFromSelectedText| command
@@ -338,6 +342,46 @@ name of this program is assumed to be simply 'markdown'. If you want to use a
338342
different program for Markdown to HTML conversion, set this option to the name
339343
of the program.
340344

345+
-------------------------------------------------------------------------------
346+
The *g:notes_conceal_code* option
347+
348+
By default the backticks that mark inline code snippets are hidden when your
349+
version of Vim supports concealing of text. By setting this option to zero you
350+
stop vim-notes from hiding those backticks. In the following example, the
351+
backticks would be visible in the editor when this option is set to zero:
352+
>
353+
This is a sentence with an `inline code` fragment.
354+
<
355+
-------------------------------------------------------------------------------
356+
The *g:notes_conceal_italic* option
357+
358+
By default the underscores that mark italic text are hidden when your version
359+
of Vim supports concealing of text. By setting this option to zero you stop
360+
vim-notes from hiding those underscores. In the following example, the
361+
underscores would be visible in the editor when this option is set to zero:
362+
>
363+
This is a sentence with _italic_ text.
364+
<
365+
-------------------------------------------------------------------------------
366+
The *g:notes_conceal_bold* option
367+
368+
By default the stars that mark bold text are hidden when your version of Vim
369+
supports concealing of text. By setting this option to zero you stop vim-notes
370+
from hiding those stars. In the following example, the stars would be visible
371+
in the editor when this option is set to zero:
372+
>
373+
This is a sentence with *bold* text.
374+
<
375+
-------------------------------------------------------------------------------
376+
The *g:notes_conceal_url* option
377+
378+
By default URL schemes (text fragments like 'http://') are hidden when your
379+
version of Vim supports concealing of text. By setting this option to zero you
380+
stop vim-notes from hiding URL schemes. In the following example, the
381+
'https://' text would be visible in the editor when this option is set to zero:
382+
>
383+
You can find the vim-notes plug-in at https://github.com/xolox/vim-notes.
384+
<
341385
===============================================================================
342386
*notes-commands*
343387
Commands ~

syntax/notes.vim

Lines changed: 5 additions & 5 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: November 27, 2014
3+
" Last Change: March 15, 2015
44
" URL: http://peterodding.com/code/vim/notes/
55

66
" Note: This file is encoded in UTF-8 including a byte order mark so
@@ -57,7 +57,7 @@ highlight def link notesSingleQuoted Special
5757
highlight def link notesDoubleQuoted String
5858

5959
" Highlight inline code fragments (same as Markdown syntax). {{{2
60-
if has('conceal')
60+
if has('conceal') && xolox#misc#option#get('notes_conceal_code', 1)
6161
syntax region notesInlineCode matchgroup=notesInlineCodeMarker start=/`/ end=/`/ concealends
6262
highlight link notesItalicMarker notesInlineCodeMarker
6363
else
@@ -67,7 +67,7 @@ syntax cluster notesInline add=notesInlineCode
6767
highlight def link notesInlineCode Special
6868

6969
" Highlight text emphasized in italic font. {{{2
70-
if has('conceal')
70+
if has('conceal') && xolox#misc#option#get('notes_conceal_italic', 1)
7171
syntax region notesItalic matchgroup=notesItalicMarker start=/\<_\k\@=/ end=/_\>\|\n/ contains=@Spell concealends
7272
highlight link notesItalicMarker notesHiddenMarker
7373
else
@@ -77,7 +77,7 @@ syntax cluster notesInline add=notesItalic
7777
highlight notesItalic gui=italic cterm=italic
7878

7979
" Highlight text emphasized in bold font. {{{2
80-
if has('conceal')
80+
if has('conceal') && xolox#misc#option#get('notes_conceal_bold', 1)
8181
syntax region notesBold matchgroup=notesBoldMarker start=/\*\k\@=/ end=/\S\@<=\*/ contains=@Spell concealends
8282
highlight link notesBoldMarker notesHiddenMarker
8383
else
@@ -97,7 +97,7 @@ highlight def link notesTextURL notesSubtleURL
9797
execute printf('syntax match notesRealURL @%s@', g:xolox#notes#url_pattern)
9898
syntax cluster notesInline add=notesRealURL
9999
highlight def link notesRealURL notesSubtleURL
100-
if has('conceal')
100+
if has('conceal') && xolox#misc#option#get('notes_conceal_url', 1)
101101
syntax match notesUrlScheme @\(mailto:\|javascript:\|\w\{3,}://\)@ contained containedin=notesRealURL conceal
102102
highlight def link notesUrlScheme notesRealURL
103103
endif

0 commit comments

Comments
 (0)