Giter Site home page Giter Site logo

vim-livedown's Introduction

livedown.vim

A Vim plugin for Livedown.

Installation

First make sure you have node with npm installed.

If you have node do

$ npm install -g livedown

Then install this plugin with your preferred installation method. I recommend installing pathogen.vim, and then simply copy and paste

$ git clone git://github.com/shime/vim-livedown.git ~/.vim/bundle/vim-livedown

Usage

The following commands are available

" launch the Livedown server and preview your markdown file
:LivedownPreview

" stop the Livedown server
:LivedownKill

" launch/kill the Livedown server
:LivedownToggle

Bonus points for setting your own mapping

nmap gm :LivedownToggle<CR>

Configuration

There are several configuration variables you can customize to suit your needs, with the following defaults.

" should markdown preview get shown automatically upon opening markdown buffer
let g:livedown_autorun = 0

" should the browser window pop-up upon previewing
let g:livedown_open = 1

" the port on which Livedown server will run
let g:livedown_port = 1337

" the browser to use, can also be firefox, chrome or other, depending on your executable
let g:livedown_browser = "safari"

License

MIT

vim-livedown's People

Contributors

edgej avatar frm avatar shime avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

vim-livedown's Issues

Browser not auto updating

Hi, I have this plugin installed and it will open the preview in the browser with gm but if I make changes to the .md file, it does not auto update the browser window. Any suggestions?

Thank you,

Rob

livedown_browser option is not working

I'm trying to open markdown preview in some other browser, not default one (I have Chrome as default)

let g:livedown_browser = "open /Applications/Safari.app"
or
let g:livedown_browser = "open /Applications/Chromium.app"
in my .vimrc not helping.

Does anybody know, maybe, why?

problems with TEMP files in Win8

It seems that the plugin has a problem with creation of tempfiles. I am running Windows8.

Error detected while processing function LivedownPreview:
line 1:
E484: Cant open file c:\Users\HP\AppData\Local\Temp\VIoDD73.tmp

the temp file is missing in the Temp dir....
The problem persist if I change cygwin for cmd as shell.
please help

the problem is probably the same one that I had with vim gitgutter, which airblade (thanks) somehow solved (the problem disappered in newer commits, solution was not explicitely described)
airblade/vim-gitgutter#206

consider not put all browser windows to the front?

I open two browser windows, one is on display 1, the other is on display 2.

I write markdown files in display 1 with vim, and want to preview the markdown in display 2.

After I press :LivedownToggle, I expect the preview page will be shown in browser window of display 2.

Yes, it works indeed. But it also put the browser window of display 1 to the front, which hides the vim window.

Be able to open buffers without filename

Currently, the buffer contents need to be saved to a file for livedown to work. However, I was wondering if it's possible to implement this for buffers that don't have a set filename, e.g. scratch buffers.

A possible implementation would be to copy buffer contents to a file in /tmp/ and open that for displaying?

XSS

Hey there, an XSS is present in livedown you can trigger it with

[link](<script>alert(1)</script>)

Show vim cursor in preview?

Is this possible? It would make it easier to type while looking at the browser rather than the vim window.

Code in bullet list not rendered correctly

Hi there!

First, thank you for making live markdown preview so easy and convenient with vim :)

I have a rendering issue with code inside bullet points.

Original code:

On OS X it's pretty easy:

