Commit Graph

438 Commits

Author SHA1 Message Date
b1a21fbdb0 vim:ftplug:man: Try to keep the position in file
How did I only test this while being at the top of the page?
2025-01-25 13:37:11 +01:00
f863f66542 vim:ftplug:man: Add comment to nospell setting 2025-01-25 03:04:35 +01:00
2842bba50c vim:ftplug:man: Move scrolling settings from zprofile 2025-01-25 03:02:07 +01:00
78917a686e vim:ftplug:man: Enable resizing with hard-wrapping
From :h :Man:

> when running `man` from the shell and with that `MANPAGER` [='nvim
> +Man!'] in your environment, `man` will pre-format the manpage using
> `groff`. Thus, Nvim will inevitably display the manual page as it was
> passed to it from stdin. One of the caveats of this is that the width
> will _always_ be hard-wrapped

Since I actually don't like `g:man_hardwrap=0`/`MANPAGER=999` (e.g.
scrolling can be a mess with very long wrapped lines), add an
autocommand that is meant to reload the manpage through `:edit` after
every resize, so that its hard-wrapping adjusts to the new size.

This is slightly hacky, but does its job quite well.

Move the man.vim into after/ftplugin so that it overwrites the `set
wrap` of the global ftplugin, which I want turned off, since it messes
with the buffer shortly when resizing.
2025-01-25 02:57:38 +01:00
467df52c66 vim:ftplug:man: Fix wrapping due to signcolumn
man(1) will assume it can use the full width of the terminal when
hard-wrapping the lines. When signcolumn is enabled the width is one
cell smaller and thus, lines that have a character in the last column
will be wrapped by vim (i.e. almost all of them).
2025-01-25 01:08:51 +01:00
fde6aa06a4 vim:quick-scope: Only highlight on f,F,t,T 2025-01-21 18:32:17 +01:00
59f12488b1 vim: Make trailing space highlighting more subtle
I sometimes work in files where I cannot remove trailing whitespaces (at
least not permanently). In these cases the background highlighting of
them is quite strong and can be a bit annoying. To make this more
pleasing, use the foreground to highlight trailing characters, as long
as tabs and trailing spaces are displayed as non-space characters.

For this I also set `trail` in `&listchars`, and while at it, merged the
two lines setting `&listchars` and cleaned up some comments.
2024-12-04 09:02:09 +01:00
cbacf728e6 vim:keys: Add e flag to [[ and ]] mappings
Let the search place the cursor on the curly brace instead of the start
of the line.
2024-11-20 12:55:19 +01:00
611e83b1c8 vim:keys: Streamline [[ and ]] mappings
Use the `s` flag, so that the position before the last jump is updated
automatically.

Use `<Cmd>` so that both normal and visual mode mappings become
identical and can be merged. This has the added benefit that it now also
maps in operator-pending mode.

Complete the TODOs.
2024-11-20 12:55:18 +01:00
f5ec488b08 vim:keys: Better >> & << for tab-indent-space-align 2024-11-16 02:27:22 +01:00
d831a4140e vim:setts: Set cindent & preserveindent
For slightly better indentation.
2024-11-16 02:22:40 +01:00
5af20402b9 vim:looks: Formatting 2024-11-06 13:53:25 +01:00
066f30a39f vim:au: Pass Funcref to timer_start
Apparently on older neovim versions, passing the name of script-local
functions to `timer_start` is not enough (in v0.10.2 this works, but
v0.7.2 not). Fix this by wrapping it in `function(...)` to pass a
Funcref.

See :h timer_start:

