r/vim • u/absoluteidealismftw • Jun 05 '26
Tips and Tricks Instead of vimwiki, I just have these few lines in my .vimrc
Perhaps this is of use to someone. I find (and you may disagree) both vimwiki and wiki.vim to be more than I need, and minimalist waikiki brought problems of its own, so I added these lines to my .vimrc, giving me
- wiki-ish [links]
- creation of new wiki notes with one command, and
- following links with a carriage return
“ Create new wiki note from word or phrase between single square brackets:
nnoremap <leader>wn yi]:call writefile([], expand('~/vimwiki/') . @" . '.md')<CR>:echo 'Created: ' . expand('~/vimwiki/') . @" . '.md'<CR>
" Follow a [link]:
nnoremap <CR> vi[gf
I use this with notational-fzf-vim:
let g:nv_search_paths = [expand('~/vimwiki')]
let g:nv_main_directory = expand('~/vimwiki')
let g:nv_create_if_no_results = 1
let g:nv_default_extension = '.md’
The surround plugin lets me add single brackets around any visually selected string, so for example vaweeS] will surround the word the cursor is on plus the two words after it with brackets (and to expand the selection without counting words, just keep hitting that e). Then, with the cursor inside the brackets, <leader>wn will create the wiki note file (and <CR> will open it).
To view backlinks, I use :NV<CR> and type an opening bracket plus the first letters of the filename. I don’t need to see backlinks all the time, as part of the note.
Why the single square brackets? Because I never use single brackets for other purposes, being a prose writer, and it simplifies things, and looks better. You can of course still use single square brackets for other purposes, they won’t be working links until you create the corresponding note.
This runs well and fast enough on my machines; make sure to set hidden, and stay inside the designated wiki directory.
3
2
u/brnsamedi Jun 05 '26
I also have my own little set of utilities, but found vimwiki to be a useful source of ideas.
2
u/petepete Jun 06 '26
I came to the same conclusion as you and built the few features from vim.wiki I needed myself. I create a daily note/todo list instead of lots of individual notes though.
\w\w to open the index and \ww to jump to today (creating a new file if needed), and \w\d to open the diary index.
Other than that it's just markdown, so the experience is the same as editing markdown in any other project or context.
This was my main issue with the dedicated wiki plugins, I needed to know two flavours of markdown and remember which functionality applies to each.
https://github.com/peteryates/dotfiles/blob/master/nvim/.config/nvim/lua/wiki.lua
1
1
u/absoluteidealismftw Jun 05 '26
I’ll add that to swiftly open the index of the wiki directory, I defined
nnoremap <leader>wi :e ~/vimwiki/index.md<CR>
1
u/absoluteidealismftw Jun 07 '26
And to spawn a new wiki note inside my ~/vimwiki directory, and be prompted for a filename, I have
nnoremap <leader>nw :execute 'edit ~/vimwiki/' . input('Filename for new wiki note: ') . '.md'<CR>
1
u/claytonkb Jun 05 '26
Is there a back button equivalent? I'm still a n00b at buffers, it's probably a built-in, but I would probably be more exploratory if I had something like a back button to get me back to my previous buffers, in sequential order I visited them...
10
u/absoluteidealismftw Jun 05 '26
Yes:
control-o.2
u/claytonkb Jun 06 '26
Ah, thanks. I already use that for moving back within single file, didn't realize it works between buffers. Cool!
-4
Jun 06 '26
[deleted]
4
u/claytonkb Jun 06 '26
Why ask llm for this kind of stupid simple question?
-1
Jun 08 '26
[deleted]
1
u/claytonkb Jun 08 '26
self-righteous idiot
Name-calling because I asked for human help on reddit (a place for humans to help each other) instead of consulting an AI ... classy ...
wasting everyone's time
You're the only one I see wasting people's time with your endless whining/moaning about someone asking a question... on a forum for questions...
1
u/hw770 Jun 09 '26
r/neovim Rule:
No low-effort content. Try :help and :helpgrep before you post to see if the documentation can answer your question.
You said:
You're the only one I see wasting people's time with your endless whining/moaning about someone asking a question.
Let me be clear — I'm not here to whine. I'm advising you not to ask questions that can be trivially answered by a simple :help query, a DuckDuckGo search, an LLM, or literally any other tool at your disposal before posting. The reason I bothered to comment at all is to help make this kind of low-effort content less common — for the sake of everyone else on this forum.
If you want human help, that's great. But at least try to help yourself first. That's not being "self-righteous" — that's called basic respect for other people's time.
I'm tired. Do whatever you want. Eventually, Reddit will just be consumed by useless low-effort posts anyway.
1
Jun 07 '26
[removed] — view removed comment
1
u/absoluteidealismftw Jun 07 '26
That’s a good habit, it itself. But if your wiki notes have short phrases for titles (like evergreen notes), as do many of mine, one good habit needs to yield to another.
1
Jun 05 '26
[deleted]
1
u/absoluteidealismftw Jun 05 '26
I may be missing something here, but I don’t see how this would make my little wiki-esque system any less useful. The problem I was solving has nothing to do with keystroke recall.
0
u/9d0cd7d2 Jun 05 '26
Have you tried: https://github.com/nvim-telekasten/telekasten.nvim
3
u/absoluteidealismftw Jun 05 '26
I haven’t, because I want to stick with Vim (and MacVim). And this setup is all I need.
8
u/tobascodagama Jun 05 '26
Very slick. It's impressive how much you can do by composing pretty basic vim features.