When entering visual mode it does not really make sense to keep the
cword highlighting but it should restart automatically (i.e. without
CursorMoved) when leaving back out of visual mode.
About directly starting selection highlighting I am still unsure since I
rarely ever want to highlight only one character and it could decrease
performance.
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]`")
Ignore the .git directory globally instead of ignoring it manually in
tools like fd and ripgrep.
I feel very dumb for putting all this time into the redefinition of :Rg,
especially since I am currently **much** procrastinating writing my
bachelor thesis.
This way it is more easily extendable.
This also gives the possibility to modify it in ftplugins. I thought
about removing 'de' from the dictionary in the tex.vim ftplugin to
encourage using `\"a` and alike.
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.
I rarely use them and are more an annoyance.
For the case that I want to enable them in a session, move the
numbertoggle augroup into a function and add an autocommand on
`OptionSet relativenumber`.
Underline old cursor position for better readability. Reusing
`TermCursor` made me confuse the current window many times.
My favorite solution would be an empty box around the position similar
to how terminals do it when focus is lost. But I fear that this is not
possible with a simple highlighting group.