Skip to content

the-mayankjha/fknb.nvim

Repository files navigation

🧠 fknb.nvim — Notebook Cells in Neovim

Modern interactive notebook experience in Neovim, inspired by Jupyter but built for developers who love Vim. Run code blocks, render execution controls inline, and work like a scientist without leaving Neovim.

FkVim Ecosystem

⚠️ Work-in-progress — highly experimental

image

✨ Features (Current)

Feature Status
Cell detection (#%%)
Clean notebook-style UI
Dynamic separators per cell
Kernel icons (Python/Lua/JS/R/Markdown)
Animated status spinner
Cell ID + labels with syntax colors
Execution icons (▶ ↻ 🐞)
Does not override your code

🎨 UI Showcase

A cell looks like this:

image
  • Highlighted “Cell” in Yellow
  • Cell ID in Blue (#1, #2, etc.)
  • Animated execution spinners.
  • Kernel icon + language + env icon
  • Action icons: run/retry/debug

Markdown cells stay readable. Code stays editable. Delimiters remain hidden.

🚀 Usage

Mark cells with:

#%% --> codecell Delimiter
print("Hello World")

Or in Markdown:

#%  --> Markdown Delimiter
# This is a markdown cell

Cells automatically render with UI if the file ends with .fknb.

📁 File Type

Create a notebook file:

nvim my_notebook.fknb

⚙️ Under the Hood

FKNB uses:

  • Virtual lines
  • Extmarks
  • Custom status spinner
  • No overwriting buffer text
  • Kernel icon mapping
  • Language recognition from cell header

🧩 Roadmap

✅ Done

  • Basic cell UI & separators
  • Spinner + status icons
  • Hide cell markers
  • No-overlap UI rendering
  • Execute Python/Lua cells
  • Output panel render

🔜 Coming Next

Feature Priority
Persistent execution state ⭐⭐⭐
Async execution queue ⭐⭐⭐
Toolbar keybinds ⭐⭐
Theme support (Catppuccin/Gruvbox) ⭐⭐

📦 Install (WIP)

using lazy.nvim

{
  "https://github.com/flashcodes-themayankjha/fknb.nvim",    
  config = function()
    require("fknb").setup()
  end
}

📦 Configuration

require("fknb").setup({
default_kernel = "python3",
  default_kernel_path = nil,
  cell_separator = "",
  auto_save = false,

  ui = {
    spinner_frames = { "󰪞", "󰪟", "󰪠", "󰪡", "󰪢", "󰪣", "󰪤", "󰪥" },
    highlights = {
      FknbStatusDone       = { fg = "green" },
      FknbStatusError      = { fg = "red" },
      FknbStatusReady      = { fg = "white" },
      FknbStatusRunning    = { fg = "yellow" },
      FknbStatusRetry      = { fg = "yellow" },
      FknbStatusActive     = { fg = "green" },
      FknbStatusInactive   = { fg = "red" },
      FknbStatusNotReady   = { fg = "red" },
      FknbActionRunReady   = { fg = "green" },
      FknbActionRunError   = { fg = "red" },
      FknbActionDebug      = { fg = "red" },
      FknbActionRetry      = { fg = "yellow" },
    },
    cell_label_text = "Cell",
    cell_label_hl = "WarningMsg",
    id_label_hl = "DiagnosticInfo",
  },

  output = {
    icons = {
      ok    = "󰗠",
      error = "",
      info  = "󰜉",
    },
    highlights = {
      sep         = "Comment",
      icon_ok     = "DiffAdded",
      icon_err    = "DiagnosticError",
      icon_info   = "DiagnosticWarn",

      out_label   = "Normal",
      out_id      = "DiagnosticInfo",
      exec_lbl    = "Comment",
      exec_time   = "DiagnosticWarn",
      log_lbl     = "DiagnosticError",

      out_text    = "Normal",
      err_text    = "Normal",
    },
    indent_string = "  ",
  },

  icons = {
    kernels = {
      python = "",
      markdown = "",
      default = "",
    },
    env = {
      active   = "",
      inactive = "󱋙",
    },
    status = {
      ready     = "",
      running   = "",
      retry     = "󱍷",
      error     = "󰗖",
      not_ready = "󱃓",
    },
    actions = {
      run   = "",
      retry = "󰜉",
      debug = "",
    },
  },

  -- ⚙️ New: Keybindings (users can override)
  keymaps = {
    run_cell        = "<leader>kr",
    restart_kernel  = "<leader>kk",
    stop_kernel     = "<leader>ks",
    start_kernel    = "<leader>kS",
    clear_output    = "<leader>kc",
    clear_all       = "<leader>kC",
    toggle_output   = "<leader>kt",
  },
})

💡 Philosophy

Bring interactive computing to Neovim without killing the Vim workflow.

  • No notebook lag
  • No ugly borders
  • Seamless editing experience
  • Beautiful, minimalist inline UI

🧑‍💻 Author

Developed by Mayank Kumar Jha from nfks Project vision: Modern Neovim notebooks + gamified dev UX

🌟 Support / Contribute

This is an early stage tool — feedback & PRs welcome!

Star ⭐ the repo if you love Neovim science ❤️

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors