58 Commits

Author SHA1 Message Date
Rane Brown 99dc186df0 Possible fix for #642.
When using a custom Wiki2HTML on Windows the normalized paths caused the
closing quote to be escaped and not pass the correct arguments to the
system call. This fix removes the trailing slash for Windows while
leaving the default behavior the same.
2019-03-28 22:56:01 -06:00
Greg Anders e56c26c7ba Add an option to conceal preformatted text blocks
This merges PR #641.
2019-03-28 14:50:25 -07:00
Rane Brown f5cf991115 Merge pull request #634 from sstallion/sstallion/headers
Adjust generated header behavior for TOC, links, tags, and diary (oh my!)
2019-03-26 11:57:24 -06:00
Steven Stallion 6c2f9f999d Adjust generated header behavior for TOC, etc. 2019-03-26 12:03:09 -05:00
Rane Brown cdc9940887 Fix spelling per comment in #637 2019-03-25 08:44:59 -06:00
Rane Brown a013e8b1b5 Merge pull request #637 from tinmarino/dev
Add option : g:vimwiki_table_reduce_last_col to not expand the last column of a table.
2019-03-24 21:40:27 -06:00
tinmarino dfccfb1951 Add option : g:vimwiki_table_reduce_last_col. Used to not expand table last cells in order to avoid large, useless wraps 2019-03-23 11:23:58 -03:00
Rane Brown 32c7f289b7 Fix missing 'T' in syntax definition of VimwikiDelTextT
The missing 'T' character was causing strikethrough ~ characters to be
hidden within tables which is not the desired behavior. Closes #404.
2019-03-21 22:26:42 -06:00
Michael F. Schönitzer ae365a8b8f Merge branch 'master' into dev 2019-03-21 23:21:32 +01:00
Eric Langlois 8f5d38365b Added optional extra caption levels to diary index.
Added the option 'diary_caption_level', which controls the presence of
captions in the diary index linking to headers within the diary pages.

Possible values:
-1:  No headers are read from the diary page.
 0:  The first header from the diary page is used as the caption.
       There are no sub-captions.
 1:  Captions are created for headers of level 1 in the diary page.
 2:  Captions are created for headers up to level 2 in the diary page.
 etc.

When the value is >= 1, the primary caption of each diary page is set to
the first header read from that page if it is the unique lowest-level
header.
2019-03-20 14:09:57 -07:00
Rane Brown 7d82c7541d Merge pull request #529 from sstallion/sstallion/markdown_link_ext
Add support for Markdown link extensions!!!
2019-03-19 21:54:32 -06:00
Samir Benmendil 9964026586 Don't override existing mappings 2019-03-19 22:03:50 +00:00
Steven Stallion eb00d30d9b Initial commit 2019-03-19 10:33:08 -05:00
Rane Brown c8d09d7c9e Merge pull request #629 from gpanders/dev
Allow customization of header level of TOC
2019-03-18 17:20:30 -06:00
Лёха e0f4ab8c5e Revert implementation of function s:get_cell_aligns()
This commit reverses a change to s:get_cell_aligns introduced by
bdcfca1e5c.
2019-03-18 14:43:43 -07:00
Steven Stallion ad8e1d30bf Add g:vimwiki_create_link option to prevent link creation.
Adds a new global option named create_link, which allows the user to
control :VimwikiFollowLink behavior when attempting to follow a
non-existent link. The original behavior of creating a new link is
preserved. However, by setting this option to 0, new links will not be
created when pressing return over regular text. Closes #528.
2019-03-18 14:37:12 -07:00
Henry Qin c4b21b498e Convert DesignNotes to Markdown to fix display in GitHub. 2019-03-18 11:46:52 -07:00
Henry Qin bdcfca1e5c Merge branch 'lyokha-dev' into dev. Closes #47.
This PR optimizes large table reformatting to only look at a subset of
rows.
2019-03-18 11:33:11 -07:00
lyokha ad6a3bceb6 the cause of the linear slowing down was fixed 2019-03-18 17:49:13 +03:00
lyokha 1f4fb8ca58 notes on the newer table formatting algorithm 2019-03-18 16:02:52 +03:00
lyokha 0c82d9dcb8 Merge remote-tracking branch 'upstream/dev' into dev 2019-03-18 13:13:30 +03:00
Henry Qin efcc3f1fa5 Merge branch 'wiki-path' into 'dev'. Closes #573.
Introduce a `%wiki_path%` variable which can be used in HTML template
files to output the path of the wiki file being converted to HTML.
2019-03-17 18:19:49 -07:00
Henry Qin e6d6830db7 Merge branch 'colorcodes' into 'dev'. Closes PR #616.
This colors all CSS color codes found alone in inline code blocks to the
color they mention.
2019-03-17 18:09:06 -07:00
Hugo Hörnquist da52523710 Add documentation for colorcodes. 2019-03-17 22:50:56 +01:00
Hugo Hörnquist 2f87f92060 Better foreground for colorcodes. 2019-03-17 22:40:34 +01:00
Hugo Hörnquist 6f687aff52 Move location of %wiki_path% documentation. 2019-03-17 22:22:55 +01:00
Henry Qin 8941508e35 Allow AddHeaderLevel and RemoveHeaderLevel to take counts 2019-03-17 10:43:42 -07:00
Henry Qin b4c9a4f028 Add DesignNotes.wiki, a place for internal documentation 2019-03-17 10:43:12 -07:00
lyokha 88a6820e9e updated for the new aligns feature 2019-03-15 16:07:52 +03:00
Alexey Radkov fa6342c454 Merge branch 'dev' into dev 2019-03-15 15:38:22 +03:00
lyokha 5e4a89c898 faster table format on InsertLeave; faster s:get_rows() 2019-03-15 15:31:28 +03:00
Rane f40f054441 Merge branch 'md_bold_italics' into dev
This fixes Markdown syntax for bold, italic, and bold_italic. With these
changes **bold** and __bold__, *italic* and _italic_, and
***bold_italic*** and ___italic_bold___ are shown correctly.
This closes #23, closes #189, closes #318, and closes #576.
2019-03-15 06:25:01 -06:00
Rane 1f1966a4f6 Add description of markdown specific text decorators 2019-03-15 06:12:35 -06:00
Henry Qin abd12d4479 Merge PR #377 from https://github.com/schmeisers/vimwiki 2019-03-14 18:08:27 -07:00
Rane 6b29b6604c Fix bold_italic and italic_bold markdown syntax. 2019-03-14 15:21:04 -06:00
Rane e26d9fdb8e Fix bold and italic markdown syntax 2019-03-14 14:03:42 -06:00
Greg Anders bb40826def Allow customization of header level of TOC
Instead of forcing the TOC to always be at header level 1, allow the
user to specify via the option g:vimwiki_toc_header_level what level
they want.

This defaults to 1, so if the user does nothing then the old behavior
will remain the same.
2019-03-14 08:34:52 -06:00
lyokha 07ba7339f1 added docs about new commands gq1 and gw1 2019-03-14 14:44:08 +03:00
lyokha 30c0bdffaa synced README.md with the remote dev branch (3) 2019-03-14 14:25:35 +03:00
lyokha 7e176c659b synced README.md with the remote dev branch (2) 2019-03-14 14:24:13 +03:00
lyokha bfbfa2783e synced README.md with the remote dev branch 2019-03-14 14:21:28 +03:00
Alexey Radkov af8cdc4d62 Merge branch 'dev' into dev 2019-03-14 14:09:30 +03:00
lyokha a74e0821b0 resolved conflicts in tbl.vim 2019-03-14 13:36:51 +03:00
Hugo Hörnquist 08ec02a755 Alternative where text color is inverse of background. 2019-02-19 21:04:57 +01:00
Hugo Hörnquist 21f5069e48 Code-blocks auto-color. 2019-02-19 20:45:10 +01:00
Hugo Hörnquist 6f7e40ff78 Add short documentation for %wiki_path%. 2018-10-21 20:50:16 +02:00
Hugo Hörnquist 28727b3971 Add %wiki_path% template variable. 2018-10-11 14:25:55 +02:00
Steven Schmeiser 10f502a698 table align - catch up to dev 2018-07-09 13:51:18 -04:00
Steven Schmeiser 23d273d547 table alignment: break out of loop when separator found 2018-07-09 10:05:30 -04:00
Steven Schmeiser 7730fa28b5 add horizontal alignment to table documentation 2017-08-17 10:22:27 -04:00
Steven Schmeiser f384aa6d1e add horizontal alignment to tables 2017-08-17 10:22:09 -04:00
Alexey Radkov 920f41b318 fixed get_cells() FSM and gqq command
- get_cells() FSM correctly treats unclosed quotes now,
- fixed gqq command: now it aligns all the table
- proposed 'fast' variant of gqq: gq1 that aligns current + 2 above rows
2014-05-09 12:47:21 +04:00
Alexey Radkov 72ad6d1b16 minor stylistic change 2014-05-04 20:46:00 +04:00
Alexey Radkov 4d1bb91dbe small fix in s:get_aligned_rows() 2014-05-04 18:42:00 +04:00
Alexey Radkov cd25233cc8 fast <Tab> and <S-Tab> in Insert mode
this also fixes Tab navigation in a new added line
2014-05-04 17:09:42 +04:00
Alexey Radkov b79977d6b8 further large table optimizations
1. s:get_aligned_rows(): getting 2 last rows is enough for having been
   formatted tables
2. vimwiki#tbl#get_cells(): using faster strpart() instead concatenating
   every new character into variables cell and quote
3. checking by getline() whether the line was changed before setline()
   does matter on slower computers
2014-05-04 15:46:19 +04:00
Alexey Radkov 411d8da0a4 Merge remote-tracking branch 'upstream/dev' into dev 2014-05-04 15:25:38 +04:00
Alexey Radkov 0559bf8aed Merge remote-tracking branch 'upstream/master' into dev 2014-05-04 15:23:45 +04:00
19 changed files with 1071 additions and 431 deletions
+2 -10
View File
@@ -6,21 +6,13 @@ https://github.com/vimwiki/vimwiki/tree/dev to see if your problem is already fi
Issues can be filed at https://github.com/vimwiki/vimwiki/issues/ .
# Creating a pull request
If you want to provide a pull request on GitHub, please start from the `dev` branch, not from the
`master` branch. (Caution, GitHub shows `master` as the default branch from which to start a PR.)
Make sure to update `doc/vimwiki.txt` with the following information:
1. Update the changelog to include information on the new feature the PR introduces or the bug it
is fixing.
2. Add a help section to describe any new features or options.
2. If you are a first time contributor add your name to the list of contributors.
# More info and advice for (aspiring) core developers
- Before implementing a non-trivial feature, think twice what it means for the user. We should
always try to keep backward compatibility. If you are not sure, discuss it on GitHub.
always try to keep backward compatiblility. If you are not sure, discuss it on GitHub.
- Also, when thinking about adding a new feature, it should be something which fits into the
overall design of Vimwiki and which a significant portion of the users may like. Keep in mind
that everybody has their own way to use Vimwiki.
@@ -29,7 +21,6 @@ Make sure to update `doc/vimwiki.txt` with the following information:
setups. Take a little time to think about under which circumstances your changes could break.
## Git branching model
- there are two branches with eternal lifetime:
- `dev`: This is where the main development happens. Tasks which are done in one or only a few
commits go here directly. Always try to keep this branch in a working state, that is, if the
@@ -60,4 +51,5 @@ Make sure to update `doc/vimwiki.txt` with the following information:
forget this plan.
11. Tell the world.
%% vim:tw=99
+186
View File
@@ -0,0 +1,186 @@
# Design Notes
This file is meant to document design decisions and algorithms inside vimwiki
which are too large for code comments, and not necessarily interesting to
users. Please create a new section to document each behavior.
## Formatting tables
In vimwiki, formatting tables occurs dynamically, when navigating between cells
and adding new rows in a table in the Insert mode, or statically, when pressing
`gqq` or `gqw` (which are mappings for commands `VimwikiTableAlignQ` and
`VimwikiTableAlignW` respectively) in the Normal mode. It also triggers when
leaving Insert mode, provided variable `g:vimwiki_table_auto_fmt` is set. In
this section, the original and the newer optimized algorithms of table
formatting will be described and compared.
### The older table formatting algorithm and why this is not optimal
Let's consider a simple example. Open a new file, say _tmp.wiki_, and create a
new table with command `VimwikiTable`. This should create a blank table.
```
| | | | | |
|---|---|---|---|---|
| | | | | |
```
Let's put the cursor in the first header column of the table, enter the Insert
mode and type a name, say _Col1_. Then press _Tab_: the cursor will move to the
second column of the header and the table will get aligned (in the context of
the table formatting story, words _aligned_ and _formatted_ are considered as
synonyms). Now the table looks as in the following snippet.
```
| Col1 | | | | |
|------|---|---|---|---|
| | | | | |
```
Then, when moving cursor to the first data row (i.e. to the third line of the
table below the separator line) and typing anything here and there while
navigating using _Tab_ or _Enter_ (pressing this creates a new row below the
current row), the table shall keep formatting. Below is a result of such a
random edit.
```
| Col1 | | | | |
|------|-------|---|-------|----------|
| | Data1 | | Data2 | |
| | | | | New data |
```
The lowest row gets aligned when leaving the Insert mode. Let's copy _Data1_
(using `viwy` or another keystroke) and paste it (using `p`) in the second data
row of the first column. Now the table looks mis-aligned (as we did not enter
the Insert mode).
```
| Col1 | | | | |
|------|-------|---|-------|----------|
| | Data1 | | Data2 | |
| Data1 | | | | New data |
```
This is not a big problem though, because we can put the cursor at _any_ place
in the table and press `gqq`: the table will get aligned.
```
| Col1 | | | | |
|-------|-------|---|-------|----------|
| | Data1 | | Data2 | |
| Data1 | | | | New data |
```
Now let's make real problems! Move the cursor to the lowest row and copy it
with `yy`. Then 500-fold paste it with `500p`. Now the table very long. Move
the cursor to the lowest row (by pressing `G`), enter the Insert mode, and try
a new random editing session by typing anything in cells with _Tab_ and _Enter_
navigation interleaves. The editing got painfully slow, did not?
The reason of the slowing down is the older table formatting algorithm. Every
time _Tab_ or _Enter_ get pressed down, all rows in the table get visited to
calculate a new alignment. Moreover, by design it may happen even more than
once per one press!
```vim
function! s:kbd_create_new_row(cols, goto_first)
let cmd = "\<ESC>o".s:create_empty_row(a:cols)
let cmd .= "\<ESC>:call vimwiki#tbl#format(line('.'))\<CR>"
let cmd .= "\<ESC>0"
if a:goto_first
let cmd .= ":call search('\\(".s:rxSep()."\\)\\zs', 'c', line('.'))\<CR>"
else
let cmd .= (col('.')-1)."l"
let cmd .= ":call search('\\(".s:rxSep()."\\)\\zs', 'bc', line('.'))\<CR>"
endif
let cmd .= "a"
return cmd
endfunction
```
Function `s:kbd_create_new_row()` is called when _Tab_ or _Enter_ get pressed.
Formatting of the whole table happens in function `vimwiki#tbl#format()`. But
remember that leaving the Insert mode triggers re-formatting of a table when
variable `g:vimwiki_table_auto_fmt` is set. This means that formatting of the
whole table is called on all those multiple interleaves between the Insert and
the Normal mode in `s:kbd_create_new_row` (notice `\<ESC>`, `o`, etc.).
### The newer table formating algorithm
The newer algorithm was introduced to struggle against performance issues when
formatting large tables.
Let's take the table from the previous example in an intermediate state.
```
| Col1 | | | | |
|------|-------|---|-------|----------|
| | Data1 | | Data2 | |
| Data1 | | | | New data |
```
Then move the cursor to the first data row, copy it with `yy`, go down to the
mis-aligned line, and press `5p`. Now we have a slightly bigger mis-aligned
table.
```
| Col1 | | | | |
|------|-------|---|-------|----------|
| | Data1 | | Data2 | |
| Data1 | | | | New data |
| | Data1 | | Data2 | |
| | Data1 | | Data2 | |
| | Data1 | | Data2 | |
| | Data1 | | Data2 | |
| | Data1 | | Data2 | |
```
Go down to the lowest, the 7th, data row and press `gq1`. Nothing happened.
Let's go to the second or the third data row and press `gq1` once again. Now
the table gets aligned. Let's undo formatting with `u`, go to the fourth row,
and press `gq1`. Now the table should look like in the following snippet.
```
| Col1 | | | | |
|------|-------|---|-------|----------|
| | Data1 | | Data2 | |
| Data1 | | | | New data |
| | Data1 | | Data2 | |
| | Data1 | | Data2 | |
| | Data1 | | Data2 | |
| | Data1 | | Data2 | |
| | Data1 | | Data2 | |
```
What a peculiar command! Does using it make any sense? Not much, honestly.
Except it shows how the newer optimized table formatting algorithm works in the
Insert mode.
Indeed, the newer table formatting algorithm introduces a _viewport_ on a table.
Now, when pressing _Tab_ or _Enter_ in the Insert mode, only a small part of
rows are checked for possible formatting: two rows above the current line and
the current line itself (the latter gets preliminary shrunk with function
`s:fmt_row()`). If all three lines in the viewport are of the same length, then
nothing happens (case 1 in the example). If the second or the shrunk current
line is longer then the topmost line in the viewport, then the algorithm falls
back to the older formatting algorithm and the whole table gets aligned
(case 2). If the topmost line in the viewport is longer than the second
and the shrunk current line, then the two lowest lines get aligned according to
the topmost line (case 3).
Performance of the newer formatting algorithm should not depend on the height
of the table. The newer algorithm should also be consistent with respect to
user editing experience. Indeed, as soon as a table should normally be edited
row by row from the top to the bottom, dynamic formatting should be both fast
(watching only three rows in a table, re-formatting only when the shrunk
current row gets longer than any of the two rows above) and eager (a table
should look formatted on every press on _Tab_ and _Enter_). However, the newer
algorithm differs from the older algorithm when starting editing a mis-aligned
table in an area where mis-aligned rows do not get into the viewport: in this
case the newer algorithm will format the table partly (in the rows of the
viewport) until one of the being edited cells grows in length to a value big
enough to trigger the older algorithm and the whole table gets aligned. When
partial formatting is not desirable, the whole table can be formatted by
pressing `gqq` in the Normal mode.
View File
+124 -186
View File
@@ -1,180 +1,90 @@
# VimWiki: A Personal Wiki For Vim
A Personal Wiki For Vim
==============================================================================
[中文](README-cn.md)
- [Intro](#intro)
- [Installation](#installation)
- [Prerequisites](#prerequisites)
- [VIM Packages](#installation-using-vim-packages-since-vim-741528)
- [Pathogen](#installation-using-pathogen)
- [Vim-Plug](#installation-using-vim-plug)
- [Vundle](#installation-using-vundle)
- [Basic Markup](#basic-markup)
- [Lists](#lists)
- [Key Bindings](#key-bindings)
- [Commands](#commands)
- [Changing Wiki Syntax](#changing-wiki-syntax)
- [Getting Help](#getting-help)
- [Helping VimWiki](#helping-vimwiki)
- [Wiki](https://github.com/vimwiki/vimwiki/wiki)
- [License](#license)
![screenshot1](doc/screenshot_1.png)
![screenshot2](doc/screenshot_2.png) *
## Intro
Intro
------------------------------------------------------------------------------
VimWiki is a personal wiki for Vim -- a number of linked text files that have
Vimwiki is a personal wiki for Vim -- a number of linked text files that have
their own syntax highlighting.
With VimWiki you can:
With Vimwiki you can:
* Organize notes and ideas
* Manage to-do lists
* Write documentation
* Maintain a diary
* Export everything to HTML
* organize notes and ideas
* manage todo-lists
* write documentation
* maintain a diary
* export everything to HTML
To do a quick start press `<Leader>ww` (this is usually `\ww`) to go to your
index wiki file. By default it is located in `~/vimwiki/index.wiki`.
To do a quick start press `<Leader>ww` (this is usually `\ww`) to go to your index
wiki file. By default it is located in `~/vimwiki/index.wiki`.
Feed it with the following example:
```
= My knowledge base =
* Tasks -- things to be done _yesterday_!!!
* Project Gutenberg -- good books are power.
* Scratchpad -- various temporary stuff.
= My knowledge base =
* Tasks -- things to be done _yesterday_!!!
* Project Gutenberg -- good books are power.
* Scratchpad -- various temporary stuff.
```
Place your cursor on `Tasks` and press Enter to create a link. Once pressed,
`Tasks` will become `[[Tasks]]` -- a VimWiki link. Press Enter again to
open it. Edit the file, save it, and then press Backspace to jump back to your
Place your cursor on `Tasks` and press Enter to create a link. Once pressed,
`Tasks` will become `[[Tasks]]` -- a Vimwiki link. Press Enter again to
open it. Edit the file, save it, and then press Backspace to jump back to your
index.
A VimWiki link can be constructed from more than one word. Just visually
select the words to be linked and press Enter. Try it with `Project Gutenberg`.
A Vimwiki link can be constructed from more than one word. Just visually
select the words to be linked and press Enter. Try it with `Project Gutenberg`.
The result should look something like:
```
= My knowledge base =
* [[Tasks]] -- things to be done _yesterday_!!!
* [[Project Gutenberg]] -- good books are power.
* Scratchpad -- various temporary stuff.
```
## Screenshots
![Lists View](doc/lists.png)
![Entries View](doc/entries.png)
![Todos View](doc/todos.png)
![Wiki View](doc/wiki.png)
## Installation
### Prerequisites
Make sure you have these settings in your vimrc file:
```vim
set nocompatible
filetype plugin on
syntax on
```
Without them VimWiki will not work properly.
= My knowledge base =
* [[Tasks]] -- things to be done _yesterday_!!!
* [[Project Gutenberg]] -- good books are power.
* Scratchpad -- various temporary stuff.
#### Installation using [Vim packages](http://vimhelp.appspot.com/repeat.txt.html#packages) (since Vim 7.4.1528)
Basic Markup
------------------------------------------------------------------------------
```sh
git clone https://github.com/vimwiki/vimwiki.git ~/.vim/pack/plugins/start/vimwiki
```
#### Installation using [Pathogen](http://www.vim.org/scripts/script.php?script_id=2332)
```sh
cd ~/.vim
mkdir bundle
cd bundle
git clone https://github.com/vimwiki/vimwiki.git
```
#### Installation using [Vim-Plug](https://github.com/junegunn/vim-plug)
Add the following to the plugin-configuration in your vimrc:
```vim
Plug 'vimwiki/vimwiki'
```
Then run `:PlugInstall`.
#### Installation using [Vundle](https://github.com/VundleVim/Vundle.vim)
Add `Plugin 'vimwiki/vimwiki'` to your vimrc file and run
```sh
vim +PluginInstall +qall
```
Or download the [zip
archive](https://github.com/vimwiki/vimwiki/archive/master.zip) and extract it
in `~/.vim/bundle/`
Then launch Vim, run `:Helptags` and then `:help vimwiki` to verify it was
installed.
## Basic Markup
```
= Header1 =
== Header2 ==
=== Header3 ===
= Header1 =
== Header2 ==
=== Header3 ===
*bold* -- bold text
_italic_ -- italic text
*bold* -- bold text
_italic_ -- italic text
[[wiki link]] -- wiki link
[[wiki link|description]] -- wiki link with description
```
[[wiki link]] -- wiki link
[[wiki link|description]] -- wiki link with description
### Lists:
```
* bullet list item 1
- bullet list item 2
- bullet list item 3
* bullet list item 4
* bullet list item 5
* bullet list item 6
* bullet list item 7
- bullet list item 8
- bullet list item 9
Lists:
* bullet list item 1
- bullet list item 2
- bullet list item 3
* bullet list item 4
* bullet list item 5
* bullet list item 6
* bullet list item 7
- bullet list item 8
- bullet list item 9
1. numbered list item 1
2. numbered list item 2
a) numbered list item 3
b) numbered list item 4
1. numbered list item 1
2. numbered list item 2
a) numbered list item 3
b) numbered list item 4
```
For other syntax elements, see `:h vimwiki-syntax`
## Key bindings
Normal mode:
Key bindings
------------------------------------------------------------------------------
normal mode:
* `<Leader>ww` -- Open default wiki index file.
* `<Leader>wt` -- Open default wiki index file in a new tab.
@@ -190,61 +100,89 @@ Normal mode:
For more keys, see `:h vimwiki-mappings`
## Commands
* `:VimWiki2HTML` -- Convert current wiki link to HTML
* `:VimWikiAll2HTML` -- Convert all your wiki links to HTML
Commands
------------------------------------------------------------------------------
* `:Vimwiki2HTML` -- Convert current wiki link to HTML
* `:VimwikiAll2HTML` -- Convert all your wiki links to HTML
* `:help vimwiki-commands` -- list all commands
* `:help vimwiki` -- General vimwiki help docs
## Changing Wiki Syntax
VimWiki currently ships with 3 syntaxes: VimWiki (default), Markdown
(markdown), and MediaWiki (media)
Changing Wiki Syntax
------------------------------------------------------------------------------
If you would prefer to use either Markdown or MediaWiki syntaxes, set the
following option in your .vimrc:
Vimwiki currently ships with 3 syntaxes: Vimwiki (default), Markdown (markdown), and MediaWiki (media)
```vim
If you would prefer to use either Markdown or MediaWiki syntaxes, set the following option in your .vimrc:
```
let g:vimwiki_list = [{'path': '~/vimwiki/',
\ 'syntax': 'markdown', 'ext': '.md'}]
```
let g:vimwiki_list = [{'path': '~/vimwiki/',
\ 'syntax': 'markdown', 'ext': '.md'}]
```
Installation
==============================================================================
## Getting help
Prerequisites
------------------------------------------------------------------------------
**Have a question?**
Visit the IRC channel [`#vimwiki`](https://webchat.freenode.net/?channels=#vimwiki) on Freenode ([webchat](https://webchat.freenode.net/?channels=#vimwiki), also synced to Matrix/Riot: `#freenode_#vimwiki:matrix.org`) or post to the [mailing list](https://groups.google.com/forum/#!forum/vimwiki).
Make sure you have these settings in your vimrc file:
## Helping VimWiki
set nocompatible
filetype plugin on
syntax on
VimWiki has a lot of users but only very few recurring developers or people
helping the community. Your help is therefore appreciated. Everyone can help!
See [#625](https://github.com/vimwiki/vimwiki/issues/625) for information on
how you can help.
Without them Vimwiki will not work properly.
## License
MIT License
Installation using [Vim packages](http://vimhelp.appspot.com/repeat.txt.html#packages) (since Vim 7.4.1528)
------------------------------------------------------------------------------
Copyright (c) 2008-2010 Maxim Kim
2013-2017 Daniel Schemala
git clone https://github.com/vimwiki/vimwiki.git ~/.vim/pack/plugins/start/vimwiki
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Installation using [Pathogen](http://www.vim.org/scripts/script.php?script_id=2332)
------------------------------------------------------------------------------
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
cd ~/.vim
mkdir bundle
cd bundle
git clone https://github.com/vimwiki/vimwiki.git
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Installation using [Vim-Plug](https://github.com/junegunn/vim-plug)
------------------------------------------------------------------------------
Add the following to the plugin-configuration in your vimrc:
Plug 'vimwiki/vimwiki'
Then run `:PlugInstall`.
Installation using [Vundle](https://github.com/VundleVim/Vundle.vim)
------------------------------------------------------------------------------
Add `Plugin 'vimwiki/vimwiki'` to your vimrc file and run
vim +PluginInstall +qall
Or download the [zip archive](https://github.com/vimwiki/vimwiki/archive/master.zip) and extract it in `~/.vim/bundle/`
Then launch Vim, run `:Helptags` and then `:help vimwiki` to verify it was installed.
Getting help
==============================================================================
Have a question? Visit the IRC channel `#vimwiki` on Freenode ([webchat](https://webchat.freenode.net/?channels=#vimwiki), also synced to Matrix/Riot: `#freenode_#vimwiki:matrix.org`) or post to the [mailing list](https://groups.google.com/forum/#!forum/vimwiki).
Helping Vimwiki
==============================================================================
Vimwiki has a lot of users but only very few recurring developers or people helping the community. Your help is therefore appreciated. Everyone can help! See [#625](https://github.com/vimwiki/vimwiki/issues/625) for information on how you can help.
----
\* Screenshots made with the [solarized colorscheme](https://github.com/altercation/vim-colors-solarized)
and [lightline](https://github.com/itchyny/lightline.vim)
+96 -23
View File
@@ -9,6 +9,9 @@ endif
let g:loaded_vimwiki_auto = 1
let g:vimwiki_max_scan_for_caption = 5
function! s:safesubstitute(text, search, replace, mode)
" Substitute regexp but do not interpret replace
let escaped = escape(a:replace, '\&')
@@ -197,7 +200,10 @@ function! vimwiki#base#resolve_link(link_text, ...)
\ vimwiki#vars#get_wikilocal('ext', link_infos.index)
endif
else
let link_infos.filename .= vimwiki#vars#get_wikilocal('ext', link_infos.index)
let ext = fnamemodify(link_text, ':e')
if ext == '' " append ext iff one not already present
let link_infos.filename .= vimwiki#vars#get_wikilocal('ext', link_infos.index)
endif
endif
elseif link_infos.scheme ==# 'diary'
@@ -348,17 +354,34 @@ function! vimwiki#base#generate_links()
let bullet = repeat(' ', vimwiki#lst#get_list_margin()) . vimwiki#lst#default_symbol().' '
for link in links
let abs_filepath = vimwiki#path#abs_path_of_link(link)
if !s:is_diary_file(abs_filepath)
call add(lines, bullet.
\ s:safesubstitute(vimwiki#vars#get_global('WikiLinkTemplate1'),
\ '__LinkUrl__', link, ''))
let link_infos = vimwiki#base#resolve_link(link)
if !s:is_diary_file(link_infos.filename)
if vimwiki#vars#get_wikilocal('syntax') == 'markdown'
let link_tpl = vimwiki#vars#get_syntaxlocal('Weblink1Template')
else
let link_tpl = vimwiki#vars#get_global('WikiLinkTemplate1')
endif
let link_caption = vimwiki#base#read_caption(link_infos.filename)
if link_caption == '' " default to link if caption not found
let link_caption = link
endif
let entry = s:safesubstitute(link_tpl, '__LinkUrl__', link, '')
let entry = s:safesubstitute(entry, '__LinkDescription__', link_caption, '')
call add(lines, bullet. entry)
endif
endfor
let links_rx = '\m^\s*'.vimwiki#u#escape(vimwiki#lst#default_symbol()).' '
let links_rx = '\%(^\s*$\)\|\%('.vimwiki#vars#get_syntaxlocal('rxListBullet').'\)'
call vimwiki#base#update_listing_in_buffer(lines, 'Generated Links', links_rx, line('$')+1, 1)
call vimwiki#base#update_listing_in_buffer(
\ lines,
\ vimwiki#vars#get_global('links_header'),
\ links_rx,
\ line('$')+1,
\ vimwiki#vars#get_global('links_header_level'),
\ 1)
endfunction
@@ -598,7 +621,12 @@ function! s:get_links(wikifile, idx)
endif
let syntax = vimwiki#vars#get_wikilocal('syntax', a:idx)
let rx_link = vimwiki#vars#get_syntaxlocal('wikilink', syntax)
if syntax == 'markdown'
let rx_link = vimwiki#vars#get_syntaxlocal('rxWeblink1MatchUrl', syntax)
else
let rx_link = vimwiki#vars#get_syntaxlocal('wikilink', syntax)
endif
let links = []
let lnum = 0
@@ -994,10 +1022,11 @@ function! vimwiki#base#nested_syntax(filetype, start, end, textSnipHl) abort
let group='texMathZoneGroup'
endif
let concealpre = vimwiki#vars#get_global('conceal_pre') ? ' concealends' : ''
execute 'syntax region textSnip'.ft.
\ ' matchgroup='.a:textSnipHl.
\ ' start="'.a:start.'" end="'.a:end.'"'.
\ ' contains=@'.group.' keepend'
\ ' contains=@'.group.' keepend'.concealpre
" A workaround to Issue 115: Nested Perl syntax highlighting differs from
" regular one.
@@ -1015,14 +1044,14 @@ endfunction
" creates or updates auto-generated listings in a wiki file, like TOC, diary
" links, tags list etc.
" - the listing consists of a level 1 header and a list of strings as content
" - the listing consists of a header and a list of strings as content
" - a:content_regex is used to determine how long a potentially existing list is
" - a:default_lnum is the line number where the new listing should be placed if
" it's not already present
" - if a:create is true, it will be created if it doesn't exist, otherwise it
" will only be updated if it already exists
function! vimwiki#base#update_listing_in_buffer(strings, start_header,
\ content_regex, default_lnum, create)
\ content_regex, default_lnum, header_level, create)
" Vim behaves strangely when files change while in diff mode
if &diff || &readonly
return
@@ -1031,7 +1060,8 @@ function! vimwiki#base#update_listing_in_buffer(strings, start_header,
" check if the listing is already there
let already_there = 0
let header_rx = '\m^\s*'.substitute(vimwiki#vars#get_syntaxlocal('rxH1_Template'),
let header_level = 'rxH' . a:header_level . '_Template'
let header_rx = '\m^\s*'.substitute(vimwiki#vars#get_syntaxlocal(header_level),
\ '__Header__', a:start_header, '') .'\s*$'
let start_lnum = 1
@@ -1077,23 +1107,39 @@ function! vimwiki#base#update_listing_in_buffer(strings, start_header,
let start_lnum = a:default_lnum
let is_cursor_after_listing = ( cursor_line > a:default_lnum )
let whitespaces_in_first_line = ''
" append newline if not replacing first line
if start_lnum > 1
keepjumps call append(start_lnum -1, '')
let start_lnum += 1
endif
endif
let start_of_listing = start_lnum
" write new listing
let new_header = whitespaces_in_first_line
\ . s:safesubstitute(vimwiki#vars#get_syntaxlocal('rxH1_Template'),
\ . s:safesubstitute(vimwiki#vars#get_syntaxlocal(header_level),
\ '__Header__', a:start_header, '')
keepjumps call append(start_lnum - 1, new_header)
let start_lnum += 1
let lines_diff += 1 + len(a:strings)
let lines_diff += 1
if vimwiki#vars#get_wikilocal('syntax') == 'markdown'
for _ in range(vimwiki#vars#get_global('markdown_header_style'))
keepjumps call append(start_lnum - 1, '')
let start_lnum += 1
let lines_diff += 1
endfor
endif
for string in a:strings
keepjumps call append(start_lnum - 1, string)
let start_lnum += 1
let lines_diff += 1
endfor
" append an empty line if there is not one
if start_lnum <= line('$') && getline(start_lnum) !~# '\m^\s*$'
" remove empty line if end of file, otherwise append if needed
if start_lnum == line('$')
silent exe 'keepjumps ' . start_lnum.'delete _'
elseif start_lnum < line('$') && getline(start_lnum) !~# '\m^\s*$'
keepjumps call append(start_lnum - 1, '')
let lines_diff += 1
endif
@@ -1200,7 +1246,7 @@ function! vimwiki#base#follow_link(split, ...)
else
if a:0 >= 3
execute "normal! ".a:3
else
elseif vimwiki#vars#get_global('create_link')
call vimwiki#base#normalize_link(0)
endif
endif
@@ -1618,7 +1664,10 @@ function! vimwiki#base#TO_table_col(inner, visual)
endfunction
function! vimwiki#base#AddHeaderLevel()
function! vimwiki#base#AddHeaderLevel(...)
if a:1 > 1
call vimwiki#base#AddHeaderLevel(a:1 - 1)
endif
let lnum = line('.')
let line = getline(lnum)
let rxHdr = vimwiki#vars#get_syntaxlocal('rxH')
@@ -1646,7 +1695,10 @@ function! vimwiki#base#AddHeaderLevel()
endfunction
function! vimwiki#base#RemoveHeaderLevel()
function! vimwiki#base#RemoveHeaderLevel(...)
if a:1 > 1
call vimwiki#base#RemoveHeaderLevel(a:1 - 1)
endif
let lnum = line('.')
let line = getline(lnum)
let rxHdr = vimwiki#vars#get_syntaxlocal('rxH')
@@ -1863,7 +1915,7 @@ function! vimwiki#base#table_of_contents(create)
let bullet = vimwiki#lst#default_symbol().' '
for [lvl, link, desc] in complete_header_infos
if vimwiki#vars#get_wikilocal('syntax') == 'markdown'
let link_tpl = vimwiki#vars#get_syntaxlocal('Weblink1Template')
let link_tpl = vimwiki#vars#get_syntaxlocal('Weblink2Template')
else
let link_tpl = vimwiki#vars#get_global('WikiLinkTemplate2')
endif
@@ -1873,9 +1925,15 @@ function! vimwiki#base#table_of_contents(create)
call add(lines, startindent.repeat(indentstring, lvl-1).bullet.link)
endfor
let links_rx = '\m^\s*'.vimwiki#u#escape(vimwiki#lst#default_symbol()).' '
let links_rx = '\%(^\s*$\)\|\%('.vimwiki#vars#get_syntaxlocal('rxListBullet').'\)'
call vimwiki#base#update_listing_in_buffer(lines, toc_header_text, links_rx, 1, a:create)
call vimwiki#base#update_listing_in_buffer(
\ lines,
\ toc_header_text,
\ links_rx,
\ 1,
\ vimwiki#vars#get_global('toc_header_level'),
\ a:create)
endfunction
@@ -2087,6 +2145,21 @@ function! vimwiki#base#complete_links_escaped(ArgLead, CmdLine, CursorPos) abort
endfunction
function! vimwiki#base#read_caption(file)
let rx_header = vimwiki#vars#get_syntaxlocal('rxHeader')
if filereadable(a:file)
for line in readfile(a:file, '', g:vimwiki_max_scan_for_caption)
if line =~# rx_header
return vimwiki#u#trim(matchstr(line, rx_header))
endif
endfor
endif
return ''
endfunction
" -------------------------------------------------------------------------
" Load syntax-specific Wiki functionality
for s:syn in s:vimwiki_get_known_syntaxes()
+121 -27
View File
@@ -10,9 +10,6 @@ endif
let g:loaded_vimwiki_diary_auto = 1
let s:vimwiki_max_scan_for_caption = 5
function! s:prefix_zero(num)
if a:num < 10
return '0'.a:num
@@ -63,26 +60,98 @@ function! s:get_month_name(month)
return vimwiki#vars#get_global('diary_months')[str2nr(a:month)]
endfunction
function! s:get_first_header(fl)
" Get the first header in the file within the first s:vimwiki_max_scan_for_caption lines.
let header_rx = vimwiki#vars#get_syntaxlocal('rxHeader')
for line in readfile(a:fl, '', g:vimwiki_max_scan_for_caption)
if line =~# header_rx
return vimwiki#u#trim(matchstr(line, header_rx))
endif
endfor
return ''
endfunction
function! s:get_all_headers(fl, maxlevel)
" Get a list of all headers in a file up to a given level.
" Returns a list whose elements are pairs [level, title]
let headers_rx = {}
for i in range(1, a:maxlevel)
let headers_rx[i] = vimwiki#vars#get_syntaxlocal('rxH'.i.'_Text')
endfor
let headers = []
for line in readfile(a:fl, '')
for [i, header_rx] in items(headers_rx)
if line =~# header_rx
call add(headers, [i, vimwiki#u#trim(matchstr(line, header_rx))])
break
endif
endfor
endfor
return headers
endfunction
function! s:count_headers_level_less_equal(headers, maxlevel)
" Count headers with level <= maxlevel in a list of [level, title] pairs.
let l:count = 0
for [header_level, _] in a:headers
if header_level <= a:maxlevel
let l:count += 1
endif
endfor
return l:count
endfunction
function! s:get_min_header_level(headers)
" The minimum level of any header in a list of [level, title] pairs.
if len(a:headers) == 0
return 0
endif
let minlevel = a:headers[0][0]
for [level, _] in a:headers
let minlevel = min([minlevel, level])
endfor
return minlevel
endfunction
function! s:read_captions(files)
let result = {}
let rx_header = vimwiki#vars#get_syntaxlocal('rxHeader')
let caption_level = vimwiki#vars#get_wikilocal('diary_caption_level')
for fl in a:files
" remove paths and extensions
let fl_key = substitute(fnamemodify(fl, ':t'), vimwiki#vars#get_wikilocal('ext').'$', '', '')
let fl_captions = {}
if filereadable(fl)
for line in readfile(fl, '', s:vimwiki_max_scan_for_caption)
if line =~# rx_header && !has_key(result, fl_key)
let result[fl_key] = vimwiki#u#trim(matchstr(line, rx_header))
" Default; no captions from the file.
let fl_captions['top'] = ''
let fl_captions['rest'] = []
if caption_level >= 0 && filereadable(fl)
if caption_level == 0
" Take first header of any level as the top caption.
let fl_captions['top'] = s:get_first_header(fl)
else
let headers = s:get_all_headers(fl, caption_level)
if len(headers) > 0
" If first header is the only one at its level or less, then make it the top caption.
let [first_level, first_header] = headers[0]
if s:count_headers_level_less_equal(headers, first_level) == 1
let fl_captions['top'] = first_header
call remove(headers, 0)
endif
let min_header_level = s:get_min_header_level(headers)
for [level, header] in headers
call add(fl_captions['rest'], [level - min_header_level, header])
endfor
endif
endfor
endif
if !has_key(result, fl_key)
let result[fl_key] = ''
endif
endif
let fl_key = substitute(fnamemodify(fl, ':t'), vimwiki#vars#get_wikilocal('ext').'$', '', '')
let result[fl_key] = fl_captions
endfor
return result
endfunction
@@ -138,9 +207,13 @@ function! s:format_diary()
let links_with_captions = s:read_captions(s:get_diary_files())
let g_files = s:group_links(links_with_captions)
let g_keys = s:sort(keys(g_files))
for year in g_keys
if len(result) > 0
call add(result, '')
endif
for year in s:sort(keys(g_files))
call add(result, '')
call add(result,
\ substitute(vimwiki#vars#get_syntaxlocal('rxH2_Template'), '__Header__', year , ''))
@@ -149,22 +222,43 @@ function! s:format_diary()
call add(result, substitute(vimwiki#vars#get_syntaxlocal('rxH3_Template'),
\ '__Header__', s:get_month_name(month), ''))
for [fl, cap] in s:sort(items(g_files[year][month]))
if vimwiki#vars#get_wikilocal('syntax') == 'markdown'
for _ in range(vimwiki#vars#get_global('markdown_header_style'))
call add(result, '')
endfor
endif
for [fl, captions] in s:sort(items(g_files[year][month]))
let topcap = captions['top']
let link_tpl = vimwiki#vars#get_global('WikiLinkTemplate2')
if vimwiki#vars#get_wikilocal('syntax') == 'markdown'
let link_tpl = vimwiki#vars#get_syntaxlocal('Weblink1Template')
if empty(cap) " When using markdown syntax, we should ensure we always have a link description.
let cap = fl
if empty(topcap) " When using markdown syntax, we should ensure we always have a link description.
let topcap = fl
endif
elseif empty(cap)
let link_tpl = vimwiki#vars#get_global('WikiLinkTemplate1')
endif
let entry = substitute(link_tpl, '__LinkUrl__', fl, '')
let entry = substitute(entry, '__LinkDescription__', cap, '')
call add(result, repeat(' ', vimwiki#lst#get_list_margin()).'* '.entry)
if empty(topcap)
let top_link_tpl = vimwiki#vars#get_global('WikiLinkTemplate1')
else
let top_link_tpl = link_tpl
endif
let bullet = vimwiki#lst#default_symbol().' '
let entry = substitute(top_link_tpl, '__LinkUrl__', fl, '')
let entry = substitute(entry, '__LinkDescription__', topcap, '')
call add(result, repeat(' ', vimwiki#lst#get_list_margin()).bullet.entry)
for [depth, subcap] in captions['rest']
if empty(subcap)
continue
endif
let entry = substitute(link_tpl, '__LinkUrl__', fl.'#'.subcap, '')
let entry = substitute(entry, '__LinkDescription__', subcap, '')
call add(result, repeat(' ', vimwiki#lst#get_list_margin() * (2 + depth)).'- '.entry)
endfor
endfor
endfor
@@ -285,9 +379,10 @@ function! vimwiki#diary#generate_diary_section()
let current_file = vimwiki#path#path_norm(expand("%:p"))
let diary_file = vimwiki#path#path_norm(s:diary_index())
if vimwiki#path#is_equal(current_file, diary_file)
let content_rx = '^\%(\s*\* \)\|\%(^\s*$\)\|\%('.vimwiki#vars#get_syntaxlocal('rxHeader').'\)'
let content_rx = '^\%('.vimwiki#vars#get_syntaxlocal('rxHeader').'\)\|'.
\ '\%(^\s*$\)\|\%('.vimwiki#vars#get_syntaxlocal('rxListBullet').'\)'
call vimwiki#base#update_listing_in_buffer(s:format_diary(),
\ vimwiki#vars#get_wikilocal('diary_header'), content_rx, line('$')+1, 1)
\ vimwiki#vars#get_wikilocal('diary_header'), content_rx, 1, 1, 1)
else
echomsg 'Vimwiki Error: You can generate diary links only in a diary index page!'
endif
@@ -324,4 +419,3 @@ function vimwiki#diary#calendar_sign(day, month, year)
\ a:year.'-'.month.'-'.day.vimwiki#vars#get_wikilocal('ext')
return filereadable(expand(sfile))
endfunction
+43 -7
View File
@@ -344,7 +344,27 @@ endfunction
function! s:tag_code(value)
return '<code>'.s:safe_html_preformatted(s:mid(a:value, 1)).'</code>'
let l:retstr = '<code'
let l:str = s:mid(a:value, 1)
let l:match = match(l:str, '^#[a-fA-F0-9]\{6\}$')
if l:match != -1
let l:r = eval("0x".l:str[1:2])
let l:g = eval("0x".l:str[3:4])
let l:b = eval("0x".l:str[5:6])
let l:fg_color =
\ (((0.299 * r + 0.587 * g + 0.114 * b) / 0xFF) > 0.5)
\ ? "black" : "white"
let l:retstr .=
\ " style='background-color:" . l:str .
\ ";color:" . l:fg_color . ";'"
endif
let l:retstr .= '>'.s:safe_html_preformatted(l:str).'</code>'
return l:retstr
endfunction
@@ -1078,7 +1098,7 @@ function! s:process_tag_h(line, id)
else
let h_part = '<div id="'.h_id.'" class="toc"><h1 id="'.h_id.'"'
let h_part = '<div id="'.h_id.'" class="toc"><h'.h_level.' id="'.h_id.'"'
endif
@@ -1398,24 +1418,38 @@ function! s:use_custom_wiki2html()
\ (s:file_exists(custom_wiki2html) || s:binary_exists(custom_wiki2html))
endfunction
function! vimwiki#html#CustomWiki2HTML(path, wikifile, force)
call vimwiki#path#mkdir(a:path)
" fix for trailing / causing " to be escaped on windows, see #642
if has('win16') || has('win95') || has('win32') || has('win64')
let l:path = substitute(a:path, '\\$', '', '')
let l:css = substitute(shellescape(s:default_CSS_full_name(a:path)), '\\$', '', '')
" template path ends in / even on windows hence the different substitute
let l:tmpl = shellescape(expand(substitute(vimwiki#vars#get_wikilocal('template_path'), '/$', '', '')))
let l:rpath = substitute(shellescape(s:root_path(vimwiki#vars#get_bufferlocal('subdir'))), '\\$', '', '')
else
let l:path = a:path
let l:css = shellescape(s:default_CSS_full_name(a:path))
let l:tmpl = shellescape(expand(vimwiki#vars#get_wikilocal('template_path')))
let l:rpath = shellescape(s:root_path(vimwiki#vars#get_bufferlocal('subdir')))
endif
echomsg system(vimwiki#vars#get_wikilocal('custom_wiki2html'). ' '.
\ a:force. ' '.
\ vimwiki#vars#get_wikilocal('syntax'). ' '.
\ strpart(vimwiki#vars#get_wikilocal('ext'), 1). ' '.
\ shellescape(a:path). ' '.
\ shellescape(l:path). ' '.
\ shellescape(a:wikifile). ' '.
\ shellescape(s:default_CSS_full_name(a:path)). ' '.
\ l:css . ' '.
\ (len(vimwiki#vars#get_wikilocal('template_path')) > 1 ?
\ shellescape(expand(vimwiki#vars#get_wikilocal('template_path'))) : '-'). ' '.
\ l:tmpl : '-'). ' '.
\ (len(vimwiki#vars#get_wikilocal('template_default')) > 0 ?
\ vimwiki#vars#get_wikilocal('template_default') : '-'). ' '.
\ (len(vimwiki#vars#get_wikilocal('template_ext')) > 0 ?
\ vimwiki#vars#get_wikilocal('template_ext') : '-'). ' '.
\ (len(vimwiki#vars#get_bufferlocal('subdir')) > 0 ?
\ shellescape(s:root_path(vimwiki#vars#get_bufferlocal('subdir'))) : '-'). ' '.
\ l:rpath : '-'). ' '.
\ (len(vimwiki#vars#get_wikilocal('custom_wiki2html_args')) > 0 ?
\ vimwiki#vars#get_wikilocal('custom_wiki2html_args') : '-'))
endfunction
@@ -1529,6 +1563,7 @@ function! s:convert_file(path_html, wikifile)
let title = s:process_title(placeholders, fnamemodify(a:wikifile, ":t:r"))
let date = s:process_date(placeholders, strftime('%Y-%m-%d'))
let wiki_path = strpart(s:current_wiki_file, strlen(vimwiki#vars#get_wikilocal('path')))
let html_lines = s:get_html_template(template_name)
@@ -1537,6 +1572,7 @@ function! s:convert_file(path_html, wikifile)
call map(html_lines, 'substitute(v:val, "%date%", "'. date .'", "g")')
call map(html_lines, 'substitute(v:val, "%root_path%", "'.
\ s:root_path(vimwiki#vars#get_bufferlocal('subdir')) .'", "g")')
call map(html_lines, 'substitute(v:val, "%wiki_path%", "'. wiki_path .'", "g")')
let css_name = expand(vimwiki#vars#get_wikilocal('css_name'))
let css_name = substitute(css_name, '\', '/', 'g')
+40 -10
View File
@@ -296,6 +296,7 @@ function! vimwiki#tags#generate_tags(...) abort
let need_all_tags = (a:0 == 0)
let specific_tags = a:000
let header_level = vimwiki#vars#get_global('tags_header_level')
let metadata = s:load_tags_metadata()
" make a dictionary { tag_name: [tag_links, ...] }
@@ -310,26 +311,55 @@ function! vimwiki#tags#generate_tags(...) abort
endfor
endfor
let tag_match = printf('rxH%d', header_level + 1)
let tag_tpl = printf('rxH%d_Template', header_level + 1)
let lines = []
let bullet = repeat(' ', vimwiki#lst#get_list_margin()).vimwiki#lst#default_symbol().' '
for tagname in sort(keys(tags_entries))
if need_all_tags || index(specific_tags, tagname) != -1
call extend(lines, [
\ '',
\ substitute(vimwiki#vars#get_syntaxlocal('rxH2_Template'), '__Header__', tagname, ''),
\ '' ])
if len(lines) > 0
call add(lines, '')
endif
call add(lines,
\ substitute(vimwiki#vars#get_syntaxlocal(tag_tpl), '__Header__', tagname, ''))
if vimwiki#vars#get_wikilocal('syntax') == 'markdown'
for _ in range(vimwiki#vars#get_global('markdown_header_style'))
call add(lines, '')
endfor
endif
for taglink in sort(tags_entries[tagname])
call add(lines, bullet . substitute(vimwiki#vars#get_global('WikiLinkTemplate1'),
\ '__LinkUrl__', taglink, ''))
if vimwiki#vars#get_wikilocal('syntax') == 'markdown'
let link_tpl = vimwiki#vars#get_syntaxlocal('Weblink3Template')
let link_infos = vimwiki#base#resolve_link(taglink)
let link_caption = vimwiki#base#read_caption(link_infos.filename)
let link_text = split(taglink, '#', 1)[0]
let entry = substitute(link_tpl, '__LinkUrl__', link_text, '')
let entry = substitute(entry, '__LinkAnchor__', link_infos.anchor, '')
let entry = substitute(entry, '__LinkDescription__', link_caption, '')
call add(lines, bullet.entry)
else
let link_tpl = vimwiki#vars#get_global('WikiLinkTemplate1')
call add(lines, bullet . substitute(link_tpl, '__LinkUrl__', taglink, ''))
endif
endfor
endif
endfor
let links_rx = '\m\%(^\s*$\)\|\%('.vimwiki#vars#get_syntaxlocal('rxH2').'\)\|\%(^\s*'
\ .vimwiki#u#escape(vimwiki#lst#default_symbol()).' '
\ .vimwiki#vars#get_syntaxlocal('rxWikiLink').'$\)'
let links_rx = '^\%('.vimwiki#vars#get_syntaxlocal(tag_match).'\)\|'.
\ '\%(^\s*$\)\|\%('.vimwiki#vars#get_syntaxlocal('rxListBullet').'\)'
call vimwiki#base#update_listing_in_buffer(lines, 'Generated Tags', links_rx, line('$')+1, 1)
call vimwiki#base#update_listing_in_buffer(
\ lines,
\ vimwiki#vars#get_global('tags_header'),
\ links_rx,
\ line('$')+1,
\ header_level,
\ 1)
endfunction
+206 -85
View File
@@ -63,7 +63,7 @@ endfunction
function! s:is_separator(line)
return a:line =~# '^\s*'.s:rxSep().'\(--\+'.s:rxSep().'\)\+\s*$'
return a:line =~# '^\s*'.s:rxSep().'\(:\=--\+:\='.s:rxSep().'\)\+\s*$'
endfunction
@@ -72,6 +72,11 @@ function! s:is_separator_tail(line)
endfunction
function! s:is_last_column(lnum, cnum)
return a:line =~# '^\{-1}\%(\s*\|-*\)\%('.s:rxSep().'-\+\)\+'.s:rxSep().'\s*$'
endfunction
function! s:is_last_column(lnum, cnum)
let line = strpart(getline(a:lnum), a:cnum - 1)
return line =~# s:rxSep().'\s*$' && line !~# s:rxSep().'.*'.s:rxSep().'\s*$'
@@ -135,56 +140,62 @@ function! s:create_row_sep(cols)
endfunction
function! vimwiki#tbl#get_cells(line)
function! vimwiki#tbl#get_cells(line, ...)
let result = []
let cell = ''
let quote = ''
let state = 'NONE'
let cell_start = 0
let quote_start = 0
let len = strlen(a:line) - 1
" 'Simple' FSM
for idx in range(strlen(a:line))
" The only way I know Vim can do Unicode...
let ch = a:line[idx]
if state ==# 'NONE'
if ch == '|'
let state = 'CELL'
endif
elseif state ==# 'CELL'
if ch == '[' || ch == '{'
let state = 'BEFORE_QUOTE_START'
let quote = ch
elseif ch == '|'
call add(result, vimwiki#u#trim(cell))
let cell = ""
else
let cell .= ch
endif
elseif state ==# 'BEFORE_QUOTE_START'
if ch == '[' || ch == '{'
let state = 'QUOTE'
let quote .= ch
else
let state = 'CELL'
let cell .= quote.ch
let quote = ''
endif
elseif state ==# 'QUOTE'
if ch == ']' || ch == '}'
let state = 'BEFORE_QUOTE_END'
endif
let quote .= ch
elseif state ==# 'BEFORE_QUOTE_END'
if ch == ']' || ch == '}'
let state = 'CELL'
endif
let cell .= quote.ch
let quote = ''
while state != 'CELL'
if quote_start != 0 && state != 'CELL'
let state = 'CELL'
endif
endfor
for idx in range(quote_start, len)
" The only way I know Vim can do Unicode...
let ch = a:line[idx]
if state ==# 'NONE'
if ch == '|'
let cell_start = idx + 1
let state = 'CELL'
endif
elseif state ==# 'CELL'
if ch == '[' || ch == '{'
let state = 'BEFORE_QUOTE_START'
let quote_start = idx
elseif ch == '|'
let cell = strpart(a:line, cell_start, idx - cell_start)
if a:0 && a:1
let cell = substitute(cell, '^ \(.*\) $', '\1', '')
else
let cell = vimwiki#u#trim(cell)
endif
call add(result, cell)
let cell_start = idx + 1
endif
elseif state ==# 'BEFORE_QUOTE_START'
if ch == '[' || ch == '{'
let state = 'QUOTE'
let quote_start = idx
else
let state = 'CELL'
endif
elseif state ==# 'QUOTE'
if ch == ']' || ch == '}'
let state = 'BEFORE_QUOTE_END'
endif
elseif state ==# 'BEFORE_QUOTE_END'
if ch == ']' || ch == '}'
let state = 'CELL'
endif
endif
endfor
if state == 'NONE'
break
endif
endwhile
if cell.quote != ''
call add(result, vimwiki#u#trim(cell.quote, '|'))
endif
return result
endfunction
@@ -194,7 +205,7 @@ function! s:col_count(lnum)
endfunction
function! s:get_indent(lnum)
function! s:get_indent(lnum, depth)
if !s:is_table(getline(a:lnum))
return
endif
@@ -209,50 +220,94 @@ function! s:get_indent(lnum)
break
endif
let lnum -= 1
if a:depth > 0 && lnum < a:lnum - a:depth
break
endif
endwhile
return indent
endfunction
function! s:get_rows(lnum)
function! s:get_rows(lnum, ...)
if !s:is_table(getline(a:lnum))
return
endif
let upper_rows = []
let lower_rows = []
let rows = []
let lnum = a:lnum - 1
while lnum >= 1
let depth = a:0 > 0 ? a:1 : 0
let ldepth = 0
while lnum >= 1 && (depth == 0 || ldepth < depth)
let line = getline(lnum)
if s:is_table(line)
call add(upper_rows, [lnum, line])
call insert(rows, [lnum, line])
else
break
endif
let lnum -= 1
let ldepth += 1
endwhile
call reverse(upper_rows)
let lnum = a:lnum
while lnum <= line('$')
let line = getline(lnum)
if s:is_table(line)
call add(lower_rows, [lnum, line])
if lnum == a:lnum
let cells = vimwiki#tbl#get_cells(line)
let clen = len(cells)
let max_lens = repeat([0], clen)
let aligns = repeat(['left'], clen)
let line = s:fmt_row(cells, max_lens, aligns, 0, 0)
endif
call add(rows, [lnum, line])
else
break
endif
if depth > 0
break
endif
let lnum += 1
endwhile
return upper_rows + lower_rows
return rows
endfunction
function! s:get_cell_aligns(lnum)
let aligns = {}
for [lnum, row] in s:get_rows(a:lnum)
let found_separator = s:is_separator(row)
if found_separator
let cells = vimwiki#tbl#get_cells(row)
for idx in range(len(cells))
let cell = cells[idx]
if cell =~# '^--\+:'
let aligns[idx] = 'right'
elseif cell =~# '^:--\+:'
let aligns[idx] = 'center'
else
let aligns[idx] = 'left'
endif
endfor
return aligns
endif
endfor
if !found_separator
let cells = vimwiki#tbl#get_cells(row)
for idx in range(len(cells))
let aligns[idx] = 'left'
endfor
endif
return aligns
endfunction
function! s:get_cell_max_lens(lnum, ...)
let max_lens = {}
for [lnum, row] in s:get_rows(a:lnum)
let rows = a:0 > 2 ? a:3 : s:get_rows(a:lnum)
for [lnum, row] in rows
if s:is_separator(row)
continue
endif
@@ -270,20 +325,54 @@ function! s:get_cell_max_lens(lnum, ...)
endfunction
function! s:get_aligned_rows(lnum, col1, col2)
let rows = s:get_rows(a:lnum)
let startlnum = rows[0][0]
function! s:get_aligned_rows(lnum, col1, col2, depth)
let rows = []
let startlnum = 0
let cells = []
for [lnum, row] in rows
call add(cells, vimwiki#tbl#get_cells(row))
endfor
let max_lens = s:get_cell_max_lens(a:lnum, cells, startlnum)
let max_lens = {}
let check_all = 1
if a:depth > 0
let rows = s:get_rows(a:lnum, a:depth)
let startlnum = rows[0][0]
let lrows = len(rows)
if lrows == a:depth + 1
let i = 1
for [lnum, row] in rows
call add(cells, vimwiki#tbl#get_cells(row, i != lrows - 1))
let i += 1
endfor
let max_lens = s:get_cell_max_lens(a:lnum, cells, startlnum, rows)
" user option not to expand last call
if vimwiki#vars#get_global('table_reduce_last_col')
let last_index = keys(max_lens)[-1]
let max_lens[last_index] = 1
endif
let fst_lens = s:get_cell_max_lens(a:lnum, cells, startlnum, rows[0:0])
let check_all = max_lens != fst_lens
endif
endif
if check_all
" all the table must be re-formatted
let rows = s:get_rows(a:lnum)
let startlnum = rows[0][0]
let cells = []
for [lnum, row] in rows
call add(cells, vimwiki#tbl#get_cells(row))
endfor
let max_lens = s:get_cell_max_lens(a:lnum, cells, startlnum, rows)
" user option not to expand last call
if vimwiki#vars#get_global('table_reduce_last_col')
let last_index = keys(max_lens)[-1]
let max_lens[last_index] = 1
endif
endif
let aligns = s:get_cell_aligns(a:lnum)
let result = []
for [lnum, row] in rows
if s:is_separator(row)
let new_row = s:fmt_sep(max_lens, a:col1, a:col2)
let new_row = s:fmt_sep(max_lens, aligns, a:col1, a:col2)
else
let new_row = s:fmt_row(cells[lnum - startlnum], max_lens, a:col1, a:col2)
let new_row = s:fmt_row(cells[lnum - startlnum], max_lens, aligns, a:col1, a:col2)
endif
call add(result, [lnum, new_row])
endfor
@@ -312,20 +401,25 @@ function! s:cur_column()
endfunction
function! s:fmt_cell(cell, max_len)
function! s:fmt_cell(cell, max_len, align)
let cell = ' '.a:cell.' '
let diff = a:max_len - s:wide_len(a:cell)
if diff == 0 && empty(a:cell)
let diff = 1
endif
let cell .= repeat(' ', diff)
if a:align == 'left'
let cell .= repeat(' ', diff)
elseif a:align == 'right'
let cell = repeat(' ',diff).cell
else
let cell = repeat(' ',diff/2).cell.repeat(' ',diff-diff/2)
endif
return cell
endfunction
function! s:fmt_row(cells, max_lens, col1, col2)
function! s:fmt_row(cells, max_lens, aligns, col1, col2)
let new_line = s:rxSep()
for idx in range(len(a:cells))
if idx == a:col1
@@ -334,28 +428,36 @@ function! s:fmt_row(cells, max_lens, col1, col2)
let idx = a:col1
endif
let value = a:cells[idx]
let new_line .= s:fmt_cell(value, a:max_lens[idx]).s:rxSep()
let new_line .= s:fmt_cell(value, a:max_lens[idx], a:aligns[idx]).s:rxSep()
endfor
let idx = len(a:cells)
while idx < len(a:max_lens)
let new_line .= s:fmt_cell('', a:max_lens[idx]).s:rxSep()
let new_line .= s:fmt_cell('', a:max_lens[idx], a:aligns[idx]).s:rxSep()
let idx += 1
endwhile
return new_line
endfunction
function! s:fmt_cell_sep(max_len)
function! s:fmt_cell_sep(max_len, align)
let cell = ''
if a:max_len == 0
return repeat('-', 3)
let cell .= '-'
else
return repeat('-', a:max_len+2)
let cell .= repeat('-', a:max_len)
endif
if a:align == 'right'
return cell.'-:'
elseif a:align == 'left'
return cell.'--'
else
return ':'.cell.':'
endif
endfunction
function! s:fmt_sep(max_lens, col1, col2)
function! s:fmt_sep(max_lens, aligns, col1, col2)
let new_line = s:rxSep()
for idx in range(len(a:max_lens))
if idx == a:col1
@@ -363,7 +465,7 @@ function! s:fmt_sep(max_lens, col1, col2)
elseif idx == a:col2
let idx = a:col1
endif
let new_line .= s:fmt_cell_sep(a:max_lens[idx]).s:rxSep()
let new_line .= s:fmt_cell_sep(a:max_lens[idx], a:aligns[idx]).s:rxSep()
endfor
return new_line
endfunction
@@ -371,7 +473,7 @@ endfunction
function! s:kbd_create_new_row(cols, goto_first)
let cmd = "\<ESC>o".s:create_empty_row(a:cols)
let cmd .= "\<ESC>:call vimwiki#tbl#format(line('.'))\<CR>"
let cmd .= "\<ESC>:call vimwiki#tbl#format(line('.'), 2)\<CR>"
let cmd .= "\<ESC>0"
if a:goto_first
let cmd .= ":call search('\\(".s:rxSep()."\\)\\zs', 'c', line('.'))\<CR>"
@@ -407,8 +509,15 @@ endfunction
function! vimwiki#tbl#goto_next_col()
let curcol = virtcol('.')
let lnum = line('.')
let newcol = s:get_indent(lnum)
let max_lens = s:get_cell_max_lens(lnum)
let depth = 2
let newcol = s:get_indent(lnum, depth)
let rows = s:get_rows(lnum, depth)
let startlnum = rows[0][0]
let cells = []
for [lnum, row] in rows
call add(cells, vimwiki#tbl#get_cells(row, 1))
endfor
let max_lens = s:get_cell_max_lens(lnum, cells, startlnum, rows)
for cell_len in values(max_lens)
if newcol >= curcol-1
break
@@ -435,8 +544,15 @@ endfunction
function! vimwiki#tbl#goto_prev_col()
let curcol = virtcol('.')
let lnum = line('.')
let newcol = s:get_indent(lnum)
let max_lens = s:get_cell_max_lens(lnum)
let depth = 2
let newcol = s:get_indent(lnum, depth)
let rows = s:get_rows(lnum, depth)
let startlnum = rows[0][0]
let cells = []
for [lnum, row] in rows
call add(cells, vimwiki#tbl#get_cells(row, 1))
endfor
let max_lens = s:get_cell_max_lens(lnum, cells, startlnum, rows)
let prev_cell_len = 0
for cell_len in values(max_lens)
let delta = cell_len + 3 " +3 == 2 spaces + 1 separator |<space>...<space>
@@ -526,6 +642,8 @@ function! vimwiki#tbl#format(lnum, ...)
return
endif
let depth = a:0 == 1 ? a:1 : 0
if a:0 == 2
let col1 = a:1
let col2 = a:2
@@ -534,16 +652,19 @@ function! vimwiki#tbl#format(lnum, ...)
let col2 = 0
endif
let indent = s:get_indent(a:lnum)
let indent = s:get_indent(a:lnum, depth)
if &expandtab
let indentstring = repeat(' ', indent)
else
let indentstring = repeat(' ', indent / &tabstop) . repeat(' ', indent % &tabstop)
endif
for [lnum, row] in s:get_aligned_rows(a:lnum, col1, col2)
" getting N = depth last rows is enough for having been formatted tables
for [lnum, row] in s:get_aligned_rows(a:lnum, col1, col2, depth)
let row = indentstring.row
call setline(lnum, row)
if getline(lnum) != row
call setline(lnum, row)
endif
endfor
let &tw = s:textwidth
@@ -586,9 +707,9 @@ function! vimwiki#tbl#create(...)
endfunction
function! vimwiki#tbl#align_or_cmd(cmd)
function! vimwiki#tbl#align_or_cmd(cmd, ...)
if s:is_table(getline('.'))
call vimwiki#tbl#format(line('.'))
call call('vimwiki#tbl#format', [line('.')] + a:000)
else
exe 'normal! '.a:cmd
endif
+30 -4
View File
@@ -145,6 +145,8 @@ function! s:read_global_settings_from_user()
\ 'auto_chdir': {'type': type(0), 'default': 0, 'min': 0, 'max': 1},
\ 'autowriteall': {'type': type(0), 'default': 1, 'min': 0, 'max': 1},
\ 'conceallevel': {'type': type(0), 'default': 2, 'min': 0, 'max': 3},
\ 'conceal_pre': {'type': type(0), 'default': 0, 'min': 0, 'max': 1},
\ 'create_link': {'type': type(0), 'default': 1, 'min':0, 'max': 1},
\ 'diary_months': {'type': type({}), 'default':
\ {
\ 1: 'January', 2: 'February', 3: 'March',
@@ -164,13 +166,21 @@ function! s:read_global_settings_from_user()
\ 'html_header_numbering_sym': {'type': type(''), 'default': ''},
\ 'list_ignore_newline': {'type': type(0), 'default': 1, 'min': 0, 'max': 1},
\ 'text_ignore_newline': {'type': type(0), 'default': 1, 'min': 0, 'max': 1},
\ 'links_header': {'type': type(''), 'default': 'Generated Links', 'min_length': 1},
\ 'links_header_level': {'type': type(0), 'default': 1, 'min': 1, 'max': 6},
\ 'listsyms': {'type': type(''), 'default': ' .oOX', 'min_length': 2},
\ 'listsym_rejected': {'type': type(''), 'default': '-', 'length': 1},
\ 'map_prefix': {'type': type(''), 'default': '<Leader>w'},
\ 'markdown_header_style': {'type': type(0), 'default': 1, 'min':0, 'max': 2},
\ 'markdown_link_ext': {'type': type(0), 'default': 0, 'min': 0, 'max': 1},
\ 'menu': {'type': type(''), 'default': 'Vimwiki'},
\ 'table_auto_fmt': {'type': type(0), 'default': 1, 'min': 0, 'max': 1},
\ 'table_reduce_last_col': {'type': type(0), 'default': 0, 'min': 0, 'max': 1},
\ 'table_mappings': {'type': type(0), 'default': 1, 'min': 0, 'max': 1},
\ 'tags_header': {'type': type(''), 'default': 'Generated Tags', 'min_length': 1},
\ 'tags_header_level': {'type': type(0), 'default': 1, 'min': 1, 'max': 5},
\ 'toc_header': {'type': type(''), 'default': 'Contents', 'min_length': 1},
\ 'toc_header_level': {'type': type(0), 'default': 1, 'min': 1, 'max': 6},
\ 'url_maxsave': {'type': type(0), 'default': 15, 'min': 0},
\ 'use_calendar': {'type': type(0), 'default': 1, 'min': 0, 'max': 1},
\ 'use_mouse': {'type': type(0), 'default': 0, 'min': 0, 'max': 1},
@@ -251,6 +261,7 @@ function! s:populate_wikilocal_options()
\ 'diary_header': {'type': type(''), 'default': 'Diary', 'min_length': 1},
\ 'diary_index': {'type': type(''), 'default': 'diary', 'min_length': 1},
\ 'diary_rel_path': {'type': type(''), 'default': 'diary/', 'min_length': 1},
\ 'diary_caption_level': {'type': type(0), 'default': 0, 'min': -1, 'max': 6},
\ 'diary_sort': {'type': type(''), 'default': 'desc', 'possible_values': ['asc', 'desc']},
\ 'ext': {'type': type(''), 'default': '.wiki', 'min_length': 1},
\ 'index': {'type': type(''), 'default': 'index', 'min_length': 1},
@@ -441,6 +452,9 @@ function! vimwiki#vars#populate_syntax_vars(syntax)
let g:vimwiki_syntax_variables[a:syntax]['rxH'.i] =
\ '^\s*'.header_symbol.'\{'.i.'}[^'.header_symbol.'].*[^'.header_symbol.']'
\ .header_symbol.'\{'.i.'}\s*$'
let g:vimwiki_syntax_variables[a:syntax]['rxH'.i.'_Text'] =
\ '^\s*'.header_symbol.'\{'.i.'}\zs[^'.header_symbol.'].*[^'.header_symbol.']\ze'
\ .header_symbol.'\{'.i.'}\s*$'
let g:vimwiki_syntax_variables[a:syntax]['rxH'.i.'_Start'] =
\ '^\s*'.header_symbol.'\{'.i.'}[^'.header_symbol.'].*[^'.header_symbol.']'
\ .header_symbol.'\{'.i.'}\s*$'
@@ -457,6 +471,8 @@ function! vimwiki#vars#populate_syntax_vars(syntax)
\ repeat(header_symbol, i).' __Header__'
let g:vimwiki_syntax_variables[a:syntax]['rxH'.i] =
\ '^\s*'.header_symbol.'\{'.i.'}[^'.header_symbol.'].*$'
let g:vimwiki_syntax_variables[a:syntax]['rxH'.i.'_Text'] =
\ '^\s*'.header_symbol.'\{'.i.'}\zs[^'.header_symbol.'].*\ze$'
let g:vimwiki_syntax_variables[a:syntax]['rxH'.i.'_Start'] =
\ '^\s*'.header_symbol.'\{'.i.'}[^'.header_symbol.'].*$'
let g:vimwiki_syntax_variables[a:syntax]['rxH'.i.'_End'] =
@@ -687,10 +703,21 @@ function! s:populate_extra_markdown_vars()
let mkd_syntax.rxWeblink1Prefix = '['
let mkd_syntax.rxWeblink1Suffix = ')'
let mkd_syntax.rxWeblink1Separator = ']('
let mkd_syntax.rxWeblink1Ext = ''
if vimwiki#vars#get_global('markdown_link_ext')
let mkd_syntax.rxWeblink1Ext = vimwiki#vars#get_wikilocal('ext')
endif
" [DESCRIPTION](URL)
let mkd_syntax.Weblink1Template = mkd_syntax.rxWeblink1Prefix . '__LinkDescription__'.
\ mkd_syntax.rxWeblink1Separator. '__LinkUrl__'.
\ mkd_syntax.rxWeblink1Separator. '__LinkUrl__'. mkd_syntax.rxWeblink1Ext.
\ mkd_syntax.rxWeblink1Suffix
" [DESCRIPTION](ANCHOR)
let mkd_syntax.Weblink2Template = mkd_syntax.rxWeblink1Prefix . '__LinkDescription__'.
\ mkd_syntax.rxWeblink1Separator. '__LinkUrl__'. mkd_syntax.rxWeblink1Suffix
" [DESCRIPTION](FILE#ANCHOR)
let mkd_syntax.Weblink3Template = mkd_syntax.rxWeblink1Prefix . '__LinkDescription__'.
\ mkd_syntax.rxWeblink1Separator. '__LinkUrl__'. mkd_syntax.rxWeblink1Ext.
\ '#__LinkAnchor__'. mkd_syntax.rxWeblink1Suffix
let valid_chars = '[^\\]'
@@ -703,8 +730,8 @@ function! s:populate_extra_markdown_vars()
" 1. [DESCRIPTION](URL)
" 1a) match [DESCRIPTION](URL)
let mkd_syntax.rxWeblink1 = mkd_syntax.rxWeblink1Prefix.
\ mkd_syntax.rxWeblink1Url . mkd_syntax.rxWeblink1Separator.
\ mkd_syntax.rxWeblink1Descr . mkd_syntax.rxWeblink1Suffix
\ mkd_syntax.rxWeblink1Descr . mkd_syntax.rxWeblink1Separator.
\ mkd_syntax.rxWeblink1Url . mkd_syntax.rxWeblink1Suffix
" 1b) match URL within [DESCRIPTION](URL)
let mkd_syntax.rxWeblink1MatchUrl = mkd_syntax.rxWeblink1Prefix.
\ mkd_syntax.rxWeblink1Descr. mkd_syntax.rxWeblink1Separator.
@@ -847,4 +874,3 @@ endfunction
function! vimwiki#vars#number_of_wikis()
return len(g:vimwiki_wikilocal_vars) - 1
endfunction
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 177 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 276 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 249 KiB

+176 -35
View File
@@ -9,7 +9,7 @@
|___| |___| |_| |_||__| |__||___| |___| |_||___| ~
Version: 2.4.1
Version: 2.4
==============================================================================
CONTENTS *vimwiki*
@@ -513,6 +513,12 @@ gqq Format table. If you made some changes to a table
or without swapping insert/normal modes this command
gww will reformat it.
*vimwiki_gq1* *vimwiki_gw1*
gq1 Fast format table. The same as the previous, except
or that only a few lines above the current line are
gw1 tested. If the alignment of the current line differs,
then the whole table gets reformatted.
*vimwiki_<A-Left>*
<A-Left> Move current table column to the left.
See |:VimwikiTableMoveColumnLeft|
@@ -877,9 +883,21 @@ is decorated: >
super^script^
sub,,script,,
For Markdown syntax these variations are used: >
**bold text** or __bold text__
*italic text* or _italic text_
***bold_italic text*** or ___italic_bold text___
Furthermore, there are a number of words which are highlighted extra flashy:
TODO, DONE, STARTED, FIXME, FIXED, XXX.
When rendered as HTML, code blocks containing only a hash prefixed 6 digit hex
number will be colored as themselves. For example >
`#ffe119`
Becomes >
<code style='background-color:#ffe119;color:black;'>#ffe119</code>
------------------------------------------------------------------------------
5.2. Links *vimwiki-syntax-links*
@@ -1715,6 +1733,15 @@ values: >
To indent table indent the first row. Then format it with 'gqq'.
You can specify the type of horizontal alignment for columns in the separator
using the ':' character. The default is left-align. >
| Date | Item | Price |
|------------|:------:|--------:|
| yest | Coffee | $15.00 |
| 2017-02-13 | Tea | $2.10 |
| 2017-03-14 | Cake | $143.12 |
<
==============================================================================
10. Diary *vimwiki-diary*
@@ -2043,13 +2070,17 @@ Each template could look like: >
</html>
where
%title% is replaced by a wiki page name or by a |vimwiki-title|
%date% is replaced with the current date or by |vimwiki-date|
%root_path% is replaced by a count of ../ for pages buried in subdirs:
`%title%` is replaced by a wiki page name or by a |vimwiki-title|
`%date%` is replaced with the current date or by |vimwiki-date|
`%root_path%` is replaced by a count of ../ for pages buried in subdirs:
if you have wikilink [[dir1/dir2/dir3/my page in a subdir]] then
%root_path% is replaced by '../../../'.
`%root_path%` is replaced by '../../../'.
`%wiki_path%` Path to current wiki-file.` The file path to the current wiki
file. For example, if you are on page a/b.wiki %wiki-path% contains
"a/b.wiki". Mostly useful if you want to link the to raw wiki page from
the rendered version.
%content% is replaced by a wiki file content.
`%content%` is replaced by a wiki file content.
The default template will be applied to all wiki pages unless a page specifies
@@ -2213,6 +2244,26 @@ Description~
Sort links in a diary index page.
*vimwiki-option-diary_caption_level*
------------------------------------------------------------------------------
Key Default value~
diary_caption_level 0
Description~
Controls the presence of captions in the diary index linking to headers within
the diary pages.
Possible values:
-1: No headers are read from the diary page.
0: The first header from the diary page is used as the caption.
There are no sub-captions.
1: Captions are created for headers of level 1 in the diary page.
2: Captions are created for headers up to level 2 in the diary page.
etc.
When the value is >= 1, the primary caption of each diary page is set to the
first header read from that page if it is the unique lowest-level header.
*vimwiki-option-custom_wiki2html*
------------------------------------------------------------------------------
Key Default value~
@@ -2510,6 +2561,31 @@ Value Description~
Default: 1
------------------------------------------------------------------------------
*g:vimwiki_create_link*
Create target wiki page if it does not exist. See |:VimwikiFollowLink|.
Value Description~
0 Do not create target wiki page.
1 Create target wiki page.
Default: 1
------------------------------------------------------------------------------
*g:vimwiki_markdown_link_ext*
Append wiki file extension to links in Markdown. This is needed for
compatibility with other Markdown tools.
Value Description~
0 Do not append wiki file extension.
1 Append wiki file extension.
Default: 0
------------------------------------------------------------------------------
*VimwikiLinkHandler*
@@ -2643,6 +2719,21 @@ Value Description~
Default: 1
------------------------------------------------------------------------------
*g:vimwiki_table_reduce_last_col*
If set, the last column separator will not be expanded to fill the cell. When
`:set wrap` this option improves how a table is displayed, particularly on
small screens. If |g:vimwiki_table_auto_fmt| is set to 0, this option has no
effect.
Value Description~
0 Enable table auto formating for all columns.
1 Disable table auto formating for the last column.
Default: 0
------------------------------------------------------------------------------
*g:vimwiki_w32_dir_enc*
@@ -2796,6 +2887,26 @@ URLs and hides markers and URL for links that have a description.
Default: 2
------------------------------------------------------------------------------
*g:vimwiki_conceal_pre*
Conceal preformatted text markers. For example,
>
{{{python
def say_hello():
print("Hello, world!")
}}}
>
would appear as simply
>
def say_hello():
print("Hello, world!")
>
in your wiki file.
Default: 0
------------------------------------------------------------------------------
*g:vimwiki_autowriteall*
@@ -2872,6 +2983,15 @@ appropriate word in your mother tongue like this: >
The default is 'Contents'.
------------------------------------------------------------------------------
*g:vimwiki_toc_header_level*
The header level of the Table of Contents (see |vimwiki-toc|). Valid values
are from 1 to 6.
The default is 1.
------------------------------------------------------------------------------
*g:vimwiki_map_prefix*
@@ -2896,6 +3016,54 @@ Value Description~
Default: 0
------------------------------------------------------------------------------
*g:vimwiki_links_header*
A string with the magic header that tells Vimwiki where the generated links
are located in a file. You can change it to the appropriate word in your
mother tongue like this: >
let g:vimwiki_links_header = 'Generierte Links'
The default is 'Generated Links'.
------------------------------------------------------------------------------
*g:vimwiki_links_header_level*
The header level of generated links. Valid values are from 1 to 6.
The default is 1.
------------------------------------------------------------------------------
*g:vimwiki_tags_header*
A string with the magic header that tells Vimwiki where the generated tags
are located in a file. You can change it to the appropriate word in your
mother tongue like this: >
let g:vimwiki_tags_header = 'Generierte Stichworte'
The default is 'Generated Tags'.
------------------------------------------------------------------------------
*g:vimwiki_tags_header_level*
The header level of generated tags. Valid values are from 1 to 5.
The default is 1.
------------------------------------------------------------------------------
*g:vimwiki_markdown_header_style*
The number of newlines to be inserted after a header is generated. Valid
values are from 0 to 2.
The default is 1.
==============================================================================
13. Getting help *vimwiki-help*
@@ -2959,7 +3127,7 @@ Contributors and their Github usernames in roughly chronological order:
- Daniel Trnka (@trnila)
- Yuchen Pei (@ycpei)
- @maqiv
- Dawid Ciężarkiewicz (@dpc)
- @dpc
- Drew Hays (@Dru89)
- Daniel Etrata (@danetrata)
- Keith Haber (@kjhaber)
@@ -2973,22 +3141,7 @@ Contributors and their Github usernames in roughly chronological order:
- Zhuang Ma (@mzlogin)
- Huy Le (@huynle)
- Nick Borden (@hcwndbyw)
- John Campbell (@johnmarcampbell)
- Petrus (@PetrusZ)
- Steven Stallion (@sstallion)
- Daniel Quomsieh (@DQuomsieh)
- Fredrik Arnerup (@farnerup)
- CUI Hao (@cuihaoleo)
- Benjamin Brandtner (@BenjaminBrandtner)
- @sreejith994
- Raphael Feng (@raphaelfeng)
- Kasper Socha (@fte10kso)
- Nicolas Brailovsky (@nicolasbrailo)
- @BenMcH
- Stefan Huber (@shuber2)
- Hugo Hörnquist (@HugoNikanor)
- Rane Brown (@ranebrown)
- @monkinco
==============================================================================
@@ -3001,13 +3154,7 @@ http://code.google.com/p/vimwiki/issues/list. They may be accessible from
https://github.com/vimwiki-backup/vimwiki/issues.
2.4.1 (2019-02-20)~
Fixed:
* Fix VimwikiShowVersion function.
* strikethrough `~` characters were not hidden within tables
* Update and format README.md and update screen shots
2.4 (2019-03-24)~
2.4 (not yet released)~
New:~
* Add the option |g:vimwiki_text_ignore_newline|.
@@ -3027,8 +3174,6 @@ New:~
* Add the %date placeholder, see |vimwiki-date|.
* Add the option |vimwiki-option-custom_wiki2html_args|.
* Add support for HTML-style comments when using markdown syntax.
* Made headings link to themselves in HTML output.
* Add |:VimwikiShowVersion| to check the version
Removed:~
* Remove the undocumented and buggy command :VimwikiReadLocalOptions
@@ -3053,10 +3198,6 @@ Fixed:~
* Opening the diary and wikis from the menu works correctly now.
* Issue #497: Make |:VimwikiMakeDiaryNote| work outside a wiki buffer.
* Use markdown syntax in the diary when appropriate.
* Improve handling of errors on opening files.
* Update links when renaming a page with |:VimwikiRenameLink|.
* Fix losing the highlighting in various situations.
* Improved link normalisation.
* Various other minor fixes.
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 305 KiB

+7 -4
View File
@@ -305,8 +305,8 @@ command! -buffer VimwikiListToggle call vimwiki#lst#toggle_list_item()
" table commands
command! -buffer -nargs=* VimwikiTable call vimwiki#tbl#create(<f-args>)
command! -buffer VimwikiTableAlignQ call vimwiki#tbl#align_or_cmd('gqq')
command! -buffer VimwikiTableAlignW call vimwiki#tbl#align_or_cmd('gww')
command! -buffer -nargs=? VimwikiTableAlignQ call vimwiki#tbl#align_or_cmd('gqq', <f-args>)
command! -buffer -nargs=? VimwikiTableAlignW call vimwiki#tbl#align_or_cmd('gww', <f-args>)
command! -buffer VimwikiTableMoveColumnLeft call vimwiki#tbl#move_column_left()
command! -buffer VimwikiTableMoveColumnRight call vimwiki#tbl#move_column_right()
@@ -584,6 +584,8 @@ endif
nnoremap <buffer> gqq :VimwikiTableAlignQ<CR>
nnoremap <buffer> gww :VimwikiTableAlignW<CR>
nnoremap <buffer> gq1 :VimwikiTableAlignQ 2<CR>
nnoremap <buffer> gw1 :VimwikiTableAlignW 2<CR>
if !hasmapto('<Plug>VimwikiTableMoveColumnLeft')
nmap <silent><buffer> <A-Left> <Plug>VimwikiTableMoveColumnLeft
endif
@@ -633,13 +635,14 @@ vnoremap <silent><buffer> il :<C-U>call vimwiki#lst#TO_list_item(1, 1)<CR>
if !hasmapto('<Plug>VimwikiAddHeaderLevel')
nmap <silent><buffer> = <Plug>VimwikiAddHeaderLevel
endif
nnoremap <silent><buffer> <Plug>VimwikiAddHeaderLevel :<C-U>call vimwiki#base#AddHeaderLevel()<CR>
nnoremap <silent><buffer> <Plug>VimwikiAddHeaderLevel :
\<C-U>call vimwiki#base#AddHeaderLevel(v:count)<CR>
if !hasmapto('<Plug>VimwikiRemoveHeaderLevel')
nmap <silent><buffer> - <Plug>VimwikiRemoveHeaderLevel
endif
nnoremap <silent><buffer> <Plug>VimwikiRemoveHeaderLevel :
\<C-U>call vimwiki#base#RemoveHeaderLevel()<CR>
\<C-U>call vimwiki#base#RemoveHeaderLevel(v:count)<CR>
if !hasmapto('<Plug>VimwikiGoToParentHeader')
nmap <silent><buffer> ]u <Plug>VimwikiGoToParentHeader
+17 -17
View File
@@ -10,7 +10,7 @@ endif
let g:loaded_vimwiki = 1
" Set to version number for release, otherwise -1 for dev-branch
let s:plugin_vers = "2.4.1"
let s:plugin_vers = -1
" Get the directory the script is installed in
let s:plugin_dir = expand('<sfile>:p:h:h')
@@ -195,15 +195,15 @@ endfunction
function! s:get_version()
if s:plugin_vers != -1
echo "Stable version: " . string(s:plugin_vers)
echo "Stable version: " . s:plugin_vers
else
let l:plugin_rev = system("git --git-dir " . s:plugin_dir . "/.git rev-parse --short HEAD")
let l:plugin_branch = system("git --git-dir " . s:plugin_dir . "/.git rev-parse --abbrev-ref HEAD")
let l:plugin_date = system("git --git-dir " . s:plugin_dir . "/.git show -s --format=%ci")
let a:plugin_rev = system("git --git-dir " . s:plugin_dir . "/.git rev-parse --short HEAD")
let a:plugin_branch = system("git --git-dir " . s:plugin_dir . "/.git rev-parse --abbrev-ref HEAD")
let a:plugin_date = system("git --git-dir " . s:plugin_dir . "/.git show -s --format=%ci")
if v:shell_error == 0
echo "Branch: " . l:plugin_branch
echo "Revision: " . l:plugin_rev
echo "Date: " . l:plugin_date
echo "Branch: " . a:plugin_branch
echo "Revision: " . a:plugin_rev
echo "Date: " . a:plugin_date
else
echo "Unknown version"
endif
@@ -261,7 +261,7 @@ augroup vimwiki
" Format tables when exit from insert mode. Do not use textwidth to
" autowrap tables.
if vimwiki#vars#get_global('table_auto_fmt')
exe 'autocmd InsertLeave *'.s:ext.' call vimwiki#tbl#format(line("."))'
exe 'autocmd InsertLeave *'.s:ext.' call vimwiki#tbl#format(line("."), 2)'
exe 'autocmd InsertEnter *'.s:ext.' call vimwiki#tbl#reset_tw(line("."))'
endif
if vimwiki#vars#get_global('folding') =~? ':quick$'
@@ -309,43 +309,43 @@ command! VimwikiShowVersion call s:get_version()
let s:map_prefix = vimwiki#vars#get_global('map_prefix')
if !hasmapto('<Plug>VimwikiIndex')
if !hasmapto('<Plug>VimwikiIndex') && maparg(s:map_prefix.'w', 'n') == ""
exe 'nmap <silent><unique> '.s:map_prefix.'w <Plug>VimwikiIndex'
endif
nnoremap <unique><script> <Plug>VimwikiIndex :VimwikiIndex<CR>
if !hasmapto('<Plug>VimwikiTabIndex')
if !hasmapto('<Plug>VimwikiTabIndex') && maparg(s:map_prefix.'t', 'n') == ""
exe 'nmap <silent><unique> '.s:map_prefix.'t <Plug>VimwikiTabIndex'
endif
nnoremap <unique><script> <Plug>VimwikiTabIndex :VimwikiTabIndex<CR>
if !hasmapto('<Plug>VimwikiUISelect')
if !hasmapto('<Plug>VimwikiUISelect') && maparg(s:map_prefix.'s', 'n') == ""
exe 'nmap <silent><unique> '.s:map_prefix.'s <Plug>VimwikiUISelect'
endif
nnoremap <unique><script> <Plug>VimwikiUISelect :VimwikiUISelect<CR>
if !hasmapto('<Plug>VimwikiDiaryIndex')
if !hasmapto('<Plug>VimwikiDiaryIndex') && maparg(s:map_prefix.'i', 'n') == ""
exe 'nmap <silent><unique> '.s:map_prefix.'i <Plug>VimwikiDiaryIndex'
endif
nnoremap <unique><script> <Plug>VimwikiDiaryIndex :VimwikiDiaryIndex<CR>
if !hasmapto('<Plug>VimwikiDiaryGenerateLinks')
if !hasmapto('<Plug>VimwikiDiaryGenerateLinks') && maparg(s:map_prefix.'<Leader>i', 'n') == ""
exe 'nmap <silent><unique> '.s:map_prefix.'<Leader>i <Plug>VimwikiDiaryGenerateLinks'
endif
nnoremap <unique><script> <Plug>VimwikiDiaryGenerateLinks :VimwikiDiaryGenerateLinks<CR>
if !hasmapto('<Plug>VimwikiMakeDiaryNote')
if !hasmapto('<Plug>VimwikiMakeDiaryNote') && maparg(s:map_prefix.'<Leader>w', 'n') == ""
exe 'nmap <silent><unique> '.s:map_prefix.'<Leader>w <Plug>VimwikiMakeDiaryNote'
endif
nnoremap <unique><script> <Plug>VimwikiMakeDiaryNote :VimwikiMakeDiaryNote<CR>
if !hasmapto('<Plug>VimwikiTabMakeDiaryNote')
if !hasmapto('<Plug>VimwikiTabMakeDiaryNote') && maparg(s:map_prefix.'<Leader>t', 'n') == ""
exe 'nmap <silent><unique> '.s:map_prefix.'<Leader>t <Plug>VimwikiTabMakeDiaryNote'
endif
nnoremap <unique><script> <Plug>VimwikiTabMakeDiaryNote
\ :VimwikiTabMakeDiaryNote<CR>
if !hasmapto('<Plug>VimwikiMakeYesterdayDiaryNote')
if !hasmapto('<Plug>VimwikiMakeYesterdayDiaryNote') && maparg(s:map_prefix.'<Leader>y', 'n') == ""
exe 'nmap <silent><unique> '.s:map_prefix.'<Leader>y <Plug>VimwikiMakeYesterdayDiaryNote'
endif
nnoremap <unique><script> <Plug>VimwikiMakeYesterdayDiaryNote
+5 -3
View File
@@ -318,8 +318,9 @@ execute 'syntax match VimwikiCodeT /'.vimwiki#vars#get_syntaxlocal('rxCode').
" <hr> horizontal rule
execute 'syntax match VimwikiHR /'.vimwiki#vars#get_syntaxlocal('rxHR').'/'
execute 'syntax region VimwikiPre start=/'.vimwiki#vars#get_syntaxlocal('rxPreStart').
\ '/ end=/'.vimwiki#vars#get_syntaxlocal('rxPreEnd').'/ contains=@Spell'
let concealpre = vimwiki#vars#get_global('conceal_pre') ? ' concealends' : ''
execute 'syntax region VimwikiPre matchgroup=VimwikiPreDelim start=/'.vimwiki#vars#get_syntaxlocal('rxPreStart').
\ '/ end=/'.vimwiki#vars#get_syntaxlocal('rxPreEnd').'/ contains=@Spell'.concealpre
execute 'syntax region VimwikiMath start=/'.vimwiki#vars#get_syntaxlocal('rxMathStart').
\ '/ end=/'.vimwiki#vars#get_syntaxlocal('rxMathEnd').'/ contains=@Spell'
@@ -383,7 +384,7 @@ hi def link VimwikiBoldT VimwikiBold
hi def VimwikiItalic term=italic cterm=italic gui=italic
hi def link VimwikiItalicT VimwikiItalic
hi def VimwikiBoldItalic term=bold cterm=bold gui=bold,italic
hi def VimwikiBoldItalic term=bold,italic cterm=bold,italic gui=bold,italic
hi def link VimwikiItalicBold VimwikiBoldItalic
hi def link VimwikiBoldItalicT VimwikiBoldItalic
hi def link VimwikiItalicBoldT VimwikiBoldItalic
@@ -395,6 +396,7 @@ hi def link VimwikiCodeT VimwikiCode
hi def link VimwikiPre PreProc
hi def link VimwikiPreT VimwikiPre
hi def link VimwikiPreDelim VimwikiPre
hi def link VimwikiMath Number
hi def link VimwikiMathT VimwikiMath
+18 -20
View File
@@ -13,38 +13,36 @@ let s:markdown_syntax = g:vimwiki_syntax_variables['markdown']
let s:markdown_syntax.rxEqIn = '\$[^$`]\+\$'
let s:markdown_syntax.char_eqin = '\$'
" text: *strong*
" let s:markdown_syntax.rxBold = '\*[^*]\+\*'
" text: **strong** or __strong__
let s:markdown_syntax.rxBold = '\%(^\|\s\|[[:punct:]]\)\@<='.
\'\*'.
\'\%([^*`[:space:]][^*`]*[^*`[:space:]]\|[^*`[:space:]]\)'.
\'\*'.
\'\(\*\|_\)\{2\}'.
\'\%([^*_`[:space:]][^*_`]*[^*_`[:space:]]\|[^*_`[:space:]]\)'.
\'\1\{2\}'.
\'\%([[:punct:]]\|\s\|$\)\@='
let s:markdown_syntax.char_bold = '*'
let s:markdown_syntax.char_bold = '\*\*\|__'
" text: _emphasis_
" let s:markdown_syntax.rxItalic = '_[^_]\+_'
" text: _emphasis_ or *emphasis*
let s:markdown_syntax.rxItalic = '\%(^\|\s\|[[:punct:]]\)\@<='.
\'_'.
\'\%([^_`[:space:]][^_`]*[^_`[:space:]]\|[^_`[:space:]]\)'.
\'_'.
\'\(\*\|_\)'.
\'\%([^*_`[:space:]][^*_`]*[^*_`[:space:]]\|[^*_`[:space:]]\)'.
\'\1'.
\'\%([[:punct:]]\|\s\|$\)\@='
let s:markdown_syntax.char_italic = '_'
let s:markdown_syntax.char_italic = '\*\|_'
" text: *_bold italic_* or _*italic bold*_
let s:markdown_syntax.rxBoldItalic = '\%(^\|\s\|[[:punct:]]\)\@<='.
\'\*_'.
\'\%([^*_`[:space:]][^*_`]*[^*_`[:space:]]\|[^*_`[:space:]]\)'.
\'_\*'.
\'\(\*\)\{3\}'.
\'\%([^*`[:space:]][^*`]*[^*`[:space:]]\|[^*`[:space:]]\)'.
\'\1\{3\}'.
\'\%([[:punct:]]\|\s\|$\)\@='
let s:markdown_syntax.char_bolditalic = '\*_'
let s:markdown_syntax.char_bolditalic = '\*\*\*'
let s:markdown_syntax.rxItalicBold = '\%(^\|\s\|[[:punct:]]\)\@<='.
\'_\*'.
\'\%([^*_`[:space:]][^*_`]*[^*_`[:space:]]\|[^*_`[:space:]]\)'.
\'\*_'.
\'\(_\)\{3\}'.
\'\%([^_`[:space:]][^_`]*[^_`[:space:]]\|[^_`[:space:]]\)'.
\'\1\{3\}'.
\'\%([[:punct:]]\|\s\|$\)\@='
let s:markdown_syntax.char_italicbold = '_\*'
let s:markdown_syntax.char_italicbold = '___'
" text: `code`
let s:markdown_syntax.rxCode = '`[^`]\+`'