2015-06-06 00:20:15 +00:00
|
|
|
;;; packages.el --- ipython Layer packages File for Spacemacs
|
|
|
|
;;
|
2016-01-12 02:40:54 +00:00
|
|
|
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
|
2015-06-06 00:20:15 +00:00
|
|
|
;;
|
|
|
|
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;;; License: GPLv3
|
|
|
|
|
2015-06-08 03:36:39 +00:00
|
|
|
(setq ipython-notebook-packages '(ein))
|
2015-06-06 00:20:15 +00:00
|
|
|
|
2015-06-08 03:36:39 +00:00
|
|
|
(defun ipython-notebook/init-ein ()
|
2015-06-06 00:20:15 +00:00
|
|
|
(use-package ein
|
2015-06-08 22:49:07 +00:00
|
|
|
:defer t
|
2015-06-06 00:20:15 +00:00
|
|
|
:commands ein:notebooklist-open
|
|
|
|
:init
|
2015-11-18 00:38:05 +00:00
|
|
|
(spacemacs/set-leader-keys "ain" 'ein:notebooklist-open)
|
2015-06-06 00:20:15 +00:00
|
|
|
:config
|
2015-06-08 03:33:33 +00:00
|
|
|
(progn
|
|
|
|
(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))
|
2015-06-06 00:20:15 +00:00
|
|
|
|
2015-06-08 22:49:07 +00:00
|
|
|
(defun spacemacs//concat-leader (key)
|
|
|
|
(if dotspacemacs-major-mode-leader-key
|
|
|
|
(concat dotspacemacs-major-mode-leader-key key)
|
2016-05-17 20:44:49 +00:00
|
|
|
(concat "," key)))
|
2015-06-08 22:49:07 +00:00
|
|
|
|
2015-11-18 00:38:05 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'ein:notebook-multilang-mode
|
|
|
|
"y" 'ein:worksheet-copy-cell
|
|
|
|
"p" 'ein:worksheet-yank-cell
|
|
|
|
"d" 'ein:worksheet-kill-cell
|
|
|
|
"h" 'ein:notebook-worksheet-open-prev-or-last
|
|
|
|
"i" 'ein:worksheet-insert-cell-below
|
|
|
|
"I" 'ein:worksheet-insert-cell-above
|
|
|
|
"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
|
|
|
|
"R" 'ein:worksheet-rename-sheet
|
|
|
|
"RET" 'ein:worksheet-execute-cell-and-goto-next
|
2015-06-08 22:49:07 +00:00
|
|
|
;; Output
|
2015-11-18 00:38:05 +00:00
|
|
|
" C-l" 'ein:worksheet-clear-output
|
|
|
|
" C-S-l" 'ein:worksheet-clear-all-output
|
2015-06-08 22:49:07 +00:00
|
|
|
;;Console
|
2015-11-18 00:38:05 +00:00
|
|
|
" C-o" 'ein:console-open
|
2015-06-08 22:49:07 +00:00
|
|
|
;; Merge cells
|
2015-11-18 00:38:05 +00:00
|
|
|
" C-k" 'ein:worksheet-merge-cell
|
|
|
|
" C-j" 'spacemacs/ein:worksheet-merge-cell-next
|
2015-06-08 22:49:07 +00:00
|
|
|
;; Notebook
|
2015-11-18 00:38:05 +00:00
|
|
|
" 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
|
|
|
|
"u" 'ein:worksheet-change-cell-type
|
2015-06-16 02:56:55 +00:00
|
|
|
"fs" 'ein:notebook-save-notebook-command)
|
2015-06-15 20:19:02 +00:00
|
|
|
|
2015-07-27 19:50:52 +00:00
|
|
|
;; keybindings for ipython notebook traceback mode
|
2015-11-18 00:38:05 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'ein:traceback-mode
|
|
|
|
"RET" 'ein:tb-jump-to-source-at-point-command
|
|
|
|
"n" 'ein:tb-next-item
|
|
|
|
"p" 'ein:tb-prev-item
|
|
|
|
"q" 'bury-buffer)
|
2015-07-27 19:50:52 +00:00
|
|
|
|
2015-06-15 20:19:02 +00:00
|
|
|
;; keybindings mirror ipython web interface behavior
|
|
|
|
(evil-define-key 'insert ein:notebook-multilang-mode-map
|
|
|
|
(kbd "<C-return>") 'ein:worksheet-execute-cell
|
|
|
|
(kbd "<S-return>") 'ein:worksheet-execute-cell-and-goto-next)
|
2015-06-08 22:49:07 +00:00
|
|
|
|
|
|
|
(evil-define-key 'normal ein:notebook-multilang-mode-map
|
2015-06-15 20:19:02 +00:00
|
|
|
;; keybindings mirror ipython web interface behavior
|
|
|
|
(kbd "<C-return>") 'ein:worksheet-execute-cell
|
|
|
|
(kbd "<S-return>") 'ein:worksheet-execute-cell-and-goto-next
|
2015-06-08 22:49:07 +00:00
|
|
|
"gj" 'ein:worksheet-goto-next-input
|
|
|
|
"gk" 'ein:worksheet-goto-prev-input)
|
|
|
|
|
|
|
|
;; if this is not required then the following keygindings fail
|
|
|
|
(require 'ein-multilang)
|
|
|
|
(define-key ein:notebook-multilang-mode-map (kbd "M-j") 'ein:worksheet-move-cell-down)
|
|
|
|
(define-key ein:notebook-multilang-mode-map (kbd "M-k") 'ein:worksheet-move-cell-up)
|
|
|
|
|
2016-01-20 02:55:38 +00:00
|
|
|
(spacemacs|define-transient-state ipython-notebook
|
|
|
|
:title "iPython Notebook Transient State"
|
2016-01-21 04:00:27 +00:00
|
|
|
:doc "
|
2016-06-18 02:51:34 +00:00
|
|
|
Operations on Cells^^^^^^ On Worksheets^^^^ Other
|
|
|
|
----------------------------^^^^^^ ------------------------^^^^ ----------------------------------^^^^
|
|
|
|
[_k_/_j_]^^ select prev/next [_h_/_l_] select prev/next [_t_]^^ toggle output
|
|
|
|
[_K_/_J_]^^ move up/down [_H_/_L_] move left/right [_C-l_/_C-S-l_] clear/clear all output
|
|
|
|
[_C-k_/_C-j_]^^ merge above/below [_1_.._9_] open [1st..last] [_C-o_]^^ open console
|
|
|
|
[_O_/_o_]^^ insert above/below [_+_/_-_] create/delete [_C-s_/_C-r_] save/rename notebook
|
|
|
|
[_y_/_p_/_d_] copy/paste ^^^^ [_x_]^^ close notebook
|
|
|
|
[_u_]^^^^ change type ^^^^ [_q_]^^ quit transient-state
|
|
|
|
[_RET_]^^^^ execute"
|
|
|
|
:evil-leader-for-mode (ein:notebook-multilang-mode . ".")
|
2015-06-08 03:33:33 +00:00
|
|
|
: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)
|
2015-06-08 22:49:07 +00:00
|
|
|
("u" ein:worksheet-change-cell-type)
|
2015-06-08 03:33:33 +00:00
|
|
|
("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)
|
2016-06-18 02:51:34 +00:00
|
|
|
("x" ein:notebook-close))))
|
2016-06-14 08:51:08 +00:00
|
|
|
(with-eval-after-load 'ein-notebooklist
|
|
|
|
(define-key ein:notebooklist-mode-map "o" 'spacemacs/ace-buffer-links)))
|