Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove misc/notes/user/README, add .gitignore, document g:notes_direc…

…tory (issue #28)
  • Loading branch information...
commit 20984944e2cffe1307a8a0b66f85965f7bff0b15 1 parent 6880ab7
@xolox authored
View
4 .gitignore
@@ -0,0 +1,4 @@
+doc/tags
+misc/notes/index.pickle
+misc/notes/tags.txt
+misc/notes/user/
View
9 README.md
@@ -37,7 +37,11 @@ Note that after changing an option in your [vimrc script] [vimrc] you have to re
### The `g:notes_directory` option
-All your notes are stored together in one directory. This option defines the path of this directory.
+All your notes are stored together in one directory. This option defines the path of this directory. The default value depends on circumstances but should work for most people:
+
+ * If the profile directory where the plug-in is installed is writable, the directory `misc/notes/user` under the profile directory is used. This is for compatibility with [Pathogen] [pathogen]; the notes will be stored inside the plug-in's bundle.
+
+ * If the above doesn't work out, the default depends on the platform: `~/vimfiles/misc/notes/user` on Windows and `~/.vim/misc/notes/user` on other platforms.
### The `g:notes_suffix` option
@@ -267,7 +271,7 @@ If you have questions, bug reports, suggestions, etc. the author can be contacte
## License
This software is licensed under the [MIT license] [mit].
2011 Peter Odding &lt;<peter@peterodding.com>&gt;.
2013 Peter Odding &lt;<peter@peterodding.com>&gt;.
[ctrlwf]: http://vimdoc.sourceforge.net/htmldoc/windows.html#CTRL-W_f
@@ -280,6 +284,7 @@ This software is licensed under the [MIT license] [mit].
[mapleader]: http://vimdoc.sourceforge.net/htmldoc/map.html#mapleader
[mit]: http://en.wikipedia.org/wiki/MIT_License
[modeline]: http://vimdoc.sourceforge.net/htmldoc/options.html#modeline
+[pathogen]: http://www.vim.org/scripts/script.php?script_id=2332
[python]: http://python.org/
[shell]: http://www.vim.org/scripts/script.php?script_id=3123
[slate]: http://code.google.com/p/vim/source/browse/runtime/colors/slate.vim
View
19 autoload/xolox/notes.vim
@@ -1,12 +1,12 @@
" Vim auto-load script
" Author: Peter Odding <peter@peterodding.com>
-" Last Change: January 18, 2012
+" Last Change: April 18, 2013
" URL: http://peterodding.com/code/vim/notes/
" 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.16.17'
+let g:xolox#notes#version = '0.17'
let s:scriptdir = expand('<sfile>:p:h')
function! xolox#notes#init() " {{{1
@@ -28,6 +28,7 @@ function! xolox#notes#init() " {{{1
if !exists('g:notes_directory')
let g:notes_directory = xolox#misc#path#merge(localdir, 'user')
endif
+ call s:create_notes_directory()
" Define the default location of the shadow directory with predefined notes?
if !exists('g:notes_shadowdir')
let g:notes_shadowdir = xolox#misc#path#merge(systemdir, 'shadow')
@@ -71,6 +72,17 @@ function! xolox#notes#init() " {{{1
endif
endfunction
+function! s:create_notes_directory()
+ let notes_directory = expand(g:notes_directory)
+ if !isdirectory(notes_directory)
+ call xolox#misc#msg#info("notes.vim %s: Creating notes directory (first run?) ..", g:xolox#notes#version)
+ call mkdir(notes_directory, 'p')
+ endif
+ if filewritable(notes_directory) != 2
+ call xolox#misc#msg#warn("notes.vim %s: The notes directory (%s) is not writable!", g:xolox#notes#version, notes_directory)
+ endif
+endfunction
+
function! xolox#notes#shortcut() " {{{1
" The "note:" pseudo protocol is just a shortcut for the :Note command.
let name = matchstr(expand('<afile>'), 'note:\zs.*')
@@ -412,6 +424,7 @@ function! xolox#notes#search(bang, input) " {{{1
endfunction
function! s:tag_under_cursor() " {{{2
+ " Get the word or @tag under the text cursor.
try
let isk_save = &isk
set iskeyword+=@-@
@@ -428,7 +441,7 @@ function! s:match_all_keywords(keywords) " {{{2
return '/' . escape(join(results, '\&'), '/') . '/'
endfunction
-function! s:match_any_keyword(keywords)
+function! s:match_any_keyword(keywords) " {{{2
" Create a regex that matches every occurrence of all {keywords}.
let results = copy(a:keywords)
call map(results, 'xolox#misc#escape#pattern(v:val)')
View
37 doc/notes.txt
@@ -141,7 +141,17 @@ 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.
+path of this directory. The default value depends on circumstances but should
+work for most people:
+
+ - If the profile directory where the plug-in is installed is writable, the
+ directory 'misc/notes/user' under the profile directory is used. This is
+ for compatibility with Pathogen [6]; the notes will be stored inside the
+ plug-in's bundle.
+
+ - If the above doesn't work out, the default depends on the platform:
+ '~/vimfiles/misc/notes/user' on Windows and '~/.vim/misc/notes/user' on
+ other platforms.
-------------------------------------------------------------------------------
The *g:notes_suffix* option
@@ -516,14 +526,14 @@ Other plug-ins that work well with the notes plug-in ~
*notes-utl.vim*
utl.vim ~
-The utl.vim [6] universal text linking plug-in enables links between your
+The utl.vim [7] universal text linking plug-in enables links between your
notes, other local files and remote resources like web pages.
-------------------------------------------------------------------------------
*notes-shell.vim*
shell.vim ~
-My shell.vim [7] plug-in also enables easy navigation between your notes and
+My shell.vim [8] plug-in also enables easy navigation between your notes and
environment like local files and directories, web pages and e-mail addresses
by providing key mappings and commands to e.g. open the file/URL under the
text cursor. This plug-in can also change Vim to full screen which can be
@@ -533,7 +543,7 @@ really nice for large notes.
*notes-voom*
VOoM ~
-The VOoM [8] outlining plug-in should work well for notes if you use the
+The VOoM [9] outlining plug-in should work well for notes if you use the
Markdown style headers starting with '#', however it has been reported that
this combination may not always work so well in practice (sometimes losing
notes!)
@@ -543,7 +553,7 @@ notes!)
Txtfmt ~
If the text formatting supported by the notes plug-in is not enough for you,
-consider trying the Txtfmt [9] (The Vim Highlighter) plug-in. To use the two
+consider trying the Txtfmt [10] (The Vim Highlighter) plug-in. To use the two
plug-ins together, create the file 'after/ftplugin/notes.vim' inside your Vim
profile with the following contents:
>
@@ -557,13 +567,13 @@ Contact ~
If you have questions, bug reports, suggestions, etc. the author can be
contacted at peter@peterodding.com. The latest version is available at
http://peterodding.com/code/vim/notes/ and http://github.com/xolox/vim-notes.
-If you like the script please vote for it on Vim Online [10].
+If you like the script please vote for it on Vim Online [11].
===============================================================================
*notes-license*
License ~
-This software is licensed under the MIT license [11]. Copyright 2011 Peter
+This software is licensed under the MIT license [12]. Copyright 2013 Peter
Odding <peter@peterodding.com>.
===============================================================================
@@ -575,11 +585,12 @@ References ~
[3] http://code.google.com/p/vim/source/browse/runtime/colors/slate.vim
[4] http://peterodding.com/code/vim/notes/syntax.png
[5] http://peterodding.com/code/vim/downloads/notes.zip
-[6] http://www.vim.org/scripts/script.php?script_id=293
-[7] http://www.vim.org/scripts/script.php?script_id=3123
-[8] http://www.vim.org/scripts/script.php?script_id=2657
-[9] http://www.vim.org/scripts/script.php?script_id=2208
-[10] http://www.vim.org/scripts/script.php?script_id=3375
-[11] http://en.wikipedia.org/wiki/MIT_License
+[6] http://www.vim.org/scripts/script.php?script_id=2332
+[7] http://www.vim.org/scripts/script.php?script_id=293
+[8] http://www.vim.org/scripts/script.php?script_id=3123
+[9] http://www.vim.org/scripts/script.php?script_id=2657
+[10] http://www.vim.org/scripts/script.php?script_id=2208
+[11] http://www.vim.org/scripts/script.php?script_id=3375
+[12] http://en.wikipedia.org/wiki/MIT_License
vim: ft=help
View
4 misc/notes/user/README
@@ -1,4 +0,0 @@
-README
-
-Your notes will be stored in this directory by default.
-Feel free to delete this file if you don't want to see it again.
Please sign in to comment.
Something went wrong with that request. Please try again.