We’re rewarding the question askers & reputations are being recalculated! Read more.

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
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
18 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
39 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. ...
2
votes
1answer
39 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
2answers
186 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 ...
1
vote
2answers
55 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 ...
1
vote
1answer
54 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 ...
0
votes
0answers
41 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
31 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
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
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. ...
0
votes
0answers
102 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 ...
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 ...
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 ...
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 ...
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 ...
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
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
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
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
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
21 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
67 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, ...
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. ...
0
votes
1answer
185 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 ...
3
votes
1answer
128 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 ...
1
vote
2answers
39 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 ...
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
80 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?
2
votes
2answers
238 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
1answer
70 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> :...
1
vote
1answer
98 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 ...
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 ...
1
vote
1answer
49 views

How do I find commands that're available in insert mode?

I know of 4 commands I can use in Vim's insert mode. C-w delete word C-k delete line C-d delete one 'shiftwidth' worth of indent C-t add one 'shiftwidth' worth of indent C-O begin a quick command. ...
1
vote
3answers
86 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><...
1
vote
0answers
77 views

remap keybinding for vim gocode autocomplete feature? (remap keybinding in insert mode) [duplicate]

So I installed vim-go and gocode and Blackrush/vim-gocode.git (the latter because I use pathogen). So far so good! I am fine, I can type <C-x><C-o> in insert mode and I get completion ...
1
vote
2answers
223 views

Scroll view up or down while in insert mode

I really like Ctrl-E and Ctrl-Y in normal mode, which expose additional lines at the bottom or top of the screen (respectively) without moving the cursor. I'd like to do the same thing in insert mode ...
0
votes
1answer
38 views

How to invoke mapped `i_CTRL-W` in function

First I will describe what I am trying to achieve: In general I use set iskeyword+=- as I see this more usable (one should always put spaces around operators when needed). This is quite helpful, but ...
1
vote
1answer
33 views

Going to the start of insert command on exit

Hi Vi StackExchange, A Picture of what I want Say I have the following in my buffer: foo("a", "bar") And I am in normal mode with my point on b in bar. Now I want to insert some characters, say ...
1
vote
0answers
31 views

how to edit the command when copy into conque

I am using conque plugin in Vim. When I copy some content into conque, it seems only possible to edit at the end of the command. What I wish to do is to copy something into conque and change a little ...
9
votes
1answer
591 views

Is there a prepend insert mode?

I was trying to write a string with all chars from z to a and I thought this would be much easier if I could write backwards. The idea would be like an INSERT mode in which the cursor doesn't step ...
0
votes
1answer
42 views

Is there possibly something wrong with (i)mapping the left bracket?

I've been using the vim-surround plugin for as long as I can remember and have grown accustomed to typing <c-g>s ) when I want to insert text between brackets. I was writing with the atom editor ...
0
votes
1answer
451 views

Make backspace delete character and enter insert mode when in normal mode

I want the backspace to behave the same in normal mode as insert mode and it should also enter insert mode.
1
vote
1answer
66 views

Is there something like '5s' for replacing words (instead of letters)?

Given the following line this is a testing line When my cursor is on "a" and then I type 2s, it becomes this is testing line My cursor is on "t" of testing, and I am in insert mode. Is there ...
1
vote
2answers
135 views

How to not trigger InsertLeave inside an imap?

When you want to leave insert mode, it's possible to avoid to trigger the InsertLeave event by pressing Ctrl-C instead of Esc. But when I try to use this method inside an insert mapping, it still ...
0
votes
1answer
61 views

How to replace ) by <left> when closing bracket [config]

I have the following in my .vimrc, it permits to automatically close brackets. ino " ""<left> ino ( ()<left> ino ' ''<left> ino [ []<left> ino { {}<left> What I would ...
-1
votes
1answer
74 views

Insert position

Recently insert position becomes strange. i can change insert position. Sometimes insert to the left of current cursor, sometimes to the right. Caps is not activated. VIM 8.0 1-586