Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 42 additions & 37 deletions README
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
This is a mirror of http://www.vim.org/scripts/script.php?script_id=2551

Vim - Interpreter Command Line Editor. Use vim like a front-end for edit commands and send it to an interactive interpreter open in a GNU Screen session or tmux session.
Vim Interpreter Command Line Editor. Use Vim as a front-end to edit commands and send them to an interactive interpreter open in a GNU Screen session.

Features:

- Command History, just like a shell
- History save/load
- Can send only selected text or custom selection
- Command history, just like a shell.
- History save/load.
- Can send only selected text or custom selection.

I have been using Python, Ruby, Common Lisp, Scheme, Clojure, Ksh, and others interpreters through Vim and Vicle (and GNU Screen or tmux).
I have been using Python, Ruby, Common Lisp, Scheme, Clojure, Ksh, and others
interpreters through Vim and Vicle (and GNU Screen or tmux).

Usage:

Expand All @@ -18,57 +19,58 @@ Usage:
% irb
>>

- Open Vim with the vicle plugin and type a command (without press ENTER):
- Open Vim with the Vicle plugin and type a command (without pressing ENTER):
puts "Ruby interpreter"

- Type <C-c><C-c> or <C-CR> or :VicleSend to send to the interpreter the
current line (that can be changed by setting other Selection String).
- Type <C-c><C-c> or <C-CR> or :VicleSend to send the current line to the
interpreter (what to send can be changed by changing the Selection String).

- If the identifiers of the screen are not set, you are going be asked for
it (put the session name and window number where your interpreter are.
All the windows in a Screen session have a unique number.
- If the identifiers of the session are not set, you are going be prompted for
them. Enter the session name and window number where your interpreter is.
All the windows in a screen or tmux session have a unique number.
You can use TAB key for completion in the Session name):

Session name: rubySession
Window number: 0

In the screen window you are going to see:
Subsequently, you will see something like the following in the screen
window:
>> puts "Ruby interpreter"
Ruby interpreter
=> nil

If you disable the Edition Mode by calling the command :VicleEditionToggle
the <C-CR> and the other shortcut are going to send all the content of the
screen and after that, the screen of Vim are going to be cleared, just
like a normal command line.
the <C-CR> and the other shortcut are going to send the entire content of
the buffer, and clear the buffer, just like a normal command line.

- You scroll through the commands with the key <C-Up> and <C-Down> just
- You scroll through the commands with the key <C-Up> and <C-Down> just
like the history of the shell.

- Edition Mode
This mode do not clear the screen after send the command. Also, it send a
command selected by a custom Selection String that is in the variable
This mode does not clear the screen after sending the command. Also, it
sends the text selected by a custom Selection String found in the variable.

w:vicle_selection_string

Edition Mode is 1 (ON) by default.

By default, vicle in Edition mode send the current line.
By default, Vicle in Edition mode sends the current line.
Toggle the Edition Mode using the command :VicleEditionToggle

The selection string is by default "0v$y": go to column 0, enter visual
mode, go to the end of line and yank. Always is necesary to end with the
yank command "y".
It can be set to "{v}y" to select the current paragraph
mode, go to the end of line and yank.
(Always end with the yank command "y".)
It can be set to "{v}y" to select the current paragraph.

- Sending selected text using Vim's Visual Mode
Just select the text and press <C-CR> or <C-c><C-c> to send the selected
text without clear the screen. It is the same in Vicle Edition Mode and
Vicle Not Edicion Mode (send command and clear vim screen)
text without clearing the screen. It is the same whether Vicle Edition
Mode is on (don't clear screen) or off (send command and clear Vim
screen).

Just select the text. Vicle are going to yank it.
Just select the text. Vicle will yank it.

- Usefull commands for manage the history. Use absolute paths for history files:
- Useful commands for managing the history. Use absolute paths for history files:
:VicleHistoryToggle " activate or deactivate history
:VicleHistoryClear
:VicleHistorySize
Expand All @@ -80,35 +82,36 @@ Usage:

- Some global variables that you can define in your .vimrc:

let g:vicle_session_sn = 'normal_session_name'
let g:vicle_session_wn = 'normal_session_window'
let g:vicle_use = 'screen' " Can be 'screen' or 'tmux'
let g:vicle_escape_caret = 0 " If defined as 1 then the characters ^ will be escaped as \^
let g:vicle_session_sn = 'normal_session_name'
let g:vicle_session_wn = 'normal_session_window'
let g:vicle_use = 'screen' " Can be 'screen' or 'tmux'
let g:vicle_escape_caret = 0 " If defined as 1 then the characters ^ will be escaped as \^

let g:vicle_history_active = 0 " deactivate history
let g:vicle_edition_mode = 1 " active edition mode
let g:vicle_selection_string = "0v$y" " yank current line

let g:vicle_hcs = '~~~your_command_separator~~~'
let g:vicle_max_buffer = 300 " work for OSX
let g:vicle_hcs = '~~~your_command_separator~~~'
let g:vicle_max_buffer = 300 " work for OSX

Tips:

- If you want to send commands to a Ruby interpreter (irb), open a file like
work.rb or other with the extension .rb or set the filetype manually
:set filetype=ruby

This apply to other languages supported by vim.
This applies to other languages supported by Vim.

- For use Vicle with diferent languages
- To use Vicle with different languages:

autocmd FileType python let w:vicle_selection_string = "0v}y"
autocmd FileType lisp let w:vicle_edition_mode = 1 | let w:vicle_history_active = 0 | let w:vicle_selection_string = "v%y"
autocmd FileType clojure let t:vicle_edition_mode = 1 | let t:vicle_history_active = 0 | let t:vicle_selection_string = "v%y" | let t:vicle_session_sn ="session_name" | let t:vicle_session_wn= "window_name.pane_index"

- Use of rlwrap to run the interpreter

It is known that by trying and testing that running the interpreter with rlwrap improves the performances of vicle.
Trial and error has shown that running the interpreter with rlwrap
improves the performances of Vicle.

Clojure with rlwrap:
screen -S clojure rlwrap java -cp clojure.jar clojure.main
Expand All @@ -119,10 +122,12 @@ Tips:

- About the limit of size for the buffers to send

Vicle call many times to Screen when the buffer to send its bigger than 1000 characters. This let vicle to send really big buffers.
If the buffer to be sent is longer than 1000 characters, Vicle will call
screen repeatedly. This allows Vicle to send really large buffers without
running into limits.


Inspired On:
Inspired by:

Slime for Vim from Jonathan Palardy
http://technotales.wordpress.com/2007/10/03/like-slime-for-vim/
Expand Down