Vim-mode Powerful Shortcuts

Key mapping support in .vimrc alone is already very powerful and a lot can be done with it.
e.g. I could remap something like bi[[<ESC>ea]] to a shortcut like ,,l to quickly linkify any word under a cursor

2 Likes

That’s actually an awesome idea!


I agree a .vimrc can be really powerful specially for macros.

For instance something like this is always needed for a good writing experience:

nmap j gj
nmap k gk

so that going down every line of written text, works as expected.


I also really enjoy saving macros in my .vimrc , but yeah even a first integration of vim shortcuts without a .vimrc would be an awesome thing, and if later a .vimrc could be added that’d be even better!

2 Likes

There’s a Roam Research plugin called Roam Toolkit that lets you use Vim keybindings to navigate through blocks. Here’s a the demo from their GitHub README:


I would imagine that Vim keybindings could work similarly in Logseq.

8 Likes

No way, that’s amazing! Is there any way to use it in Logseq? or is it more for inspiration?
hahaha you nearly tented me to move to Roam
Once logseq has vim, there’s no way I’ll ever leave Logseq hahah

2 Likes

It would be nice if it worked with Logseq, but I think it only works on domains starting with roamresearch.com. I just posted it for inspiration. :smiley: The closest thing to Roam Toolkit is probably Vimium, which allows you to navigate websites and click on anything within a site with Vim keybindings, but you can’t edit text like real Vim.

2 Likes

I like modal interfaces like Vim - but in the case of LogSeq, I think they should continue developing their keymap and of course reuse Vim keybindings when applicable. Like Gmail lets say. Just take cues from Vim-land instead of having a Vim-mode.

OTOH I wish I could navigate in LogSeq without entering edit mode all the time.

3 Likes

I agree with more keymaps vim mode will become possible. In general it’d be great to be able to make vim optional. So that those who don’t want to use vim are not confused by it.

I did a quick search and I don’t know what you meant by vim-land vs vim-mode

Got you, nice! I agree vimium is great for general navigation, but you said, it’s not really for text editing like real vim is

Sorry -by Vimland I just meant the kind of applications that take cues from Vim’s modal qualities without using the exact keymaps.

Another good example is GitHub - mgsloan/todoist-shortcuts: Comprehensive keyboard shortcuts for Todoist, via browser extension - a todoist (web version only) extension which makes it much less mouse dependent.

1 Like

got you! that makes sense!

1 Like

Replying to this old Vim-mode thread to highlight the custom keyboard shortcut features available now in Logseq beta 0.1.x. See https://logseq.github.io/#/page/custom%20keyboard%20shortcuts and scroll down to “Example of a vim-like shortcut setup”.

4 Likes

Perfect, yes I’ve been using those shortcuts and they some excellent progress on Vim-mode in Logseq!

It’s still be amazing to use some other features

Examples

  • y for yank (copy)
  • p for paste.
    Visual line with shift + v for example.

But what is currently possible is some great progress so far, The Logseq team is on fire, thanks guys for the great work

5 Likes

Checking out how VIM works in Obsidian.
Did I understand correctly that at the moment, we need to update the keybindings to match that to VIM?

So bind J to (down)? But since we can’t use J (conflicts), we use ctrl-j right?

Or just copy paste the closure (?) script to the settings?

Did I understand correctly?

I migrated to LogSeq from Checkvist and on the whole found something which is better suited to my needs. Thank you for making this!

The biggest loss, however, has been the keyboard commands. Checkvist had the Vim-like powers Santi suggests! It is world class as far as the keyboard-driven user experinece. In this respect Logseq is not in its league. And to match Santi’s sentiment, if you’re going to make extensive use of a tool, the best user experience is going to come from what the keyboard gives you.

1 Like

yes, It’s really an important feature.

The lack of vim support is the one thing currently keeping me from adapting logseq. This is the #1 requested feature for a good reason!

It seems like the cleanest approach may be to simply delegate the vim parts to neovim, just as in https://github.com/asvetliakov/vscode-neovim.

  • When the user hits esc to enter normal mode, the current text is copied into a scratch buffer in a headless neovim instance, and all subsequent keystrokes are passed through to neovim (which handles the navigation, replacements, etc.)
  • When the user hits i to go back to insert mode, keystrokes are captured by logseq again to edit the text directly.

Since logseq files are just markdown text under the hood, it seems like a very basic prototype should be relatively easy to build.

8 Likes

Puh-leeease — this would make for some real polish on a splendid apple!

1 Like

As a temporary sloution there is now a vim mode plugin!

logseq-plugin-vim-shortcuts v0.0.1 was just released! :tada::tada::tada:
I provided 30+ shortcuts which give Logseq a feeling of VIM-like.
No more description, just try it~ :grinning_face_with_smiling_eyes:

It’s available in the marketplace. To enable plugins:

  • Settings ⇾ advanced ⇾ enable developer mode
  • Click on the 3 dots top right
  • you will see now an option for plugins.
8 Likes
3 Likes