Commit Graph

317 Commits

Author SHA1 Message Date
e84eaba7a2 vim:aucmd: Don't overwrite constants when sourcing
When resourcing the vimscript (i.e. writing it) currently three errors
are printed that constant values cannot be overwritten.
2024-04-03 13:32:23 +02:00
f1f9f36d43 vim:aucmd: Reorder *Highlight* functions
Also improve their comments.
2024-03-24 16:56:12 +01:00
0006a778f9 vim:aucmd: Improve highlighting on mode changes
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.
2024-03-24 16:56:12 +01:00
6260c84f3a vim:aucmd: Clear highlights on exiting visual mode
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").
2024-03-24 16:56:11 +01:00
bfccb0f089 vim:aucmd: Support multi-line selection highlight 2024-03-24 16:47:49 +01:00
a4405ee614 vim:keys: Change family of <C-w>gf mappings
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]`")
2024-03-18 14:39:03 +01:00
8096917ad4 vim:keys: Open file in split with <C-w>g[fF]
Open the file under the cursor in a split window similar to the rest of
the `<C-w>` mappings. I'm surprised this mapping does not exist by
default.
2024-03-07 13:09:41 +01:00
b3f1a469db vim:keys: Clear highlights on normal-mode Esc
Clear highlights from visual selection or word highlighting together
with the highlight of the search results.
2024-02-20 01:21:46 +01:00
58243e0510 *: Update and add TODOs 2024-01-05 16:20:42 +01:00
424be02df4 vim:aucmd: Highlight selection in all windows
Highlight the visual selection in all windows containing the current
buffer.
2023-08-22 19:29:00 +02:00
35536bfa7b vim:keys: VMap <leader>\_ to escape underscores 2023-07-16 13:13:44 +02:00
7ce2901078 vim:ftplug:tex: Escape underscores in macro-type 2023-07-16 13:12:18 +02:00
4e79b369c3 vim:keys: Rewrite mapping functions to use dicts
Instead of having a long list of `map` commands, define a dictionary for
the mappings and take shortcuts were possible.
2023-07-16 13:11:14 +02:00
31a267a0e7 vim:wiki: Don't highlight any Unicode rxTableSep
Doesn't matter what character it is.
2023-07-08 02:08:30 +02:00
d27fe12d01 vim:wiki: Don't highlight vert. box drawing char 2023-07-08 02:05:28 +02:00
80e09685e7 vim:keys: Add macro_type for uppercase snakecase 2023-06-27 18:23:02 +02:00
dd3de8d709 vim:plugs: Update vimwiki for Unicode support
My fix was merged to support unicode table separators. This has the
benefit that `|` now can be used in the cell content.
2023-06-25 23:49:10 +02:00
99d5e1ff21 vim:ftplug:tex: Do not open quickfix on warnings 2023-06-25 23:22:20 +02:00
a0825dac6a vim:ftplugin:tex: Remove options set by default
Quite a few things were obsolete because they were deprecated or already
set by default.
2023-06-24 18:20:03 +02:00
ed829f52e4 vim:plugs: Update vimtex v.2.8 -> v2.13
build_dir was deprecated for out_dir and aux_dir.
2023-06-24 18:18:12 +02:00
73529d673d vim:ftplugin:python: Change textwidth to 88 2023-06-23 23:14:56 +02:00
0c4dfbf363 git:ignore: Add /.git
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.
2023-06-23 17:03:29 +02:00
b80f86d085 vim:plugins: Do not hardcode quotes in Rg redef.
They redefinition would fail if fzf.vim would ever change the quotes
used.
2023-06-23 16:23:12 +02:00
cb67a46c0b vim:plugins: Make Rg redefinition more robust 2023-06-23 15:59:24 +02:00
2ef89f4e81 vim:plugins: Redefine :Rg programmatically
Instead of setting a hard coded value, get the current definition of
:Rg, add `-g "!.git"`, and redefine the command.
2023-06-23 15:58:35 +02:00
2411a42e32 ripgrep: Add --hidden by default 2023-06-23 14:19:09 +02:00
e6509c2651 vim: Create dict for special chars in languages
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.
2023-06-08 17:18:00 +02:00
5d4954f10e vim:aucmd: Do not start in insert mode in new file
This is annoying when moving through the jumplist and jumping over a
deleted file (which now is a 'new' file).
2023-05-24 23:53:10 +02:00
b64e5fef4d vim:keys: Add <leader>g* analog to <leader>*
Do the same thing without the word boundaries.
2023-05-22 15:14:13 +02:00
0ca1baec8c vim:ftplugin:c: Exclude - from 'iskeyword'
They don't work well together (e.g. pointer arrow).
2023-05-21 16:07:51 +02:00
29f9e2bb91 vim:ftdetect: Detect *.h as C files 2023-05-21 16:07:20 +02:00
7065f4b043 keys:vim: Fix display of search count on n & N
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
2023-05-21 16:01:37 +02:00
848df05810 vim:keys: Fix <Tab>/<C-I> confused mapping
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.
2023-05-12 12:06:46 +02:00
5f20d6d26f vim:keys: Respect 'foldopen' on remapped movements
Execute 'zv' depending on the existence of the equivalent movement type
in 'foldopen'.
2023-05-12 12:05:20 +02:00
f18cc6f05a vim:keys: Open folds on remapped movement commands
See 'foldopen':

> NOTE: When the command is part of a mapping this option is not used.
> Add the |zv| command to the mapping to get the same effect.
2023-05-12 12:04:43 +02:00
7462b5a7af vim:keys: Remove <C-U> uses behind <Cmd>
<C-U> is not needed when using <Cmd> for visual mappings.

Fix: fc9874bf97 ("vim:keys: Use <Cmd> for plain command mappings")
2023-03-22 13:19:41 +01:00
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