All Projects → jgors → Vimux Ipy

jgors / Vimux Ipy

To send python code from vim to ipython running within a tmux split (with either visually selected code or with IPython like cells).

Labels

Projects that are alternatives of or similar to Vimux Ipy

Vim Rspec Focus
Helpers for focused rspec testruns.
Stars: ✭ 9 (-18.18%)
Mutual labels:  viml
Reading Vimrc
vimrc読書会資料集
Stars: ✭ 9 (-18.18%)
Mutual labels:  viml
Vim Simplebar
A simple non-attention-seeking Vim status line.
Stars: ✭ 10 (-9.09%)
Mutual labels:  viml
Vim Independence
A vim plugin for loading (git) project specific vim settings
Stars: ✭ 9 (-18.18%)
Mutual labels:  viml
Ap dark8
8色 Terminal 用の色設定と vim 用の色設定の自作
Stars: ✭ 9 (-18.18%)
Mutual labels:  viml
Devlindo.vim
Ultimate productivity boost for Vim.
Stars: ✭ 10 (-9.09%)
Mutual labels:  viml
Elysian.vim
elysian is a 256 terminal only colorscheme inspired by Apprentice
Stars: ✭ 9 (-18.18%)
Mutual labels:  viml
Vimrc
My personal vim config. Now with organisation! :-)
Stars: ✭ 10 (-9.09%)
Mutual labels:  viml
Vim confs
Personal Vim configurations with focus on a few programming languages (Python, Perl, Ruby and Go) and MacVim.
Stars: ✭ 9 (-18.18%)
Mutual labels:  viml
Molokai Terminal
A molokai-like theme for 16-color terminals and a 256-color theme for vim.
Stars: ✭ 10 (-9.09%)
Mutual labels:  viml
Ftl Vim Syntax
Vim syntax for FTL (FreeMarker Template Language)
Stars: ✭ 9 (-18.18%)
Mutual labels:  viml
Dotfiles
My Vim dotfiles.
Stars: ✭ 9 (-18.18%)
Mutual labels:  viml
Cu.vim
vim plugin for conversion camelCase and underscoreCase
Stars: ✭ 10 (-9.09%)
Mutual labels:  viml
Vim
VIM config
Stars: ✭ 9 (-18.18%)
Mutual labels:  viml
Vim Textobj Rubysymbol
Text object for manipulation of ruby symbol variables
Stars: ✭ 10 (-9.09%)
Mutual labels:  viml
Ctrlp Branches
Git branch searching using CtrlP.vim
Stars: ✭ 9 (-18.18%)
Mutual labels:  viml
Puppet Multipuppetmaster
A setup for multiple puppetmaster and one puppeteer who manges them
Stars: ✭ 9 (-18.18%)
Mutual labels:  viml
Php.vim Html Enhanced
combination of the php indent file and the html indent file
Stars: ✭ 10 (-9.09%)
Mutual labels:  viml
Haskomplete.vim
A vim ftplugin for magical contextual haskell code completions
Stars: ✭ 10 (-9.09%)
Mutual labels:  viml
Zdict.vim
A vim plugin integrate with zdict - the last online dictionary framework you need.
Stars: ✭ 10 (-9.09%)
Mutual labels:  viml

vimux-ipy

This is a vim plugin for added python functionality built on top of vimux; thus, it assumes that the vimux plugin is installed as well. Also, it is adapted from vimux-pyutils, but I add some features & abstracted away many details to get everything up and running quicker.

There are two main uses:

  • First, it allows a block of visual-mode selected python code to be sent from vim to a tmux buffer split running iPython.

  • Second, "cells" of code can be sent from vim to the running iPython tmux split. Regarding this use case, the idea here is to be able to have code block execution similiar to that found in the iPython Notebook, though being able to stay within vim. Additionally, if the cell_delim arg (explained below) is set such that it is the same as what the iPython notebook uses to delimit its code cells, then the script can be uploaded & opened as an iPython notebook, and the iPython NB environment will recognize the delimited cell blocks.

####The workflow for this would be:

  • start a tmux session,
  • open the desired python script with vim,
  • then execute the command to open the iPython tmux split/pane (eg. Leader vip),
  • now execute code in the tmux pane with iPython by either visually selecting code to send, or send a block of code that is delimited into cells.

####A typical session would look like this (using cells for execution by executing the cell by being inside of that cell and hitting Leader+c):

Key mappings

key mappings that are enabled by placing the following code into .vimrc:

To open the iPython tmux split [Leader vip]:

map <Leader>vip :call VimuxIpy()<CR>

  • Optionally, an argument can be passed into VimuxIpy() to start ipython in a preferred way: eg. VimuxIpy("ipython --pylab"), or VimuxIpy("ipython --profile=some_cool_profile"). If no argument is passed to VimuxIpy(), then normal ipython will start without any flags set.

After the iPython tmux split is created, these keybindings are made:

  • Jump down into the tmux pane in copy(/vim) mode

Leader vi

  • Close the vim tmux split

Leader vx

  • Interrupt any command running in the tmux pane

Leader vq

  • Insert the same cell block delimiter that iPython uses to seperate their code blocks in the iPython notebook [# <codeblock>]

Leader vc


To send & execute visually selected code in the iPython tmux split [Leader e]:

vmap <silent> <Leader>e :python run_visual_code()<CR>


To execute the current "cell" in the iPython tmux split [Leader c]:

noremap <silent> <Leader>c :python run_cell(save_position=False, cell_delim='####')<CR>

Note, a cell is similar to an iPython Notebook code cell and is defined as a code block spanning from one cell_delim to the next cell_delim (explained below).

Two arguments can be passed into run_cell:

  • save_position: [default False]

    If set True, then the cursor will stay at the current location after the code cell is executed. If False, then the cursor will jump ahead to the beginning of the next code cell block.

  • cell_delim: [default '####']

    Code cells are delimited by the cell_delim argument -- this specifies what should seperate the code cell blocks. Note, there should be a cell_delim at the beginning of the first code cell, as well as at the end of the last code cell.

    As mentioned above, this arg can be set such that it is the same as what the iPython notebook uses to delimit its code cells: cell_delim='# <codecell>'
    Meaning, if cells are seperated with this as the cell_delim, then the script can be uploaded & opened as an iPython notebook, and the iPython NB environment will recognize the delimited code cell blocks -- NOTE, in order to be able to upload a script delimited in this way to the iPython notebook environment, the first thing at the very top of the script needs to be: # <nbformat>3</nbformat>

    for more details see:

    ipython notebook format stable

    ipython notebook format dev

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].