10

You can also use :%s/\w\+/`&` to convert from Lorem ipsum dolor sit amet to `Lorem` `ipsum` `dolor` `sit` `amet` :% range to the next command (whole buffer) s is a substitute command :s/regexWhat/substituteValue without range will substitute on a current line. \w\+ is a regexp for a word & is a whole value of what has been matched with regexpWhat, ...


6

Manually toggling :set paste/:set nopaste as suggested by francois P is cumbersome, and resetting the TERM variable as evaristegd suggests is a very bad idea as explained in the comments (which hint at the better solution below). The best solutions that I could find are explained here, and I'll briefly repeat them below. Background The central concept for ...


5

As of Vim patch 8.2.0590 you can use :set backspace+=nostop to make backspace and CtrlW not stop at the insertion point.


4

You can use the :normal command, which allows you to run a sequence of Normal mode commands. When given a range, it repeats the sequence for every line. (It also starts at the beginning of each line, when given a range.) So you could use the e motion (end of the word, for a definition of word that includes keyword characters) or E (going up to the first ...


4

I happen to be teaching myself kdenlive (video editor) this weekend. In need of a subject for my first project, I created a video demonstrating some of what you mention. In particular, the tasks I perform in the video are... Paste several Ipsum Lorem sentences from the clipboard into vim Find the ending period ('.') of the first sentence and append two ...


3

If you use the GUI, you don't need anything special, but you need at least the patch 8.2.0851. Remove all of your code, except the mappings: inoremap <M-h> <left> inoremap <M-j> <down> inoremap <M-k> <up> inoremap <M-l> <right> If you use Vim in a terminal which supports the modifyOtherKeys feature (typically ...


3

Try to make NORMAL your main mode. So after you did change/insert text goto normal mode right away. Then start all your typings and commands knowing you are in NORMAL mode. And by default vim shows other than NORMAL modes in the bottom left corner:


3

Plug-in wellle/targets.vim implements this feature, through an in' text-object (n for "next".) You can use it with a count, so you can use c3in' or 3cin' to change inside the third next single quoted string from the cursor. See the README section for the next and last pair (and also the linked cheat sheet.) This kind of mapping is made possible ...


3

You can use the f or t motions for this. With your cursor at the start of the text you want to delete: h5 style=("text-align: center; margin-top: 2rem;") some text ^ Type either of these: df; dt" The first deletes up to and including the ; character, the second deletes up to but not including the ". See :...


3

As a naive attempt, try this: inoremap a;o año inoremap e;e eñe const s:LHS = ['a;o', 'e;e'] let s:MAPSAVE = [] for s:key in s:LHS let s:MAPSAVE += [maparg(s:key, 'i', v:false, v:true)] endfor lockvar! s:MAPSAVE unlet! s:key let s:mappingsEnabled = v:true inoremap <expr> <c-s> <sid>ToggleMappings() fu s:ToggleMappings() let i = 0 ...


3

I have an alternative recommendation, and a flexible script you can adapt. Use Digraphs Vim has wonderful support for a large swath of characters that are hard to enter on many ISO/American Keyboards (among others). Without even looking, I could tell that the digraph for ñ is n~ (and the same goes for most accented characters). Ironically, this isn't ...


3

This looks like a textbook example of the sort of situation for which the 'keymap' option exists. To use this option, first create a file ~/.vim/keymap/spanish.vim with the contents: " Uncomment the following line to set a "short" name for the keymap. " This will be shown in the statusline instead of the full keymap name. "let b:...


3

How about hdiw? I.e. move into the space and then delete the "word" formed by the whitespace. That will give you: horse catdog To keep 1 space between cat and dog, the best I can think of is ge2ldw, i.e. go to the end of the previous word, move to the second space in the gap, and delete to the start of the next word.


3

As sussed out in the comments, you have mappings that begin with <esc> somewhere (and the surprise indicates you didn’t ask for them). You can use :verbose imap <esc> to find out where the mappings are coming from; in general, mappings with a prefix cause a delay whenever the prefix is entered, as vim has to distinguish between the prefix ...


2

Adding my comment as an answer on Rich's advice; while mappings don't apply in this case specifically, it's still a possible cause of the problem Remapping <esc> can also trigger the problem. In my case, I had a map like this: inoremap <expr> <esc> pumvisible() ? "<C-o>:pclose<CR>" : "\<esc>" Largely ...


2

I would approach it with a macro + visual selection. start recording a macro do the changes stop the macro recording Visual select all lines that needs this change apply the macro That would look the following: qq$Cfoo<ESC>q record the macro (qq) with the change ($Cfoo) end the macro (q) Visual select with V followed by the move keys to select the ...


2

If you don’t want to type non-breaking spaces, you can just map them to normal spaces. Doing so globally can be done by this command (add it to your .vimrc or init.vim file): execute "inoremap \u00A0 <Space>" If you want to map only in the current buffer, use <buffer>, like so: execute "inoremap <buffer> \u00A0 <Space>&...


2

Filbranden’s answer is what I would go with in my editing; I would type the first command (append), then use q: to edit it into the second (if I didn’t have surround.vim; see bottom). But there are other options: for example, a macro qqI`<Esc>ea`<Esc>jq When repeated with @q (or @@, once replayed once), it will do the backticks for the first ...


2

There's indeed more straight-forward ways to do this. As you can see in the help for :h d *d* ["x]d{motion} Delete text that {motion} moves over [into register x]. See below for exceptions. The delete command, as many, accepts a motion. This means you can tell Vim what object you want to delete (diw for &...


2

Do most vim users stay more in normal mode instead of in insert mode? I find it impossible to use vim more in normal mode. Apart from Replace mode, how can anybody type without being in Insert mode? I don't know about "most vim users," but I edited your entire post mostly in normal mode. I'm typing this answer in vim, in insert mode to add the ...


2

I try to address this specific "how": "breaking the paragraph into point lines" Navigate to whitespace where you want the break to occur and replace it with Enter: r<Enter> You will stay in normal mode.


2

The Insert mode is discussed in detail under :h Insert topic in Vim's help. In particular, to insert the contents of the "plus" register, while being in Insert mode, you have to press Ctrl-R+


2

The problem is that you have a trailing space in your inoremap line in your vimrc. That trailing space becomes part of the mapping replacement, so every time you type <C-h>, not only will Vim execute the <C-o>gk part, which will move up one line, it will also produce a <Space> in Insert mode. I can actually even see it in your paste in your ...


2

All you need to do is insert <C-\> before the <C-o>. inoremap <C-_> <C-\><C-o>dB Help for i_CTRL-\_CTRL-O says: CTRL-\ CTRL-O : like CTRL-O but don't move the cursor That's it. Well except for a caveat or two which I'll reproduce here for your convenience ;) ... The CTRL-O command sometimes has a side effect: If the cursor ...


2

An idea: nnoremap <expr> f FindInsert('f', 'i') function FindInsert(find, insert) abort const l:char = getchar()->nr2char() return printf('%s%s%s', a:find, l:char, a:insert) endfunction It would then be easy to add F/t/T, or to use a instead of i, or what have you. But be aware that when you press ; or ,, you won't get this behavior. Also, I ...


2

It depends if you can edit where your cursor is or if you need to move your cursor. For example, you have the following: Your cursor here V [...] hell [...] and want to change hell into shell, you'd use i, to be in the good place directly (rather than using append, and move the cursor with the arrow key while in insert mode). However, if you have the ...


2

One option is instead of trying to bind a key combination to this action, just use the default key binding for it, which is Ctrl+W. See :help i_CTRL-W. This same key binding should be available by default in zsh (or bash, etc.) so you could just use it everywhere with no need for custom configuration. You could try to map Option+⌫ to do the same in Vim... ...


2

There isn't, but it is possible to create a mapping to do this. For example, if you want <leader>e to do the equivalent of e then i: nnoremap <leader>e ei Edit: as statox notes in the comments to the original question, whilst this is possible it may be symptomatic of non-idiomatic vim usage.


2

Since you're looking at pairing open/close tags across multiple lines (enclosing a block) and in your case it makes sense to insert the closing tag when breaking the line, my suggestion is to add a mapping to the Enter key in Insert mode and then use an <expr> to decide whether we need to add the closing tag. You can make that decision based on the ...


1

I'm afraid it is not possible (but we can make a nice mapping, skip to the end for that). See :h object-select for reference. Unlike other commands, such as i(, iW, etc., i' does not have an optional [count]. a" a' "a quoted string". Selects the text from the previous quote until the next quote. i" i' Like a", a' and ...


Only top voted, non community-wiki answers of a minimum length are eligible