Skip to content

Commit e88a8d1

Browse files
committed
Merge pull request #49: Add option to disable Unicode
2 parents 677a27f + aac2bf5 commit e88a8d1

File tree

3 files changed

+39
-15
lines changed

3 files changed

+39
-15
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ Old versions of the notes plug-in would highlight note titles without considerin
7171

7272
:let g:notes_word_boundaries = 1
7373

74+
### The `g:notes_unicode_enabled` option
75+
76+
By default the vim-notes plug-in uses Unicode characters (e.g. list bullets, arrows, etc.) when Vim's ['encoding'] [enc] option is set to UTF-8. If you don't want Unicode characters in your notes (regardless of the ['encoding'] [enc] option) you can set this option to false (0):
77+
78+
:let g:notes_unicode_enabled = 0
79+
7480
### The `g:notes_smart_quotes` option
7581

7682
By default the notes plug-in automatically performs several substitutions on the text you type in insert mode, for example regular quote marks are replaced with curly quotes. The full list of substitutions can be found below in the documentation on mappings. If you don't want the plug-in to perform these substitutions, you can set this option to zero like this:
@@ -338,6 +344,7 @@ This software is licensed under the [MIT license] [mit].
338344
[download-misc]: http://peterodding.com/code/vim/downloads/misc.zip
339345
[download-notes]: http://peterodding.com/code/vim/downloads/notes.zip
340346
[edit]: http://vimdoc.sourceforge.net/htmldoc/editing.html#:edit
347+
[enc]: http://vimdoc.sourceforge.net/htmldoc/options.html#'encoding'
341348
[gf]: http://vimdoc.sourceforge.net/htmldoc/editing.html#gf
342349
[github-misc]: http://github.com/xolox/vim-misc
343350
[github-notes]: http://github.com/xolox/vim-notes

autoload/xolox/notes.vim

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
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.24'
9+
let g:xolox#notes#version = '0.25'
1010
let g:xolox#notes#url_pattern = '\<\(mailto:\|javascript:\|\w\{3,}://\)\(\S*\w\)\+/\?'
1111
let s:scriptdir = expand('<sfile>:p:h')
1212

@@ -70,6 +70,10 @@ function! xolox#notes#init() " {{{1
7070
" Valid values are "no", "change_title", "rename_file" and "prompt".
7171
let g:notes_title_sync = 'prompt'
7272
endif
73+
" Unicode is enabled by default if Vim's encoding is set to UTF-8.
74+
if !exists('g:notes_unicode_enabled')
75+
let g:notes_unicode_enabled = (&encoding == 'utf-8')
76+
endif
7377
" Smart quotes and such are enabled by default.
7478
if !exists('g:notes_smart_quotes')
7579
let g:notes_smart_quotes = 1
@@ -262,10 +266,6 @@ function! xolox#notes#edit_shadow() " {{{1
262266
call xolox#notes#set_filetype()
263267
endfunction
264268

265-
function! xolox#notes#unicode_enabled()
266-
return &encoding == 'utf-8'
267-
endfunction
268-
269269
function! s:transcode_utf8_latin1()
270270
let view = winsaveview()
271271
silent %s/\%xe2\%x80\%x98/`/eg
@@ -276,6 +276,12 @@ function! s:transcode_utf8_latin1()
276276
call winrestview(view)
277277
endfunction
278278

279+
function! xolox#notes#unicode_enabled() " {{{1
280+
" Check if the `g:notes_unicode_enabled` option is set to true (1) and Vim's
281+
" encoding is set to UTF-8.
282+
return g:notes_unicode_enabled && &encoding == 'utf-8'
283+
endfunction
284+
279285
function! xolox#notes#select(filter) " {{{1
280286
" Interactively select an existing note whose title contains {filter}.
281287
let notes = {}

doc/notes.txt

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,17 @@ Contents ~
1111
2. The |g:notes_suffix| option
1212
3. The |g:notes_title_sync| option
1313
4. The |g:notes_word_boundaries| option
14-
5. The |g:notes_smart_quotes| option
15-
6. The |g:notes_ruler_text| option
16-
7. The |g:notes_list_bullets| option
17-
8. The |g:notes_tab_indents| option
18-
9. The |g:notes_alt_indents| option
19-
10. The |g:notes_shadowdir| option
20-
11. The |g:notes_indexfile| option
21-
12. The |g:notes_indexscript| option
22-
13. The |g:notes_tagsindex| option
23-
14. The |g:notes_markdown_program| option
14+
5. The |g:notes_unicode_enabled| option
15+
6. The |g:notes_smart_quotes| option
16+
7. The |g:notes_ruler_text| option
17+
8. The |g:notes_list_bullets| option
18+
9. The |g:notes_tab_indents| option
19+
10. The |g:notes_alt_indents| option
20+
11. The |g:notes_shadowdir| option
21+
12. The |g:notes_indexfile| option
22+
13. The |g:notes_indexscript| option
23+
14. The |g:notes_tagsindex| option
24+
15. The |g:notes_markdown_program| option
2425
4. Commands |notes-commands|
2526
1. The |:Note| command
2627
2. The |:NoteFromSelectedText| command
@@ -225,6 +226,16 @@ default:
225226
:let g:notes_word_boundaries = 1
226227
<
227228
-------------------------------------------------------------------------------
229+
The *g:notes_unicode_enabled* option
230+
231+
By default the vim-notes plug-in uses Unicode characters (e.g. list bullets,
232+
arrows, etc.) when Vim's |'encoding'| option is set to UTF-8. If you don't want
233+
Unicode characters in your notes (regardless of the |'encoding'| option) you
234+
can set this option to false (0):
235+
>
236+
:let g:notes_unicode_enabled = 0
237+
<
238+
-------------------------------------------------------------------------------
228239
The *g:notes_smart_quotes* option
229240

230241
By default the notes plug-in automatically performs several substitutions on

0 commit comments

Comments
 (0)