New answers tagged

2

I assume "doesn't hold the cursor" applies to the corner case when the cursor is at the end of the line and virtualedit is empty (then <esc> will move cursor one position backward, to the last existing character). That's often an issue for insert-mode mappings. There's :h i_ctrl-\_ctrl-o which executes one normal mode command without touching the ...


1

Plugin vim-ninja-feet by tommcdo Currently, this plugin provides following square bracket mappings (do not overlook the square in the definition): {operator}[{text object} Perform {operator} from the cursor to the beginning of the text object defined by {text object}. {operator}]{text object} ...


3

For the general case, you can try creating new operators, gs and ge: function! GoStart(type) abort normal! `[ endfunction function! GoEnd(type) abort normal! `] endfunction nnoremap <silent> gs :set opfunc=GoStart<CR>g@ nnoremap <silent> ge :set opfunc=GoEnd<CR>g@ When Vim invokes the operator functions after you type your ...


4

This doesn't answer your more general question about text objects, but you can achieve the behaviour in your specific indentation-based example with folds: setlocal foldmethod=indent setlocal shiftwidth=2 setlocal foldlevel=99 Setting 'foldmethod' tells Vim that you want to use indentation based folding. Setting 'shiftwidth' tells Vim the size of each ...


0

Let's consider our cursor at the first line, column zero f' ....................... jumps to the first single quote Use visual block selection to cut the three first lines Ctrl-v ................... starts visual block selection 2j ....................... expands to the next two lines $ ........................ makes selection expand to the end of the ...


1

There isn't really a native command to repeat a change without including the inserted text as part of the repeat. You mentioned using a macro, but recording it (using the q command) can be tricky, since you want to end it inside insert mode. It turns out you can actually do that using qacit<C-O>q to record only cit in @a, which you can use to ...


Top 50 recent answers are included