Skip to content

About

One vim note per herdr workspace, docked on the right and toggled with one key

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

herdr-vim-notes

A vim note for every herdr workspace. One key opens it in a pane docked on the right at about 30% of the tab. The same key jumps back to it, or saves and closes it.

What the key does

Where you are What happens
No notes pane in this workspace Opens the workspace's note in vim on the right, about 30% of the tab, and focuses it
Notes pane open, you're in another pane or tab Jumps to the notes pane
In the notes pane Saves and closes it, even from insert mode

:wq closes it too. In a tab that already has several panes, the note splits the top-right one, so it can come out narrower or shorter.

Requirements

  • herdr 0.9.1 or newer, on macOS or Linux
  • vim
  • jq

Install

herdr plugin install antonyr/herdr-vim-notes

Keyboard shortcut

Bind the toggle in ~/.config/herdr/config.toml:

[[keys.command]]
key = "prefix+m"
type = "plugin_action"
command = "herdr-vim-notes.toggle"
description = "workspace notes in vim"

Then run herdr server reload-config, or press prefix+shift+r. With herdr's default prefix, the shortcut is ctrl+b then m.

prefix+m is unused in herdr's default keymap. prefix+n would be the obvious pick, but it is herdr's next tab.

Without a key binding, run it with:

herdr plugin action invoke herdr-vim-notes.toggle

Where notes live

A workspace's note is ~/.config/herdr/notes/<workspace name>.md, or under $XDG_CONFIG_HOME if you set it. The file is created the first time you open the note.

Unless you rename a workspace, herdr names it after the repo or folder of its root pane and keeps that name current as the pane moves. So the note follows the project:

  • closing a workspace and later opening the same project brings its note back
  • two workspaces on the same repo share one note
  • cd-ing the root pane into another project switches to that project's note

Renaming a workspace starts a new file. Characters other than letters, digits, ., _ and - in the name become _.

Closing

The key saves by sending vim Ctrl-\ Ctrl-N and then :x, so it works from insert or visual mode.

Avoid closing the pane with herdr's prefix+x while the note has unsaved changes. That kills vim, which keeps its swap file so you can recover the changes, and vim asks about it the next time you open the note. Answer that prompt before pressing the key (R recovers the changes), because the key does not answer prompts.

The plugin finds its pane by the pane label notes, so don't give another pane that label.

Uninstall

herdr plugin uninstall herdr-vim-notes

Your notes stay in ~/.config/herdr/notes.

License

MIT

About

One vim note per herdr workspace, docked on the right and toggled with one key

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages