Archive

Posts Tagged ‘plugin’

gist.vim: Vim Plugin For Gist

October 8th, 2010 No comments

Gist is a simple way to share snippets and pastes with others. All gists are git repositories, so they are automatically versioned, forkable and usable as a git repository.

Yasuhiro Matsumoto’s Gist.vim plugin allow you to work with gist from Vim.

Working With gist.vim

:Gist

post whole text to gist.

Gist -p

post whole text to gist with private.

:Gist -a

post whole text to gist with anonymous.

:Gist -e

edit the gist. (shoud be work on gist buffer) you can update the gist with :w command on gist buffer.

:Gist -e foo.js

edit the gist with name ‘foo.js’. (shoud be work on gist buffer)

:Gist XXXXX

get gist XXXXX.

:Gist -c XXXXX.

get gist XXXXX and put to clipboard.

:Gist -l

list gists from mine.

:Gist -la

list gists from all.

Installing Gist.vim

1. Download the script
2. Move Gist.vim to ~/.vim (on Unix/Linux) or ~\vimfiles (on Windows).
3. Restart Vim.

Categories: VIM Tags: ,

Choose Your VIM Color Scheme With Color Sampler Pack

March 31st, 2010 No comments

vimYou can easily change your vim color scheme by :colorscheme, but it can be hard to compare several schemes to decide what’s best for you. But the Vim Color Sampler Pack can help you to choose which color scheme is best for you. This package was put together simply to save others time in downloading the color schemes.

This package is simply to help people who want to try out a lot of color schemes. It is the top 100 rated color schemes on vim.sf.net as of Jan 20th, 2010 that are are not “evil” (binding keys, changing fonts, etc) — zipped up in a single package. Every single theme was updated to its newest revision, and converted to unix formatted line endings.

Check out these screenshots before installing the color sampler pack.

Installing Vim Color Sampler Pack

Download the Color Sampler Pack From here. Simply unzip, and place the files in ~/.vim/plugin and ~/.vim/colors — it will unzip with correct dir structure, so you can just unzip to ~/.vim

The pack comes with an organized GUI menu, but no tool for console users. Console users can download the ScrollColor.vim plugin to walk through installed color schemes. Drop ScrollColors.vim into your plugin directory. Type :SCROLL and use arrow keys to walk through color schemes.

You can map two keys of your choice to NextColor and PrevColor actions. Choose pair of shortcut keys (for example and , or \n and \p) and map them as follows:

map <silent><f3> :NEXTCOLOR<cr>
map <silent><f2> :PREVCOLOR<cr>

Put the above maps in your ~/.vimrc

Happy coloring :-)

Categories: VIM Tags: ,

Vim Plugin: NERD Commenter

January 21st, 2010 3 comments

vimHi all, this is the second post about ‘Vim Plugins’. This time I am going to introduce you a new plugin called ‘NERD_commenter.vim’.

NERD commenter is a plugin for Vim that allows for easy commenting for many filetypes. The NERD commenter provides many different commenting operations and styles which are invoked via key mappings and a menu. NERD_commenter can handle single line, multi line, partial line commenting. This is a must have plugin if you’re programming in VIM.

How to use NERD_commenter.vim

This is the default block of code we will be working with:

$queue  = '/queue/foo';
$msg    = 'bar';
 
/* connection */
try {
     $stomp = new Stomp('tcp://localhost:61613');
} catch(StompException $e) {
     die('Connection failed: ' . $e->getMessage());
}
 
/* send a message to the queue 'foo' */
$stomp->send($queue, $msg);

,cc |NERDComComment|

Comments out the current line or text selected in visual mode.

//$queue  = '/queue/foo';
//$msg    = 'bar';
 
// connection
try {
    $stomp = new Stomp('tcp://localhost:61613');
} catch(StompException $e) {
    die('Connection failed: ' . $e->getMessage());
}
 
/* send a message to the queue 'foo' */
$stomp->send($queue, $msg);

,cn |NERDComNestedComment|

Same as |NERDComComment| but forces nesting.

//$queue  = '/queue/foo';
//$msg    = 'bar';
 
//// connection
try {
    $stomp = new Stomp('tcp://localhost:61613');
} catch(StompException $e) {
    die('Connection failed: ' . $e->getMessage());
}
 
/* send a message to the queue 'foo' */
$stomp->send($queue, $msg);

