Post

skitty-notes | Markdown Sticky Notes app in Neovim in the Kitty Terminal

Do you spend most of your day in Neovim or Vim and would like to have a sticky notes app that uses vim motions, allows you to have markdown links, view paste images, use markdown headings, snippets, basically anything you can do in a Markdown file when in Neovim?

skitty-notes | Markdown Sticky Notes app in Neovim in the Kitty Terminal

Contents

Table of contents

YouTube video

Pre-requisites

  • Skitty-notes will run in a terminal application, my main terminal is Ghostty, so I’m using kitty to run it on the right side
  • If you also want to use kitty, make sure you install it first

What is skitty-notes?

  • I’m used to vim motions way too much, and when I have to use an app that doesn’t have vim motions it’s pretty hard for me to move around and manipulate text
  • So I was looking for a sticky notes app that allowed me to do this, unfortunately there is not (that I’m aware of) so decided to use my own Neovim config with some slight modifications, and I can use all my keymaps, vim motions, etc
  • skitty-notes is the app you see on the right side

Image You can see skitty-notes on the right

Why the skitty-notes name?

  • Since I was looking for a sticky notes app and I decided to use kitty, just added an s in the front of kitty and that was basically it

Where do I store this skitty-notes.md file

  • In the video you’ll see that I store this file in icloud, but my personal recommendation is, don’t do that, instead of storing it in icloud, I personally keep track of the file in github, I created a private repo and a script that auto pushes changes, similar to the git plugin in obsidian
  • I did have the file in icloud and also at the same time I was tracking it in github, but was getting a github error fatal: mmap failed: Resource deadlock avoided
  • So my personal recommendation, to avoid issues, just keep it out of icloud or any other cloud syncing service

Apple Stickies app

  • If you’re on macOS there’s a native alternative for this, called the Stickes app
  • This application does not even support markdown formatting, let alone vim motions, it works as a basic and not useful sticky notes app

Image macOS Stickies app

Configure skitty-notes

Configure kitty

  • When I open kitty, I want it to automatically open a specific markdown file in neovim, so in my kitty.conf file you will notice that there’s a shell bash --login -c command
  • Starting neovim with the –listen flag to create a socket at /tmp/skitty-neobean-socket
    • This allows the ~/github/dotfiles-latest/scripts/macos/mac/400-autoPushGithub.sh script to trigger buffer writes and refresh lualine
  • I’m cleaning up the socket before start with rm -f /tmp/skitty-neobean-socket, otherwise it’s left there from a previous run and it just stops working
  • All the other settings and flags are documented already in my dotfiles, so go and read the comments in this file to understand more kitty.conf file
  • Read the heading below to understand how to open kitty in the same place and of the same size all the time
1
shell bash --login -c "rm -f /tmp/skitty-neobean-socket && export PATH=\"/opt/homebrew/bin:$PATH\" && export NEOVIM_MODE=skitty && ~/github/dotfiles-latest/yabai/positions/kitty-pos.sh && NVIM_APPNAME=neobean nvim --listen /tmp/skitty-neobean-socket \"$HOME/github/skitty/skitty-notes.md\""

Open kitty in the same screen position

  • Notice that in the command above, there’s this section ~/github/dotfiles-latest/yabai/positions/kitty-pos.sh
  • This script is the one that allows me to open kitty in a specific section on my screen, and I always want to open it of the same size
  • This is done in macOS using a window manager, in my case I use Yabai, so if you go through the script you’ll be able to see the commands that position kitty and also resize it
  • Just remember to make your script executable
  • Many folks use Aerospace now instead of yabai, I haven’t tested it yet, because I think I’ll be missing some features, but I will, and probably create a video on how to make skitty-notes work with Aerospace
1
2
yabai -m window --focus "$(yabai -m query --windows | jq '.[] | select(.app == "kitty") | .id')" --move abs:1369:39
yabai -m window --focus "$(yabai -m query --windows | jq '.[] | select(.app == "kitty") | .id')" --resize abs:231:400

