Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e3fb8e6

Browse files
committed
Cell mode
1 parent 3b0f66e commit e3fb8e6

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ tmux split and this allow to execute a file chunk-by-chunk.
1212
This is somewhat similar to the code block execution that can be found in
1313
scientific software (for example Matlab).
1414

15+
Keys mapping
16+
-----------
17+
By default, the following mappings are enabled :
18+
19+
* <C-c> will paste and execute the currently selected block in ipython
20+
* <C-b> will execute the current cell in ipython
21+
A cell is similar to MATLAB's cell and is defined as the line ranging from
22+
the previous ## to the next ##
23+
1524
Difference with vim-ipython
1625
---------------------------
1726
Note that if you want more advanced integration with IPython (using the new

ftplugin/python/pyutils.vim

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,16 @@ endpython
6060

6161
vmap <silent> <C-c> :python run_tmux_python_chunk()<CR>
6262
63+
" This is to emulate MATLAB's cell mode
64+
" Cells are delimited by ##. Note that there should be a ## at the end of the
65+
" file
66+
" The :?##?;/##/ part creates a range with the following
67+
" ?##? search backwards for ##
68+
" Then ';' starts the range from the result of the previous search (##)
69+
" /##/ End the range at the next ##
70+
" See the doce on 'ex ranges' here :
71+
" http://tnerual.eriogerg.free.fr/vimqrc.html
72+
" Then, we simply call run_tmux_python_chunk that will run the range
73+
" of the current buffer
74+
noremap <silent> <C-b> :?##?;/##/ :python run_tmux_python_chunk()<CR>
75+

0 commit comments

Comments
 (0)