https://github.com/noopeeks/datanvim
A fully-featured batteries-included Neovim distribution for the world of Data Science. Prepared to run code and interact with Jupyter Notebooks without ever leaving your terminal.
https://github.com/noopeeks/datanvim
data data-science distribution jupyter-notebook machine-learning neovim nvim nvim-config text-editor vim
Last synced: 4 months ago
JSON representation
A fully-featured batteries-included Neovim distribution for the world of Data Science. Prepared to run code and interact with Jupyter Notebooks without ever leaving your terminal.
- Host: GitHub
- URL: https://github.com/noopeeks/datanvim
- Owner: NoOPeEKS
- License: gpl-3.0
- Created: 2024-06-10T18:00:10.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-06-29T22:36:46.000Z (over 1 year ago)
- Last Synced: 2024-06-30T04:55:29.732Z (over 1 year ago)
- Topics: data, data-science, distribution, jupyter-notebook, machine-learning, neovim, nvim, nvim-config, text-editor, vim
- Language: Lua
- Homepage:
- Size: 45.9 KB
- Stars: 58
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: .github/README.md
- License: LICENSE
Awesome Lists containing this project
README
# 📊 DataNvim
DataNvim is a custom Neovim distribution prepared for Data Science and to easily run code and interact with Jupyter Notebooks without ever leaving your terminal. It also provides a well structured config that makes it an easy starting point to extend it as you want.