Configure Neovim with NEOVIM_MODE=skitty

  • Remember that we’re passing an env var from kitty, NEOVIM_MODE=skitty, I use this variable to modify the skitty-notes configuration, an example is lualine, it looks different in my regular Neovim config compared to the skitty notes version
  • You can print the env var with:
  • :lua print(vim.env.NEOVIM_MODE)
  • Here we capture the environment variable to make it accessible to neovim
1
vim.g.neovim_mode = vim.env.NEOVIM_MODE or "default"
  • Also in the same init.lua file I added this
1
2
3
4
5
6
7
8
-- Delay for `skitty` configuration
-- If I don't add this delay, I get the message
-- "Press ENTER or type command to continue"
if vim.g.neovim_mode == "skitty" then
  vim.wait(500, function()
    return false
  end) -- Wait for X miliseconds without doing anything
end

Modify plugin settings based on NEOVIM_MODE

Modify options.lua file

  • I’d say this is the most important file, because this is where you modify for example the textwidth I normally configure that as 80 in my regular neovim config, but in skitty-notes I set it to 28, because I want it to move to the next line when typing
  • I don’t need relativenumbers when in skitty notes, so I disable that there
  • I also modify how winbar looks
  • Here’s part of the configuration to get you inspired
  • Notice the else at the bottom is for my regular neovim config
  • Remember that all of these configurations are in my dotfiles
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
-- Conditional settings based on mode
if vim.g.neovim_mode == "skitty" then
  -- Line numbers
  vim.opt.number = false
  vim.opt.relativenumber = false

  -- Text width and wrapping
  vim.opt.textwidth = 28

  local colors = require("config.colors")
  vim.cmd(string.format([[highlight WinBar1 guifg=%s]], colors["linkarzu_color03"]))
  -- -- Set the winbar to display "skitty-notes" with the specified color
  -- vim.opt.winbar = "%#WinBar1#   skitty-notes%*"
  -- Set the winbar to display the current file name on the left and "linkarzu" aligned to the right
  vim.opt.winbar = "%#WinBar1# %t%*%=%#WinBar1# linkarzu %*"
else
  -- I never used relative line numbers, so fuck that
  -- Edit a few days after, I'll give them a try again, so re-enabled them
  vim.opt.relativenumber = true
  • I also change the cursor color in the same options.lua file
1
2
3
4
5
6
7
8
9
-- I also want the vim.g.neovim_mode cursor color to be changed
-- Neovide cursor color, remember to set these in your colorscheme, I have
-- mine set in ~/github/dotfiles-latest/neovim/neobean/lua/plugins/colorschemes/eldritch.lua
-- Otherwise, my cursor was white
vim.opt.guicursor = {
  "n-v-c-sm:block-Cursor", -- Use 'Cursor' highlight for normal, visual, and command modes
  "i-ci-ve:ver25-lCursor", -- Use 'lCursor' highlight for insert and visual-exclusive modes
  "r-cr:hor20-CursorIM", -- Use 'CursorIM' for replace mode
}

Modify img-clip settings

  • Let me give you a few examples of some plugin configurations I changed that depend on the NEOVIM_MODE being used
  • One of the plugins I changed is ~/github/dotfiles-latest/neovim/neobean/lua/plugins/img-clip.lua, look at the configuration below
  • So if the neovim_mode is skitty, which means that I’m running the skitty-notes app, set the image directory to img
1
2
3
4
      -- Conditional dir_path based on skitty mode
      dir_path = vim.g.neovim_mode == "skitty" and "img" or function()
        return vim.fn.expand("%:t:r") .. "-img"
      end,

Modify image.nvim plugin settings

  • I want to have smaller images in skitty-notes compared to my regular neovim config
  • Notice below that if on skitty-notes the image height is 30, but if on my regular neovim config its 40
