10 votes

On string concatenation, what's the difference between . and .. (single dot and double dot)?

The . and .. have semantically the same meaning of string concatenation. However, the . can also be used to access dictionary items and can as well be used for floating point numbers. So the meaning ...
Christian Brabandt's user avatar
7 votes

On string concatenation, what's the difference between . and .. (single dot and double dot)?

Take note of the examples: :execute "buffer" nextbuf :execute "normal" count .. "w" What it's indirectly saying is, to avoid a space in the resulting string that's ...
Zoe is on strike's user avatar
5 votes
Accepted

Why doesn't d_ delete to the first non-blank character on the line?

_ is a linewise motion operator (:h linewise), its primary purpose is to move your cursor to <count> - 1 lines below your current position. For example: 5_ will move your cursor 4 lines down ...
Zorzi's user avatar
  • 1,111
4 votes
Accepted

Keep cursor from moving when using operators

There's no way to change this behavior for all operators (short of mapping them all.) But you can make your <F4> keep the cursor position (and window view) by saving and restoring it before and ...
filbranden's user avatar
  • 28.6k
4 votes
Accepted

Creating custom text objects via omap - How to run functions after the motion

Interesting question! 👍 Reading your attempts of code made me think of the order in which the operations are actually executed, which is: The omap motion or text object is executed and selected. ...
filbranden's user avatar
  • 28.6k
3 votes

Operator Modifier

That is indeed a novel and potentially time-saving feature! The way to do this in plain Vim would be using :substitute for a range; the pattern can be easily set via * when the cursor is on top of it:...
Ingo Karkat's user avatar
  • 17.8k
3 votes

Making operator insert and append repeatable

You can come up with something relatively simple, following and tinkering what vim has described in :h :map-operator: As an example I came up with in about 15 minutes of experimenting: nmap <...
Maxim Kim's user avatar
  • 13.1k
2 votes
Accepted

Make j and k act character-wise when used with operators

As Matt says, use {operator}vj as per :help forced-motion. You can force line-wise, character-wise, and block-wise (think of it like "casting" the motion).
D. Ben Knoble's user avatar
  • 25.8k
1 vote

How to make dot replay embedded normal command? e.g in insert mode: <c-o>ysiw>Some<esc>

This is using https://github.com/tpope/vim-surround to get that ysiw> behavior. The . dot command works on individual changes. The ywis> edit is the first edit and then typing Option is the ...
Chris Heithoff's user avatar
1 vote

Keep cursor from moving when using operators

I would suggest you this solution pure vim solution: augroup yank_restore_cursor autocmd! autocmd VimEnter,CursorMoved * \ let s:cursor = getpos('.') autocmd TextYankPost * ...
SergioAraujo's user avatar
  • 1,165
1 vote

How to create new operator by using existing operator with current motion?

Visually select motion text, execute existing operator: function! OperatorFunc(type, ...) " change op to desired operator call ExecuteOperator(a:type, a:0 > 0, 'op') " do other stuff ...
dedowsdi's user avatar
  • 6,238

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