Questions tagged [insert-mode]

The mode in Vi and Vim in which you can insert text to the open document.

Filter by
Sorted by
Tagged with
4
votes
2answers
452 views

Breaks line without leaving insert mode

With the textwidth option set the text written can be wrapped when we leave insert mode. If I type a line longer than my textwidth value then it will go on a new line. e.g. with set textwidth=5 and ...
8
votes
4answers
1k views

Grok Vim motions and simple edits

I'm returning to Vim after using Emacs for a few years. I'm trying to grok Vim by reading and watching tutorials, as well as actually using it daily. When editing text, I find the Emacs commands of ...
2
votes
0answers
95 views

Why typing `alt + 3` exits insert mode? [duplicate]

In the last week my vim has started to exit insert mode when I type alt + 3. I have changed my theme to tomorrow night, but other than that no updates or changes to .vimrc. Any ideas what could be ...
1
vote
1answer
249 views

how to map usual key in insert mode?

I want to bring some magic to my configuration but it fails to work because it seems vim refuses to imap to a key in main keyboard. For example: imap a bcd I know most of time that's insane, but i ...
21
votes
4answers
1k views

Undo <CR> in insert mode

Sometimes in insert mode I hit <CR> by mistake and I have to hit the backspace multiple times (depends on the indentation) to get back where I was. e.g. <div> <p> This is some ...
4
votes
1answer
536 views

Vimscript insert after cursor

I am aware of the startinsert command which switch to insert mode as if the i key was pressed. With the ! it behaves like A. Do you know if there is some kind of option to go to insert mode like we ...
5
votes
1answer
151 views

Is there a way to push existing text left while inserting (e.g., insert right-aligned text)?

In insert mode, typing normally moves the cursor right and pushes text to the right of the cursor farther to the right on the line. I am typing some right-aligned text and am wondering - is there a ...
4
votes
2answers
152 views

<C-v> <C-i> not working to print literal tab!

I'm trying to set a custom breakat for plain text files. Aiming for a very small set of characters -- just hyphens, slashes, and whitespace. That means I need to add tabs, which I do by setting ...
16
votes
4answers
4k views

How to enter insert mode when entering neovim terminal pane?

I have the following mappings to make it easy to move out of a terminal pane in neovim: tnoremap <C-h> <C-\><C-n><C-w>h " Workaround since <C-h> isn't working in neovim ...
6
votes
2answers
220 views

imap beginning with <C-o> interferes with omnicomplete

I added the following key mappings: inoremap <silent> <Up> <C-o>gk inoremap <silent> <Down> <C-o>gj The goal was that j/k would still work the way that I was ...
0
votes
1answer
91 views

Quickest way to change a certain number of characters in INSERT mode? [closed]

What's the quickest way to change a specific number of characters? I want to edit the next N number of characters without using replace mode.
16
votes
3answers
338 views

Speed bump on <Esc>O (Insert to Normal to Insert new line above cursor)

Often when I'm in Insert mode, I'll hit Esc to get into Normal mode, and then immediately hit O to begin a new line above the cursor and go into Insert mode there. But when I do that, there is a 1-...
14
votes
3answers
1k views

Edit different words simultaneously, one the same line like in Sublime Text with multiplie selections

is it possible to edit more than one word simultaneously, which are on the same line? For example, let's say I have this: Spam and Eggs is all you need for a healthy breakfast and I would like to ...
6
votes
1answer
1k views

Cursor moves one character backwards on exiting insert mode

I recently have noticed that entering and then exiting insert mode will move your cursor one space to the left. This is a default behavior of vim, since it still occurs with vim -u NONE -U NONE -N. ...
5
votes
1answer
1k views

Mapping control-H in insert mode doesn't work; it always works like backspace

I tried mapping control-H, J, K, and L respectively in insert mode to move around splits. inoremap <C-h> <ESC><C-W><C-h>i inoremap <C-l> <ESC><C-W><C-l&...
2
votes
1answer
111 views

Complete multiple lines

I want to complete multiple lines at once. For instance, in a buffer (may be hidden): ... using std::cout; using std::cin; using std::endl; ... In the current buffer I can complete a whole line ...
4
votes
1answer
501 views

Vim forgets cursor column when I move over a line that ends with a brace in insert mode

