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
1answer
39 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
1answer
34 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
0answers
34 views

What does the "§" key do in insert mode?

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 ...
0
votes
0answers
13 views

How to override current command

I have Template command installed from sonicteomplate The problem with this plugin is, when I call a plugin, the cursor jumps to where {{_cursor_}} is, but it stays in normal mode, it doesn't go to ...
0
votes
0answers
9 views

How to leave insert mode immediately with python (or force vim to dispatch its event queue)?

Reproduction step : Use this vimrc : function! Ttt() py3 << EOF vim.command('echom mode()') vim.command('stopinsert') vim.command('echom mode()') EOF endfunction au InsertChange * :call Ttt()...
0
votes
1answer
34 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 ...
0
votes
1answer
28 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 ...
0
votes
1answer
55 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 ...
1
vote
1answer
46 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
2answers
46 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 ...
0
votes
1answer
50 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
1answer
33 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
1answer
154 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
1answer
19 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 ...
1
vote
1answer
52 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 ...
1
vote
1answer
110 views

Auto pairing using strings instead of characters

I'm already aware of existing solution to automatically "surround" sentences/word/etc (eg: auto-surround, vim-surround, etc) but those (as far as i know) don't support using normal strings ...
0
votes
1answer
42 views

How to make cursor move to the top line inserted with 2O?

Using a simple example: h[]ello If I type 2o<esc>, the cursor will be moved to the last inserted line like this: hello [] But if I type 2O<esc>, the cursor will be moved to the last ...
1
vote
2answers
74 views

How to return to normal mode by pressing ESC only once

