Skip to content

Repository files navigation

NvimCheatsheetWidget

A native macOS desktop widget that displays common Neovim shortcuts. Click the widget to expand into a full searchable cheatsheet.

Screenshots

Menu Bar IconWidget Preview

Full Cheatsheet

Search Feature

Features

  • Compact Widget - Floats on desktop showing 7 most common shortcuts
  • Expanded Cheatsheet - Full window with 15 sections of keymaps (including Vim Basics for beginners)
  • Menu Bar Icon - Quick access from top menu bar ( icon)
  • Search - Filter keymaps by keystroke or description
  • Collapsible Sections - Click headers to expand/collapse
  • Desktop Accessory - Doesn't show in Dock, stays on all spaces

Requirements

  • macOS 14.0+
  • Xcode 15.0+

Building

cd /Users/dvz/Luckgrid/Code/Native/NvimCheatsheetWidget
xcodebuild -project NvimCheatsheetWidget.xcodeproj -scheme NvimCheatsheetWidget -configuration Release build

The built app will be in:

~/Library/Developer/Xcode/DerivedData/NvimCheatsheetWidget-*/Build/Products/Release/NvimCheatsheetWidget.app

Opening in Xcode

open NvimCheatsheetWidget.xcodeproj

Running

# Build and run
open ~/Library/Developer/Xcode/DerivedData/NvimCheatsheetWidget-*/Build/Products/Release/NvimCheatsheetWidget.app

Auto-launch with Neovim

Add this to your ~/.config/nvim/init.lua to open the widget when Neovim starts:

-- Auto-open NvimCheatsheetWidget on startupvim.api.nvim_create_autocmd("VimEnter", {
callback=function()
localapp_path=vim.fn.expand("~/Library/Developer/Xcode/DerivedData/NvimCheatsheetWidget-*/Build/Products/Release/NvimCheatsheetWidget.app")
localexpanded_path=vim.fn.glob(app_path)
ifexpanded_path~="" thenvim.fn.jobstart({ "open", expanded_path }, { detach=true })
endend,
})

Neovim Keymap Integration

Add this to your ~/.config/nvim/init.lua to open/focus the widget with <Space>?:

-- Open NvimCheatsheetWidget if not already runningvim.keymap.set("n", "<leader>?", function()
localapp_path=vim.fn.expand("~/Library/Developer/Xcode/DerivedData/NvimCheatsheetWidget-*/Build/Products/Release/NvimCheatsheetWidget.app")
localexpanded_path=vim.fn.glob(app_path)
ifexpanded_path=="" thenvim.notify("NvimCheatsheetWidget not found. Build it first.", vim.log.levels.WARN)
returnend-- Open/focus the appvim.fn.jobstart({ "open", expanded_path }, { detach=true })
end, { desc="Open cheatsheet widget" })

Usage

  1. The widget appears in the bottom-right corner of your screen
  2. Drag the widget to reposition it anywhere on screen
  3. Click the close button (X) to hide the widget
  4. Click the expand button to open the full cheatsheet
  5. Use the search bar to filter keymaps
  6. Click section headers to collapse/expand sections
  7. Menu bar icon () provides quick access:
    • Open Cheatsheet (⌘C)
    • Show Widget (⌘W)
    • Quit (⌘Q)

Customizing Keymaps

Edit NvimCheatsheetWidget/Keymaps.swift to modify the shortcuts:

  • compactKeymaps - Array of keymaps shown in the compact widget
  • keymapSections - Array of sections for the expanded cheatsheet

Each keymap has:

Keymap(keys:"<Space>ff", description:"Find files")

Each section has:

KeymapSection(title:"Navigation", icon:"arrow.up.arrow.down", keymaps:[...])

Icons use SF Symbols names (e.g., "folder", "magnifyingglass", "terminal").

Customizing Icons

The app uses SF Symbols throughout. You can change icons in two places:

Menu Bar Icon

Edit NvimCheatsheetWidgetApp.swift:

button.image =NSImage(systemSymbolName:"command", accessibilityDescription:"Neovim Cheatsheet")

Widget Header Icon

Edit WidgetView.swift:

Image(systemName:"command")

Popular SF Symbols for this App

SymbolDescription
"command"⌘ Command key (current)
"terminal"Terminal icon
"terminal.fill"Filled terminal
"keyboard"Keyboard icon
"book"Book outline
"book.fill"Filled book
"chevron.left.forwardslash.chevron.right"</> code brackets
"questionmark.circle"Help icon
"doc.text"Document with text

Browse all SF Symbols using Apple's SF Symbols app.

Using a Custom Image

To use your own icon image instead of SF Symbols:

  1. Add a 16x16 or 18x18 PNG to the project (drag into Xcode)
  2. Update the code:
// Menu bar custom image
iflet button = statusItem?.button {
button.image =NSImage(named:"myCustomIcon")}
// Widget custom image
Image("myCustomIcon").resizable().frame(width:16, height:16)

Project Structure

NvimCheatsheetWidget/ # Root project folder (PascalCase)
├── NvimCheatsheetWidget.xcodeproj/ # Xcode project bundle
│ └── project.pbxproj # Project configuration
├── README.md
└── NvimCheatsheetWidget/ # Source group (matches target name)
├── NvimCheatsheetWidgetApp.swift # App entry point & window management
├── WidgetView.swift # Compact widget UI
├── CheatsheetView.swift # Expanded cheatsheet UI
├── Keymaps.swift # All keymap definitions
└── Info.plist # App configuration

Naming Conventions

This follows Xcode's default structure where the root folder and inner source group share the same name:

ElementConventionExample
Root folderPascalCaseNvimCheatsheetWidget/
Xcode projectPascalCaseNvimCheatsheetWidget.xcodeproj
Source groupPascalCase (matches target)NvimCheatsheetWidget/
Swift filesPascalCaseWidgetView.swift
Bundle IDreverse-domain.lowercasecom.luckgrid.NvimCheatsheetWidget

The "duplication" of folder names is intentional:

  • Outer folder - Directory on disk containing the project
  • Inner folder - Xcode group representing the app target

Resources

Swift & SwiftUI

macOS Development

Widgets & Menu Bar Apps

Design Resources

Tools

License

MIT

About

A native macOS desktop widget that displays common Neovim shortcuts. Click the widget to expand into a full searchable cheatsheet.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages