Coder Social home page Coder Social logo

nvim-markdown's Introduction

Nvim Markdown

Fork of vim-markdown with extra functionality.

Installation

This plugin requires Neovim 0.5+

Use a package manager like vim-plug to install it.

To install with vim-plug add: Plug 'ixru/nvim-markdown'

To install manually instead, see :help plugin

Features

  • Syntax highlighting with optional concealment of links and text formatting.
  • Fold headers and lists by pressing tab in normal mode, they persist between sessions.
  • Insert checkboxes [X] in lists by pressing Control-c in normal mode.
  • Auto-inserts bullets on newline; can be removed again with backspace while preserving indentation, or tab to create a sub-list.
  • Create links [link text](url) by pressing Control-k in insert or visual mode. If pressed in an url, or in a word, it will autofill the correct field. tab can be used in insert mode to skip from one field to the next.
  • Follow links with Return
  • Return will create a link to a markdown file, if pressed over a word.

Options

Syntax Concealing

Concealing is set for some syntax.

For example, conceal [link text](link url) as just link text. Also, _italic_ and *italic* will conceal to just italic. Similarly __bold__, **bold**, ___italic bold___, and ***italic bold*** will conceal to just bold, bold, italic bold, and italic bold respectively.

To change what is concealed use one of these in your vimrc:

let g:vim_markdown_conceal = 0 " Nothing is concealed
let g:vim_markdown_conceal = 1 " Links are concealed
let g:vim_markdown_conceal = 2 " Links and text formatting is concealed (default)

To disable math conceal with LaTeX math syntax enabled, add the following to your .vimrc:

let g:tex_conceal = ""
let g:vim_markdown_math = 1
Enable TOC window auto-fit

Allow for the TOC window to auto-fit when it's possible for it to shrink. It never increases its default size (half screen), it only shrinks.

    let g:vim_markdown_toc_autofit = 1
Text emphasis restriction to single-lines

By default text emphasis works across multiple lines until a closing token is found. However, it's possible to restrict text emphasis to a single line (i.e., for it to be applied a closing token must be found on the same line). To do so:

    let g:vim_markdown_emphasis_multiline = 0
Fenced code block languages

You can use filetype name as fenced code block languages for syntax highlighting. If you want to use different name from filetype, you can add it in your .vimrc like so:

    let g:vim_markdown_fenced_languages = ['csharp=cs']

This will cause the following to be highlighted using the cs filetype syntax.

```csharp
...
```

Default is ['c++=cpp', 'viml=vim', 'bash=sh', 'ini=dosini'].

Syntax extensions

The following options control which syntax extensions will be turned on. They are off by default.

LaTeX math

Used as $x^2$, $$x^2$$, escapable as \$x\$ and \$\$x\$\$.

let g:vim_markdown_math = 1
YAML Front Matter

Highlight YAML front matter as used by Jekyll or Hugo.

let g:vim_markdown_frontmatter = 1
TOML Front Matter

Highlight TOML front matter as used by Hugo.

TOML syntax highlight requires vim-toml.

let g:vim_markdown_toml_frontmatter = 1
JSON Front Matter

Highlight JSON front matter as used by Hugo.

JSON syntax highlight requires vim-json.

let g:vim_markdown_json_frontmatter = 1

Mappings

Normal mode

  • ]]: Go to next header. <Plug>Markdown_MoveToNextHeader
  • [[: Go to previous header. Contrast with ]c. <Plug>Markdown_MoveToPreviousHeader
  • ][: Go to next sibling header if any. <Plug>Markdown_MoveToNextSiblingHeader
  • []: Go to previous sibling header if any. <Plug>Markdown_MoveToPreviousSiblingHeader
  • ]c: Go to Current header. <Plug>Markdown_MoveToCurHeader
  • ]u: Go to parent header (Up). <Plug>Markdown_MoveToParentHeader
  • Ctrl-c: Toggle checkboxes. <Plug>Markdown_Checkbox
  • Return: Follow links. <Plug>Markdown_FollowLink

Insert mode

  • Tab: Indent new bullets, jump through empty fields in links. <Plug>Markdown_Jump
  • Ctrl-k: Create new links. <Plug>Markdown_CreateLink
  • O: New line above, overrides default. <Plug>Markdown_NewLineAbove
  • o: New line below, overrides default. <Plug>Markdown_NewLineBelow
  • Return: New line below, overrides default. <Plug>Markdown_NewLineBelow

Visual mode

  • Ctrl-k: Create new links. <Plug>Markdown_CreateLink

This plugin follows the recommended Vim plugin mapping interface, so to change the map ]u to asdf, add to your .vimrc:

map asdf <Plug>Markdown_MoveToParentHeader

To disable a map use:

map <Plug> <Plug>Markdown_MoveToParentHeader

To disable all mappings use:

let g:vim_markdown_no_default_key_mappings = 1

Commands

The following requires :filetype plugin on.

  • :HeaderDecrease: Decrease level of all headers in buffer: h2 to h1, h3 to h2, etc.

    If range is given, only operate in the range. If an h1 would be decreased, abort. For simplicity of implementation, Setex headers are converted to Atx.

  • :HeaderIncrease: Analogous to :HeaderDecrease, but increase levels instead.

  • :SetexToAtx: Convert all Setex style headers in buffer to Atx.

    If a range is given, e.g. hit : from visual mode, only operate on the range.

  • :Toc: create a quickfix vertical window navigable table of contents with the headers. Hit <Enter> on a line to jump to the corresponding line of the markdown file.

  • :Toch: Same as :Toc but in a horizontal window.

  • :Tocv: Same as :Toc but in a vertical window.

  • :InsertToc: Insert table of contents at the current line.

    An optional argument can be used to specify how many levels of headers to display in the table of content, e.g., to display up to and including h3, use :InsertToc 3.

  • :InsertNToc: Same as :InsertToc, but the format of h2 headers in the table of contents is a numbered list, rather than a bulleted list.

Credits

The main contributors of vim-markdown are:

  • Ben Williams (A.K.A. plasticboy). The original developer of vim-markdown. Homepage.

If you feel that your name should be on this list, please make a pull request listing your contributions.

License

The MIT License (MIT)

Copyright (c) 2012 Benjamin D. Williams

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:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

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.

nvim-markdown's People

Contributors

shirosaki avatar ************ avatar bwilliamsgryphon avatar alexconst avatar codybuell avatar plasticboy avatar brandonf2002 avatar yous avatar memeplex avatar ilikepi avatar citizenmatt avatar tobinjt avatar sersorrel avatar michaelpotter avatar todesking avatar jrwrigh avatar cdelledonne avatar colinsullivan avatar blueyed avatar farmckon avatar fmoralesc avatar jhoepken avatar rhdunn avatar artumi-richard avatar y0t4 avatar aseom avatar haya14busa avatar xiaket avatar beala avatar boack avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.