Add support for code-cells in python layer
This commit is contained in:
parent
11f45d529f
commit
895deed51a
|
@ -25,6 +25,7 @@
|
|||
- [[#autoflake][autoflake]]
|
||||
- [[#pylookup][pylookup]]
|
||||
- [[#dap-mode-debugger-only-for-lsp-backend][dap-mode debugger (only for lsp backend)]]
|
||||
- [[#notebook-and-code-cells][Notebook and code cells]]
|
||||
- [[#configuration][Configuration]]
|
||||
- [[#fill-column][Fill column]]
|
||||
- [[#sort-imports][Sort imports]]
|
||||
|
@ -70,6 +71,7 @@ This layer adds support for the Python language.
|
|||
- Fix a missing import statement with [[https://github.com/anachronic/importmagic.el][importmagic]]
|
||||
- Pip package manager with [[https://github.com/brotzeit/pippel][pippel]]
|
||||
- Interactive debugger using [[https://github.com/emacs-lsp/dap-mode][dap-mode]]
|
||||
- Support for ipython notebook and MATLAB-like cells using using [[https://github.com/astoff/code-cells.el][code-cells]]
|
||||
|
||||
* Install
|
||||
** Layer
|
||||
|
@ -306,6 +308,15 @@ To use =dap-mode= for debugging do:
|
|||
pip install "ptvsd>=4.2"
|
||||
#+END_SRC
|
||||
|
||||
** Notebook and code cells
|
||||
To use =code-cells-mode= with ipython notebook automatically you should install
|
||||
[[https://github.com/mwouts/jupytext][jupytext]]. Make sure that the =ipython-notebook= layer is not used.
|
||||
|
||||
Then you can evaluate the current cell in a REPL process with ~SPC m s c~ or all
|
||||
the cells above with ~SPC m s a~.
|
||||
You can also move to the next cell with ~SPC m g F~ and to the previous cell
|
||||
with ~SPC m g B~.
|
||||
|
||||
* Configuration
|
||||
** Fill column
|
||||
If you want to customize the fill column value, use something like this inside
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
(defconst python-packages
|
||||
'(
|
||||
blacken
|
||||
code-cells
|
||||
company
|
||||
counsel-gtags
|
||||
cython-mode
|
||||
|
@ -95,6 +96,19 @@
|
|||
(add-to-list 'spacemacs-jump-handlers-python-mode
|
||||
'(anaconda-mode-find-definitions :async t)))))
|
||||
|
||||
(defun python/init-code-cells ()
|
||||
(use-package code-cells
|
||||
:if (not (configuration-layer/layer-used-p 'ipython-notebook))
|
||||
:defer t
|
||||
:init
|
||||
(progn
|
||||
(add-hook 'python-mode-hook 'code-cells-mode)
|
||||
(spacemacs/set-leader-keys-for-minor-mode 'code-cells-mode
|
||||
"gB" 'code-cells-backward-cell
|
||||
"gF" 'code-cells-forward-cell
|
||||
"sc" 'code-cells-eval
|
||||
"sa" 'code-cells-eval-above))))
|
||||
|
||||
(defun python/post-init-company ()
|
||||
;; backend specific
|
||||
(add-hook 'python-mode-local-vars-hook #'spacemacs//python-setup-company)
|
||||
|
|
Loading…
Reference in New Issue