DEV Community

Discussion on: How to take notes/to-do list in terminal itself? Vim or spacemacs or something else?

Collapse
 
pbnj profile image
Peter Benjamin (they/them) • Edited

Can vim be used for this?

Short answer: yes, there are a couple of ways you could accomplish this depending on the experience you want to have and trade-offs you're willing to make.


Long answer:

Minimal Approach

I use the official GitHub CLI gh for this and keep track of my notes/to-dos in a private gist.

For example, you could maintain both notes & to-do's in 1 gist, like:

$ echo '# NOTES' > /tmp/NOTES.md # you won't need these files after initial creation as future edits will be immediately written to GH Gists
$ echo '# TODOS' > /tmp/TODOS.md # you won't need these files after initial creation as future edits will be immediately written to GH Gists

$ gh gist create /tmp/NOTES.md /tmp/TODOS.md --desc "My notes & todos"
- Creating gist with multiple files
✓ Created gist NOTES.md
https://gist.github.com/123abc456def
Enter fullscreen mode Exit fullscreen mode

Then to edit them later:

$ gh gist edit 123abc456def
# You will be prompted to select between NOTES.md or TODOS.md
# Then your $EDITOR will be launched

# Alternatively, you can pre-select the file you want to edit:
$ gh gist edit 123abc456def -f NOTES.md

# You can also add new files to existing gists later:
$ echo '# TEST' > /tmp/TEST.md
$ gh gist edit 123abc456def --add /tmp/TEST.md
Enter fullscreen mode Exit fullscreen mode

With this basic gh familiarity, you can write some bash shell scripts to simplify managing notes & to-do's, like:

# Interactive Notes & To-Dos
$ echo 'int() { gh gist edit 123abc456def ; }' >> ~/.profile

# Note only
$ echo 'note() { gh gist edit 123abc456def -f NOTES.md ; }' >> ~/.profile

# To-Do only
$ echo 'todo() { gh gist edit 123abc456def -f TODOS.md ; }' >> ~/.profile

$ source ~/.profile

$ int
$ note
$ todo
Enter fullscreen mode Exit fullscreen mode

You can also write a simple Vim command to manage notes/to-dos from within Vim, like:

:command! INT execute '!gh gist edit 123abc456def'
:INT
Enter fullscreen mode Exit fullscreen mode

This minimal approach resembles the unix philosophy where you use specialized tools that are good at one thing and stitch them together to accomplish something productive, extensive, and re-usable. The beauty of it shines when you realize the following:

  • Notes are instantly sync'ed and accessible from other machines/devices (thanks to GitHub).
  • You can use nano, vim, neovim, emacs, spacemacs, visual studio code, intellij, or butterflies, by setting the export EDITOR="..." environment variable.
  • Unlimited extensibility. For example, if you use alfred (aka macOS Spotlight on steroids), then you can create a shortcut for this so you can call it from anywhere. If you use tmux, you can create keybindings to call it from anywhere, e.g. bind-key C-t split-window 'gh gist edit 123abc456def' to launch it with <prefix> + <Ctrl-T>. If you use VSCode, you can do the same with a Custom Task or a Gist vscode plugin. And so on...
  • If you are an iOS/iPadOS user, you can access and manage all your notes/to-dos via Working Copy app. I'm certain android has a number of git clients that you can use as well.

Bonus: I use this method for blog posts. I start by dumping thoughts/outlines in markdown file, then use gh gist create /path/to/file.md, continue to work on it over days/weeks/months until it is done, then publish it to GitHub Pages and/or to dev.to.

Vim Plugin Approach

There are a number of vim plugins for note-taking. I personally have used vimwiki in the past, but there are more options, like vim-dotoo.

This reddit post from 6 years ago might be relevant.

The benefit of this approach is that note editing and management is a lot more integrated with Vim (e.g. keybindings to speed up common operations) at the cost of being re-usable via shell scripts or if you use a different editor later.