VsCode Vim Extension command to enter insert mode - visual-studio-code

I am wondering what is the vim command that one can use to enter the insert mode? In other words, what command is executed when you press "i" from normal mode. I want to use this command to construct custom actions using "extension.multiCommand.execute". In particular, I want to bind cmd+D in visual mode such that after selecting a text, pressing cmd+D will first put me in the insert mode without changing the selection and then will add another cursor each time I press cmd+D to the next found instance of the selected text.
Thanks

Related

VSCode integrated terminal pass CTRL+SPACE to Clink

I am using Clink for Windows and it works mostly fine in the integrated terminal from VSCode. Since it is invoked via ctrl+space I tried removing all related VSCode keybindings. With shift+alt+? (clinks keybinding browser) I found that VSCode sends the wrong keystrokes when pressing ctrl+space:
C-# : set-mark -- Set the mark to the cursor point. If a numeric argument is supplied, sets the mark to that position
When I am in a normal terminal I get:
C-Space : clink-select-complete -- Perform completion by selecting from an interactive list of possible completions; if there is only one match, insert it

How to stop NeoVim from sending ^S character while I press Ctrl+S in Insert Mode?

I wanted to remap <C-s> to save a file. It works fine in normal mode. But when I'm in Insert Mode and I press Ctrl+S, it just send the character ^S (as a single character).
I'm using Windows 10 and Powershell to open NeoVim. Is there a way that I can map Ctrl+S to save the file in my current situation? Also should I stick to Powershell or should I switch to another terminal?
I would try remapping it to something like
leave insert mode
save
return to insert mode, after the cursor
inoremap <C-s> <Esc>:w<cr>a

Turn multiline selection into multi cursor selection in VSCode

It happens from time to time that I need to edit 100+ lines in a text file all at once.
I know I can use ⌘ Cmd+↑/↓ to select multiple lines but depending on the size of the file that takes a while.
In Atom and Sublime, I can just do a ⌘ Cmd + a to select everything, hit another shortcut (forgot the actual shortcut) and end up with a cursor for every line.
Have not found this in VSCode.
Ctrl-a to select all. (or whatever muli-line selection you want)
Shift-alt-I will put cursors at end of each selected line.
And then if you want those cursors at the beginning of each line you need to trigger the command "cursorLineStart" which is unbound by default. Give it a keybinding and all those end-of-line cursors will jump to the beginning of each line.
With v1.43 and Column Selection Mode this can be quite easy, see Column selection like Visual Studio and How to put the cursor at the end of all selected lines in Visual Studio Code?
FWIW cursorLineStart is not the opposite of Shift-Alt-I. In looking at the commends, Shift-Alt-I is "Add cursors to line ends", but there is not a "Add cursors to line begins" option.
However, the easy trick for that is:
Select your text block
Shift-Alt-I to put a cursor at the end of each line
Command-LeftArrow will move those cursors to the beginning of the lines
Its an extra step but it works. When I get time I will play around with building a custom command to do all this in one action.

Automatic Code Identation

I have a huge code and now for testing purpose I have to add that whole script into an infinite while loop is there any short way (without pressing space for each row) to add a space for indentation so the whole code is consider part of the one while loop ? Such as for example when we press ctrl +r it comments out the line
Ctrl-I/Cmd-I will automatically indent the file. Other wse you just select multiple row and use Tab/Shift-Tab to move them backwards and forwards.
For indentation is a must, however Matlab as a language does not care so it is not really a must to indent it. Additionally, you can just execute the code from the command line, say that you script or function is called Umar, then from the command line you just type while 1, Umar; end.
You can copy the code into notepad++.
Activate Column mode selection holding alt+shift and use the mouse to select the column of all the text you want to insert a space/tabulation/etc. and just insert it.
Final step is to copy back the code to matlab.
Matlab does not currently support column selection.
MATLAB has the option to select all your code, then press the right click and select smart indent button.
If you like to use shortcuts, just type the combination of Ctrl+A (select all) followed by Ctrl+I (smart indent)

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.