如何:在IPython / Jupyter笔记本中进行Sublime Text样式编辑

news/2024/7/10 2:42:48 标签: vue, excel, vim, javascript, anaconda

So, I really like the Jupyter notebook (formerly known as the IPython notebook), but I often find myself missing the ‘fancy’ features that ‘proper’ editors have. I particularly miss the amazing multiple cursor functionality of editors like Sublime Text and Atom.

因此,我真的很喜欢Jupyter笔记本(以前称为IPython笔记本),但是我经常发现自己缺少“适当”编辑者具有的“精美”功能。 我尤其想念Sublime Text和Atom之类的编辑器惊人的多光标功能。

I’ve known for a while that you can edit a cell in your default $EDITOR by running %%edit at the top of the cell – but I’ve recently found out that you can configure Jupyter to use Sublime Text-style keyboard shortcuts when editing cells in the notebook – all thanks to CodeMirror, the javascript-based text editor component that the Jupyter notebook uses. Brilliantly, this also brings with it the multiple-cursor functionality! So, you can get something like this:

我已经知道一段时间了,您可以通过在单元格顶部运行%%edit默认$EDITOR中的单元格-但是我最近发现您可以将Jupyter配置为使用Sublime Text样式的键盘快捷键在笔记本中编辑单元格时–多亏了CodeMirror ,Jupyter笔记本使用的基于JavaScript的文本编辑器组件。 出色的是,这还带来了多光标功能! 因此,您可以获得以下内容:

IPyNbSublime

So, how do you do this? It’s really simple.

那么,你如何做到这一点? 真的很简单。

  1. Find your Jupyter configuration folder by running jupyter --config-dir
  2. Open the custom.js file in the custom sub-folder in your favourite editor
  3. Add the following lines to the bottom of the file
  1. 通过运行jupyter --config-dir查找Jupyter配置文件夹
  2. 在您喜欢的编辑器中的custom子文件夹中打开custom.js文件
  3. 将以下行添加到文件的底部
require(["codemirror/keymap/sublime", "notebook/js/cell", "base/js/namespace"],
    function(sublime_keymap, cell, IPython) {
        // setTimeout(function(){ // uncomment line to fake race-condition
        cell.Cell.options_default.cm_config.keyMap = 'sublime';
        var cells = IPython.notebook.get_cells();
        for(var c=0; c< cells.length ; c++){
            cells.code_mirror.setOption('keyMap', 'sublime');
        }

        // }, 1000)// uncomment  line to fake race condition 
    } 
);

翻译自: https://www.pybloggers.com/2016/03/how-to-get-sublime-text-style-editing-in-the-ipythonjupyter-notebook/


http://www.niftyadmin.cn/n/986930.html

相关文章

Matlab画图-非常具体,非常全面

Matlab画图 强大的画图功能是Matlab的特点之中的一个&#xff0c;Matlab提供了一系列的画图函数&#xff0c;用户不须要过多的考虑画图的细节&#xff0c;仅仅须要给出一些基本參数就能得到所需图形&#xff0c;这类函数称为高层画图函数。此外&#xff0c;Matlab还提供了直接对…

Stack Overflow上最热门问题是什么?

要找到Stack Overflow全时最热问题很容易&#xff0c;但是当前最热问题能告诉我们现在的重要话题。在本文中&#xff0c;你可以了解到怎么才能得到当前最热话题。 从下图的交互面板中你可以得到具体问题的答案。下面&#xff0c;我们来看看它是怎么创建的。交互面板的链接如下&…

SharePoint 2007小型、中型、大型部署的界定

典型的小型服务器场包括&#xff1a; 1、一台运行MS SQL Server 2005或MS SQL Server 2000及最新补丁包的数据库服务器 2、一台或多台运行IIS和Office SharePoint Server 2007 的前端服务器。&#xff08;前端服务器配置为Web服务器和应用服务器&#xff09; 典型的中型服务器…

linux内核led添加流程,fl2440——linux内核自带的led驱动添加

主机操作系统&#xff1a;Centos 6.7交叉编译器环境&#xff1a;arm-linux-gcc-4.5.4 (可通过命令/opt/buildroot-2012.08/arm920t/usr/bin/arm-linux-gcc -v查询)开发板平台&#xff1a; fl2440Linux内核版本&#xff1a; linux-3.0 .54我们之前做过了有关platform驱动的led驱…

keil 调试 操作系统_调试操作系统:内存分配的经验教训

keil 调试 操作系统It began, as so many investigations do, with a bug report. 和许多调查一样&#xff0c;它是从一个错误报告开始的 。 The name of the bug report was simple enough: “iter_content slow with large chunk size on HTTPS connection”. This is the k…

“朝三暮四”与“BPO”

我之前撰写了一篇关于“ SaaS&#xff0c;PaaS&#xff0c;IaaS 和 Cloud ”的文章&#xff0c;我也提到我们在使用任何IT术语之前&#xff0c;都应该先严谨地考虑它的准确定义。如今词语滥用的现象已非常普遍&#xff0c;比如中文词汇里&#xff0c;我想知道为什么“朝三暮四”…

JS返回是否确认删除或者其他_无需整理

为什么80%的码农都做不了架构师&#xff1f;>>> 和我的名字一样哟……。 原文地址&#xff1a;JS返回是否确认删除或者其他的脚本 作者&#xff1a;邢台飘雪 JS返回是否确认删除或者其他的脚本 <a href"renwu_del.php?id<?php echo $rows[0];?>&q…

linux任务调度时间间隔,go任务调度2(linux的cron调用)

cron格式&#xff1a;分 时 日 月 周每隔5分钟执行1次&#xff1a; /5 * echo hello > /tmp/x.log每隔1-5分钟执行1次&#xff1a; 1-5 echo hello > /tmp/x.log每天10点整、22点整执行1次&#xff1a; 0 10,22 * echo hello > /tmp/x.log每隔1-5分钟执行1次&#xff…