,c<space>|NERDComToggleComment|

Toggles the comment state of the selected line(s). If the topmost selected
line is commented, all selected lines are uncommented and vice versa.

create connection
try {
    $stomp = new Stomp('tcp://localhost:61613');
} catch(StompException $e) {
    die('Connection failed: ' . $e->getMessage());
}

,cm |NERDComMinimalComment|

Comments the given lines using only one set of multipart delimiters if
possible.

// create connection
/*try {
    $stomp = new Stomp('tcp://localhost:61613');
} catch(StompException $e) {
    die('Connection failed: ' . $e->getMessage());
}*/

,ci |NERDComInvertComment|

Toggles the comment state of the selected line(s) individually. Each selected
line that is commented is uncommented and vice versa.

create connection
//try {
    //$stomp = new Stomp('tcp://localhost:61613');
//} catch(StompException $e) {
    //die('Connection failed: ' . $e->getMessage());
//}

,cs |NERDComSexyComment|

Comments out the selected lines “sexily”

// create connection
/*
*try {
*    $stomp = new Stomp('tcp://localhost:61613');
*} catch(StompException $e) {
*    die('Connection failed: ' . $e->getMessage());
*}
*/

,cy |NERDComYankComment|

Same as |NERDComComment| except that the commented line(s) are yanked
before commenting.

// create connection
//try {
    //$stomp = new Stomp('tcp://localhost:61613');
//} catch(StompException $e) {
    //die('Connection failed: ' . $e->getMessage());
//}

pasted the yanked lines you will get

try {
    $stomp = new Stomp('tcp://localhost:61613');
} catch(StompException $e) {
    die('Connection failed: ' . $e->getMessage());
}

,c$ |NERDComEOLComment|

Comments the current line from the cursor to the end of line.

try {
    $stomp = /*new Stomp('tcp://localhost:61613');*/
} catch(StompException $e) {

,cA |NERDComAppendComment|

Adds comment delimiters to the end of line and goes into insert mode between
them.

try {
    $stomp = new Stomp('tcp://localhost:61613'); // cursor here
} catch(StompException $e) {

,cI |NERDComPrependComment|

Adds comment delimiters to the start of line and goes into insert mode between
them.

try {
    // cursor here   $stomp = new Stomp('tcp://localhost:61613');
} catch(StompException $e) {

,ca |NERDComAltDelim|

Switches to the alternative set of delimiters.

switches between // and /* */ for example. Here’s ,cc after applying this

/*$queue  = '/queue/foo';*/
/*$msg    = 'bar';*/
 
// create connection
try {
    $stomp = new Stomp('tcp://localhost:61613');
} catch(StompException $e) {
die('Connection failed: ' . $e->getMessage());
}

,cl  |NERDComAlignedComment|

Same as |NERDComComment| except that the delimiters are aligned down the side.

// create connection
/*try {*/
/*    $stomp = new Stomp('tcp://localhost:61613');*/
/*} catch(StompException $e) {*/
/*    die('Connection failed: ' . $e->getMessage());*/
/*}*/

,cr |NERDComAlignedComment|

Same as |NERDComComment| except that the delimiters are aligned down the right side.

// create connection
// create connection
/*try {                                             */
    /*$stomp = new Stomp('tcp://localhost:61613');  */
/*} catch(StompException $e) {                      */
    /*die('Connection failed: ' . $e->getMessage());*/
/*}*/

,cb |NERDComAlignedComment|

Same as |NERDComComment| except that the delimiters are aligned down both sides.

// create connection
/*try {                                             */
/*    $stomp = new Stomp('tcp://localhost:61613');  */
/*} catch(StompException $e) {                      */
/*    die('Connection failed: ' . $e->getMessage());*/
/*}

,cu |NERDComUncommentLine|

Uncomments the selected line(s).

send a message to the queue 'foo'
$stomp->send($queue, $msg);

Installing NERD_commenter.vim

To get the latest version:

* 1. Download NERD_commenter.zip.
* 2. Extract NERD_commenter.zip to ~/.vim (on Unix/Linux) or ~\vimfiles (on Windows).
* 3. Run :helptags ~/.vim/doc (on Unix/Linux) or :helptags ~/vimfiles/doc (on Windows) to rebuild the tags file (so that you can read :help NERD_commenter.)
* 4. Restart Vim.

Categories: HOW-TOS, VIM Tags: