The cursor is always moved to the beginning of the selection when
yanking in visual mode. This mapping resets the position back to where
it was.
Link: https://stackoverflow.com/a/3806664/20927629
If :h 'spelllang' is something else, do nothing.
A possible future improvement could be to keep a list of the languages
to cycle between and first adding any other languages to this list so
that one could return to the original setting. I see this especially
useful when the current setting is `en,de`.
Make ][ and ]] work like they used to with the new functionality through
a workaround.
The problem is that recursive mappings are evaluated at runtime not
"compiletime" - which is what I would need in this situation.
I still want both mappings blocks so that they are not entangled and I
can turn each one off without affecting the other.
I use the [[ & etc. mappings to jump between function definitions in C.
This works as long as the braces are put on a newline (like in the
kernel coding style guide).
Relax the mappings for opening braces to jump to unindented lines with
an opening brace to cover also different style guides.
When exiting visual mode I want to clear the highlights of the visual
selection. As this is done automatically now, <Esc> does not need to do
it (and i had problems with keys.vim executing ClearHighlights because
of the script variables).
This reverts commit b3f1a469db ("vim:keys: Clear highlights on
normal-mode Esc").
The mapping to split and open the file under cursor exists by default
(not as I thought), but is not <C-w>gf but rather <C-w>f.
Swap the mappings for tab and split 'destination'.
Fixes: 8096917ad ("vim:keys: Open file in split with `<C-w>g[fF]`")
When 'lazyredraw' is set the search count is not displayed. This seems
like a bug as it is being displayed if `n` and `N` are not remapped.
Fix this by shortly turning off lazyredraw and resetting it after.
This leads to the new problem that hlsearch is not triggered. It does
stay though after searching with `/<CR>`, so this is a smaller issue I
can fix later.
Found thanks to: https://github.com/kevinhwang91/nvim-hlslens/issues/34
In a terminal with libtermkey support (e.g. my st build), <Tab> and
<C-I> can be differentiated.
Because of that the keys have to be mapped explicitly.
Add two vmaps that call ExpandVisualSelection() for the appropriate
direction.
That expands the selection over all directly following lines in the
given direction that contain the current selection at the same position.
Example:
```
- TODO: ...
- TODO: ...
- TODO: ...
```
In visual block one can select `TODO: ` on the first line and then call
`ExpandVisualSelection(1)` which results in a block selection that spans
over all other TODOs as well.
Map <C-BS> (i.e. Ctrl-Backspace) to delete one word in insert mode & co.
as it is properly recognized in some terminals implementing [fixterm][1]
(e.g. kitty and patched st).
Keep the <C-H> mapping for other terminals but reuse the <C-BS> mapping.
[1]: http://www.leonerd.org.uk/hacks/fixterms/
Similar to <leader>* in normal mode, set the search pattern to the
visual selection and start a ripgrep search.
To not mess up the commandline, potential quotes that are the same as
the ones used around the string need to be escaped. As this is only
possible with double quotes, a second layer of backslash escaping is
needed as well.
Because of that, **before** escaping backslashes and double quotes, all
backslashes need to be escaped a second time. The other way around would
result in two backslashes in front of each double quote, which would
miss the whole point entirely.
In addition GetVisualSelection needed to be expanded to first reselect
the visual selection for it to work in the new mapping.
When the cursor is on the last character of the hash (e.g. after
pasting), the mapping would break and insert the commit subject behind
the next word.
Fix this by using `viw<Esc>` which places the cursor on the end of the
current word independent of the placement of the cursor.
`i_CTRL-Q` is not really useful anyways:
> Same as CTRL-V.
> Note: Some terminal connections may eat CTRL-Q, it doesn't work then.
> It does work in the GUI.
Map `<leader>gca` to fugitives `G commit --amend`, as I use that quite
often.
Also change the normal commit mapping to use double `c`s for unambiguity
between the mappings and as I already got the habit of pressing `c`
twice to skip waiting `timeoutlen` (As the mapping was already
ambiguous with `<leader>gcd` for `:Gcd`).
When converting double to single quotes with `<leader>"`, only pairs of
quotes should be converted. This lowers the false positive rate by
trying to make sure that the double quotes are really used for string
quotation and not for something else (e.g. exactly these mappings).