Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

From time to time I want to use vim as scratch pad for commands that I would like to send to a command line shell like psql (Postgres), ghci (Haskell programming language), octave ('calculator'), gnuplot (plot) etc.

The advantages would be that you could put comments next to command lines, directly document your session, incrementally develop command lines, test examples ad-hoc in manuals etc.

Pro features I would like to use: send a selection to a shell, send e.g. the next 10 lines to a shell, display the output of a shell command into a vim output buffer, into a vim yank-register, directly insert it etc.

There should be some support of a shell-session concept, i.e. the shell should not be started for each command from scratch.

I could live with a kind of remote controlled xterm which I would put side by side to a vim window.

share|improve this question
    
A bonus tip: bash supports vi-keybindings with set -o vi which enables more advanced editing of the command line. –  Herman Torjussen Sep 20 '12 at 19:14
    
@htor, yup, this is also useful, but it is really a different use case (btw. setting set editing-mode vi in ~/.inputrc gives you that experience in all readline enabled applications). –  maxschlepzig Sep 20 '12 at 19:30
    
And btw, Ctrl-X Ctrl-E in Bash opens your $EDITOR with the current command, so you can edit it as you like. The command will be run when you quit the editor. –  Axel Knauf Sep 21 '12 at 14:51
    
@AxelKnauf Ctrl-X Ctrl-E ... it is ESC v ! ;) –  maxschlepzig Sep 21 '12 at 18:20
add comment

1 Answer

up vote 2 down vote accepted

Try vim-slime, an environment inspired by Emacs's SLIME mode. It sends the contents of Vim to a screen or tmux session.

In the future you can probably also use Xiki, but for now its Vim support is incomplete.

share|improve this answer
    
vim-slime is great - C-c-c sends the current paragraph to the specified screen-window (screen is used by default). I'd like to configure a key-binding for just sending the current line - probably not that hard. –  maxschlepzig Sep 26 '12 at 5:20
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.