Normally, when I use the up/down arrow keys to move between lines in insert mode (I'm using Vim wrong, I know), Vim remembers which column my cursor is in, so if I move to a line shorter than where my ...
7
votes
2answers
442 views

Remove the insert delay after entering insert in a read-only file

When entering or doing any command mode modifications to a read only file for the first time you will get the warning W10: Warning: Changing a readonly file That's fine, but this also introduces a ...
4
votes
1answer
1k views

Triggering UltiSnips with enter

Is there any possible way to do expand trigger in UltiSnips with enter? I've tried <Enter>, <Return>, and <CR>. It works to trigger but doesn't work for new line. And I've tried to &...
4
votes
3answers
581 views

Is it possible to wrap characters around text every time you paste something from the system clipboard?

I am going to be pasting a lot of characters into a file. Each time I paste something, the pasted element will need to be wrapped in quotes and followed by a comma. Is there a way to automatically ...
11
votes
1answer
2k views

How can I run an autocmd when starting Vim with no file, a non-existing file, or a blank file (but not when starting with an existing file)?

I would like to run an autocmd in the following scenarios when I start Vim: With no filename specified. When the file is new. When the file exists but is completely blank. In all of the above three ...
9
votes
4answers
2k views

How to delete content backwards until “=” at the previous line?

I use an example of javascript code: 1 var a = 1; 2 var b = |{}; The cursor is at the position of |( on the character "{" when the cursor shape is block), I find out that I want a ...
22
votes
3answers
2k views

How to write vertically?

Lets say I want to produce the following text in my document: % % Not Important % O -------------------------> % | % S | % o | % m | % e | % | % M | % s | % g | % | % ...
9
votes
2answers
445 views

How can I create a pseudo insert mode with a different keymap?

I am in the slightly unusual position of using two different keyboard layouts on a regular basis (Programmers-Dvorak and Turkish-F). These layouts are quite different from each-other and I am only ...
29
votes
5answers
8k views

What is the easiest way to insert Unicode characters into a document?

When writing documents occasionally I want to insert Unicode characters into the text. Sometimes I know the character code and sometimes I look it up on the web. Currently I go to insert mode and ...
36
votes
7answers
7k views

What is the easiest way to insert en dash in Vim?

To insert an en dash, I use ^v u 2014 which is seven keypresses. Is there an easier way? (I was looking at digraphs and didn't find en dash there.)
160
votes
4answers
118k views

Why doesn't the backspace key work in insert mode?

Trying to delete characters in insert mode with the backspace key sometimes doesn't seem to work. I can backspace sometimes, but at other times it does nothing; the cursor doesn't go to the left, and ...
2
votes
1answer
725 views

How can I have (g)vim start in insert mode by default (when opening a .txt file)? [duplicate]

I often just need to create a notes.txt file in Windows to just quickly paste some text from some other place, save it from the gvim UI, and close the file. I want to be able to perform this operation ...
12
votes
2answers
12k views

Insert tabs in INSERT mode when expandtab is set

I have set expandtab in my .vimrc file to convert tab to multiple space characters. However some files (like Makefile) need actual the tab character inserted. Is there an easy way to force the ...
6
votes
2answers
205 views

Deleting groups of autoindents in Insert mode

In my .vimrc I have set backspace=eol,start, which allows me to backspace over line breaks and the start of what I wrote since I entered Insert mode. This does not allow me to backspace over ...
11
votes
1answer
327 views

Map a sequence of letters in insert mode

I can already map a key combination in insert mode: :inoremap abc <do stuff> However, this has a few drawbacks: When typing a partial version of the sequence, such as ab, the characters aren'...
3
votes
4answers
544 views

Can Escape be disabled in insert mode?

I'm trying to retrain my fingers to refrain from using Escape so often. Can I disable Escape when I'm in insert mode, leaving just Control+[ and Control+C as the only ways to return to normal mode? ...
3
votes
1answer
961 views

What are the Control-key combinations/chords?

Because of Vim's modes, there is not a lot of holding down the Ctrl key while pressing another key. However ,in insert (or replace) mode, Ctrl+R will let you paste a register, and Ctrl+V lets you ...
10
votes
1answer
111 views

Is there a <C-w> for WORDs?

Pressing Ctrl-w in Insert mode will delete the previous word. It is equivalent to Ctrl-Backspace in Windows, and Opt-Delete in OS X, and really speeds up typing. Vim has the separate concepts of word ...
16
votes
4answers
629 views

Set the paste option, but for one insertion only

I want to have a quick way of setting the Vim 'paste' option, inserting some text, and reverting to the previous value of 'paste'. A typical use case insert the OS clipboard content literally, ...
79
votes
12answers
68k views

Other ways to exit Insert mode besides Escape

The primary reason I like vim over emacs is that my hand movement distance away from the home row is very low (even as a programmer). However, the one main time that I do this is leaving insert mode, ...
23
votes
4answers
5k views

Automatically load Vi into insert mode

I use Vi as my preferred (and, in fact, only) text editor on Linux Systems. I know how to change modes from normal to insert, and vice verse. Is it possible to have Vi automatically load into Insert ...

1 2 3 4