ipython layer
You asked for it :) This is very trivial still ;_;
This commit is contained in:
parent
a4b5a22fb3
commit
1b0b7371a5
91
contrib/!tools/ipython/README.org
Normal file
91
contrib/!tools/ipython/README.org
Normal file
|
@ -0,0 +1,91 @@
|
|||
|
||||
* iPython contribution layer for Spacemacs (WIP)
|
||||
|
||||
** Description
|
||||
This layer adds support for the package =emacs-ipython-notebook=.
|
||||
|
||||
Do not hesitate to check the original package README [[https://github.com/millejoh/emacs-ipython-notebook][here]]. Also the wiki has
|
||||
lots of informative stuff.
|
||||
|
||||
** Features
|
||||
- Micro-State with "evilified" keybindings
|
||||
- Lazy-loading
|
||||
** TODO List
|
||||
- Maybe it'd be better if there was a state for this
|
||||
- Make more keybinding to =connect= to a python buffer.
|
||||
- Deleting visual regions don't work, find out why.
|
||||
- This is a WIP, feel free to collaborate.
|
||||
|
||||
** Install
|
||||
*** Layer
|
||||
#+begin_src emacs-lisp
|
||||
(setq-default dotspacemacs-configuration-layers '(ipython))
|
||||
#+end_src
|
||||
*** Dependencies
|
||||
Install iPython > 3
|
||||
#+begin_src sh
|
||||
pip install ipython
|
||||
#+end_src
|
||||
*** What needs to be run
|
||||
Have an iPython notebook running
|
||||
#+begin_src sh
|
||||
ipython notebook
|
||||
#+end_src
|
||||
|
||||
** Key Bindings
|
||||
|
||||
*** Open Notebook List
|
||||
This layer is lazy loaded so the micro-state will only work after you summon the
|
||||
command =ein:notebooklist-open= which is bound to =SPC a i n=
|
||||
*** Micro-state: =ipython-notebook=
|
||||
Once you are in the ipython notebook you can activate the micro-state with
|
||||
=SPC a i n=
|
||||
|
||||
| Key | Function |
|
||||
|---------+-------------------------------------------|
|
||||
| =h= | ein:notebook-worksheet-open-prev-or-last |
|
||||
| =j= | ein:worksheet-goto-next-input |
|
||||
| =k= | ein:worksheet-goto-prev-input |
|
||||
| =l= | ein:notebook-worksheet-open-next-or-first |
|
||||
| =H= | ein:notebook-worksheet-move-prev |
|
||||
| =J= | ein:worksheet-move-cell-down |
|
||||
| =K= | ein:worksheet-move-cell-up |
|
||||
| =L= | ein:notebook-worksheet-move-next |
|
||||
| =t= | ein:worksheet-toggle-output |
|
||||
| =d= | ein:worksheet-kill-cell |
|
||||
| =R= | ein:worksheet-rename-sheet |
|
||||
| =y= | ein:worksheet-copy-cell |
|
||||
| =p= | ein:worksheet-yank-cell |
|
||||
| =o= | ein:worksheet-insert-cell-below |
|
||||
| =O= | ein:worksheet-insert-cell-above |
|
||||
| =RET= | ein:worksheet-execute-cell-and-goto-next |
|
||||
| =C-l= | ein:worksheet-clear-output |
|
||||
| =C-S-l= | ein:worksheet-clear-all-output |
|
||||
| =C-o= | ein:console-open |
|
||||
| =C-k= | ein:worksheet-merge-cell |
|
||||
| =C-j= | spacemacs/ein:worksheet-merge-cell-next |
|
||||
| =C-s= | ein:notebook-save-notebook-command |
|
||||
| =C-r= | ein:notebook-rename-command |
|
||||
| =1= | ein:notebook-worksheet-open-1th |
|
||||
| =2= | ein:notebook-worksheet-open-2th |
|
||||
| =3= | ein:notebook-worksheet-open-3th |
|
||||
| =4= | ein:notebook-worksheet-open-4th |
|
||||
| =5= | ein:notebook-worksheet-open-5th |
|
||||
| =6= | ein:notebook-worksheet-open-6th |
|
||||
| =7= | ein:notebook-worksheet-open-7th |
|
||||
| =8= | ein:notebook-worksheet-open-8th |
|
||||
| =9= | ein:notebook-worksheet-open-last |
|
||||
| =+= | ein:notebook-worksheet-insert-next |
|
||||
| =-= | ein:notebook-worksheet-delete |
|
||||
| =x= | ein:notebook-close |
|
||||
|
||||
** Screenshots
|
||||
*** Light
|
||||
[[img/light.png]]
|
||||
*** Dark
|
||||
[[img/dark.png]]
|
||||
|
||||
** Bonus
|
||||
If you want to have a matplotlibrc that looks good with a dark background try
|
||||
using [[file:matplotlibrc][this]] =matplotlibrc=. Plot background is always transparent by default so
|
||||
it will look okay for most dark themes out there.
|
BIN
contrib/!tools/ipython/img/dark.png
Normal file
BIN
contrib/!tools/ipython/img/dark.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 313 KiB |
BIN
contrib/!tools/ipython/img/light.png
Normal file
BIN
contrib/!tools/ipython/img/light.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 348 KiB |
27
contrib/!tools/ipython/matplotlibrc
Normal file
27
contrib/!tools/ipython/matplotlibrc
Normal file
|
@ -0,0 +1,27 @@
|
|||
# -*- conf-unix -*-
|
||||
|
||||
text.color : dcdccc
|
||||
|
||||
patch.facecolor : 8cd0d3 # blue
|
||||
patch.edgecolor : eeeeee
|
||||
|
||||
axes.facecolor : 383838 # axes background color
|
||||
axes.edgecolor : bcbcbc # axes edge color
|
||||
axes.grid : True # display grid or not
|
||||
axes.labelcolor : dcdccc
|
||||
axes.color_cycle : 8cd0d3, 7f9f7f, cc9393, 93e0e3, dc8cc3, f0dfaf, dcdccc
|
||||
# (system default) blue, green, red, cyan, magenta, yellow, black
|
||||
|
||||
xtick.color : dcdccc # color of the tick labels
|
||||
xtick.direction : in # direction: in or out
|
||||
ytick.color : dcdccc # color of the tick labels
|
||||
ytick.direction : in # direction: in or out
|
||||
|
||||
legend.fancybox : True # if True, use a rounded box for the
|
||||
|
||||
figure.facecolor : 3f3f3f # figure facecolor; 0.75 is scalar gray
|
||||
figure.edgecolor : 383838 # figure edgecolor
|
||||
|
||||
# See also:
|
||||
# * Sane color scheme for Matplotlib
|
||||
# http://www.huyng.com/posts/sane-color-scheme-for-matplotlib/
|
107
contrib/!tools/ipython/packages.el
Normal file
107
contrib/!tools/ipython/packages.el
Normal file
|
@ -0,0 +1,107 @@
|
|||
;;; packages.el --- ipython Layer packages File for Spacemacs
|
||||
;;
|
||||
;; Copyright (c) 2012-2014 Sylvain Benner
|
||||
;; Copyright (c) 2014-2015 Sylvain Benner & Contributors
|
||||
;;
|
||||
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
||||
;; URL: https://github.com/syl20bnr/spacemacs
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
;;
|
||||
;;; License: GPLv3
|
||||
|
||||
;; List of all packages to install and/or initialize. Built-in packages
|
||||
;; which require an initialization must be listed explicitly in the list.
|
||||
(setq ipython-packages
|
||||
'(
|
||||
ein
|
||||
))
|
||||
|
||||
(defun ipython/init-ein ()
|
||||
(use-package ein
|
||||
:commands ein:notebooklist-open
|
||||
:init
|
||||
(evil-leader/set-key
|
||||
"ain" 'ein:notebooklist-open)
|
||||
:config
|
||||
(defun spacemacs/ein:worksheet-merge-cell-next ()
|
||||
(interactive)
|
||||
(ein:worksheet-merge-cell (ein:worksheet--get-ws-or-error) (ein:worksheet-get-current-cell) t t))
|
||||
|
||||
(defvar spacemacs--ipython-notebook-ms-doc-toggle 0
|
||||
"Display a short doc when nil, full doc otherwise.")
|
||||
|
||||
(defun spacemacs//ipython-notebook-ms-doc ()
|
||||
(if (equal 0 spacemacs--ipython-notebook-ms-doc-toggle)
|
||||
"[?] for help"
|
||||
"
|
||||
[?] display this help
|
||||
[k,j]: [prev,next] cell [K,J]: move cell [up,down]
|
||||
[h,l]: prev,next worksheet [H,L]: move worksheet [left,right]
|
||||
[d,y,p,RET]: [kill,copy,paste, execute] cell [t,C-l,C-S-L]: [toggle,clear,clear all] output
|
||||
[o,O]: insert cell [bellow,above]
|
||||
[C-o]: open console [C-k,C-j]: merge cell [above,bellow]
|
||||
[1,2,...,8,9]: open [1st,2nd,..,8th,last] worksheet
|
||||
[C-s, C-r]: [save, rename] notebook
|
||||
[+,-]: [create,delete] worksheet
|
||||
[x]: close notebook
|
||||
[q] quit"))
|
||||
|
||||
(defun spacemacs//ipython-notebook-ms-toggle-doc ()
|
||||
(interactive)
|
||||
(setq spacemacs--ipython-notebook-ms-doc-toggle
|
||||
(logxor spacemacs--ipython-notebook-ms-doc-toggle 1)))
|
||||
|
||||
(spacemacs|define-micro-state ipython-notebook
|
||||
:doc (spacemacs//ipython-notebook-ms-doc)
|
||||
:use-minibuffer t
|
||||
:evil-leader "ein"
|
||||
:bindings
|
||||
("q" nil :exit t)
|
||||
("?" spacemacs//ipython-notebook-ms-toggle-doc)
|
||||
("h" ein:notebook-worksheet-open-prev-or-last)
|
||||
("j" ein:worksheet-goto-next-input)
|
||||
("k" ein:worksheet-goto-prev-input)
|
||||
("l" ein:notebook-worksheet-open-next-or-first)
|
||||
("H" ein:notebook-worksheet-move-prev)
|
||||
("J" ein:worksheet-move-cell-down)
|
||||
("K" ein:worksheet-move-cell-up)
|
||||
("L" ein:notebook-worksheet-move-next)
|
||||
("t" ein:worksheet-toggle-output)
|
||||
("d" ein:worksheet-kill-cell)
|
||||
("R" ein:worksheet-rename-sheet)
|
||||
("y" ein:worksheet-copy-cell)
|
||||
("p" ein:worksheet-yank-cell)
|
||||
("o" ein:worksheet-insert-cell-below)
|
||||
("O" ein:worksheet-insert-cell-above)
|
||||
("RET" ein:worksheet-execute-cell-and-goto-next)
|
||||
;; Output
|
||||
("C-l" ein:worksheet-clear-output)
|
||||
("C-S-l" ein:worksheet-clear-all-output)
|
||||
;;Console
|
||||
("C-o" ein:console-open)
|
||||
;; Merge cells
|
||||
("C-k" ein:worksheet-merge-cell)
|
||||
("C-j" spacemacs/ein:worksheet-merge-cell-next)
|
||||
;; Notebook
|
||||
("C-s" ein:notebook-save-notebook-command)
|
||||
("C-r" ein:notebook-rename-command)
|
||||
("1" ein:notebook-worksheet-open-1th)
|
||||
("2" ein:notebook-worksheet-open-2th)
|
||||
("3" ein:notebook-worksheet-open-3th)
|
||||
("4" ein:notebook-worksheet-open-4th)
|
||||
("5" ein:notebook-worksheet-open-5th)
|
||||
("6" ein:notebook-worksheet-open-6th)
|
||||
("7" ein:notebook-worksheet-open-7th)
|
||||
("8" ein:notebook-worksheet-open-8th)
|
||||
("9" ein:notebook-worksheet-open-last)
|
||||
("+" ein:notebook-worksheet-insert-next)
|
||||
("-" ein:notebook-worksheet-delete)
|
||||
("x" ein:notebook-close)
|
||||
)
|
||||
))
|
||||
|
||||
;;
|
||||
;; Often the body of an initialize function uses `use-package'
|
||||
;; For more info on `use-package', see readme:
|
||||
;; https://github.com/jwiegley/use-package
|
Loading…
Reference in a new issue