Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #49: Add option to disable Unicode

  • Loading branch information...
commit e88a8d1ecd3d689ffaf4a8ab96ed097bed683f0b 2 parents 677a27f + aac2bf5
@xolox authored
Showing with 39 additions and 15 deletions.
  1. +7 −0 README.md
  2. +11 −5 autoload/xolox/notes.vim
  3. +21 −10 doc/notes.txt
View
7 README.md
@@ -71,6 +71,12 @@ Old versions of the notes plug-in would highlight note titles without considerin
:let g:notes_word_boundaries = 1
+### The `g:notes_unicode_enabled` option
+
+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):
+
+ :let g:notes_unicode_enabled = 0
+
### The `g:notes_smart_quotes` option
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].
[download-misc]: http://peterodding.com/code/vim/downloads/misc.zip
[download-notes]: http://peterodding.com/code/vim/downloads/notes.zip
[edit]: http://vimdoc.sourceforge.net/htmldoc/editing.html#:edit
+[enc]: http://vimdoc.sourceforge.net/htmldoc/options.html#'encoding'
[gf]: http://vimdoc.sourceforge.net/htmldoc/editing.html#gf
[github-misc]: http://github.com/xolox/vim-misc
[github-notes]: http://github.com/xolox/vim-notes
View
16 autoload/xolox/notes.vim
@@ -6,7 +6,7 @@
" Note: This file is encoded in UTF-8 including a byte order mark so
" that Vim loads the script using the right encoding transparently.
-let g:xolox#notes#version = '0.24'
+let g:xolox#notes#version = '0.25'
let g:xolox#notes#url_pattern = '\<\(mailto:\|javascript:\|\w\{3,}://\)\(\S*\w\)\+/\?'
let s:scriptdir = expand('<sfile>:p:h')
@@ -70,6 +70,10 @@ function! xolox#notes#init() " {{{1
" Valid values are "no", "change_title", "rename_file" and "prompt".
let g:notes_title_sync = 'prompt'
endif
+ " Unicode is enabled by default if Vim's encoding is set to UTF-8.
+ if !exists('g:notes_unicode_enabled')
+ let g:notes_unicode_enabled = (&encoding == 'utf-8')
+ endif
" Smart quotes and such are enabled by default.
if !exists('g:notes_smart_quotes')
let g:notes_smart_quotes = 1
@@ -262,10 +266,6 @@ function! xolox#notes#edit_shadow() " {{{1
call xolox#notes#set_filetype()
endfunction
-function! xolox#notes#unicode_enabled()
- return &encoding == 'utf-8'
-endfunction
-
function! s:transcode_utf8_latin1()
let view = winsaveview()
silent %s/\%xe2\%x80\%x98/`/eg
@@ -276,6 +276,12 @@ function! s:transcode_utf8_latin1()
call winrestview(view)
endfunction
+function! xolox#notes#unicode_enabled() " {{{1
+ " Check if the `g:notes_unicode_enabled` option is set to true (1) and Vim's
+ " encoding is set to UTF-8.
+ return g:notes_unicode_enabled && &encoding == 'utf-8'
+endfunction
+
function! xolox#notes#select(filter) " {{{1
" Interactively select an existing note whose title contains {filter}.
let notes = {}
View
31 doc/notes.txt
@@ -11,16 +11,17 @@ Contents ~
2. The |g:notes_suffix| option
3. The |g:notes_title_sync| option
4. The |g:notes_word_boundaries| option
- 5. The |g:notes_smart_quotes| option
- 6. The |g:notes_ruler_text| option
- 7. The |g:notes_list_bullets| option
- 8. The |g:notes_tab_indents| option
- 9. The |g:notes_alt_indents| option
- 10. The |g:notes_shadowdir| option
- 11. The |g:notes_indexfile| option
- 12. The |g:notes_indexscript| option
- 13. The |g:notes_tagsindex| option
- 14. The |g:notes_markdown_program| option
+ 5. The |g:notes_unicode_enabled| option
+ 6. The |g:notes_smart_quotes| option
+ 7. The |g:notes_ruler_text| option
+ 8. The |g:notes_list_bullets| option
+ 9. The |g:notes_tab_indents| option
+ 10. The |g:notes_alt_indents| option
+ 11. The |g:notes_shadowdir| option
+ 12. The |g:notes_indexfile| option
+ 13. The |g:notes_indexscript| option
+ 14. The |g:notes_tagsindex| option
+ 15. The |g:notes_markdown_program| option
4. Commands |notes-commands|
1. The |:Note| command
2. The |:NoteFromSelectedText| command
@@ -225,6 +226,16 @@ default:
:let g:notes_word_boundaries = 1
<
-------------------------------------------------------------------------------
+The *g:notes_unicode_enabled* option
+
+By default the vim-notes plug-in uses Unicode characters (e.g. list bullets,
+arrows, etc.) when Vim's |'encoding'| option is set to UTF-8. If you don't want
+Unicode characters in your notes (regardless of the |'encoding'| option) you
+can set this option to false (0):
+>
+ :let g:notes_unicode_enabled = 0
+<
+-------------------------------------------------------------------------------
The *g:notes_smart_quotes* option
By default the notes plug-in automatically performs several substitutions on
Please sign in to comment.
Something went wrong with that request. Please try again.