Friday, 12 April 2013

Use VIM to make notes [markdown]

Sometimes you will face a situation that you want to write down some notes, but you can not have a suitable tool on handle. For example, you only have VIM to edit and don't have the "Notes" like Evernote, OneNote etc. So how can you make writing down a note easy? Here's one solution: VIM + Voom + markdown syntax highlight

Source file of this post is reference to markdown.mkd, One screen show:

 

Markdown

Markdown is intended to be as easy-to-read and easy-to-write as is feasible. Markdown’s syntax is intended for one purpose: to be used as a format for writing for the web.
Reference: <http://daringfireball.net/projects/markdown/syntax>

Syntax

Header

Two types of header: Setext and atx
  • Setext
    = for 1st level
    • for 2nd level
  • atx
    # for H1
    ## for H2
    ### for H3
    #### for H4
    ##### for H5
    ###### for H6

Block Quotes

  • Use the > for each line or only > for each paragraph
Quote Block or
  • can be nested
Quote
Block

Bullets

  • *, - and + all do the same

Numbering

  1. 1 Use the number
  2. 2
  3. 3

Codeblocks

Indent with 4 spaces or one tab. C Example: for(i = 0; i \< 5; i++) { printf("%d\n", i); }

Horizontal Rules

  • three or more (*, -, or _)



Links

Emphasis

Text wrapped in * and _
  • Markdown is very helpful to make notes
  • Markdown is very helpful to make notes

Code

Wrap the code with backtick quotes (`) * printf() function will print on the stardard output 0

Special characters

The special characters (\, `, *, _, -, {}, ], (), #, +, ., !) can be inputted by a prefix backslash \

Markdown syntax highlight

Installation

  • It's very easy to install it. Just download the latest the markdown-.vba.gz, then
    $ vim makedown-.vba.gz +":so %"
    Reference: http://www.vim.org/scripts/script.php?script_id=2882
  • Make sure the syntax highlight is on and can be set in .vimrc syntax on filetype on

Usage

Just create a new file with extension 'mkd', for example $ vim hello.mkd

Voom - Two-pane outliner

Installation

Usage

  • Load the markdown format file, such as hello.mkd
  • Open Voom markdown markup formats within VIM : Voom markdown

Markups supported

Voom can support a variety of markups - fmr, fmr1, fmr2 -- start fold markers with levels (variations of the default mode);
- wiki -- MediaWiki, headlines are surrounded by '=';
- vimwiki -- vimwiki plugin (vimscript #2226);
- viki -- Viki/Deplate plugin (vimscript #861);
- org -- Emacs Org-mode;
- rest -- reStructuredText section titles;
- markdown -- Markdown headers, both Setext-style and Atx-style;
- hashes -- #, ##, ###, etc. (Atx-style headers, a subset of Markdown format);
- txt2tags -- txt2tags titles and numbered titles;
- asciidoc -- AsciiDoc document and section titles, both styles;
- latex -- LaTeX sectioning and some other commands;
- taskpaper -- TaskPaper (vimscript #2027);
- thevimoutliner -- The Vim Outliner plugin (vimscript #517);
- vimoutliner -- VimOutliner plugin (vimscript #3515);
- cwiki -- vimscript #2176;
- html -- HTML heading tags, single line only;
- python -- Python code browser, blocks between 'class' and 'def' are also nodes.

Convert to html

Installation of python-markdown

  • MAC OS: $ sudo easy_install Markdown

Command line

$ markdown_py -f hello.html hello.mkd
Notes: two spaces in the end of line means EOL

No comments :

Post a Comment