> timer_start({time}, {callback} [, {options}])
> [...]
> {callback} is the function to call.  It can be the name of a function
> or a |Funcref|.  [...]
2024-11-06 13:44:03 +01:00
2437044ed6 vim:looks: Add function to easily see syntax stack 2024-11-06 02:44:28 +01:00
c5463595c0 vim: Rename aesthetics.vim to looks.vim 2024-11-06 02:44:03 +01:00
f404c150b1 vim:setts: Decrease 'scrolloff' (15 -> 5)
It's annoying sometimes.
2024-11-06 02:39:46 +01:00
a3fa9a043f vim:coc: Fix copy-paste error 2024-11-06 02:38:42 +01:00
965786d19a vim:ftplug:wiki: Fix completion with Tab 2024-11-06 02:37:06 +01:00
e95bc71b0b vim:au: Improve clearing of old selection highlight
Because of the deferring of the highlight, the old selection highlight
was deleted only when a new one was created. Introduce a second timer
that makes sure that the old highlight is cleared earlier.
2024-11-04 17:43:41 +01:00
2322f4ad67 vim:au: Work around additional call of _highlight_cword
Sometimes `_highlight_cword` is called without the existence of
w:cword_timer_id but with a w:cword_match_id. No idea why.

I thought that it might be a race condition, but does not seem like it.
(Also not sure if this could even run in parallel)

TODO: Investigate how _highlight_cword can be called without
      w:cword_timer_id
2024-11-04 17:25:27 +01:00
312ea225da vim:au: Fix flickering of selection highlights
Defer the clearing of the old highlight as well. This means that the old
highlight will remain a bit longer but prevents the highlight from
flickering because of the continuous `matchdelete`.
2024-11-04 17:17:20 +01:00
551fde8f2b vim:au: Fix empty line selection in linewise-visual
`highlight_selection()` is supposed to abort if the visual mode was
started on an empty line. This was done correctly for charwise-visual
but failed to do so in linewise-visual.
2024-11-04 16:54:51 +01:00
fc1e1bdd1e vim:ftplug:fugitiveblame: Disable cword highlighting 2024-11-04 13:22:33 +01:00
5fa05e94a3 vim:ftdetect: Detect Bochs config files 2024-11-04 08:17:35 +01:00
d88ae4d808 vim:ftdetect: Detect *.nasm as asm files 2024-11-03 16:58:35 +01:00
4f25801402 vim:au: Rename functions from CamelCase to snake_case
Make them also script-local as I don't need them outside.
2024-11-01 00:57:58 +01:00
92cc304bbb vim:au: Improve performance of cword/selection highlight
- Combine one `exists` call with an implicit `get` into a `get` with an
  empty default
- Do not stop any timer in the `Highlight*` functions as this done
  already by `ClearHighlights`
- Get rid of the check for existence of `w:*_timer_id` since I believe
  that there is no way of it being unset in the current state. The
  `_Highlight*` functions are only called via the timer so there should
  always be the variable. I could also not reproduce the description in
  the comment - this might have been true in a previous revision.
- Make sure that the visual selection itself is not matched. This
  actually increased the performance a lot while also looking like
  normally (there were some subtle differences between the highlight by
  visual mode and `CursorColumn`)
2024-11-01 00:47:19 +01:00
859337e9c0 vim:au: Defer selection highlighting by 100ms too
This makes moving the cursor in visual mode more responsive.
2024-10-31 23:20:44 +01:00
3cdb9d6902 vim:au: Stop timer too when clearing cword highlight
When deleting the cword match, any running timer should stop too so that
the highlighting does not restart. This had led to some weird flickering
bug.
2024-10-31 23:18:32 +01:00
d87d2cfee5 vim:NrrwRgn: Don't let splits take full width
The default setting of `g:loaded_nrrw_rgn` is `topleft` which opens the
split at the very top/far left and makes the window have full
width/height. This is very annoying when narrowing multiple splits.
2024-10-30 15:53:28 +01:00
2a4812a740 vim:ftplug:qf: Disable spell checking 2024-10-30 13:12:53 +01:00
c608700199 vim:aucmd: Highlight selection on linewise v-mode
I assumed that the selection will always be one character long when the
ModeChanged event is triggered. This is not the case when entering
linewise visual mode.

