How to know which config file is being used?

88 views
Skip to first unread message

Nate L.

unread,
Feb 9, 2018, 3:01:52 PM2/9/18
to Project Jupyter
I am using Jupyter on SSH, with the amazing VIM extension. However, when I try to modify the vim mappings in the config file, the actions are now shown in my jupyter notebook.  Does anyone know how I can see which config file is being used by my jupyter folder? My current config file is ~/.jupyter/custom/custom.js, but it's not loading on the Jupyter notebook :(

Roland Weber

unread,
Feb 12, 2018, 2:10:07 AM2/12/18
to Project Jupyter
Hello Nate,


which config file is being used by my jupyter folder?

Config files are used by processes, not by folders. Have you tried running "jupyter --paths" from a Python notebook? Because environment variables are inherited by default, this should show the locations where Jupyter looks for config and extensions.

It's not quite clear to me whether you are working with two different environments and changes are showing up in the wrong one, or whether you have only one environment and changes are showing up at the wrong place. Or maybe it's just a typo and "actions are now shown" is supposed to read "actions are not shown". If you have two environments, you can set JUPYTER_CONFIG_DIR, JUPYTER_DATA_DIR, and/or JUPYTER_PATH to load config and extensions from different locations in each environment.

hope that helps,
  Roland

Thomas Kluyver

unread,
Feb 12, 2018, 5:35:33 AM2/12/18
to Project Jupyter
It can be tricky to get custom.js to load things at the right point. Have a look at the examples here to wait for promises:
https://github.com/jupyter/notebook/blob/master/notebook/static/custom/custom.js

If you're having some trouble, scatter some console.log('A') calls around (with different letters) and then look in your browser's Javascript console to see which bits are getting run.

On 9 February 2018 at 20:01, Nate L. <nlan...@gmail.com> wrote:
I am using Jupyter on SSH, with the amazing VIM extension. However, when I try to modify the vim mappings in the config file, the actions are now shown in my jupyter notebook.  Does anyone know how I can see which config file is being used by my jupyter folder? My current config file is ~/.jupyter/custom/custom.js, but it's not loading on the Jupyter notebook :(

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+unsubscribe@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/a141af95-ed48-4f9d-9350-3ab3ddb0d703%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nate L.

unread,
Feb 12, 2018, 9:37:28 AM2/12/18
to Project Jupyter
Hi all,

Thanks for the responses! Yes, I meant that the actions are not shown in jupyter.

Ok so now I've gotten it to the point where the vim commands are working (the custom.css file is changing the colors of my prompt), but now the Jupyter commands are not working, so when I type DD or 'a' or 'b', it's not deleting or adding any extra cells.

I've read that the problem is the vim extension, but the vim extension is so good I don't really want to do without it.  

Any thoughts as to why it's happening? 

This is in my custom.js:


