sponsor Vim development Vim logo Vim Book Ad

cmd.vim : Execute shell(or Windows cmd) command in Vim and echo output in Vim

 script karma  Rating 23/23, Downloaded by 2618  Comments, bugs, improvements  Vim wiki

created by
yp guo
 
script type
utility
 
description

Cmd.vim is a vim plugin to provide vim the ability to execute shell command
directly in vim and echo the result in vim. For example, you could use ":!ls"
to list all the files of current directory, Now cmd.vim provide a new command
":Ls" to implement the same function, but the result is in vim insteading of in
the shell. The mainpage in Chinese is avaiable at:

http://code.google.com/p/cmd-dot-vim/

There are many well known shell command to implement powerful functions, now I
port them to vim version, In the current release, there are four command
available now, More are to be added. For those not listed below, you could use
":Shell your_command" to execute your_command like "! your_command", with the
result in Vim insteading of Shell.

":Date" - print or set the system date and time
":Gcc" - gcc - GNU project C and C++ compiler
":Ls" - list directory contents
":Sdcv Words" - call sdcv to lookup Words in vim

[Note]: Please note that since Vim claim user defined commands must start with an
uppercase letter, so every shell command start with an uppercase letter.

[Note]: Please note that cmd.vim is an adapter, So please make sure the original
command is available. it is expected that cmd.vim works where the original
command works, whatever it's Linux, Cygwin, Windows, or Mac.

[Note]: In most circumstances, it will be better if you map them to your
favorite map, For example, To look up the a word under the cursor, or to lookup
the words selected:

nmap <script> <silent> <unique> <Leader>l <ESC>:Sdcv '<cword>' <CR>
vmap <script> <silent> <unique> <Leader>l y<ESC>:Sdcv <c-r>" <CR>
 
install details

Put the cmd.vim to your $HOME/.vim/plugin or the $HOME/vimfiles/plugin or
the $VIM/vimfiles/plugin.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
cmd.vim 1.0.3 2010-04-17 6.0 yp guo Feature improvement:
Add a parameter '\t' for Date command in Windows. Without that ":Date" will be interactive.
cmd.vim 1.0.2 2010-04-04 6.0 yp guo New feature: For every command, you could use ":Shell command" to get the same result as ":Command". So For command not listed, cmd.vim also works.
cmd.vim 1.0.1 2010-04-03 6.0 yp guo 1. Infrastructure changed for simplicity.
2. Add a new command ":Gcc" - compile this file using gcc.
cmd.vim 1.0 2010-04-02 6.0 yp guo Initial upload
ip used for rating: 54.196.248.93

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github