Start fish shell in vi insert mode? - fish

Using fish_vi_key_bindings, fish shell starts in normal mode. How can I change the default start to insert mode?

fish_vi_key_bindings takes an argument to indicate the initial mode.
That means fish_vi_key_bindings insert will do what you want.

Related

VsCode Vim Extension command to enter insert mode

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

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!

How to skip forward/backward a word at a time when editing postgres command in psql?

In most command line interface "cli" programs the Option-arrow key combinations allows one to move forwards/backwards a word at a time. But in psql both Option-arrow and Control-Arrow actually insert non printable control characters that corrupt the command. In addition in most CLI programs hitting CTL-A goes to the beginning of the command and CTL-E goes to the end of the command. But in psql those combinations do not have any effect.
Navigating a single character at a time is simply too slow: I can not imagine this were an unsolved problem. What is the configuration needed to get one of those key combinations to skip forward/backward by words not characters?
This is an answer containing the response in the comment by by #Marth. The ~/.inputrc does cause the issue.
# want vi to be the default editor for readline
set editing-mode vi
$if mode=vi
# normal mode
set keymap vi-command
set keymap vi-insert
"\C-n": backward-kill-word
"\C-p": history-search-backward
$endif
I have completely removed the ~/.inputrc now.

How to get out of a select in PostgreSQL without exiting to the terminal?

As you see in the image I have listed all the tables in a database...
I can move up and down, but how can I get back to the postgres prompt? If I use CONTROL+X it takes me back to the linux prompt, but out of postgres.
Thank you ALL for your patience with non-programmers!
It's less pager, simply type q.
https://www.postgresql.org/docs/current/static/app-psql.html
If the environment variable PAGER is set, the output is piped to the
specified program. Otherwise a platform-dependent default (such as
more) is used
so If you are on linux and did not explicitely change PAGER, tap q
http://man7.org/linux/man-pages/man1/more.1.html
Press space to continue, 'q' to quit.

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.