1 // Configure CodeMirror Keymap
  2 require([
  3   'nbextensions/vim_binding/vim_binding',   // depends your installation
  4 ], function() {
  5   // Map jj to <Esc>
  6   CodeMirror.Vim.map("jk", "<Esc>", "insert");
  7   // Swap j/k and gj/gk (Note that <Plug> mappings)
  8   CodeMirror.Vim.map("j", "<Plug>(vim-binding-gj)", "normal");
  9   CodeMirror.Vim.map("k", "<Plug>(vim-binding-gk)", "normal");
 10   CodeMirror.Vim.map("gj", "<Plug>(vim-binding-j)", "normal");
 11   CodeMirror.Vim.map("gk", "<Plug>(vim-binding-k)", "normal");
 12 });
 13
 14 // Configure Jupyter Keymap
 15 require([
 16   'nbextensions/vim_binding/vim_binding',
 17   'base/js/namespace',
 18 ], function(vim_binding, ns) {
 19   // Add post callback
 20   vim_binding.on_ready_callbacks.push(function(){
 21     var km = ns.keyboard_manager;
 22     // Allow Ctrl-1 to change the cell mode into code in Vim normal mode
 23     km.edit_shortcuts.add_shortcut('ctrl-1', 'vim-binding:change-cell-to-code',     true);
 24     /// Allow Ctrl-2 to change the cell mode into Markdown in Vim normal mode
 25     km.edit_shortcuts.add_shortcut('ctrl-2', 'vim-binding:change-cell-to-markdow    n', true);
 26     /// Allow Ctrl-3 to change the cell mode into code in Vim normal mode
 27     km.edit_shortcuts.add_shortcut('ctrl-3', 'vim-binding:change-cell-to-raw', t    rue);
 28     // Delete cell with dd
 29     km.edit_shortcuts.add_shortcut('d+d', 'jupyter-notebook:delete-cell', true);
 30     // Update Help




On Monday, February 12, 2018 at 5:35:33 AM UTC-5, takowl wrote:
It can be tricky to get custom.js to load things at the right point. Have a look at the examples here to wait for promises:
https://github.com/jupyter/notebook/blob/master/notebook/static/custom/custom.js

If you're having some trouble, scatter some console.log('A') calls around (with different letters) and then look in your browser's Javascript console to see which bits are getting run.
On 9 February 2018 at 20:01, Nate L. <nlan...@gmail.com> wrote:
I am using Jupyter on SSH, with the amazing VIM extension. However, when I try to modify the vim mappings in the config file, the actions are now shown in my jupyter notebook.  Does anyone know how I can see which config file is being used by my jupyter folder? My current config file is ~/.jupyter/custom/custom.js, but it's not loading on the Jupyter notebook :(

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.

Thomas Kluyver

unread,
Feb 12, 2018, 9:40:31 AM2/12/18
to Project Jupyter
Are you getting into *notebook* command mode? I don't use the vim extension myself, but from what I've heard, you press esc once to go from edit mode to vim command mode, and then again to go to notebook command mode. The cell selection cursor on the left should turn from green to blue when you switch to notebook command mode.

To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+unsubscribe@googlegroups.com.

To post to this group, send email to jup...@googlegroups.com.

Nate L.

unread,
Feb 12, 2018, 11:33:48 AM2/12/18
to Project Jupyter
Hi Takowl,

Yea, I'm in the *notebook* command mode. Upon uninstalling the Vim extension, I can now add cells with 'a', but that's about it. When I press 'b', I get the search bar pop-up:



Not sure what's wrong. Maybe I should reinstall jupyter?  The problem with reinstallation is that there are so many ways to uninstall it that I don't know which would be optimal for my case.

Thomas Kluyver

unread,
Feb 12, 2018, 11:39:32 AM2/12/18
to Project Jupyter
Reinstalling probably won't make a difference to issues in the browser like that, though it's always possible.

Is the search bar something from a browser extension? If it captures the key event before we get it, there's not much we can do about that.

To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+unsubscribe@googlegroups.com.

To post to this group, send email to jup...@googlegroups.com.

Nate L.

unread,
Feb 12, 2018, 12:28:12 PM2/12/18
to Project Jupyter
I don't think the search bar is something from a browser extension, (I don't think I ever added it), but if it is, I'd love to remove it so I can get back to good ol' Jupyter shortcuts :'(

Would you know how to inspect whether it's an extension or not, and how I can remove it?

Thanks, Takowl!!!

Best,
Nathan

Thomas Kluyver

unread,
Feb 12, 2018, 2:24:55 PM2/12/18
to Project Jupyter
Sorry, I've never seen it before. If you don't know you've installed an extension, chances are it's something built into your browser.

To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+unsubscribe@googlegroups.com.

To post to this group, send email to jup...@googlegroups.com.

Nate L.

unread,
Feb 12, 2018, 2:58:47 PM2/12/18
to Project Jupyter
You are so right.  I tried using this with Safari and everything works as expected. I'll look into what extension in Chrome is getting in the way and report back if I find out what it is.

Thanks, Takowl!

Nate L.

unread,
Feb 12, 2018, 5:42:29 PM2/12/18
to Project Jupyter
It ended up being a chrome extension called Vimium, which seems to overwrite shortcuts for a lot of sites.

M Pacer

unread,
Feb 13, 2018, 10:02:49 PM2/13/18
to jup...@googlegroups.com
Nate, out of curiosity, does your configuration issue get caught if you use jupyter_conf_search to search through your config files for the relevant option? It exists specifically to help figure out questions like yours.

If it doesn't help with your original problem, please file an issue on that repo. jupyter_conf_search should (ideally) cover .js configuration files as well as traitlet-based .json/.py config files, but I'm not sure if it does that currently. 

Aside: I also use Vimium, and I have to have it disabled for all sites originating from localhost.

To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+unsubscribe@googlegroups.com.

To post to this group, send email to jup...@googlegroups.com.

Nate L.

unread,
Feb 14, 2018, 9:57:38 AM2/14/18
to Project Jupyter
Pacer, thanks for your help!

I realized I confused /tmp/nate/.jupyter with ~/.jupyter all along.  Now, I just moved my custom config files to /tmp/nate/.jupyter/custom and when I open the notebook I see this:

An unknown error occurred while loading this notebook. This version can load notebook formats v4 or earlier. See the server log for details.



Do you know what gives?


Nate L.

unread,
Feb 14, 2018, 10:26:39 AM2/14/18
to Project Jupyter
btw, I already tried this but didn't help.
Reply all
Reply to author
Forward
0 new messages