Science and technology

Use this vi setup to maintain and manage your notes

The thought of utilizing vi to handle a wiki to your notes could seem unconventional, however once you’re utilizing vi in your each day work, it makes lots of sense.

As a software program developer, it’s simply simpler to jot down my notes in the identical instrument I exploit to code. I would like my notes to be solely an editor command away, obtainable wherever I’m, and managed the identical approach I deal with my code. That’s why I created a vi-based setup for my private information base. In a nutshell: I exploit the vi plugin Vimwiki to handle my wiki regionally on my laptop computer, I exploit Git to model it (and maintain a central, up to date model), and I exploit GitLab for on-line enhancing (for instance, on my cellular machine).

Why it is smart to make use of a wiki for note-keeping

I’ve tried many various instruments to maintain observe of notes, write down fleeting ideas, and construction duties I shouldn’t overlook. These embrace offline notebooks (sure, that entails paper), particular note-keeping software program, and mind-mapping software program.

All these options have positives, however none match all of my wants. For instance, mind maps are a good way to visualise what’s in your thoughts (therefore the identify), however the instruments I attempted supplied poor looking out performance. (The similar factor is true for paper notes.) Also, it’s typically exhausting to learn thoughts maps after time passes, so that they don’t work very properly for long-term observe holding.

One day whereas establishing a DokuWiki for a collaboration undertaking, I discovered that the wiki construction suits most of my necessities. With a wiki, you possibly can create notes (such as you would in any textual content editor) and create hyperlinks between your notes. If a hyperlink factors to a non-existent web page (possibly since you wished a bit of data to be by itself web page however haven’t set it up but), the wiki will create that web page for you. These options make a wiki a very good match for shortly writing issues as they arrive to your thoughts, whereas nonetheless holding your notes in a web page construction that’s simple to browse and seek for key phrases.

While this sounds promising, and establishing DokuWiki just isn’t troublesome, I discovered it a bit an excessive amount of work to arrange a complete wiki only for holding observe of my notes. After some analysis, I discovered Vimwiki, a Vi plugin that does what I would like. Since I exploit Vi every single day, holding notes is similar to enhancing code. Also, it’s even simpler to create a web page in Vimwiki than DokuWiki—all it’s important to do is press Enter whereas your cursor hovers over a phrase. If there isn’t already a web page with that identify, Vimwiki will create it for you.

To take my plan to make use of my on a regular basis instruments for note-keeping a step additional, I’m not solely utilizing my favourite IDE to jot down notes but in addition my favourite code administration instruments—Git and GitLab—to distribute notes throughout my varied machines and be capable to entry them on-line. I’m additionally utilizing Markdown syntax in GitLab’s on-line Markdown editor to jot down this text.

Setting up Vimwiki

Installing Vimwiki is simple utilizing your present plugin supervisor: Just add vimwiki/vimwiki to your plugins. In my most well-liked plugin supervisor, Vundle, you simply add the road Plugin 'vimwiki/vimwiki' in your ~/.vimrc adopted by a :supply ~/.vimrc|PluginInstall.

Following is a bit of my ~.vimrc exhibiting a little bit of Vimwiki configuration. You can be taught extra about putting in and utilizing this instrument on the Vimwiki page.

let wiki_1 =
let wiki_1.path = '~/vimwiki_work_md/'
let wiki_1.syntax = 'markdown'
let wiki_1.ext = '.md'

let wiki_2 =
let wiki_2.path = '~/vimwiki_personal_md/'
let wiki_2.syntax = 'markdown'
let wiki_2.ext = '.md'

let g:vimwiki_list = [wiki_1, wiki_2]
let g:vimwiki_ext2syntax =

Another benefit of my strategy, which you’ll be able to see within the configuration, is that I can simply divide my private and work-related notes with out switching the note-keeping software program. I would like my private notes accessible all over the place, however I don’t need to sync my work-related notes to my personal GitLab and pc. This was simpler to arrange in Vimwiki in comparison with the opposite software program I attempted.

The configuration tells Vimwiki there are two completely different wikis and I need to use Markdown syntax in each (once more, as a result of I’m used to Markdown from my each day work). It additionally tells Vimwiki the folders the place to retailer the wiki pages.

If you navigate to the folders the place the wiki pages are saved, you will see that your wiki’s flat Markdown pages with none particular Vimwiki context. That makes it simple to initialize a Git repository and sync your wiki to a central repository.

Synchronizing your wiki to GitLab

The steps to take a look at a GitLab undertaking to your native Vimwiki folder are practically the identical as you’d use for any GitHub repository. I simply choose to maintain my notes in a personal GitLab repository, so I maintain a GitLab occasion operating for my private tasks.

GitLab has a wiki performance that means that you can create wiki pages to your tasks. Those wikis are Git repositories themselves. And they use Markdown syntax. You get the place that is main.

Just initialize the wiki you need to synchronize with the wiki of a undertaking you created to your notes:

cd ~/vimwiki_personal_md/
git init
git distant add origin [email protected]:your_user/vimwiki_personal_md.wiki
git add .
git commit -m "Initial commit"
git push -u origin grasp

These steps will be copied from the web page the place you land after creating a brand new undertaking on GitLab. The solely factor to alter is the .wiki on the finish of the repository URL (as a substitute of .git), which tells it to clone the wiki repository as a substitute of the undertaking itself.

That’s it! Now you possibly can handle your notes with Git and edit them in GitLab’s wiki person interface.

But possibly (like me) you don’t need to manually create commits for each observe you add to your pocket book. To clear up this downside, I exploit the Vim plugin chazy/dirsettings. I added a .vimdir file with the next content material to ~/vimwiki_personal_md:

:cd %:p:h
silent! !git pull > /dev/null
:e!
autocmd! BufWritePost * silent! !git add .;git commit -m "vim autocommit" > /dev/null; git push > /dev/null&

This pulls the newest model of my wiki each time I open a wiki file and publishes my adjustments after each :w command. Doing this could maintain your native copy in sync with the central repo. If you have got merge conflicts, you might must resolve them (as typical).

For now, that is the way in which I work together with my information base, and I’m fairly pleased with it. Please let me know what you take into consideration this strategy. And please share within the feedback your favourite technique to maintain observe of your notes.

Most Popular

breakingExpress.com features the latest multimedia technologies, from live video streaming to audio packages to searchable archives of news features and background information. The site is updated continuously throughout the day.

Copyright © 2017 Breaking Express, Green Media Corporation

To Top