Skip to content

pedromg/vimblog.vim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

vimblog.vim

Description

Vimblog.vim is a vim script written in Ruby that allows blog posts to be managed by commands inside the vim famous editor. Compatible with Vi, Vim, GVim, MacVim when compiled with ruby support.

Under Vim environment, you can create new posts, list, edit, move to draft, publish, delete and fetch all the categories with the bellow usage.

Usage

Usage is :Blog option [arg].

  • :Blog np creates new post;
  • :Blog rp [n] lists most n recent posts (defaults to 10);
  • :Blog gp [id] gets post with id, where you can edit it;
  • Blog del [id] deletes post with id;
  • Blog gc: gets categories list;
  • Blog draft saves current post as draft;
  • Blog publish publishes the current post.
  • Blog link [ADDRESS],[TITLE],[STRING] will insert a link STRING

It is out-of-the-box working for Wordpress, but should quite easilly be used for Blogger, MovableType, TextPattern or other platforms exposing API's.

Its the beauty of open source software. Study the code, change it and use it.

It should be safe to use it because, unlike with proprietary software, you can check for vulnerabilities like credentials theft, etc.

Requirements:

You'll need vim compiled with ruby scripting support. You can check this by typing:

$ vim --version | grep ruby

on you current shell session. The result will let you know if you have it or not.

Example for a vim with non ruby support:

+cscope            +localmap          -ruby              +wildignore

Notice the minus sign in -ruby. You'll want to see a plus sign.

Example for a ruby supported vim:

-python3 +quickfix +reltime -rightleft +ruby +scrollbind +signs +smartindent

install on Debian/Ubuntu:

$ sudo apt-get install vim-ruby

install MacVim with Homebrew:

You can try MacVim:

$ brew install macvim

How-To

  • copy vimblog.vim file to one of your vim scripts directory. Example to your .vim home folder:

$HOME/.vim/vimlog.vim

  • add the following lines to your .vimrc file. If it does not exist, create it ($HOME/.vimrc):
if !exists('*Wordpress_vim')
   runtime vimblog.vim
endif
  • open the vimblog.vim script and edit the personal data in the get_personal_data method approximatelly at line 97, update your blog login/password info;
  • @site value: do not insert “http://”. Just insert the blog address, something like blog.exmaple.com;
  • @xml value: make sure you have xmlrpc.php file in your / blog dir. If not, change the @xml variable to the correct location;
Test the script:
  • open vim and try to get your 10 most recent posts (rp):
:Blog rp

If you can see them, it’s fine. If not, test this:

  • check if the script is being found, by typing :B + TAB key. If it auto-completes to Blog it is finding the script. Remember, capital B.
  • if error persist, check for the correct path for xmlrpc.php in @xml value.

Have fun 🎉

Also, check this Vim colorscheme vim_pr0kter.

Releases

No releases published

Packages

No packages published