Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

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
75
votes
12answers
60k 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, ...
2
votes
2answers
242 views

How to light the Caps Lock LED when in insert mode (on GNU/Linux)?

On Xubuntu LTS, I already managed to remap CapsLock to Esc. However, now I discovered some Vim users are lighting the Scroll Lock LED, Caps Lock LED or even the entire keyboard to indicate that (g)...
0
votes
2answers
41 views

How to remap Autocomplete on Control+N, to Control+Space?

I am trying to remap this functionality: to Ctrl+Space, by using this line in .vimrc inoremap <C-Space> <C-n> However, I can not seem to get it to work. If I press Ctrl+Space after ...
1
vote
1answer
19 views

detecting insert-normal mode

I notice that when in insert, pressing <C-o> will take me to normal mode, but once I finish pressing a sequence of keys, I get taken back to insert mode. I find this very useful, but I want a ...
0
votes
0answers
41 views

Escape newlines when breaking text

I'm using Vim to typeset some Latex documents, and resizing it to take up half my screen so I can reference other materials on the other half. Therefore, formatoptions+=t would be very helpful here. ...
5
votes
1answer
158 views

How to disable folding while typing?

I'm programming mostly in Python/Cython and use foldmethod=syntax (and foldclose=). Overall, this works fairly well, i.e. functions/classes/methods are folded reliably mostly. However, I have one ...
2
votes
1answer
40 views

Is it possible to supply arguments to inoremap?

Currently, I have the following map for cpp files: inoremap ;;f for<Space>()<Space>{<Enter>}<Esc>kkf)i Which essentially allows me to quickly setup a c-style for loop. ...
1
vote
1answer
99 views

How to stop “tab” key indenting whole line

In one version of VIM that I run, when I hit the "tab" key in insert mode, it indents the whole line, regardless of the cursors position in the line. Here is what I believe to be the only modified ...
19
votes
5answers
10k views

Navigation in insert mode

I finally decided to ditch the arrow keys for navigation in favor of hjkl. I used the Vim hardmode plugin to disable the arrow keys. I got used to navigation pretty fast, but turns out that ...
1
vote
2answers
56 views

How can I stop Vim from inserting keypresses into the document unless the document is visible?

I have a macro that's essentially equivalent to the following: in insert mode, I press the following keys: Ctrl+O, :, !, t, r, u, e, Enter. This runs the command true in a shell and shows "Press ENTER ...
0
votes
1answer
44 views

Is there a way to enter command line mode for a single command directly from insert mode?

I'd like to go directly into command line mode from insert mode, enter a single command (say :r !date which inserts the date) and then go immediately back into insert mode. Basically something ...
1
vote
2answers
187 views

How to auto-replace words, such as acronyms, while typing?

When typing a report, we have a large list of acronyms defined in Acronyms.tex. In order to use it, we have to encapsulate an acronym such as KDF with the acronym command: \ac{KDF}. I often forget and ...
4
votes
1answer
145 views

How do I prevent the delay when mapping jj to <ESC> in insert mode?

I've recently mapped jj to <ESC> in insert mode for quick escaping. While everything is functional, I find the brief delay after typing j while it waits for a second input very distracting. Is ...
1
vote
1answer
55 views

Mapping using <Esc> writes “<Esc>” in insert mode rather than switching to normal mode

