Repository: untitled-ai/jupyter_ascending.vim
Branch: master
Commit: 8b0f533fbf7f
Files: 5
Total size: 7.1 KB
Directory structure:
gitextract_zzuf9woh/
├── LICENSE
├── README.md
├── autoload/
│ └── jupyter_ascending.vim
├── doc/
│ └── jupyter_ascending.txt
└── plugin/
└── jupyter_ascending.vim
================================================
FILE CONTENTS
================================================
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2020 Untiled AI
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
# jupyter_ascending.vim
Vim plugin to interact with `jupyter_ascending`
Currently only supports Jupyter Notebook.

## Installation
First, you must install [jupyter_ascending](https://github.com/untitled-ai/jupyter_ascending) in the python envirenment you're working in. For example:
```bash
$ pyenv activate my_notebook_env
$ pip install jupyter_ascending
```
It is possible you won't need to run the following commands on newer version of jupyter notebook, but it's recommended that you do anyway, because installing extensions is hard. Or unless you already executed them in the previous step of installing `jupyter_ascending`.
```bash
$ jupyter nbextension install --py --sys-prefix jupyter_ascending
$ jupyter nbextension enable jupyter_ascending --sys-prefix --py
$ jupyter serverextension enable jupyter_ascending --sys-prefix --py
```
You can confirm it's installed by checking:
```bash
$ jupyter nbextension list
$ jupyter serverextension list
```
Then install this plugin using the vim plugin manager you like. For example:
```
Plug 'untitled-ai/jupyter_ascending.vim'
```
Or if you use lua configs:
```
use 'untitled-ai/jupyter_ascending.vim'
```
## Usage
1) First create a Jupyter notebook notebook_name.sync.ipynb.
2) Then generate a notebook_name.sync.py file using jupytext with "percent format". (see Paired notebooks in [jupytext](https://github.com/mwouts/jupytext))
3) Edit .sync.py file in vim and Jupyter Ascending will update the .sync.ipynb every time .sync.py is saved.
4) Send commands to Jupyter notebook via the following mappings:
Execute cell
```vim
nmap <space><space>x <Plug>JupyterExecute
```
Execute all cells
```vim
nmap <space><space>X <Plug>JupyterExecuteAll
```
Restart kernel
```vim
nmap <space><space>r <Plug>JupyterRestart
```
NOTE: it syncs your `py` file with `ipynb` file whenever you save your `py` file.
Use `# %%` to separate cells.
Use `# %% [markdown]` to make a markdown block.
## Settings
See `doc/jupyter_ascending.txt` for more information.
================================================
FILE: autoload/jupyter_ascending.vim
================================================
function! s:on_stdout(j, d, e)
if len(a:d) > 0 && len(a:d[0]) > 0
echom '[JupyterAscending]' a:d
endif
endfunction
function! s:execute(command_string) abort
if has('nvim')
call jobstart(a:command_string, {
\ 'on_stdout': funcref('s:on_stdout')
\ })
else
call systemlist(a:command_string)
end
endfunction
function! jupyter_ascending#sync() abort
let file_name = expand("%:p")
if match(file_name, g:jupyter_ascending_match_pattern) < 0
return
endif
let command_string = printf(
\ "%s -m jupyter_ascending.requests.sync --filename '%s'",
\ g:jupyter_ascending_python_executable,
\ file_name
\ )
call s:execute(command_string)
endfunction
function! jupyter_ascending#execute() abort
let file_name = expand("%:p")
if match(file_name, g:jupyter_ascending_match_pattern) < 0
return
endif
let command_string = printf(
\ "%s -m jupyter_ascending.requests.execute --filename '%s' --linenumber %s",
\ g:jupyter_ascending_python_executable,
\ file_name,
\ line('.')
\ )
call s:execute(command_string)
endfunction
function! jupyter_ascending#execute_all() abort
let file_name = expand("%:p")
if match(file_name, g:jupyter_ascending_match_pattern) < 0
return
endif
let command_string = printf(
\ "%s -m jupyter_ascending.requests.execute_all --filename '%s'",
\ g:jupyter_ascending_python_executable,
\ file_name
\ )
call s:execute(command_string)
endfunction
function! jupyter_ascending#restart() abort
let file_name = expand("%:p")
if match(file_name, g:jupyter_ascending_match_pattern) < 0
return
endif
let command_string = printf(
\ "%s -m jupyter_ascending.requests.restart --filename '%s'",
\ g:jupyter_ascending_python_executable,
\ file_name
\ )
call s:execute(command_string)
endfunction
================================================
FILE: doc/jupyter_ascending.txt
================================================
===============================================================================
jupyter_ascending *jupyter_ascending*
Easily interact with the python package `jupyter_ascending`
Vim Package : https://github.com/untitled-ai/jupyter_ascending.vim/
Python Package: https://github.com/untitled-ai/jupyter_ascending
===============================================================================
jupyter_ascending_config *jupter_ascending_config*
jupyter_ascending_python_executable *g:jupyter_ascending_python_executable*
The path/executable that can be used to execute Python.
If using virtual environment, make sure to have the virtual environment
enabled or accessible to Vim.
Default: ~
"python"
jupyter_ascending_match_pattern *g:jupyter_ascending_match_pattern*
Only files that match this file pattern will be synced and/or executed
with the `jupyter_ascending` package.
Default: ~
".sync.py"
jupyter_ascending_auto_write *g:jupyter_ascending_auto_write*
If true, will auto write and sync the file to Jupyter Notebook whenever
you save in Vim.
Default: ~
`v:true`
vim:tw=78:et:ft=help:norl:
================================================
FILE: plugin/jupyter_ascending.vim
================================================
let g:jupyter_ascending_python_executable = get(g:, 'jupyter_ascending_python_executable', 'python')
let g:jupyter_ascending_match_pattern = get(g:, 'jupyter_ascending_match_pattern', '.sync.py')
let g:jupyter_ascending_auto_write = get(g:, 'jupyter_ascending_auto_write', v:true)
augroup JupyterAscending
au!
if g:jupyter_ascending_auto_write
autocmd BufWritePost * :call jupyter_ascending#sync()
endif
augroup END
nnoremap <Plug>JupyterExecute :call jupyter_ascending#execute()<CR>
nnoremap <Plug>JupyterExecuteAll :call jupyter_ascending#execute_all()<CR>
nnoremap <Plug>JupyterRestart :call jupyter_ascending#restart()<CR>
if get(g:, 'jupyter_ascending_default_mappings', v:true)
nmap <space><space>x <Plug>JupyterExecute
nmap <space><space>X <Plug>JupyterExecuteAll
nmap <space><space>r <Plug>JupyterRestart
endif
gitextract_zzuf9woh/
├── LICENSE
├── README.md
├── autoload/
│ └── jupyter_ascending.vim
├── doc/
│ └── jupyter_ascending.txt
└── plugin/
└── jupyter_ascending.vim
Condensed preview — 5 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (8K chars).
[
{
"path": "LICENSE",
"chars": 1067,
"preview": "MIT License\n\nCopyright (c) 2020 Untiled AI\n\nPermission is hereby granted, free of charge, to any person obtaining a copy"
},
{
"path": "README.md",
"chars": 2080,
"preview": "# jupyter_ascending.vim\n\nVim plugin to interact with `jupyter_ascending`\nCurrently only supports Jupyter Notebook.\n\n![Ju"
},
{
"path": "autoload/jupyter_ascending.vim",
"chars": 1935,
"preview": "function! s:on_stdout(j, d, e)\n if len(a:d) > 0 && len(a:d[0]) > 0\n echom '[JupyterAscending]' a:d\n endif\nendfuncti"
},
{
"path": "doc/jupyter_ascending.txt",
"chars": 1281,
"preview": "===============================================================================\njupyter_ascending "
},
{
"path": "plugin/jupyter_ascending.vim",
"chars": 858,
"preview": "let g:jupyter_ascending_python_executable = get(g:, 'jupyter_ascending_python_executable', 'python')\nlet g:jupyter_ascen"
}
]
About this extraction
This page contains the full source code of the untitled-ai/jupyter_ascending.vim GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 5 files (7.1 KB), approximately 1.9k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.