Coder Social home page Coder Social logo

vim-markdown-writer's Introduction

#vim-markdown-writer

A plugin containing some Vimscript functions for writing Markdown blog posts, with a particular emphasis on those containing code.

Installation

If you don't have a preferred installation method, I recommend installing pathogen.vim, and then simply copy and paste:

cd ~/.vim/bundle
git clone git://github.com/jackfranklin/vim-markdown-writer.git

Available Functions

No mappings are provided, you are expected to add those to your own vimrc, mapping them to suit.

MW_MakeTwitterReferenceLink

Will replace any reference to what looks like a Twitter username with a link to it. For example:

Thanks to @phuunet with his help.

Running :call MW_MakeTwitterReferenceLink() (or a suitable mapping) will leave you with:

Thanks to [@phuunet](http://twitter.com/phuunet) for his help.

MW_ConvertFencedToIndent

Useful for if you're working on a system that doesn't support GitHub style Markdown.

If you have this:

Some sample code here:

```
something()
somethingElse()
```

Running :call MW_ConvertFencedToIndent() on the top line will change the fences into indents:

Some sample code here:

    something()
    somethingElse()

Note that your cursor must be on or above the first fence block.

MW_YamlFrontMatter

Will ask you to input keys and values, and add them to the top of your file in the form of YAML front matter.

Enter end to stop inputting. Best shown via a screencast.

MW_Heading(count)

Will insert as many hashes as passed in, and leave you in insert mode, ready to enter your heading.

For example:

```
{cursor is here}

Lorem ipsum dolor sit amet, consetetur sadipscing elitr.
```

Running :call MW_Heading(5) will do this:

```
##### {cursor here, in insert mode}

Lorem ipsum dolor sit amet, consetetur sadipscing elitr.
```

MW_MakeWordLink()

Will make the current word under the cursor a link, after asking you for the URL. There is no need to enter http:// in the URL, although if you do, the plugin will not add http:// in again. Again, shown best in a screencast.

How to Map

nnoremap <leader>mt :call MW_MakeTwitterReferenceLink()<CR>
nnoremap <leader>mfi :call MW_ConvertFencedToIndent()<CR>
nnoremap <leader>my :call MW_YamlFrontMatter()<CR>
nnoremap <leader>ml :call MW_MakeWordLink()<CR>
nnoremap <leader>mh1 :call MW_Heading(1)<CR>
nnoremap <leader>mh2 :call MW_Heading(2)<CR>
nnoremap <leader>mh3 :call MW_Heading(3)<CR>
nnoremap <leader>mh4 :call MW_Heading(4)<CR>
nnoremap <leader>mh5 :call MW_Heading(5)<CR>

Of course, some of those heading mappings end up taking more characters than just typing the text itself, but you get the point.

Or, you might want to map MW_MakeTwitterReferenceLink() function to perform its work on the entire document:

nnoremap <leader>mt ggVG:call MW_MakeTwitterReferenceLink()<CR>

Issues / Requests

This is my first Vim plugin so any feedback is more than welcome. Please open an issue.

TODO

Add a proper Vim doc file.

Changelog

0.0.3

  • added MW_MakeWorldLink

0.0.2

  • added MW_Heading method

0.0.1

  • initial release

vim-markdown-writer's People

Contributors

jackfranklin avatar marlun avatar

Watchers

 avatar  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.