Skip to content

szkny/Ipython

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Ipython

概要

neovimのターミナルモードからipythonを呼び出すプラグインです。
szkny/SplitTermを利用しています。

  • このプラグインでできること
    • Ipythonコンソールでスクリプトを実行 (実行後も変数、メソッドを保持)
    • 編集中スクリプトの部分実行
    • Ipythonの機能をおおよそ実行可能

インストール

vim-plugの場合、init.vimに以下を追記

Plug 'szkny/Ipython'

neovimを開いて下記コマンドを実行

:PlugInstall

コマンド

使い方 説明
:Ipython 現在編集中のPythonスクリプトを実行する (ipythonウィンドウが無ければ開く )
:VIpython Visual modeで選択している行を実行する (ipythonウィンドウが無ければ開く )

キーマッピング (おすすめ)

init.vimに以下を追加

nnoremap  <leader>ip  :Ipython<CR>
vnoremap  <leader>ip  :VIpython<CR>

オプション

init.vimにリストで定義

" ipythonコマンドのコマンドライン引数
let g:ipython_startup_options = ['--no-confirm-exit']

" ipython起動時実行するコマンドリスト
let g:ipython_startup_command = [
            \'from pylab import *',
            \'import pandas as pd',
            \'pd.options.display.max_rows = 10',
            \'pd.options.display.max_columns = 10',
            \'pd.options.display.precision = 3']

" ウィンドウ幅 ( 0 にすると自動で設定)
let g:ipython_window_width = 0

以下はデフォルト

let g:ipython_startup_options = [
            \'--no-confirm-exit',
            \'--colors=Linux',
            \'--no-banner']

let g:ipython_startup_command = [
            \'from IPython import get_ipython',
            \'mgc = get_ipython().run_line_magic',
            \'mgc("load_ext", "autoreload")',
            \'mgc("autoreload", "2")']

let g:ipython_window_width = 10

関数

名前 説明
ipython#open() ipythonウィンドウを開く
ipython#close() ipythonウィンドウを閉じる
ipython#exist() ipythonウィンドウの存在確認
ipython#run() 現在編集中のPythonスクリプトを実行する
ipython#run_visual() Visual modeで選択している行を実行する

スクリーンショット

About

Neovim Plugin: Ipython

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published