Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

New "notes_smart_quotes" option to disable automatic substitution

  • Loading branch information...
commit 3327d2159af5cb713fde50ffedd61a085c343b9b 1 parent 1de0527
@xolox authored
View
19 README.md
@@ -28,10 +28,12 @@ Unzip the most recent [ZIP archive] [download] file inside your Vim profile dire
## Options
-All options have reasonable defaults so if the plug-in works after installation you don't need to change any options. They're available for people who like to customize their directory layout. These options can be configured in your [vimrc] [vimrc] by including a line like this:
+All options have reasonable defaults so if the plug-in works after installation you don't need to change any options. They're available for people who like to customize their directory layout. These options can be configured in your [vimrc script] [vimrc] by including a line like this:
let g:notes_directory = '~/Documents/Notes'
+Note that after changing an option in your [vimrc script] [vimrc] you have to restart Vim for the changes to take effect.
+
### The `g:notes_directory` option
All your notes are stored together in one directory. This option defines the path of this directory.
@@ -48,6 +50,21 @@ When you rename a file in your notes directory but don't change the title, the p
If you set this option to the string `'no'` this feature will be completely disabled. If you set it to `'change_title'` it will automatically change the title to match the filename. If you set it to `'rename_file'` it will automatically rename the file on disk to match the title.
+### The `g:notes_smart_quotes` option
+
+By default the notes plug-in automatically performs several substitutions on the text you type in insert mode. Here are those substitutions:
+
+ * `'` becomes `‘` or `’` depending on where you type it
+ * `"` becomes `“` or `”` (same goes for these)
+ * `--` becomes `—`
+ * `->` becomes `→`
+ * `<-` becomes `←`
+ * the bullets `*`, `+` and `-` become `•`
+
+If you don't want the plug-in to perform these substitutions, you can set this option to zero like this:
+
+ :let g:notes_smart_quotes = 0
+
### The `g:notes_shadowdir` option
The notes plug-in comes with some default notes containing documentation about the plug-in. This option defines the path of the directory containing these notes.
View
2  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.12.9'
+let g:xolox#notes#version = '0.12.10'
function! xolox#notes#shortcut() " {{{1
" The "note:" pseudo protocol is just a shortcut for the :Note command.
View
28 doc/notes.txt
@@ -79,10 +79,13 @@ Options ~
All options have reasonable defaults so if the plug-in works after
installation you don't need to change any options. They're available for
people who like to customize their directory layout. These options can be
-configured in your |vimrc| by including a line like this:
+configured in your |vimrc| script by including a line like this:
>
let g:notes_directory = '~/Documents/Notes'
+Note that after changing an option in your |vimrc| script you have to restart
+Vim for the changes to take effect.
+
-------------------------------------------------------------------------------
The *g:notes_directory* option
@@ -116,6 +119,29 @@ title to match the filename. If you set it to 'rename_file' it will
automatically rename the file on disk to match the title.
-------------------------------------------------------------------------------
+The *g:notes_smart_quotes* option
+
+By default the notes plug-in automatically performs several substitutions on
+the text you type in insert mode. Here are those substitutions:
+
+ - ' becomes '‘' or '’' depending on where you type it
+
+ - '"' becomes '“' or '”' (same goes for these)
+
+ - '--' becomes '—'
+
+ - '->' becomes '->'
+
+ - '<-' becomes '←'
+
+ - the bullets '*', '+' and '-' become '•'
+
+If you don't want the plug-in to perform these substitutions, you can set this
+option to zero like this:
+>
+ :let g:notes_smart_quotes = 0
+
+-------------------------------------------------------------------------------
The *g:notes_shadowdir* option
The notes plug-in comes with some default notes containing documentation about
View
28 ftplugin/notes.vim
@@ -56,19 +56,21 @@ let b:undo_ftplugin .= ' | execute "iunmap <buffer> @"'
set completeopt+=longest
" Change double-dash to em-dash as it is typed. {{{1
-if xolox#notes#unicode_enabled()
+if g:notes_smart_quotes && xolox#notes#unicode_enabled()
imap <buffer> -- —
let b:undo_ftplugin .= ' | execute "iunmap <buffer> --"'
endif
" Change plain quotes to curly quotes as they're typed. {{{1
-imap <buffer> <expr> ' xolox#notes#insert_quote(1)
-imap <buffer> <expr> " xolox#notes#insert_quote(2)
-let b:undo_ftplugin .= ' | execute "iunmap <buffer> ''"'
-let b:undo_ftplugin .= ' | execute ''iunmap <buffer> "'''
+if g:notes_smart_quotes
+ imap <buffer> <expr> ' xolox#notes#insert_quote(1)
+ imap <buffer> <expr> " xolox#notes#insert_quote(2)
+ let b:undo_ftplugin .= ' | execute "iunmap <buffer> ''"'
+ let b:undo_ftplugin .= ' | execute ''iunmap <buffer> "'''
+endif
" Change ASCII style arrows to Unicode arrows. {{{1
-if xolox#notes#unicode_enabled()
+if g:notes_smart_quotes && xolox#notes#unicode_enabled()
imap <buffer> -> →
imap <buffer> <- ←
let b:undo_ftplugin .= ' | execute "iunmap <buffer> ->"'
@@ -76,12 +78,14 @@ if xolox#notes#unicode_enabled()
endif
" Convert ASCII list bullets to Unicode bullets. {{{1
-imap <buffer> <expr> - xolox#notes#insert_bullet('-')
-imap <buffer> <expr> + xolox#notes#insert_bullet('+')
-imap <buffer> <expr> * xolox#notes#insert_bullet('*')
-let b:undo_ftplugin .= ' | execute "iunmap <buffer> -"'
-let b:undo_ftplugin .= ' | execute "iunmap <buffer> +"'
-let b:undo_ftplugin .= ' | execute "iunmap <buffer> *"'
+if g:notes_smart_quotes
+ imap <buffer> <expr> - xolox#notes#insert_bullet('-')
+ imap <buffer> <expr> + xolox#notes#insert_bullet('+')
+ imap <buffer> <expr> * xolox#notes#insert_bullet('*')
+ let b:undo_ftplugin .= ' | execute "iunmap <buffer> -"'
+ let b:undo_ftplugin .= ' | execute "iunmap <buffer> +"'
+ let b:undo_ftplugin .= ' | execute "iunmap <buffer> *"'
+endif
" Indent list items using <Tab>. {{{1
imap <buffer> <silent> <Tab> <C-o>:call xolox#notes#indent_list('>>', line('.'), line('.'))<CR>
View
7 plugin/notes.vim
@@ -1,6 +1,6 @@
" Vim plug-in
" Author: Peter Odding <peter@peterodding.com>
-" Last Change: October 18, 2011
+" Last Change: November 15, 2011
" URL: http://peterodding.com/code/vim/notes/
" Support for automatic update using the GLVS plug-in.
@@ -50,6 +50,11 @@ if !exists('g:notes_title_sync')
let g:notes_title_sync = 'prompt'
endif
+" Smart quotes and such are enabled by default.
+if !exists('g:notes_smart_quotes')
+ let g:notes_smart_quotes = 1
+endif
+
" User commands to create, delete and search notes.
command! -bar -bang -nargs=? -complete=customlist,xolox#notes#cmd_complete Note call xolox#notes#edit(<q-bang>, <q-args>)
command! -bar -bang -range NoteFromSelectedText call xolox#notes#from_selection(<q-bang>)
Please sign in to comment.
Something went wrong with that request. Please try again.