1
2
3
4
5
6
        -- This is what I changed to make my images look smaller, like a
        -- thumbnail, the default value is 50
        -- max_height_window_percentage = 20,
        -- max_height_window_percentage = 40,
        -- 40 for my default nvim config and 30 for skitty
        max_height_window_percentage = vim.g.neovim_mode == "skitty" and 30 or 40,

Modify lualine settings

  • Notice below, I’m disabling all the different lualine sections, except for lualine_x, because all I want to see in skitty-notes is if I have pending changes to push to github
  • Notice the else at the bottom of the code below, that means that if not in skitty-notes you will see all your lualine items when using our regular neovim configuration
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
  opts = function(_, opts)
    if vim.g.neovim_mode == "skitty" then
      -- For skitty mode, only keep section_x and disable all others
      opts.sections = {
        lualine_a = {},
        lualine_b = {},
        lualine_c = {},
        lualine_x = {
          {
            "diff",
            symbols = {
              added = icons.git.added,
              modified = icons.git.modified,
              removed = icons.git.removed,
            },
          },
        },
        lualine_y = {},
        lualine_z = {},
      }
    else
      opts.sections.lualine_c = {

Disable some plugins for skitty-notes

  • I don’t need the CopilotChat.nvim plugin when using skitty-notes, so I want to disable it, notice how I do that below
1
2
3
4
return {
  "CopilotC-Nvim/CopilotChat.nvim",
  enabled = vim.g.neovim_mode ~= "skitty", -- Disable for skitty mode
  opts = function(_, opts)

Do I need to use kitty?

  • No, you can use any terminal emulator, the only reason I use kitty is because it allows me to view images in neovim and I actually don’t use kitty for anything else
  • My secondary terminal, in case I need to bring up a 2nd one, is wezterm, but I could have used wezterm instead of kitty, no issues there
  • You can use any terminal even if it does not support images

Test out my Neobean config


  • If you don’t want to watch the video above, and you already have your own neovim config, and want to quickly get started and follow along in this tutorial
  • Run the git clone commands below to clone my dotfiles in your .config directory and we will run my config below
1
2
mkdir -p ~/.config
git clone git@github.com:linkarzu/dotfiles-latest ~/.config/linkarzu/dotfiles-latest
  • Open the newly downloaded neobean config with:
1
NVIM_APPNAME=linkarzu/dotfiles-latest/neovim/neobean nvim
  • You can create an alias in your .bashrc or .zshrc file to run my config
1
alias neobean='NVIM_APPNAME=linkarzu/dotfiles-latest/neovim/neobean nvim'
  • Then to run this config, just run neobean


  • If you don’t even have neovim yet, of course you will need to install it first, so if you’re just getting started, I have a video for you:

Script to auto-push to GitHub

  • I created this script, remember that you can find it in my dotfiles, it automatically pushes the changes I have in skitty-notes and also in my obsidian repo every 3 min
  • ~/github/dotfiles-latest/scripts/macos/mac/400-autoPushGithub.sh
  • I’m not going to cover the script in this blogpost, but if you want me to create a video about it, let me know in the youtube comments

Reload kitty notes when restart yabai

  • I have a karabiner-elements keymap that restarts yabai, here’s the script ~/github/dotfiles-latest/yabai/yabai_restart.sh
  • Remember that this file is in my dotfiles
  • If you want to learn more about yabai, I have a video:

Other videos mentioned

If you like my content, and want to support me

  • If you want to share a tip, you can donate here
  • I recently was laid off, so if you know about any SRE related roles, please let me know

Discord server

Image

Follow me on social media

  • The following links will be in the YouTube video description:
    • Each one of the videos shown
    • A link to this blogpost

How do you manage your passwords?

  • I’ve tried many different password managers in the past, I’ve switched from LastPass to Dashlane and finally ended up in 1password
  • You want to find out why? More info in my article:
  • If you want to support me in keeping this blogpost ad free, start your 1password 14 day free trial by clicking the image below

Image

This post is licensed under CC BY 4.0 by the author.