Automatically leave insert mode after some time in IdeaVim - neovim

In my Neovim configuration, I use autocmd and updatetime to leave insert mode after some idle time. Unfortunately, IdeaVim does not support autocmd.
Is there another way to implement this behavior in IdeaVim?

Related

Neovim: Change Cursor Type for Insert Mode

I'm new to (Neo) Vim and I'm trying to find configurations that I like and learn from them.
Whenever I watch people code in vim/neovim, I notice that their cursor a thick box, same as when they're outside of Insert mode.
Basically, while in insert mode, my cursor is thin like this |, but I want to change it so that it's thick like it is when you're outside of insert mode.
I'm on the latest version of Neovim and I use Windows 10 if that's useful information.
Yes, that is possible with guicursor option, but whether what option takes effect also depends on your terminal, for example, using Windows Termianl.
This is a working setting to make cursor shape block in insert mode:
set guicursor=n-v-c-i:block
which means to make cursor shape block in normal, visual, command, and insert mode. For more details, please use :h 'guicursor'.
You should be able to change that setting with guicursor. (For NeoVim there is termcap-cursor-shape.)
But note that the two different cursor actually make sense: In normal mode you are always on a character (i.e. you can use i and a to produce different results), while in insert mode the curor must be between two characters.
Personally I think that it would just get confusing to have a blocky cursor in insert mode due to the reason above, but furthermore it would make it harder to distinguish the two modes too!
And for future reference, there is a dedicated stackexchange for vi and vim!

Change cursor in VSCodeVim during insert or command mode?

Using the most excellent VSCodeVim plugin. Is it possible to have the cursor change when in normal/command mode (block perhaps) versus input mode (vertical or underline perhaps)?
You can add these in your setting.json or search for these terms in case of using GUI setting
"vim.cursorStylePerMode.insert": "line-thin",
"vim.cursorStylePerMode.normal": "block",
This will turn cursor to thin line in insert mode and block in normal mode, which will distinguish both easily.

Emacs Minor Mode Sticky Control

Is there a minor mode in emacs that attaches a Control Key to every keystroke representing a single character? I wanted to get something similar to action mode in Vim. I've seen Viper, but would prefer not to spend the time to relearn all of the key-bindings.
Take a look at https://github.com/chrisdone/god-mode
This is a global minor mode for entering Emacs commands without modifier keys. It's similar to Vim's separation of commands and insertion mode.
The difference between this and viper/vimpulse/evil is that god-mode is still using the standard Emacs bindings.
It's not a direct answer1 to your question, but I think it implements your actual end goal.
1 This might be of some interest: Software Requirements for Code Creation / Editor with RSI Type Symptoms (unusable fingers)

Return to previous mode in Emacs

Is there a key binding to quit a mode and return to the previous mode in emacs?
For example suppose I entered line number mode using the following command:
Alt+x linum-mode
How can I quickly disable this mode and return to the mode which I was in before (not using the same command again)?
Why wouldn't you want to use the same command again?
M-xM-pRET
It doesn't get much simpler than that.
Edit: You can repeat M-p in that sequence to step back further in the command history, and you can search the command history with M-xC-r.
Also, when you disable a minor mode you're not "returning to the mode you were in before"; you're just disabling one (of many) minor modes which are all active at the same time.
Tangentially, the concept of "returning to the mode you were in before" could apply to major modes (as there's only ever one active major mode in a given buffer), but strictly speaking there's no notion of 'disabling' a major mode -- only of 'enabling' the one you wish to change to -- so to 'toggle' between two major modes, you would need to call them alternately.
Just repeat the same command: M-x linum-mode. Such minor-mode commands are toggles: on/off.
C-x z calls repeat - repeat last command.
Repeatedly calling a minor-mode enables/disables it.
One more way to do it is with smex: the last command
that you called with M-x kinda sticks around.
So you can enable linum-mode with smex, do a bunch of editing
with usual shortcuts and then disable linum-mode with
M-x RET.
A solution might follow the path kill-ring-save works: store the modes being active as current-modes-listing in a previous-modes-ring.
The code needed therefor exists basically inside describe-mode, see upward from "Enabled minor modes" - respective for the major mode.
Then a hook should check if this-command has "-mode" in it's name. If yes, check, if current modes-listing equals car of previous-modes-ring. If not, add new setting.
Finally write a command which sets current modes according to selected listing from previous-modes-ring.

Escape command in a vimscrimpt

Can anyone help me how to put an <esc> command in a vimscript in order to switch from a insert visual mode (selection mode) to the visual mode?
This is my script:
if a:type == "'<,'>"
normal! "\<esc>\<esc>"
normal gvy
let myvariable= #+
endif
explication:
I have selected a piece of text. (I'm now in insert visual mode (=selection mode))
I have to select the same text in visual mode.
Without vimscript I just have to push 2 times the <esc> command and the command gv in normal mode to reselect the selection again and this time I'm in visual mode.
I tried to put the <esc> commands as in above script but it doesn't work.
You have completely wrong syntax for invocation of :normal.
normal! "\<Esc>\<Esc>"
will execute 14 characters in normal mode, none of them will be escape character: normal does not accept expressions. You have to use
execute "normal! \e\e"
(\<Esc> also works, but \e is faster to type). I see no reason in having two normal commands here so
execute "normal! \e\egvy"
. But I am still wondering what you do to invoke this script? Without this information the above is likely to prove being completely useless.
PS: I completely agree with #romainl that using easy mode and, more, using mouse in easy mode is completely wrong way of using vim.
What are you doing in insert visual mode in the first place? Are you using GVim in "easy" mode and using the mouse? There are better ways…
Anyway, instead of <Esc><Esc> you can use <C-g> to go from select mode to visual mode.
Without more background on your goal I can't be sure but I think that you are doing something unnecessarily complicated.