Compiled from: https://opensource.com/article/18/6/vimwiki-gitlab-notes Author: ManuelDewald Translator: OctopusVimwiki and GitLab are powerful combinations of notes.

2025/06/2603:44:36 hotcomm 1238

Compiled from: https://opensource.com/article/18/6/vimwiki-gitlab-notes Author: ManuelDewald Translator: OctopusVimwiki and GitLab are powerful combinations of notes. - DayDayNews

compiled from: https://opensource.com/article/18/6/Vimwiki-GitLab-notes

Author: Manuel Dewald

Translator: Octopus

Vimwiki and GitLab are powerful combinations of notes.

Use vi to manage Wiki to record your notes, which doesn't sound like a conventional idea, but when you use vi in ​​your daily work, it makes sense.

As a software developer, it will be easier to write notes using the same tools as encoding. I want to turn my notes into an editor command that can manage my notes using the method of managing my code wherever I am. This is why I created a vi-based environment to build my own knowledge base. To summarize, I use the vi plugin Viwiki on my laptop to manage my wiki locally. Use Git for version control (to keep a centralized updated version) and use GitLab for online modifications (for example on my phone).

Why is it meaningful to use wiki to save notes

I have tried many different tools to continuously record my notes, and the notes save my inspiration and task arrangements that need to be remembered. This includes offline notebooks (yes, paper), special notes-taking software, and mind map software.

But each solution has a bad side, none of which can meet all my needs. For example, mind maps can visualize your ideas well (hence the name), but this kind of tool has poor search functions (like paper notebooks). In addition, as a period of time passes, mind maps become difficult to read, so mind maps are not suitable for long-term saved notes.

I configured DokuWiki for a collaborative project and I found that this wiki model meets most of my needs. On the wiki, you can create a note (as you did in a text editor) and create links between notes. If a link points to a page that does not exist (you want this page to add a piece of information that has not been created yet), the wiki will create this page for you. This feature makes wiki well adapted to the needs of those who need to quickly write down what they think, while still keeping your notes in a page structure that can easily browse and search for keywords.

This looks promising, and configuring DokuWiki is also easy, but I found it takes too much work to configure the entire wiki just to take a note. After some searching, I found Vimwiki, a vi plugin I wanted. Because I use vi every day, just record notes and edit the code. It's even easier to create a page in vimwiki than Dokuwiki. You just need to press Enter to the word under the cursor. If no file has this name, vimwiki will create one for you.

To further implement the plan of taking notes with the tools I use every day, I not only use this favorite IDE to write notes, but also use Git and GitLab - my favorite code management tool - to distribute my notes between my machines so that I can access them online. I also wrote this article using markdown syntax on Gitlab’s online markdown tool.

configuration vimwiki

Use your existing plug-in management tool to install vimwiki. It is very simple, just add vimwiki/vimwiki to your plug-in. For my favorite plugin manager Vundle, you just need to add the line plugin vimwiki/vimwiki in /.vimrc and execute :source ~/.vimrc | PluginInstall.

is part of my file .vimrc which shows some vimwiki configurations. You can learn more about configuration and usage 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 = {'.md': 'markdown', '.markdown': 'markdown', '.mdown': 'markdown'}

As you can see in the above configuration, my configuration has another advantage. You can simply distinguish between personal and work-related notes without switching the note-taking software. I want my personal notes to be accessible anytime, anywhere, and not want my work notes to sync to my private GitLab and computer. This configuration in vimwiki is easier than other software I've tried.

This configuration tells vimwiki that there are two different wikis, both using markdown syntax (again, because I use markdown syntax every day in my daily work). I also tell Vimwiki which folder to store the wiki page.

If you enter the folder where the wiki page is stored, you will find your wiki's normal markdown page file without other special Vimwiki related content, which makes it easy to initialize the Git repository and sync your wiki to the central repository.

sync your wiki to GitLab

This step checks out a GitLab project to the local VimWiki folder. This step is the same as you operate any GitHub repository, except that because I prefer to save my notes to my private GitLab repository, I ran a GitLab instance for my personal project.

GitLab's wiki function can be used to create wiki pages for your project. These wikis are the Git repository itself. They use markdown syntax, you know.

just needs to initialize the wiki you need and let it sync with the wiki of the project you created for your notes.

cd ~/vimwiki_personal_md/

git init

git remote add origin [email protected]:your_user/vimwiki_personal_md.wiki

git add .

git commit -m "Initial commit"

git push -u origin master

After creating a new project in GitLab, you can copy the code for these steps from the page. The only change is that the repository address ends with .wiki (not .git). This will tell Git to clone the wiki repository instead of the project itself.

is that! Now you can manage your notes through Git and modify them through the GitLab wiki user interface.

You may (like me) not want to manually create a commit for each note added to your notebook. To solve this problem, I used the Vim plugin chazy/dirsetting. I added a .vimaddr file that already has the following content:

: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

Whenever I open the wiki file and press :w to publish my modification, it updates to the latest version. Doing so will keep your local files in sync with the central repository. If you have merge conflicts, you usually need to resolve them.

Currently, this is the way to interact with my knowledge, and I like this method very much; please tell me your thoughts on this method, and you can share how you can track your notes in the comment section.


via: https://opensource.com/article/18/6/vimwiki-gitlab-notes

Author: Manuel Dewald Topic: lujun9972 Translator: octopus Proofreading: wxy

This article was originally compiled by LCTT, Linux China Honored launch

Click "Learn More" to access the link in the article

hotcomm Category Latest News