Commit Graph

431 Commits

Author SHA1 Message Date
3066eed1c7 vim:keys:TODO: Fix search results center mappings 2023-02-27 14:09:32 +01:00
3fac79115f vim:keys: Fix &spell toggle mapping
I don't if something changed or if this was broken from the get to, but
now it is fixed.
2023-02-27 11:02:47 +01:00
fc9874bf97 vim:keys: Use <Cmd> for plain command mappings
<Cmd> executes the command directly in the current mode without changing
to command-line mode and triggering Cmdline{Enter,Leave}.
2023-02-27 10:59:41 +01:00
a4c6e4ebfd vim:keys: Center hunk after moving with gitgutter 2023-02-23 14:47:59 +01:00
44194bd09c vim:keys: Expand visual selection on <leader>[jk]
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.
2023-02-15 16:44:17 +01:00
b7dcc1f79c vim:keys: Map real <C-BS> to delete one word
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/
2023-02-15 14:30:52 +01:00
a05d99df95 vim:keys: Add <leader>v/ as vmap too
Just escape visual mode and reuse the existing normal-mode mapping.
2023-02-15 14:28:35 +01:00
1d58eb729d vim:keys: Add <leader>* vmap to ripgrep selection
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.
2023-02-15 14:26:05 +01:00
1933218756 vim:keys: Center search results after N too
Forgot that one.
2023-02-15 11:37:07 +01:00
8e71a3f12e vim:keys:vmap *: Center search results
Center search results by further evaluating mappings in {rhs}.
2023-02-15 11:37:00 +01:00
9f3b9ac79a vim:keys: Save unnamed reg when getting selection
Fix that the mappings modified the unnamed register.
2023-02-15 11:35:50 +01:00
647a022782 vim:keys: Group together * mappings in the code 2023-02-15 10:52:06 +01:00
e2a133a29b vim:ftplugin:markdown: Fold by sections 2023-02-13 16:50:50 +01:00
295f33e62c vim:ftplugin: Set options locally
I only want to set the wrap settings for the current buffer/window.
2023-02-13 16:43:30 +01:00
f8519555f7 vim:setts: Deactivate 'relativenumber'
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`.
2023-02-13 15:32:53 +01:00
db6a7e2984 vim:setts: Reactivate 'cursorline' 2023-02-13 15:15:34 +01:00
be763b9ff2 vim:keys: Center search on <CR> too
In addition to center the cursor-line on `n` do it right after accepting
the search as well.
2023-02-13 15:14:30 +01:00
11fc486768 vim:keys: Fix search result centering mapping
The cursor should be vertically centered **after** we moved to the next
search result.
2023-02-13 14:55:41 +01:00
fc04a6a682 vim:keys: Add leader mappings to switch the case
I find myself quite often to type `gUl` but find that it has quite some
brain overhead. We will see, if these mappings aid in this regard.
2023-02-09 14:32:15 +01:00
1b365be8e7 vim:aucmd: Underline old cursor position
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.
2023-02-09 12:02:03 +01:00
6930d9b2d9 vim:keys: Fix <leader>grc when on end of hash
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.
2023-01-23 19:52:07 +01:00
93e8517ab2 vim:keys: Center next search result on n 2023-01-21 02:01:57 +01:00
feab64f566 vim:highNonASCII: Use shorter syntax to compare 2023-01-19 22:14:50 +01:00
2d497c6363 vim:highNonASCII: Support extension of ignore_char 2023-01-19 22:11:36 +01:00
993bd5a16e vim:ftdetect:envrc: Require .envrc only as suffix
Otherwise opening a template (i.e.
`.local/share/direnv/templates/*.envrc`) will not set the filetype
properly.
2023-01-11 22:04:32 +01:00
9de97a7f93 vim:ftdetect: Set ft=sh when opening .envrc files 2023-01-11 22:03:19 +01:00
890464b8dd vim:ftplug:tex: Close quickfix window on movement
When continuous compiling on write, the quickfix window can be tedious
when it pops up every time containing errors that will be resolved in
the future or ignored.

Fix this by closing it as soon as the cursor is moved.
2023-01-11 21:42:43 +01:00
fdafdb6154 vim:ftplug:tex: Use tex_build as build directory 2023-01-11 21:42:42 +01:00
e51427143f vim:keys: Format paragraph with <C-q> in INSERT
`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.
2023-01-11 21:42:39 +01:00
fed62f3b6d vim:keys: Keep the cursor position when formatting
Quickly formatting multiple paragraphs is now not as simple as before,
but the benefits still prevail.
2023-01-08 14:04:13 +01:00
5dc975c155 vim:highNonASCII:french: Add forgotten ÿ 2023-01-05 09:00:27 +01:00
678910f4ec vim:highNonASCII:french: Move œ (oe) behind o 2023-01-05 09:00:06 +01:00
8fda4ce158 vim:setts: Set conceallevel=1
I want concealable text to be replaced if possible but not hidden
completely (i.e. `=2`) as this makes moving over lines nauseous.
2023-01-04 22:44:41 +01:00
06c0d17fe4 vim:keys: Add <leader>v/ to search in visual selec 2022-12-29 19:55:02 +01:00
616988560a vim:keys: Add mapping for commit amending
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`).
2022-12-28 13:55:08 +01:00
dacd6d5de0 vim:keys:<leader>": Convert only pairs of quotes
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).
2022-12-28 13:53:33 +01:00
9ac408ccae vim:aucmd:highVisualSel: Yank lines silently
When yanking multiple lines, a message stating that will appear. Make
this message silent.
2022-12-28 13:44:19 +01:00
aae84fd197 vim:aesth:highNonASCII: Add uppercase Umlaute
Forgot to add the uppercase Umlaute as well.
2022-12-28 13:42:48 +01:00
b559ff646b vim:aesth:highNonASCII: Support multi-spelllang
`&spelllang` can be a list of multiple languages. Support that by
matching the language at the start, the end and/or between commas,
instead of comparing the value, and then appending to `l:ignore_chars`
for every matched language.
2022-12-28 13:40:50 +01:00
c2a657c609 vim:aesth:highNonASCII: Support spelllang=french 2022-12-28 13:39:46 +01:00
1360969ca4 vim:aesth: Refactor HighlightNonASCIIChars()
Make it easier to support other languages.
2022-12-28 13:32:02 +01:00
fe669c0aa7 vim:keys: Add visual equivalent of substitute maps 2022-12-28 13:23:05 +01:00
731a290d7b vim:keys: Map <leader>" to s/"/'/g
I prefer single quotes when a language supports them for normal strings
(e.g. python & vimlang). Add this mapping for a quick conversion.
2022-12-28 12:57:13 +01:00
fd1cb36437 vim:keys: Rephrase wrap-move comment s/real/normal 2022-12-28 12:32:55 +01:00
46ec34826e vim:keys: Map display movements only when wrapping 2022-12-27 04:24:21 +01:00
3a7f06256f vim:keys: Keep selection when changing indentation 2022-12-25 22:42:22 +01:00
4c111c0e3b vim:keys: Make display-line movements the default
I'd rather have the movement mappings behave on display-lines to make it
easier when navigating in very long lines.
2022-12-22 10:55:16 +01:00
a14bc72716 vim:autocmd: Highlight visual selection
Highlight visual selection similar to the cword highlight. Restrict the
cword highlight to only normal mode.
2022-12-22 01:19:01 +01:00
66a231e8a8 vim:autocmd: Remove forgotten debug print 2022-12-22 01:16:38 +01:00
47150894c2 vim:ftplugin:markdown,tex: Turn on line-wrap 2022-12-12 11:24:19 +01:00