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
1 answer
15 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? ...
user avatar
  • 35
1 vote
1 answer
27 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 ...
user avatar
2 votes
1 answer
58 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 ...
user avatar
  • 155
1 vote
1 answer
35 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 ...
user avatar
0 votes
1 answer
76 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>...
user avatar
  • 123
1 vote
1 answer
33 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$...
user avatar
  • 21
2 votes
2 answers
33 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 ...
user avatar
  • 21
1 vote
1 answer
35 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 ...
user avatar
  • 13
0 votes
0 answers
16 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 ...
user avatar
0 votes
2 answers
40 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 ...
user avatar
  • 85
0 votes
1 answer
24 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 ...
user avatar
  • 160
0 votes
0 answers
24 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,...
user avatar
  • 145
0 votes
0 answers
25 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 ...
user avatar
0 votes
1 answer
16 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 ...
user avatar
  • 139
0 votes
1 answer
61 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 ...
user avatar
0 votes
1 answer
42 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.
user avatar
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 ...
user avatar
  • 101
0 votes
0 answers
20 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 ...
user avatar
  • 379
0 votes
0 answers
11 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()...
user avatar
  • 101
0 votes
1 answer
84 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 ...
user avatar
0 votes
1 answer
102 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 ...
user avatar
  • 1,065
0 votes
2 answers
93 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 ...
user avatar
  • 101
1 vote
1 answer
59 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 ...
user avatar
  • 255
1 vote
2 answers
51 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 ...
user avatar
0 votes
1 answer
70 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 ...
user avatar
  • 205
0 votes
1 answer
41 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 ...
user avatar
  • 103
3 votes
1 answer
222 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 ...
user avatar
  • 43
0 votes
1 answer
23 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 ...
user avatar
  • 153
1 vote
1 answer
73 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 ...
user avatar
1 vote
1 answer
115 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 ...
user avatar
0 votes
1 answer
55 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 ...
user avatar
1 vote
2 answers
105 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 ...
user avatar
1 vote
0 answers
150 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, ...
user avatar
0 votes
1 answer
180 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 ...
user avatar
  • 135
0 votes
0 answers
25 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 ...
user avatar
  • 101
1 vote
1 answer
55 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?
user avatar
  • 113
0 votes
2 answers
190 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 ...
user avatar
  • 761
0 votes
0 answers
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 ...
user avatar
0 votes
1 answer
382 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 ...
user avatar
-1 votes
1 answer
523 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 ...
user avatar
1 vote
1 answer
31 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 -- ...
user avatar
  • 335
0 votes
1 answer
115 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 ...
user avatar
  • 69
1 vote
3 answers
332 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 ...
user avatar
  • 1,065
1 vote
2 answers
203 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 ...
user avatar
  • 1,065
1 vote
3 answers
77 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: ...
user avatar
1 vote
0 answers
103 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=...
user avatar
  • 169
1 vote
1 answer
39 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 ...
user avatar
  • 1,643
0 votes
0 answers
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, ...
user avatar
  • 1,065
4 votes
2 answers
71 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,...
user avatar
  • 1,065
1 vote
0 answers
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 ...
user avatar
  • 1,065

1
2 3 4 5 6