I use Notational Velocity on my Mac all the time. It holds all my notes, lists and any other snippet of text. I love the interface and simplicity, and most of all I love the simple use of text files in Dropbox as a store. This way I can access my notes anywhere, without needing NV to be installed. I also love the global key binding feature so that I can quickly raise it with Cmd+Shift+N.
At work (more on this soon) I started using a Thinkpad x230 running Archlinux. But I sorely missed NV. I experimented with nvpy, but it didn't cut it for me at all. The tkinter UI looks bad in a Qt/GTK desktop, notes are saved in JSON by default, and the text file option is a sort of hack which stores the title in the first line, messing up the notes in NV. So rather than write my own version, I got an almost as nice, and definitely more powerful NV equivalent in Linux.
I am going to assume you use a standard desktop environment like KDE or that your window manager is EWMH compatible. You'll need:
- To know how to define custom global shortcuts to run a command. For KDE this is System Settings -> Shortcuts and Gestures -> Edit -> New -> Global Shortcut -> Command/URL
- gvim
- wmctrl (available in Arch community repo).
Create a new shortcut which should launch the following command string
gvim --remote-silent +':lcd %:p:h | :au FocusLost * :wa' \
'/home/nikhil/Dropbox/Notational Data' && wmctrl -a 'GVIM'
You should edit the path to point to your Dropbox/NV directory. Now whenever you press the global shortcut combination you should see gvim with a list of all files (notes). Press Enter on a file to open it.
We use remote-silent
to make sure that gvim uses an existing window if it is
already open. The :lcd %:p:h
option sets vim's current working directory to
the NV directory. This will be useful later. We use the autocommand FocusLost
to save the file whenever the gvim window loses focus (simulating NV's autosave
feature). Finally wmctrl
raises the window to the top by matching the string
to the title. If you use gvim on a regular basis (I use terminal vim) and have
other windows open, you'll have to tweak this.
So this setup is completely like NV, except for one divergence. Whereas NV
searchs the note title and content together, our system will treat it as two
flows. To search note titles/file names use /
when in the main view. As part
of my standard vim plugin set I have ctrlp
and ack.vim* which will serve us well
here. To always have access to note titles use ctrlp. I map it to sf
so that
I get quick fuzzy find. Similarly to search note contents I map sd
to trigger
ack.vim. This is where setting vim's current directory is important. Both
plugins will use it as the base search directory.
This NV approximation is fast and works almost as well as the original, although without a slick interface. But nice fonts and a good vim colour scheme come pretty close.
* You'll need ack installed to use ack.vim.
ack
does not include text files by default. Put --text
in ~/.ackrc
to do
so.
Have you tried nvim ?
ReplyDeletehttp://cwoac.github.io/nvim/about.html
Thanks, I'll try it, seems very good.
DeleteWOW!! Very informative blog and useful article. Please visit this site if you want more detail
ReplyDeleteRapid Library UK proxy