How to set user command in Qt Fakevim?

(1) For example, I want to install map gd g* in Qt Fakevim, as shown below, but failed. enter image description here

(2) And also I would like to install F3 as a save command, how to do it?

(3) In Fakevim, it provides the “Read.vimrc” option, but where can I find the .vimrc file?

Thanks!

+7
source share
1 answer

It doesn't seem like there is a lot of documentation for FakeVim, so official sources may not be available. Most of this was obtained through experimentation.

If you want to dig deeper, I think there is no source as official, as the actual source: http://qt.gitorious.org/qt-creator/qt-creator/blobs/0809986e501415fe2c8508800b94b5b3169dc048/src/plugins/fakevim/fakevimplugin

Custom teams

First of all, understand that in the menu "Tools"> "Options"> "FakeVim"> "Display user commands" you set only what your user actions will perform, and not how you execute them.

By default, command # 1 is started by pressing Alt-V, then 1.

Alt-V, then 2, starts user action # 2, etc.

You can change the keyboard shortcuts through the general QtCreator configuration interface under Tools> Options> Environment> Keyboard. There is a "FakeVim" section with all of the user actions listed. Select your user action, click the small "erase" icon in the input field in the "Shortcut" section, then click the desired key combination that should appear in the input field.

Secondly, to end a command in which you usually press the enter key, you must literally type <CR> after the commands. You also need to enter ":" to enter command mode.

So, if you want to match the vim save, ": w", F3 command via FakeVim, you should:

  • Go to Tools> Options> FakeVim> Display User Commands.
  • Enter ": w <CR>" as one of the user commands (say # 7).
  • Go to Tools> Options> Environment> Keyboard.
  • Find the FakeVim "UserAction7" action.
  • Set F3 as a shortcut for it.

Now, every time you are in the editor, you can press F3 and execute the FakeVim: w command, which will save your file.

Please note that it is also possible to set a shortcut for "Save" directly in the QtCreator keyboard settings, so for this particular shortcut you really do not need to go through FakeVim.

Customizing shortcuts for other vim commands should be the same. Note that you are limited to the subset of vim commands that FakeVim implements. Refer to the source linked above to check for any specific team you are thinking of.

Vimrc file

On Linux, this will be ~ / .vimrc, a file in the user's home directory. I assume you are asking about Windows.

The best source I can find is an error report in which it is difficult to use Fakevim vimrc on Windows: https://bugreports.qt.io/browse/QTCREATORBUG-8748

After that, the Fakevim file searches for ".vimrc" in% USERPROFILE% (you can enter a name similar to the one in Explorer to go to the folder). However, it is difficult to access a file with the same name as in Windows. (So ​​why does real vim use "_vimrc" on Windows, but FakeVim does not seem to be working, at least for now.)

Here is a superuser page with workarounds for creating such files on Windows: https://superuser.com/questions/64471/create-rename-a-file-folder-that-begins-with-a-dot-in-windows

+8
source

All Articles