I have the following line in my .vimrc: inoremap kj <Esc> It had been working fine, ie it returned me to normal mode. But now it inserts the string "< Esc>" (I use the initial space here ...
16
votes
4answers
568 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, ...
0
votes
0answers
42 views

Temporary normal mode doesn't wait for the command

When I press C-o in insert mode, the expected behaviour is that vim will wait for me to execute a single command and then returns to insert mode. Usually, after pressing C-o I have all the time in the ...
2
votes
2answers
32 views

Automate breaking of history in insert mode

I started to learn ViM one month ago, so I'm not a ViM expert. My question is: if I make some changes in insert mode (let's say I type some text, then I delete the last two words and finally type ...
0
votes
0answers
110 views

Visual block mode insert/append not working in vim on RHEL/CentOS?

I was trying to append some text to multiple lines in vi on a RHEL 6 system, however I could not get it to work. I press Control + V to get into visual block mode, select the lines I need, but when I ...
1
vote
0answers
18 views

Get correct indentation when entering insert mode [duplicate]

When I enter insert mode using o or O when programming, the cursor appears at the correct level of indentation. In this example below, X is the place where I press o and Y is where my cursor appears. ...
11
votes
1answer
5k views

What options are there to enter insert mode?

I used to enter insert mode by a never realizing that there is a system as to where the insert mode starts. I was sometimes annoyed that a would put the cursor after the first character of a line, ...
1
vote
0answers
54 views

Change the behavior of CTRL-X submode key bindings

I wanted to change the behavior of some keys in the :h i_CTRL-X submode. For example, I wanted to use the following: inoremap <expr> <C-f> pumvisible() ? "\<C-x>\<C-f>" : "<...
0
votes
0answers
69 views

Don’t start in insert mode when opening a shell script

How can I prevent vi from starting in insert mode when opening a "test.sh"-like file with the vi-plugin "bash-support" v4.3 ? When I vim test.sh it opens in insert mode When I vim .vimrc it opens in ...
6
votes
2answers
2k views

Start Vim in insert mode for new files

I mostly use Vim to edit configuration files so I understand why it starts in normal mode. But I also use vi mode for the REPL (bash, zsh, ipython, etc.) and the shell always starts in insert mode (...
0
votes
2answers
34 views

How do I map a sequence of letters in insert mode?

After trying to make this work: Map a sequence of letters in insert mode I can’t get the correct answer to work. Is it still working? Can anyone post a working .vimrc file? I want to get this: When ...
11
votes
1answer
308 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'...
6
votes
3answers
2k views

Within a function, Is there a way to determine if vim is in insert mode?

Within a function, is there a way to determine if vim is in insert mode (or was in insert mode prior to calling the function)?
1
vote
0answers
13 views

How can I remap the arrow buttons in insert mode when Pencil is enabled

I use vim to write text, and that’s why I often use it in combination with the Pencil plugin. The plugin creates significant delay in the movement of the cursor when in insert mode. I have tried to ...
2
votes
1answer
27 views

Backspace + keypress adds a character of a different language in neovim with neomutt on my mac

I am a user of neomutt and I use neovim as my default editor. However, when I delete a character via backspace, and then type the correct character, I sometimes get a strange character from a ...
14
votes
3answers
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 ...
0
votes
1answer
45 views

How can I get vim to type continuously, rather than holding in place for keymappings?

For the purpose of this question, imagine that I have set iab phil philosopher In vim, as far as I know, the default display pattern when typing out the characters "phil" at the start of the word is ...
0
votes
1answer
27 views

nnoremap conflicts with i_CTRL-O

I added two normal mode mappings so that the cursor doesn't move when changing case nnoremap gUiw m0gUiw`0 nnoremap guiw m0guiw`0 Recently I had to uppercase a word and I tried like this: ...
0
votes
1answer
35 views

How to show the left-hand side of insert mode mappings while invoking them in Neovim

Much like what was asked in this question: I want Neovim to show what I type, and keep recognising it as a mapping in progress even if I use Backspace or Delete. This is actually a very useful ...
0
votes
2answers
82 views

How to put a word into like as if in R (type over) mode? [duplicate]

What I need to do is yank a word (yw) and then move my cursor to a diffent location and "paste" the word over whatever follows the cursor without disturbing the other characters in the line "yw" ......
0
votes
0answers
37 views

“--INSERT--” doesn't go away with a remapped escape key

I remapped the Esc key to jj as follows: inoremap jj <esc>l If I only put <esc> the cursor is always one letter to the right, however once I add the l the notification message --INSERT -...
1
vote
1answer
22 views

Vim doesn't extend Roxygen R comments

I'd like it if, when filling out my Roxygen comment snippet, #' Title #' #' @param #' #' @return #' #' @examples #' #' #' @export ...
0
votes
1answer
70 views

May I have a Vim session report its “Mode” in its “Window Title”?

Clarification of the moving parts First, let me clarify what I mean by "Window Title", and what I expect to achieve On Windows OS, GUI programs will have three attributes: its Window Title texts, ...
20
votes
4answers
2k views

How do I keep accidentally creating a no break space before opening curly brace?

I am conscious this is a strange question, and this might not even be the right forum to post it. But this has been a problem for several years. From time to time, let's say once a month, when I ...
3
votes
1answer
101 views

Exiting and entering insert mode again with key-binding

I'd like to experiment one of the tip by Drew Neil in his Vimcast, that is to "escape" regularly, so that it gives more granularity to the "undo" command. For example, I write one short sentence. ...
3
votes
1answer
129 views

Insert comma on new line in array

I like to format my arrays like this: myArray = [ "lorem" , "ipsum" , "dolor" , "sit" , "amet" ]; If I open a new line below the "amet" line, I ...
149
votes
4answers
107k 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 ...
0
votes
1answer
200 views

How to enter insert mode on the next line without creating a new line?

If my cursor is at position * below, how can I enter insert mode at the beginning of the next line without creating a newline? o does what I want, except that it adds an additional unwanted line into ...
1
vote
2answers
40 views

How to copy all non-alphanumeric characters at the begining of the line to the next line?

I want to implement something similar to Org mode M-RET into neovim. In Org mode it creates new list item or heading depending on what line the point is on. I'm thinking of a mapping in neovim that ...
1
vote
1answer
35 views

Editing diffs in-line in vim

I want to be able to make the changes that I’m making to certain files a lot more visible while I’m editing them. Does any plugin or functionality of vim allow for viewing the editing history of the ...
0
votes
0answers
51 views

i<c-e> and i<c-y> copy to end of line

In insert mode <c-e> and <c-y> copy a character at a time from the above line. I generally use these when working with aligned bits of text inside a program and want to copy to the end of ...
7
votes
3answers
7k views

arrow keys don't work in insert mode

When I hit the arrow keys in insert mode I get characters instead of navigation: I'd like to be able to use the arrow keys to navigate. Things I've tried I have set nocompatible in my ~/.vimrc (...
0
votes
1answer
48 views

Make conditional imap to text being enclosed in certain characters

How can I create mappings that work only if the cursor is enclosed by certain characters? As an example, I want to map ja to \alpha if the cursor is enclosed by $$ or by \[\] so as to make This jar ...
1
vote
1answer
82 views

Insert Page break ^L automatically after specific number of lines/characters?

How could VIM (script?) insert ^L (page break) and /r on an empty line, automatically after every 30 Lines OR 1800 characters while writing? Any ideas?
1
vote
3answers
87 views

Substitute an insert-mode input immediately

I would like to type begin! in insert mode and having it immediately replaced by: begin [cursor here] end I considered mappings: :inoremap begin! begin end<Left><Left><Left><...
0
votes
1answer
73 views

How to make this work in insert/edit mode too?

I want to switch between tabs, but this works only in command mode. Is it possible to make this work in edit (insert?) mode too? noremap <C-k> :tabprevious<CR> noremap <C-l> :...
2
votes
1answer
35 views

How to source an Ex file and automatically go to Insert mode

I want to have a simple alias to take quick notes. Each note starts with the current date and time (ISO 8601). The alias should: Start vim Add the current date and time Position the cursor in the ...