Fixes: b0688da69e ("vim:aucmd: Do not highlight selection on
       ModeChanged")
TODO: There are more ways of triggering ModeChanged to visual mode with
      a selection of more than one character (e.g. `[count]v`).
2024-10-28 21:16:29 +01:00
c011f2ed6a vim:setts: Don't auto-open folds when searching
This makes it a lot easier to restrict the search (besides searching in
visual selection, which is quite limited). The cursor will still land on
the closed fold but only once, independent of the number of hits inside
of the fold.
2024-10-28 16:59:03 +01:00
4d93db3947 vim: Keep only one timer for checktime
Every time the file was sourced, a new timer was created.
2024-10-27 19:11:12 +01:00
12e14673bd vim:aucmd:TODO: CursorMoved != SelectionChanged
There are operations that change the visual selection without moving the
cursor (e.g. `viw` when on the last character). These do not trigger
CursorMoved so the highlighting also does not change.

TODO: <COMMIT>
2024-10-27 19:11:12 +01:00
714a6cd120 vim:aucmd: Specify what highlight to clear
There shouldn't be highlights of the other kind (cword <-> visual)
around.
2024-10-27 19:11:12 +01:00
b0688da69e vim:aucmd: Do not highlight selection on ModeChanged
Do not call HighlightVisualSel when the mode changes to visual mode, as
then the selection is still only one character long, which I rarely want
to highlight. If I do I can still move the cursor forth and back once.

TODO: Are there situation where ModeChanged is triggered and the
      selection is immediately longer than one char without triggering
      CursorMoved?
2024-10-27 19:11:12 +01:00
2a1346e74e vim:aucmd: Abort cword highlighting earlier
When we're still on the same word, the highlighting can be just kept as
is without starting a new timer.
2024-10-27 19:11:07 +01:00
626855ec69 vim:keys:TODO: Add <leader>[hl] v-mappings
TODO: <SUBJECT>
2024-10-21 17:19:52 +02:00
f4d3a4364b vim:xdg: Fix updating spellfile through modeline
Setting `&spellfile` from the modeline is not allowed and will result in
an `E523: not allowed here` error. Fix the updating of the file by
additionally having an autocommand on BufWinEnter (i.e. after the
modeline was read).

TODO: Also get rid of the error message when rereading the modeline (:e)
2024-10-19 17:57:47 +02:00
f9764de6d5 vim:keys:TODO: Handle errors when referencing commits 2024-10-18 16:13:36 +02:00
09f9ffbd8e vim:ftplug:gitcommit: Abbreviate buffer-locally
Abbreviate `cq` only in the current buffer (i.e. the commit message).
2024-10-18 16:13:36 +02:00
890c8526ee vim:ftplug:gitcommit: Abbreviate cq to %d | x 2024-10-18 16:13:36 +02:00
b61894fcc9 vim:ftplug:gitcommit:TODO: Adjust subject length limit 2024-10-16 14:57:38 +02:00
72770f6703 vim:setts: Don't wrap termdebug settings in aucmd 2024-10-16 14:53:39 +02:00
908cc494a2 vim:keys: Fix typo in comment 2024-10-16 14:53:39 +02:00
c7c130f050 vim:aucmd: Don't highlight trailing spaces in terminal 2024-10-16 14:53:39 +02:00
dd5663b564 vim:aucmd: Fix missing w:cword_timer_id error msg 2024-10-16 10:44:19 +02:00
8a101134c7 vim:ftplug:fzf: Complete list of TUI Unicode chars
This excludes more characters than needed.

Fixes: 86af2da785 ("vim:ftplug:fzf:TODO: Look up other Unicode chars")
2024-10-14 11:56:28 +02:00
c27128fc5a vim:aucmd: Delay cword highlighting by 100ms
This should lead to better performance while scrolling through a file.
2024-09-30 11:46:03 +02:00