## 📋 Requirements
- GCC
- Kitty 0.28+
- Neovim 0.9.4+
- Python 3.10+
- Ripgrep 11.0+
- Quarto
- Npm 10.8.1+
- ImageMagick
- Lua 5.1
- Required python packages:
- [`pynvim`](https://github.com/neovim/pynvim)
- [`jupyter_client`](https://github.com/jupyter/jupyter_client)
- [`cairosvg`](https://cairosvg.org)
- [`plotly`](https://plotly.com/python/) and [`kaleido`](https://github.com/plotly/Kaleido)
- [`pyperclip`](https://github.com/asweigart/pyperclip)
- [`nbformat`](https://github.com/jupyter/nbformat)
- [`pillow`](https://pypi.org/project/pillow/)
- [`ipykernel`](https://pypi.org/project/ipykernel/)
## ✨ Feature Highlights
- Carefully designed [configuration](#configuration) file structure for easy extension and modification
- Beautiful colorscheme from [catppuccin](https://github.com/catppuccin/nvim)
- Powerful file explorer with [nvim-tree](https://github.com/nvim-tree/nvim-tree.lua)
- Fuzzy search and preview files, words and gitfiles thanks to [telescope](https://github.com/nvim-telescope/telescope.nvim)
- Preconfigured highlighting and Lsp Autocompletion for Python thanks to [treesitter](https://github.com/nvim-treesitter/nvim-treesitter) and [nvim-lsp-config](https://github.com/neovim/nvim-lspconfig)
- Extensible formatting, diagnostics, code actions and completion with [none-ls](https://github.com/nvimtools/none-ls.nvim) and [ruff](https://github.com/astral-sh/ruff)
- Complete Jupyter Notebook interaction set up thanks to [molten.nvim](https://github.com/benlubas/molten-nvim), [quarto](https://github.com/quarto-dev/quarto-nvim), and [jupytext](https://github.com/GCBallesteros/jupytext.nvim)
- Simple but beautiful status bar thanks to [lualine.nvim](https://github.com/nvim-lualine/lualine.nvim)
- Easy buffer navigation with [bufferline.nvim](https://github.com/akinsho/bufferline.nvim)
## 🔍 Want to try our Docker Container first?
- Pull DataNvim's image from `ghcr.io/noopeeks/data-nvim:latest`
```bash
docker run -it ghcr.io/noopeeks/data-nvim:latest /bin/bash
# Once inside prompt, run nvim
nvim
```
- Try it out, there is a demo .ipynb file in the home directory!
## 🛠️ Setting up for the first time
>[!WARNING]
> DataNvim will only render images if the terminal it's used on is Kitty!
- Install all the listed dependencies
- Install Kitty
- Install [luarocks](https://luarocks.org/#quick-start), Lua language's package manager.
- Install the `magick` rock with: `luarocks --local --lua-version=5.1 install magick`
- Create a virtual environment for Neovim in `~/.virtualenvs/`
```bash
mkdir ~/.virtualenvs
cd ~/.virtualenvs
python -m venv neovim
```
- Activate the virtual environment and install the beforementioned python packages with:
```bash
source ~/.virtualenvs/neovim/bin/activate
pip install ipykernel jupytext pynvim jupyter_client cairosvg plotly kaleido pyperclip nbformat pillow
python -m ipykernel
deactivate
```
- Install ipykernel and jupytext in your project-scoped virtual environment
```bash
cd whatever/directory/your/project/is/in
source venv/bin/activate
pip install ipykernel jupytext
python -m ipykernel install --user --name project_name
```
- Backup your current Neovim configuration
```bash
mv ~/.config/nvim ~/config/nvim.bak
```
- Install DataNvim's configuration
```bash
git clone https://github.com/NoOPeEKS/DataNvim.git ~/.config/nvim && nvim
```
- Run the following commands:
```vim
:UpdateRemotePlugins
:MasonInstallAll
```
- Open your notebook with the virtual environment activated and load the kernel with `:MoltenInit project_name` or Space + m + i.
- Start executing cells with [Keybindings](#keybindings)
## ⌨️ Keybindings
### Vim actions
| Key | Mode | Action |
| ---------------------------------------------------------------------------------------- | :--: | ----------------------------------- |
| Ctrl + h | i | Navigate left in insert mode |
| Ctrl + j | i | Navigate down in insert mode |
| Ctrl + k | i | Navigate up in insert mode |
| Ctrl + l | i | Navigate right in insert mode |
| Ctrl + s |i, v, n| Save current buffer |
| Space + x | n | Close current buffer |
| Tab | n | Go to next buffer |
| Shift + Tab | n | Go to previous buffer |
### Plugins
#### NvimTree
| Key | Mode | Action |
| ---------------------------------------------------------------------------------------- | :--: | ----------------------------------- |
| Ctrl + n | n | Toggle file explorer |
| Ctrl + j | n | Focus file explorer |
#### None-ls
| Key | Mode | Action |
| ---------------------------------------------------------------------------------------- | :--: | ----------------------------------- |
| Space + g + f | n | Format current buffer |
#### Molten.nvim
| Key | Mode | Action |
| ---------------------------------------------------------------------------------------- | :--: | ----------------------------------- |
| Space + m + i | n | Molten Init Python Kernel |
| Space + m + l | n | Molten Evaluate Current Line |
| Space + m + v | v | Molten Evaluate Visual Selection |
| Space + m + o | n | Molten Enter Cell Output |
| Space + m + h | n | Molten Hide Output |
#### Telescope
| Key | Mode | Action |
| ---------------------------------------------------------------------------------------- | :--: | ----------------------------------- |
| Space + f + f | n | Telescope Fuzzy Find File |
| Space + f + w | n | Telescope Fuzzy Find Word |
| Space + f + b | n | Telescope Fuzzy Find Buffers |
| Space + f + o | n | Telescope Fuzzy Find Oldfiles |
| Space + f + z | n | Telescope Fuzzy Find Current Buffer |
| Space + f + h | n | Telescope Help Tags |
#### LSP
| Key | Mode | Action |
|-------------------------------------------------------| :--: |-----------------------------------------|
| g + D | n | Go to Declaration |
| g + d | n | Go to Definition |
| K | n | Hover |
| g + i | n | Go to Implementation |
| leader + c + a | n | Code Action |
| Ctrl + k | n | Signature Help |
| Space + w + a | n | Add Workspace Folder |
| Space + w + r | n | Remove Workspace Folder |
| Space + w + l | n | List Workspace Folders |
| Space + D | n | Go to Type Definition |
| Space + r + n | n | Rename |
| g + r | n | List References |
| Space + e | n | Open Diagnostic Float |
| [ + d | n | Go to Previous Diagnostic |
| ] + d | n | Go to Next Diagnostic |
| Space + q | n | Set to Quickfix list |
## ✏️ Configuration
DataNvim is a very straightforward Neovim distribution that aims to be a batteries-included starting point for Data Science in Neovim. Thus, its directory structure for configuration is meant to be easy to understand:
```
├── init.lua <- Neovim's entrypoint. You should probably not modify anything here. Just require your own files.
├── lua <- Configuration for DataNvim goes here.
│ ├── plugins.lua <- Empty table. It will contain everything inside plugins/
│ ├── vim-options.lua <- Vim options and general movement keybindings.
│ ├── plugins <- This folder contains all of your plugins. To install new ones, create a file and make it return your plugin.
│ │ └── plugin_name.lua <- Returns a table with the plugin to install and its configuration.
```