I've created a key mapping to clear search highlights by pressing ..
map . :nohlsearch
However, pressing . only enters the nohlsearch command, requiring me to press Enter to execute the command. Is there a way to have the keybinding both enter and execute the command?
Add <CR> to the end, like this:
map . :nohlsearch<CR>
The <CR> is a "carriage return", which is the same as what pressing Enter does.
Related
on > zsh mac terminal
if i type c and get the autocompletion suggestion as clear
To accept that suggestion i need to hit right arrow key and then press enter to run it.
I want to change the right arrow key to something else for example ` OR '
Plese help on finding a way to change this behaviour.
You can change bindkey for autosuggest-accept widget.
bindkey '`' autosuggest-accept
Note that this will disable your ability to type ` character directly though.
If you want to execute the autosuggest immediately after hitting `, change autosuggest-accept to autosuggest-execute.
To make this change permanent, add the bindkey line to your ~/.zshrc
If you also want to disable arrow key, you can remove the widget from ZSH_AUTOSUGGEST_ACCEPT_WIDGETS array.
ZSH_AUTOSUGGEST_ACCEPT_WIDGETS=("${(#)ZSH_AUTOSUGGEST_ACCEPT_WIDGETS:#forward-char}")
As a more out-of-the-box solution, I just found out here that you can use:
CTRL+E
instead of the right arrow, and it will accept the autosuggestion.
In the link they refer to it as "end-of-line in emacs mode", but I didn't configure anything of the sort, so I guess it just works.
I have this script, when I press Ctrl+Win+Z it runs a Paste (Ctrl+V), then if ScrollLock is enabled it flushes Clipboard, deleting the content I just pasted.
^#A::
Send ^v
if GetKeyState("ScrollLock", "T"){
Clipboard =
}
Return
Now I wanna bind this command to Ctrl+V itself. But when I do so, I receive a dialog saying that "71 hotkeys have been received in the last 1092ms" and asking if I wanna continue.
I believe it's recursiving on itself. Every Send ^v triggers the command again.
How can I do that work? I don't want the clear clipboard to be in another shortcut, because I might forget to use this other shortcut and use Ctrl+V instead. I wanna use standard Ctrl+V for pasting and ScrollLock to set when clipboard should be flushed after it.
The $ prefix prevents hotkeys from triggering themselves:
$^v:: ; ....
I am trying to make an app in applescript where if you try to turn the volume down the volume is set to 16. I am still a beginner and i was wondering if there is a 'if buttonpress' sort of command. Thanks!
Assuming I'm understanding you, this is the basic idea:
set button_returned to button returned of (display dialog "hi")
if button_returned is "OK" then
#do something
end if
You put up a dialog, then check for the name of the button clicked, and if the name matches whichever button you're checking for, then "do something".
I know the prompt changes from < to + when the command line in R expects you to complete the current command. Is there a way (say, shortcut key) to immediately terminate the command being written and revert from the '+' mode to the regular console '>'?
Press 'Esc' key will bring you back to the prompt (<). You don't need to type word 'Esc'.
I suspect you are using a usb keyboard that has chromatic color controls via software. It sometimes mess up the keys therefore simply do a factory reset of your keyboard via install software. Then pressing "Esc" will revert to the
"greater than sign"
(1) For example, I want to set map gd g* in Qt's Fakevim like below but failed.
(2) And also I'd like to set F3 as the save command, how to do it?
(3) In Fakevim, it provides an option "Read .vimrc", but where to find the file .vimrc?
Thank you!
It doesn't look like there is a lot of documentation for FakeVim, so official sources might not exist. Most of this was obtained by experimentation.
If you want to dig deeper, I guess there's no source as official as the actual source: http://qt.gitorious.org/qt-creator/qt-creator/blobs/0809986e501415fe2c8508800b94b5b3169dc048/src/plugins/fakevim/fakevimplugin.cpp
User commands
First off, realize that in Tools>Options>FakeVim>User Command Mapping, you're only setting what your user actions will perform, not how you perform them.
By default, user command #1 is triggered by pressing Alt-V, then 1.
Alt-V, then 2, triggers user action #2, and so on.
You can change the keyboard shortcuts through the general QtCreator configuration interface, under Tools>Options>Environment>Keyboard. There is a "FakeVim" section with all the user actions listed. Select your user action of choice, press the little "erase" icon in the input field under "Shortcut", then press your desired shortcut key, which should appear in the input field.
Second, to finish a command where you would normally press enter, you should literally type in <CR> after the commands. You also need to enter in ':' to enter command mode.
So if you wanted to map the vim save command, ":w", to F3 via FakeVim, you would:
Go to Tools>Options>FakeVim>User Command Mapping.
Enter ":w<CR>" as one of the user commands (say #7).
Go to Tools>Options>Environment>Keyboard.
Find the FakeVim action "UserAction7".
Set F3 as a shortcut for it.
Now, every time you're in the editor, you should be able to click F3 and have the FakeVim :w command execute, which will save your file.
Note that there is also an option to set a shortcut for "Save" directly in the QtCreator keyboard settings, so for this particular shortcut you don't actually need to go through FakeVim.
Setting shortcuts for other vim commands should be similar. Note that you're restricted to the subset of vim commands that FakeVim implements. Refer to the source, linked above, for checking any particular command you're wondering about.
Vimrc file
On Linux this would be ~/.vimrc, a file in the user's home directory. I presume you're asking about Windows.
The best source I can find is this bug report about it being hard to use Fakevim's vimrc on Windows: https://bugreports.qt.io/browse/QTCREATORBUG-8748
Following that, the file Fakevim looks for is ".vimrc" in %USERPROFILE% (you can enter a name like that in Explorer to go to the folder). However, it's tricky to access a file with a name like that on Windows. (Thus why the real vim uses '_vimrc' on Windows -- but FakeVim apparently doesn't, at least at the moment.)
Here is a superuser page with workarounds for how to create such files on Windows: https://superuser.com/questions/64471/create-rename-a-file-folder-that-begins-with-a-dot-in-windows