How do you use <TAB> to cycle through completion suggestions with ALE? - neovim

When using Ale, I'd like to use the Tab key to cycle through completion suggestions. By default, the arrow keys do it. What are the various configuration options for cycling through the suggestions as well as selecting the correct completion?

Could do something like this:
inoremap <silent><expr> <Tab>
\ pumvisible() ? "\<C-n>" : "\<TAB>"
Essentially, when you hit tab in insert mode, check whether the popup is visible, and if it is then send Ctrl-n (to go to the next match), otherwise send a tab.

Related

Having problem with using Virtual keyboard code in Autohot Key

From the error I explained in my previous question It turns out I should use Virtual Keyboard code for the keys that I face error.
I want to use virtual code for hotkey +' (Which is pressing Shift and ' at the same time) and for the key ; (semi-column) (more specifically I want to use hotkey +' to click on a coordinate and the key ; to click on other coordinate) but I have problem writing the code. I found list of Virtual Keys here but unfortunately I don't know how to use them to write code.
Edit:
For pressing semi-column (;) I tried this key:
[vkBA27]::
Click,885,234
return
But It says it is invalid hotkey.
From the AutoHotkey documentation:
If your keyboard or mouse has a key not listed above, you might still be able to make it a hotkey by using the following steps:
Ensure that at least one script is running that is using the keyboard hook. You can tell if a script has the keyboard hook by opening its main window and selecting "View->Key history" from the menu bar.
Double-click that script's tray icon to open its main window.
Press one of the "mystery keys" on your keyboard.
Select the menu item "View->Key history"
Scroll down to the bottom of the page. Somewhere near the bottom are the key-down and key-up events for your key. NOTE: Some keys do not generate events and thus will not be visible here. If this is the case, you cannot directly make that particular key a hotkey because your keyboard driver or hardware handles it at a level too low for AutoHotkey to access. For possible solutions, see further below.
If your key is detectable, make a note of the 3-digit hexadecimal value in the second column of the list (e.g. 159).
To define this key as a hotkey, follow this example:
SC159:: ; Replace 159 with your key's value.
MsgBox, %A_ThisHotkey% was pressed.
return
Interpreting the example above, we know that the format for a hotkey declaration using a virtual key is:
SC<Hex code>::
<Your code here>
Return
I can only assume "SC" stands for "Scan Code". Using the steps above, I can see that the scan code (the documentation refers to it as the "3-digit hexadecimal value") for ; is 027, and the scan code for ' is 028. This allows me to construct your hotkey definitions like so:
SC027::
<Your code for ; here>
+SC028::
<Your code for SHIFT+' here>

Disable Return after i in vim

I have a bad habit of pressing the Return immediately after pressing the i key, when the o key would save keystrokes. I would like to disable the i-Return combination to help me break this habit.
I tried to add
imap <Return> <NOP>
to my ~/.config/nvim/init.vim, but this disables pressing it in insert mode entirely. Is there a way to disable it only upon immediately entering insert mode?
How about this combo:
nnoremap <silent> i<CR> :echoerr "Use o instead"<CR>
This will issue the error only if you press both i and <Enter> within 'timeoutline' (default one second).

How can I search through fish completions?

I've noticed that sometimes, when there are multiple completion options, I get something like an input field, beneath the command line, where I can type and filter the completions. I'm not sure how I triggered it. Is there a key combination that I can press so that I have it available on demand?
To enter search mode directly, you can press shift-tab. You can also press tab until the highlight is in the pager, and then just start typing: that triggers searching too.
Update March 2020: This changed in fish 3.0 here. There's now two ways to reveal the completion search:
Press ctrl s to toggle the search field while the pager is active
Press shift tab instead of tab to trigger completions with the search field shown immediately
These correspond to pager-toggle-search and complete-and-search key bindings.

Tab in Emacs-helm (anything) does not autocomplete with current best match

While trying to autocomplete a file (e.g. to open a file with C-x C-f) Emacs-helm shows a list of possible candidates.
If I then press Tab (which I would hope it would help me choose the first/closest match), I get the following in the minibuffer:
It looks like the minibuffer gets confused with escape characters, and it does not choose the file that I actually want to open (the top choice).
Helm requires this conceptual jump from the default Emacs completion, which is not so obvious:
You don't need to press a key to complete. The completion buffer refreshes
with new results after every input.
This is called "incremental" completion.
The normal tab functionality is not needed in "incremental"
completion. So tab was rebound to helm-select-action, which allows you to
choose an alternative action with the selection. But there is only one action
in read-file-name.
The error you're seeing could be clearer though, I've filed this issue on github.
Additionally, note Helm treats each space separated term as a filtering
regular expression. So, pressing space foo will filter
the current list down to those that contain foo in the name.

Sending a command when the shortcut exists

I've got a global command like this
!i::Send {Up} (pressing alt+I will move the caret up)
There is an application that uses Alt+I as a shortcut for an action that I'd like to call while still retaining my own custom shortcut. I'd like to remap this app's action to Ctrl+I
Within a proper WinExists, I've tried ^i::Send !{i} but that just moves the caret up.
I tried ^i::!i but that sends Ctrl+Alt+I and not Alt+I.
Any ideas? Thanks
Gabe,
Try this...
SetTitleMatchMode, 2 ; Accept the title search string to be found anywhere in title
#ifWinnotActive yourappname ; use windowspy to find a unique title string
!i::Send {Up}
#ifWinActive
This will set !i to behave just like you want in ALL programs except for the one you want to keep the special behaviour.
Alternatively, you could add a $ to the triggers, so they will not call each other like this:
$!i::Send, {Up}
$^i::Send, !i
After each command, you need to add the command return. So if you have the code:
!i::Send, ^i
return
^i::Send, !i
return
The code above inverts the functions of CTRL + i and ALT + i.