Questions tagged [insert-mode]
The mode in Vi and Vim in which you can insert text to the open document.
284
questions
1
vote
1
answer
37
views
Stop repositioning last line at bottom of window
I've just noticed that if the cursor is at the last line of a file and
I enter insert mode, then the buffer pans so that the cursorline is at the bottom of the [sub]window, as if in response to a zb
...
0
votes
1
answer
33
views
Lua insert mode mappings are pasting the rhs in buffer instead of executing them
In my init.lua, I've got some keys bound to some actions in insert mode.
e.g.:
vim.keymap.set('i', '<C-j>', '<Plug>(easymotion-bd-w)')
But when I press Ctrl-ew, instead of highlighting ...
0
votes
1
answer
80
views
Edit multiple lines and insert
Say I have a text file:
abc
abc
abc
I want to change it to this:
adbc
adbc
adbc
My current way of doing this is to move the cursor to the b in the first (or last) line, select the column of bs with ...
1
vote
1
answer
43
views
Behaviour of Neovim when in insert mode is different from expected
I recently switched from vim to neovim.
I have the following keybindings in neovim:
vim.keymap.set("i", "0", "<Esc>la", { noremap = true })
vim.keymap.set("i&...
0
votes
0
answers
89
views
Popup when writing in insert mode part of a string that has been bound to something else
I recently switched from vim to neovim.
I have been struggling with the behaviour of neovim while editing which is at times different from that of vim.
I have the following keybinding
vim.keymap.set(&...
1
vote
1
answer
115
views
Cursor position 'o' and 'O' insert command with count number
The default behaviour of the o and O when prepended with a count is to keep the cursor always at the bottom.
I'm wondering if there's a native way to get the cursor at the top.
The way I'm doing this ...
0
votes
1
answer
32
views
How does <cword> work in insert mode?
Basically I want to access the last \w\+ in my current insertion. (Hence I asked this question.)
Another solution I thought of was something like the following (I'm echoing, but clearly I'd pass it to ...
1
vote
1
answer
983
views
Neovim how to keep the diagnostic message in insert mode?
When I upgrade Neovim 0.8.3 to 0.9.0, the plugin lsp-setup.nvim diagnostic message disappears when the content is entered in insert mode.
After exiting insert mode, the diagnostic message appears ...
1
vote
1
answer
125
views
Why does not Neovim support 'insertmode' option, and will the Neovim support it in the future?
Vim has the option: 'insertmode'.
Why does not Neovim support the 'insertmode' option?
-1
votes
1
answer
74
views
What does Ctrl+e & Ctrl+y do in insert mode of Vim? I have accidentally found out a funny cmd which I don't know what's the application
In normal mode:
Ctrl+y Scrolling screen dw with the cursor staying on the same line
Ctrl+e Scrolling screen up with the cursor staying on the same line
However in insert/edit mode:
...
0
votes
0
answers
88
views
Insert-mode gqip not idempotent?
I open Vim and add the following lines to a buffer (call this state INITIAL):
xx xx xxx xx xxxx xx xxxxx xxxxxxxx xxxxx xxxxxxxxxxx x xxxxx xxx xxxx xxx x
xx xxxxxx xxx xxxxxxx xxxxxx xx x xxx xx xxx ...
2
votes
1
answer
104
views
How to implement a symbol keyboard layer in Vim?
I recently came across this question:
Mapping symbols and special characters to home row in insert mode, which introduced me to the idea of a symbol layer on the keyboard. This seems like a nice thing ...
1
vote
1
answer
600
views
<Tab> out of insert mode - lua keymap
I'm a relatively new neovim user. I use nvim-autopairs to always induce matching (, [, {, ', " character pairs, and automatically placing my cursor inside them. As an example, in insert mode, if ...
0
votes
1
answer
29
views
Why inoremapping <c-e> shadows <c-e> completion functionality?
Foreword
Open a new file with vim -Nu NONE and insert the following text (| is to indicate the position of the cursor, in insert mode)
longline
lo|
longerline
Now hit Ctrl-XCtrl-N and the ...
0
votes
1
answer
38
views
What other than mappings and abbreviations can change the text I'm typing?
The question
When editing TeX files (to do so, I use vimtex) if I've discovered that if I write lll in insert mode, I get \ell.
How do I find why this is happening?
My research
I thought "ok, I'...
0
votes
0
answers
16
views
Getting mode after feedkeys
I'm trying to run keys through feedkeys and extract what mode I end up with. Sadly every time feedkeys is run either it ends up in normal or the method hang. I tried with the "\<Ignore>&...
0
votes
2
answers
2k
views
How to select all text and delete in vi?
Is it possible to select all the text and delete it it in vi other than hitting backspace?
1
vote
2
answers
39
views
lnoremap doesn't seem to apply to insert mode when mapping an unwanted key combo to nop
This is a follow up to this question of mine.
I found out that having :noremap ^[[29^ <Nop> in my vimrc is not enough to disable the unwanted effect of Ctrl+Menu in insert mode, so I looked at :...
0
votes
0
answers
59
views
Vim automatically inserts "* " add the start of every new line in css files
If theres a "* " at the start of the previous line Vim automatically inserts a "* " at the start of the next new line. I want Vim to not insert anything.
examples:
1|* {margin: 0;}
...
2
votes
1
answer
143
views
How can I have <C-E> and <C-Y>'s normal mode functionalities also work in insert mode?
Once I've asked a general question about special characters, but I've not really pulled anything out of it.
So now I'm asking a very specific question.
I want to have Ctrl+e and Ctrl+y behave in ...
0
votes
1
answer
707
views
How can I have multiple cursors while entering insert mode after Visual Block mode?
Let's say I have some text:
ipsum
ipsum dolor
ipsum dolor sit
I want to add the word "Lorem" in front of each line.
Loremipsum
Loremipsum dolor
Loremipsum dolor sit
I can do this by:
...
2
votes
1
answer
59
views
Where is the text data stored during typing text in insert mode?
I would like to develop a small app in React and Nodejs that sends real-time typed text from my Nodejs/Express server to my React frontend. To do this, I would like to use socket.io.
The text data is ...
1
vote
0
answers
13
views
How can I get language and keyword completion in omnifunc? [duplicate]
Let's say I'm editing this Python script:
something = 1
something_else = 2
My cursor is on the third line, in insert mode.
When omnifunc is unset, <C-X><C-O> displays an error:
E764: ...
0
votes
1
answer
36
views
How do I type an insert mode command?
I've recently read that some people put inoremap jk <Esc> on their vimrc to exit insert mode without having to move their hands away from the home row. But then how do you type the letters jk? ...
1
vote
1
answer
75
views
Using an inoremap with `r`
I have some inoremap's in my vimrc, such as
inoremap \c <c-v>u2705
which enters a ✅ emoji for when I am writing checklists.
However, I noticed that while I am able to use it when in insert mode ...
3
votes
1
answer
212
views
How to undo in ctrl-x mode?
Let's say I just completed following path using Ctrl-x, Ctrl-f (twice) and I haven't exited the Ctrl-x mode yet and I got
/home/john.doe/
Let's say I chose john.doe accidentally and actually want to ...
1
vote
1
answer
40
views
Odd behaviour when pressing Tab with this mapping
I am trying to map ctrl+shift+i to insert an italics command in LaTeX files, and here's my attempt:
autocmd BufNewFile,BufRead,BufWrite *.tex inoremap <buffer> <c-I> \textit{}^[i
I am ...
1
vote
1
answer
556
views
Cursor not changing to beam in insert mode when using Kitty terminal
Well the common problem again.
I could fix my problem for Konsole by adding
" Fix cursor for Konsole
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_EI = "\<Esc>...
1
vote
1
answer
112
views
Ctrl+Arrows work differently in normal mode and in insert mode
For some reason, in my VIM there is a difference in behaviour of Ctrl+Arrow keys in normal mode and in insert mode. To demonstrate this, I edit the file which contents are:
aaa.aaa,aaa/aaa!aaa@aaa#aaa$...
2
votes
2
answers
256
views
Opening files in insert mode
How do I make vim open files in insert mode? I've got the line "startinsert" in my .vimrc, and it does what it's supposed to (vim opens in insert mode), but when I open another file it opens ...
1
vote
1
answer
46
views
Unexpected behavior in edited vimrc: dropped out of insert mode when hitting empty line
sorry for the bad title. I could not think of how to better summarise the problem. I should also state, that I am fairly new to vim, so please be a bit considerate :).
I made the following changes in ...
0
votes
0
answers
68
views
Modifying file in vim and after restart the file is reset to unmodified
I have two monitors and the second one is detected as primary even tho I made the actual one primary in the settings. I found a hacky metod to make it primary and it involves changing the files. I ...
0
votes
2
answers
67
views
How to yank the filename of specific buffer?
Is there a (simple) way to yank the filename of specific buffer in insert mode?
For example, in insert mode, Ctrl+R % gives the name from current buffer, Ctrl+R # gives the alt one, but what about an ...
0
votes
1
answer
70
views
alt dot to insert the last word of previous line
In bash shell, alt + . inserts the last argument of the previous command.
and there are alt + (number) + . and alt + , variations.
I like to do the same while editing shell script in vim, i.e.
I want ...
0
votes
0
answers
56
views
Vim doesn't respect inoremap bind in insert mode for windows wsl config
I have these two configs
:nnoremap <F5> "=strftime("%F %r")<CR>P
:inoremap <F5> <C-R>=strftime("%F %r")<CR>
In normal mode f5 inserts date-time,...
0
votes
0
answers
111
views
Neovim diffrent behaviour than vim on spelling sugestion
First thing first I am writing a foreign language with a different keyboard(greek-english).
I was trying some spell checking features of vim and neovim and I noticed that neovim might have a bug.
At ...
0
votes
1
answer
210
views
keyboard shortcut to insert text at the end of several lines of same length instead of 10,12s/$/pattern_to_be_inserted/gc
to insert the same text inside several lines in one particular line <ctrl> + <v> to select the line and then <shift> + <i> to insert a texte BEFORE the particular column. Is ...
2
votes
3
answers
1k
views
Exit insert mode and write to file in one command
Is there a command to exit insert mode and perform :w or :wq in the same command?
I am tired of pressing esc + :w every time I need to write to a file after making edits.
Alternatively, is there an ...
0
votes
1
answer
120
views
How to insert on a newline, pushing everything after the cursor down with it
Say my cursor is []:
(A very intelligent turtle[)]
I'd like to issue something like o that would put me in insert mode here:
(A very intelligent turtle
[)]
I'm using spacemacs.
0
votes
0
answers
42
views
What does the "§" key do in insert mode? [duplicate]
I stumbled into a weird behavior when using vim and it has been month of me just enduring it.
When in insert mode, when I type on the "§" key my cursor jumps into my file.\
:h §
doesn't ...
1
vote
1
answer
500
views
Set cursor anywhere in window
How to setup Vim so you can f.e mouse click in the middle of new opened empty Vim window and place cursor exactly there ( f.e line 23 char 49), instead of line 1 char 1 because?
Is there better way ...
1
vote
1
answer
477
views
How to delete .yaml elements like maps or arrays efficiently in Vim?
I often need to edit huge .yaml files, where I need to delete entire maps or arrays.
My current approach is to go into visual (line-wise) mode (Shift + V) and mark the lines manually, but that feels ...
1
vote
2
answers
309
views
How to go to the nth-to-last character in insert mode?
Capital A in Vim takes me to the last character in insert mode, but can I go to the nth-to-last character in insert mode (or append mode) in vim?
Example:
this is some t|ext
how to go specifically to ...
2
votes
1
answer
240
views
Delete from cursor position until end of line in command-line mode
I am trying to emulate readline keybindings in insert and command-line modes (for example, <C-u> for deleting from cursor position to beginning of the line, or <C-w> to delete previous ...
1
vote
2
answers
159
views
Tab to align cursor with next non-whitespace character in the line above (in insert mode)
How can we do this with vim?
set hlsearch " Highlight search matches
set incsearch " Highlight search matches as you type
set visualbell ...
1
vote
1
answer
510
views
How to set a keybinding in Insert mode
I'm new to Vim, and I've read that a best practice in Vim is to begin a new Append with each line. In other words, instead of pressing <Enter>, it is more advisable to leave Insert mode, and ...
0
votes
1
answer
156
views
Replacement of characters gives ^@ when replaced with newline but not newline [duplicate]
Why does replacement of something by using :%s/,/\n/gc in vim gives me ^@ instead of giving me newline. Sed replacement works perfectly sed s/,/'\n'/g. Any idea how to do sed thingy in Vim and save ...
3
votes
1
answer
694
views
Can macros be edited? [duplicate]
I want to end up in insert mode after a macro. Is there a way to do that?
A real life example:
Given "foo", I'm wanting to convert it into "$123" where the number is something I ...
0
votes
1
answer
42
views
Trigger complete keybind mapping using <C-O> when in Insert mode
I know that when I am in insert mode I can enter Normal mode for one command only and automatically switch back to insert mode using <C-O>. For example to go to the end of the line when in ...
2
votes
1
answer
143
views
Inserting abbreviation from file
First, I apologize if this is a trivial question.
I have the following file (main.ab) defining a Python snippet:
def main(args):
...
if __name__ == '__main__':
args = ...
main(args)
And ...