!apt-get install vim tmux powerline zsh stow
!git clone https://github.com/gbraad/dotfiles.git ~/.dotfiles
!~/.dotfiles/install.sh
or
!curl -fsSL https://dotfiles.gbraad.nl/install.sh | sh
%%script zsh
. ~/.dotfiles/source.sh
country
In a code cell execute:
from IPython.core.magic import register_line_cell_magic
@register_line_cell_magic
def mysh(line, cell=None):
command = line
if cell:
command += '\n' + cell
get_ipython().system(f"zsh -i -c '. ~/.dotfiles/source.sh; {command}'")
%dotfiles country
"The Netherlands"
%%dotfiles
country
"The Netherlands"
This is only available if the .dotfiles
has also stwoed ipython
. This can be done as follows
%%script zsh
cd ~/.dotfiles
stow ipython
After this you can use the following in your notebook to load the extension:
$load_ext dotfiles
If for some reason you get a ModuleNotFoundError: No module named 'dotfiles'
, it might be that the extensions is not part of the sys.path
. This can be fixed with:
import sys, os
sys.path.append(os.path.expanduser("~/.ipython/extensions"))