DEV Community

Shweta Kadam
Shweta Kadam

Posted on

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

When you come across a issue and solve and try to document it for future or even make a to do list of in terminal ? what do you use? I have been trying spacemacs but having trouble getting used to the point where I can use it in my everyday routine.Im a vim (not a hardcore vim user) but my most work does revolve working in terminal so wanted to make my documentation /schedule in terminal rather than opening a new app.
Can vim be used for this?

Top comments (8)

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.

Collapse
 
mjablecnik profile image
Martin Jablečník

Yes I also work in terminal on everyday basis and using Vim for make todoes is a very simple and fast way ;-)

Collapse
 
shwetarkadam profile image
Shweta Kadam

Do you use any vim plugins to make todoes or anything as such?

Collapse
 
mjablecnik profile image
Martin Jablečník

No I am not using any plugin.
I only create in plain text something like this:

- [ ] test todo1
- [ ] test todo2
- [x] test todo3
- [ ] test todo4
- [x] test todo5
Enter fullscreen mode Exit fullscreen mode

and with 'R' key I replace blank space by 'x' between brackets.

Collapse
 
amcintosh profile image
Andrew McIntosh

I've used todo.txt in the past. It's a simple text-based todo app with a command line tool: github.com/todotxt/todo.txt-cli/re...

Collapse
 
vonheikemen profile image
Heiker

I don't have the habit of taking notes but I'm aware of some vim plugins made for that.

Collapse
 
shwetarkadam profile image
Shweta Kadam

I will be sure to check these out! I was trying to learn spacemacs but the key bindings are not that intuitive to me.