- install [`homebrew`](http://brew.sh/)
- `brew install python`
- install [Neovim](http://neovim.org/) (*recommended*) or Vim or Macvim
- `git clone https://github.com/ladislas/nvim ~/.nvim`
- `cd ~/.nvim && git submodule init && git submodule update`
- `ln -s ~/nvim/vimrc ~/.nvimrc`
- open Neovim with `nvim`, press `:` and then type `PlugInstall`
- wait for the process to complete
- close Neovim with `:q`
- start Neovim

Github rendering (correct):

screen shot 2014-11-30 at 11 07 34

Livedown rendering (issue):

screen shot 2014-11-30 at 11 08 09

Any idea on how to fix this? :)

auto-open is annoying

From HN comment by @amontalenti

I think the behavior of making it auto-open upon buffer switch is un-vimlike and probably annoying. Better to just support the LivedownPreview() function. (Also, the other function has code repetition it seems.)

Vim renames, not changes files

There is an issue that falls between this Vim plugin, Vim itself and Livedown. A common Vim setup is that it creates a backupfile and replaces it in-place, resulting in a rename event instead of an change event.

Huge gif image causes git and plugin managers to fail

Commit 2580179 introduces a huge gif file, 4.5mb, even though commit d1b7a04 removes that gif, it is still stored in git's history and causes a fresh git clone to take ages, and under certain internet connections - fail.

To completely remove demo.gif from Git history, you'll need to rewrite the tree:

git filter-branch --tree-filter 'rm -f demo.gif' HEAD
git gc
git push --force

latex display error

first, this is an awesome plugin. I find "${aa}^{bb}\mathcal{G}{cc}^{dd}$" cannot be rendered. could you check on this? it is just strange cause livedown can display the latex expression partly.

Flag to determine if livedown preview is opened

I want to bind the same mapping to toggle livedown preview window on/off. For this I'll need to know if livedown preview is already opened or not -- could you add such a flag (or :LivedownToggle)?

Server stops watching for changes after the first change

Hi there! First of all, thank you for the tool, it's been very useful!

I'm having an issue with the server. When I start it with :LivedownPreview, it works as expected. I make some changes and as I write my file, it updates the livedown preview. The second time I write the file, it doesn't automatically update the preview, instead I have to reload the page so I can see the new changes. I don't know if this was the expected behavior. If anyone needs more info about my nvim or OS, feel free to ask, I'll appreciate any help.

OS: Ubuntu 20.04
NVim: v0.6.0
Browser: Mozilla Firefox 95.0

Support Neovim

Seems broken in neovim, when calling LivedownPreview, only a blank page opens.

Can't toggle/preview/kill Livedown when using powershell as vim's shell

Under Windows 10, and neovim 0.4.4, I can't send commands to livedown when shell is set to powershell in my vimrc.

If I remove the following lines from my vimrc, it defaults to using cmd.exe as shell, and livedown works fine:

set shell=powershell shellpipe=\| shellxquote=
set shellcmdflag=-NoLogo\ -NoProfile\ -ExecutionPolicy\ RemoteSigned\ -Command
set shellredir=\|\ Out-File\ -Encoding\ UTF8

No error/feedback when livedown not installed

I switched my default Node version with nvm and it took a while for me to realize that I needed to reinstall livedown globally, since nvm installs these global packages per-version of Node. Showing the user some kind of error message when livedown is not available would be helpful in figuring out why an installation that previously worked well suddenly stops working.

`package.json` with `livedown` dependency

Could you add a package.json file with the livedown dependency so I could use my plugin manager to automatically install livedown when installing vim-livedown, e.g.:

NeoBundleLazy 'shime/vim-livedown', {
    \ 'build': { 'others': 'npm install' },
    \ 'disabled': ! executable('npm'),
    \ 'filetypes': [ 'markdown' ]
    \ }

too many open windows after changing buffers

Hello,

first of all, thanks a lot for this incredibly useful plugin.

I just ran into a small problem though.

  • The options in the docs only allow me to turns the automatic opening of windows on/off altogether. This means that I either get no window at all (have to open manually) or I get dozens of open windows if I move back and forward between buffers.
  • Also, the browser windows don't close after closing the markdown file in vim.

I managed to work around the first Issue by adding the following to my .vimrc

let g:livedown_autorun=1
let g:livedown_open=1
autocmd VimEnter *.markdown let g:livedown_open=0

Still, it would be nice to simply have an option for this as it took me a while to come up with this workaround. Same thing goes for the second problem since I would't even know where to start to get this to work.

Anyway, I know this issue isn't critical but still probably "nice to have".

regards

Why Socket.io?

I'm sort of venting.

Socket.io is heavyweight. It's essentially bloated. Anything is if it relies on hundreds of separate dependencies and takes almost ten minutes for NPM to install it.

All that a plugin like this needs is something simple. like ws.

Please people. Don't use a bulldozer when a hammer is sufficient

`--browser` is now required?

Prior to #20, I could invoke :LivedownPreview without arguments, and my default browser, Chrome, would automatically pop open, showing the rendered document. Now, nothing seems to happen after :LivedownPreview. If I open http://localhost:1337 manually though, the rendered document is there.

Can optional flags like --browser be, well, optional?

Doesn't recognize Google Chrome

Tried to switch to Google Chrome using:

let g:livedown_browser = "chrome"

And variations ("Chrome", "Google Chrome", "google chrome", etc.), but none works.

If I keep safari it works perfectly.

Is it a problem or am I doing something wrong?

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.