I have been using vim for a short time, so I may not know a lot, please forgive me. There is a problem with my vim. It cannot enter normal mode from insert mode by pressing esc/ctrl-[ only once, but ...
1
vote
0answers
114 views

NeoVim : Can we "insert literally" every ASCII symbol with `<c-v>` ? (including delete `^?` )

In insert or command mode, the printable ASCII chars, like a can be insert with just a (we don't need <c-v> for those ones, but most of them will still work with <c-v>letter ). If I type, ...
0
votes
1answer
85 views

How to make mouse click ALSO enter Insert mode?

I've enabled mouse and clipboard and ... something else: set mouse=a set clipboard+=autoselect guioptions+=a That's almost perfect, but I want it so that when I left click it moves the cursor and ...
0
votes
0answers
23 views

How to automatically start in Normal mode? [duplicate]

I am using zsh on Mac and noticed that whenever I start vim, it always starts in insert mode. I use vim to inspect files more often than to edit. I tried adding set noinsertmode but it didn't have any ...
1
vote
1answer
37 views

Enter insert mode automatically after moving (e.g. with e, w)

Is there something similar to A and I for "smaller ranges" like w and e, i.e. I don't want to have to press i to insert, after navigating to the end of the word with e?
0
votes
2answers
137 views

How to backward-kill-word in Vim insert mode like zsh?

I'm re-learning Vim. My question is that I want to option + ⌫ to backward-delete a word in INSERT MODE. I've spent some days to achieve this (and succeeded) to my zsh shell through bindkey in .zshrc ...
0
votes
0answers
19 views

Shift+AnyLetter and Forward Slash Not Working on wsltty [duplicate]

I'm noticing errant behaviour with some standard key sequences with Vim 8.1 on wsltty. The correct behaviour is displayed when inside wsltty's standard terminal, so until proven otherwise I'm assuming ...
0
votes
1answer
222 views

When would I use append and when would I use insert?

I already know that a and i makes the cursor one space to the right and left respectively, but when would I use i to edit a file? Is there some special circumstance that makes insertion mode more ...
-1
votes
1answer
257 views

Enter insert mode after search?

So you're in Normal mode, then you press f followed by a character, then vim takes you to the next occurrence of that character. When you land on that character you are in Normal mode. My question is ...
1
vote
1answer
27 views

How to prevent cursor shift when using <C-O>{delete cmd} at the end of a line?

<C-w> deletes a (small-)word in insert mode, but I often want to delete the Word (to last whitespace) I've most recently typed. I tried inoremap <C-_> <C-o>dB which kind-of works -- ...
0
votes
1answer
71 views

Keep open fold open on `o`

I have a file with foldmethod=indent. I have the folds automatically open when I enter them, and close when I leave them. When I sit in Normal mode on the bottom line of a fold and press o, the fold ...
1
vote
3answers
237 views

How can I delete whitespace backwards until end of previous word?

I want to delete whitespace backwards until end of previous word. Say, I have the cursor on the character "d" in the word "dog": horse cat dog If I press Ctrl-W (Insert ...
1
vote
2answers
159 views

Shouldn't `softtabstop` be set, when using option 2 in `:h tabstop` to configure Vim to use spaces for `<Tab>`s?

I want to configure Vim to use spaces for <Tab>s everywhere. Therefore, I've had a look at :h tabstop to figure out how to perform the configuration. Looking at the help text, option 2. seems ...
1
vote
3answers
74 views

How to make a shortcut to activate and deactivate multiple maps?

I know there are questions/answers to execute commands with a single shortcut, but in my case I can't think how to do multiple maps with a single shortcut in Insert Mode. In other words, what I want: ...
1
vote
0answers
86 views

Typing colon character in Insert mode undoing changes?

I am really curious as to why this is happening. I have this line in my .vimrc file (I am using WSL2 on windows and this line helps support copying from vim to the system clipboard): set clipboard=...
1
vote
1answer
33 views

line-completion based on non-initial substring

Is there a way to perform a completion similar to <c-x><c-l>, but completes lines based on an arbitrary substring rather than a leading prefix of the line? I'm especially interested in a ...
0
votes
0answers
21 views

Why does disabling arrow keys in Insert mode (e.g. `inoremap <left> <nop>`) result in e.g. `0D` being written? [duplicate]

I want to disable the arrow keys in Insert mode, since I want to force myself to always go into Normal mode for performing movements. To achive this, I've made the following mappings for Insert mode, ...
4
votes
2answers
66 views

How can I use `ci'` to change the N'th occurrence of single-quoted text in a line?

I find the ci' (and similar commands) very useful, since I can execute it at the start of the line, and it will automatically change the first occurrence of text between single quotes ('...'). However,...
1
vote
0answers
22 views

How can I make `<Shift>+<LeftArrow>` and `<Shift>+<RightArrow>` key bindings work using MacVim?

How can I make <Shift>+<LeftArrow> and <Shift>+<RightArrow> key bindings work using MacVim? I often use these (default) key bindings in Insert mode to move the cursor one word ...
0
votes
5answers
419 views

I keep forgetting which mode I'm in

My main problem is that I don't realize which mode I am in each time I use vim. Sometimes I forget to <ESC> into normal mode, hence pressing vim commands in insert mode. I have to waste time ...
2
votes
3answers
231 views

How do vim users type/edit while switching between modes?

I'm not talking about learning or introducing commands, but how to work by switching between modes, and using normal known commands. Do most vim users stay more in normal mode instead of in insert ...
1
vote
0answers
21 views

How to prevent `autocmd` for stripping trailing whitespace for moving the cursor? [duplicate]

I've the following autocmd for stripping trailing whitespace in a buffer, every time the buffer is written to a file: " trim whitespace autocmd BufWritePre * %s/\s\+$//e However, the autocmd has ...
-1
votes
1answer
243 views

Paste clipboard data in Insert mode

I have learnt to paste clipboard data (something i copied from web browser using ctrl+c) to my current buffer in insert mode. It is much easier than doing that in Normal mode. To paste clipboard data ...
0
votes
1answer
296 views

Navigation in insert mode with soft wrap and showbreak

I’m having trouble with hjkl movement in insert mode. The issue is that I have changed hjkl movement to move by display line. I have 'wrap' on. The cursor should normally move line by line, not move ...
2
votes
1answer
173 views

Conflict between system compose key and insert mode meta key mappings

I use the right alt key as a compose key on my system, to easily draw diacritics and accent characters. In Vim, I unlock alt key mappings with this (from stackoverflow): " Allow <alt> key ...
7
votes
3answers
4k views

How can I add text to the end of words on each line?

I have a series of single-word codes on separate lines in a text file. I'd like to add a backquote ( ` ) to the beginning and end of each word. I know I can add a backquote to the beginning of each ...
0
votes
2answers
31 views

How to delete strings to close quote and close parenthese

I have a code like this: h5 style=("text-align: center; margin-top: 2rem;") some text p style=("text-align: center; margin-top: 2rem;") some text And in first line, I want to ...
1
vote
1answer
52 views

Typing d in insert mode briefly moves cursor backwards

In Vim, when I'm in Insert mode and hit d, the cursor moves back one spot for a second, then jumps back to behind the letter just typed. This is quite distracting when typing texts. It looks like Vim ...
2
votes
0answers
86 views

how to have two different colour schemes for command mode and edit mode in vim?

I have been using vim for some time now but I am always unsure of which mode I am currently in and hence end up pressing Esc too often even in the command mode. This causes an irritating computer ...
1
vote
1answer
41 views

How to put cursor in the right position after switching from normal mode to insert mode in terminal

After launching a terminal inside vim via :terminal, vim doesn't put curosr in the right position after pressing i in normal mode. As seen in the following picture, the cursor is put at the end of the ...
0
votes
1answer
81 views

prevent printing control-character in insert mode and command line

When in insert mode, if no mapping is associated to a sequence, Vim will print the character corresponding to the signal. For example, typing <c-b> will input ^b as a character. It is more ...
3
votes
3answers
1k views

How can I delete forward in "Insert" mode?

I often use the Ctrl-w command in "Insert" mode to delete the word behind the cursor, just like I would do in Bash. In Bash, I also have a Meta-d (Esc-d) command for deleting the word in front of the ...
1
vote
1answer
301 views

blockwise visual mode multi line prepend doesn't work for me [duplicate]

I'm using nVim v0.4.3 and I'm having trouble getting multiline inserts to work in visual blockwise mode. You can check this asciinema to see what I'm doing. https://asciinema.org/a/...

1
2 3 4 5