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.
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.
vi-kill-word does not exist. This change was lying around uncommitted
for ages now.
Fixes: 658797bda2 ("zsh:keys: Use `vi-` variants of navigation binds")
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|. [...]
I am not sure why I ever disabled them, but this goes way back to the
very first commit. Since some packages rely on /etc/profile.d/ to add
their location to PATH I want /etc/zsh/zprofile to source these. On my
current Manjaro machine it contains just this line:
emulate sh -c 'source /etc/profile'
Normally added by /etc/profile.d/cuda.sh and sourced by /etc/prodile.
TODO: Should I source /etc/profile.d/* from one of /etc/zsh/zprofile and
$ZDOTDIR/.zprofile?
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.
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
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`.
`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.
I believe this changed with an update. Was there a global transparency
setting before? (I have these changes lying around already a bit, so
the breaking change is from the past and not so recent).
`glog` is the most standalone tool out of my dotfiles and I know of at
least one person that uses it that way. Because of this I want to also
explicitly map all other bindings that I have in my zprofile to improve
the experience.
Due to the formatting placeholders sitting on the previous line, the
coloring of the topmost line disappeared when scrolling (as the escape
sequence scrolled away). This had the background that I wanted the code
that sets up the format string to be very readable and if possible very
close to the actual output. And since the colors have all different
lengths I decided to place them on the previous line to have them out of
the way.
Fix this by placing the placeholders on the same output line while still
maintaining a readable format string (code). This is done by joining the
array without placing newlines so that it can now have multiple elements
for one output line and formatting those as wished.
Switch to using the `change-preview()` action that was introduced in
0.29.0 (which was actually not yet released for a year when this feature
was first written). The old `preview()` is a one-off action while
`change-preview()` changes the `--preview` option.
This had the downside that when changing to a different preview and
moving to the next commit one would had to repeat the change. This was
especially annoying when looking through the history of a file that was
renamed. With the commit that renamed the file all previous commits
broke in the `files_only` preview as the path didn't exist yet (A
possible but probably pretty hard TODO to fix).
TODO: glog: Fix files_only preview for renamed files or give prompt to
change the paths
- 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`)