1 *notes.txt* Easy note taking in Vim
3 The notes.vim plug-in for the Vim text editor makes it easy to manage your
6 - Starting a new note: Execute the |:Note| command to create a new buffer and
7 load the appropriate file type and syntax
9 - You can also start a new note with the selected text as title using the
10 |:NoteFromSelectedText| command
12 - Saving notes: Just use Vim's |:write| and |:update| commands, you don't need to
13 provide a filename because it will be set based on the title (first line)
14 of your note (you also don't need to worry about special characters,
17 - Editing existing notes: Execute ':Note anything' to edit a note containing
18 'anything' in its title (if no notes are found a new one is created with
19 its title set to 'anything')
21 - Deleting notes: The |:DeleteNote| command enables you to delete the current
24 - Searching notes: ':SearchNotes keyword …' searches for keywords and
25 ':SearchNotes /pattern/' searches for regular expressions
27 - Smart defaults: Without an argument |:SearchNotes| searches for the word
28 under the cursor (if the word starts with '@' that character will be
29 included in the search, this means you can easily search for @tagged notes)
31 - Back-references: The |:RelatedNotes| command find all notes referencing the
34 - A Python 2 [1] script is included that accelerates keyword searches using an
37 - The |:RecentNotes| command lists your notes by modification date, starting
38 with the most recently edited note
40 - Navigating between notes: The included file type plug-in redefines |gf| to
41 jump between notes and the syntax script highlights note names as hyper
44 - Writing aids: The included file type plug-in contains mappings for automatic
45 curly quotes, arrows and list bullets and supports completion of note
46 titles using Control-X Control-U and completion of tags using Control-X
49 - Embedded file types: The included syntax script supports embedded
50 highlighting using blocks marked with '{{{type … }}}' which allows you to
51 embed highlighted code and configuration snippets in your notes
53 Here's a screen shot of the syntax mode using the slate [3] color scheme:
55 Syntax mode screen shot, see reference [4]
57 ===============================================================================
61 Unzip the most recent ZIP archive [5] file inside your Vim profile directory
62 (usually this is '~/.vim' on UNIX and '%USERPROFILE%\vimfiles' on Windows),
63 restart Vim and execute the command ':helptags ~/.vim/doc' (use ':helptags
64 ~\vimfiles\doc' instead on Windows). To get started execute |:Note| or ':edit
65 note:', this will start a new note that contains instructions on how to
66 continue from there (and how to use the plug-in in general).
68 ===============================================================================
72 All options have reasonable defaults so if the plug-in works after
73 installation you don't need to change any options. They're available for
74 people who like to customize their directory layout. These options can be
75 configured in your |vimrc| by including a line like this:
77 let g:notes_directory = '~/Documents/Notes'
79 -------------------------------------------------------------------------------
80 The *g:notes_directory* option
82 All your notes are stored together in one directory. This option defines the
83 path of this directory.
85 -------------------------------------------------------------------------------
86 The *g:notes_suffix* option
88 The suffix to add to generated filenames. The plug-in generates filenames for
89 your notes based on the title (first line) of each note and by default these
90 filenames don't include an extension like '.txt'. You can use this option to
91 make the plug-in automatically append an extension without having to embed the
92 extension in the note's title, e.g.:
94 :let g:notes_suffix = '.txt'
96 -------------------------------------------------------------------------------
97 The *g:notes_shadowdir* option
99 The notes plug-in comes with some default notes containing documentation about
100 the plug-in. This option defines the path of the directory containing these
103 -------------------------------------------------------------------------------
104 The *g:notes_indexfile* option
106 This option defines the pathname of the optional keyword index used by the
107 |:SearchNotes| to perform accelerated keyword searching.
109 -------------------------------------------------------------------------------
110 The *g:notes_indexscript* option
112 This option defines the pathname of the Python script that's used to perform
113 accelerated keyword searching with |:SearchNotes|.
115 -------------------------------------------------------------------------------
116 The *g:notes_tagsindex* option
118 This option defines the pathname of the text file that stores the list of
119 known tags used for tag name completion and the |:ShowTaggedNotes| command.
120 The text file is created automatically when it's first needed, after that you
121 can recreate it manually by executing |:IndexTaggedNotes| (see below).
123 ===============================================================================
127 To edit one of your existing notes you can use Vim commands such as |:edit|,
128 |:split| and |:tabedit| with a filename that starts with note: followed by (part
129 of) the title of one of your notes, e.g.:
133 This shortcut also works from the command line:
137 When you don't follow note: with anything a new note is created.
139 -------------------------------------------------------------------------------
142 When executed without any arguments this command starts a new note in the
143 current window. If you pass one or more arguments the command will edit an
144 existing note containing the given words in the title. If more than one note
145 is found you'll be asked which note you want to edit. If no notes are found a
146 new note is started with the given word(s) as title.
148 This command will fail when changes have been made to the current buffer,
149 unless you use ':Note!' which discards any changes.
151 This command supports tab completion: If you complete one word, all existing
152 notes containing the given word somewhere in their title are suggested. If you
153 type more than one word separated by spaces, the plug-in will complete only
154 the missing words so that the resulting command line contains the complete
155 note title and nothing more.
157 -------------------------------------------------------------------------------
158 The *:NoteFromSelectedText* command
160 When you execute this command it will start a new note with the selected text
161 as the title of the note.
163 -------------------------------------------------------------------------------
164 The *:DeleteNote* command
166 The |:DeleteNote| command deletes a note file, destroys the buffer and removes
167 the note from the internal cache of filenames and note titles. If you pass a
168 note name as an argument to |:DeleteNote| it will delete the given note,
169 otherwise it will delete the current note. This fails when changes have been
170 made to the buffer, unless you use ':DeleteNote!' which discards any changes.
172 -------------------------------------------------------------------------------
173 The *:SearchNotes* command
175 This command wraps |:vimgrep| and enables you to search through your notes using
176 one or more keywords or a regular expression pattern. To search for a pattern
177 you pass a single argument that starts/ends with a slash:
179 :SearchNotes /TODO\|FIXME\|XXX/
181 To search for one or more keywords you can just omit the slashes, this matches
182 notes containing all of the given keywords:
184 :SearchNotes syntax highlighting
186 -------------------------------------------------------------------------------
187 *:searchnotes-understands-tags*
188 |:SearchNotes| understands @tags ~
190 If you don't pass any arguments to the |:SearchNotes| command it will search
191 for the word under the cursor. If the word under the cursor starts with '@'
192 this character will be included in the search, which makes it possible to
193 easily add @tags to your @notes and then search for those tags. To make
194 searching for tags even easier you can create key mappings for the
195 |:SearchNotes| command:
197 " Make the C-] combination search for @tags:
198 imap <C-]> <C-o>:SearchNotes<CR>
199 nmap <C-]> :SearchNotes<CR>
201 " Make double mouse click search for @tags. This is actually quite a lot of
202 " fun if you don't use the mouse for text selections anyway; you can click
203 " between notes as if you're in a web browser:
204 imap <2-LeftMouse> <C-o>:SearchNotes<CR>
205 nmap <2-LeftMouse> :SearchNotes<CR>
207 These mappings are currently not enabled by default because they conflict with
208 already useful key mappings, but if you have any suggestions for alternatives
209 feel free to contact me through GitHub or at peter@peterodding.com.
211 -------------------------------------------------------------------------------
212 Accelerated searching with Python and SQLite ~
214 After collecting a fair amount of notes (say more than 5 MB) you will probably
215 start to get annoyed at how long it takes Vim to search through all of your
216 notes. To make searching more scalable the notes plug-in includes a Python
217 script which uses a full text index of your notes stored in an SQLite
220 The first time the Python script is run it will need to build the complete
221 index which can take a few minutes, but after the index has been initialized
222 updates and searches should be more or less instantaneous.
224 -------------------------------------------------------------------------------
225 The *:RelatedNotes* command
227 This command makes it easy to find all notes related to the current file: If
228 you are currently editing a note then a search for the note's title is done,
229 otherwise this searches for the absolute path of the current file.
231 -------------------------------------------------------------------------------
232 The *:RecentNotes* command
234 If you execute the |:RecentNotes| command it will open a Vim buffer that lists
235 all your notes grouped by the day they were edited, starting with your most
236 recently edited note. If you pass an argument to |:RecentNotes| it will filter
237 the list of notes by matching the title of each note against the argument
238 which is interpreted as a Vim pattern.
240 -------------------------------------------------------------------------------
241 The *:ShowTaggedNotes* command
243 To show a list of all notes that contains @tags@ you can use the
244 |:ShowTaggedNotes| command. If you pass a count to this command it will limit
245 the list of tags to those that have been used at least this many times. For
246 example the following two commands show tags that have been used at least ten
252 -------------------------------------------------------------------------------
253 The *:IndexTaggedNotes* command
255 The notes plug-in defines an omni completion function that can be used to
256 complete the names of tags. To trigger the omni completion you type Control-X
257 Control-O. When you type '@' in insert mode the plug-in will automatically
258 start omni completion.
260 The completion menu is populated from a text file listing all your tags, one
261 on each line. The first time omni completion triggers, an index of tag names
262 is generated and saved to the location set by |g:notes_tagsindex|. After this
263 file is created, it will be updated automatically as you edit notes and
266 If for any reason you want to recreate the list of tags you can execute the
267 |:IndexTaggedNotes| command.
269 ===============================================================================
270 Other plug-ins that work well with the notes plug-in ~
272 - The utl.vim [6] universal text linking plug-in enables links between your
273 notes, other local files and remote resources like web pages
275 - My shell.vim [7] plug-in also enables easy navigation between your notes and
276 environment like local files and directories, web pages and e-mail
279 - The VOoM [8] outlining plug-in should work well for notes if you use the
280 Markdown style headers starting with '#', however it has been reported that
281 this combination may not always work so well in practice (sometimes losing
284 ===============================================================================
288 If you have questions, bug reports, suggestions, etc. the author can be
289 contacted at peter@peterodding.com. The latest version is available at
290 http://peterodding.com/code/vim/notes/ and http://github.com/xolox/vim-notes.
291 If you like the script please vote for it on Vim Online [9].
293 ===============================================================================
297 This software is licensed under the MIT license [10]. Copyright 2011 Peter
298 Odding <peter@peterodding.com>.
300 ===============================================================================
304 [1] http://python.org/
305 [2] http://sqlite.org/
306 [3] http://code.google.com/p/vim/source/browse/runtime/colors/slate.vim
307 [4] http://peterodding.com/code/vim/notes/syntax.png
308 [5] http://peterodding.com/code/vim/downloads/notes.zip
309 [6] http://www.vim.org/scripts/script.php?script_id=293
310 [7] http://www.vim.org/scripts/script.php?script_id=3123
311 [8] http://www.vim.org/scripts/script.php?script_id=2657
312 [9] http://www.vim.org/scripts/script.php?script_id=3375
313 [10] http://en.wikipedia.org/wiki/MIT_License