Commit Graph

274 Commits

Author SHA1 Message Date
0e5baf5e36 vim:coc: Add coc-go server 2025-09-03 11:36:27 +02:00
fc0cf2ff0a vim:keys: Make git hunk mappings shorter
I act very rarely on the whole file but quite often on hunks, so it
makes sense to have the mappings for the latter shorter.

The new mappings I wanted to use for the whole file are conflicting with
`<leader>gf` (i.e. `:GFiles`), so I've disabled them for now.
2025-08-05 10:57:00 +02:00
1ee41e1c5b vim:keys: Reference commits w/ --pretty=reference
Use git's preferred way of referencing commits (`--pretty=reference`)
instead of the kernel's (`--pretty='%h ("%s")'`). I can see that
specifying the date makes sense and that the quotes are at best
unnecessary in the parentheses and at worst confusing when the subject
contains quotes itself.

Link: https://git-scm.com/docs/SubmittingPatches#describe-changes
2025-07-20 03:37:47 +02:00
4802abee17 vim:setts: Revert "Include - in &iskeyword"
Commit 0369218114 ("vim:settings: Include `-` in `&iskeyword`") added
the dash to `&iskeyword` but I didn't give an explanation for the change
and don't remember what led me to it. Today I'm annoyed by it since it
breaks some stuff (e.g. previously the C pointer arrow and syntax
highlighting of negative numbers in Python). The C ftplugin is obsolete
now, so delete it.

This reverts commit 0369218114.
2025-07-20 03:05:10 +02:00
fded58696a vim:keys:TODO: omap [ia]$ in shell scripts
I'd like to have `$` as a text object in shell scripts to select
parameter expansions and command substitutions.
2025-06-27 16:38:52 +02:00
cf68e01510 vim:keys: Center line when opening quickfix entry 2025-06-27 16:37:20 +02:00
f5c6baf856 vim:keys: Add note about macro_type augroup 2025-06-27 16:36:21 +02:00
a8d46caa78 vim:keys: Modularize changes to ]]/][ mappings
Instead of changing the functionality of `]]` and swapping `][` and
`]]` in one mapping, do it in two separate steps. This way both changes
can be used independently of each other.

Fixes: 459e0b7113 ("vim:keys:TODO: Modularize changes to ]]/][ maps")
2025-06-27 16:33:56 +02:00
2d9b00a0d3 vim:keys: Convert decimal numbers with <leader>hex 2025-06-27 13:29:25 +02:00
781e3a2f4b vim:keys: Substitute only inside visual selection
When substituting in a visual block selection, the automatically
inserted range `'<,'>` is not enough as the pattern will also match
outside of the selection on the same lines. To only match inside the
selection, insert the `\%V` atom.

Theoretically the pattern will also need the atom before the last
character to make sure that everything is inside the selection, but this
can be inserted manually when needed (see `:h /\%V`).
2025-06-26 16:18:22 +02:00
6b98838f7e vim:keys: Remove unneeded mappings
These were commented out already for longer. For `(` I have delimitMate
and the `<CR>` mapping conflicts with the one from coc.nvim (which
includes the `<C-G>u`)
2025-06-02 20:59:43 +02:00
f0ec75aa9c vim:keys: Map <leader>d also in visual mode 2025-06-02 20:59:43 +02:00
533e82cb81 vim:keys: Add :keeppatterns to substituting vmaps
All of these should not modify @/.
2025-06-02 20:59:43 +02:00
e0e1e5d971 vim:keys: Fix <Cmd> vmaps
When switching to <Cmd> for mappings in fc9874bf97 ("vim:keys: Use
<Cmd> for plain command mappings") I forgot that the previously inserted
selection range marks (i.e. '<,'>) are missing now. This broke vmaps
that used :substitute without having added them manually.

Since <Cmd> has some performance benefits, I want to keep it and add the
missing marks where needed.
2025-06-02 20:59:37 +02:00
9dc8e71ce6 vim:keys: Map <C-w>! to move window to new tab
I memorized tmux's <prefix>! mapping, but always forget how it is done
in vim.
2025-05-28 14:05:40 +02:00
671d924cca vim:fzf: Span fzf over full window in tmux
Use tmux popup windows for fzf in vim, so that it spans (almost) the
full tmux window. My use-case for this is, that sometimes I open fzf in
a split pane and notice then that the lines are too long for the width
of the pane. Since the fzf window won't resize if I resize the pane
(TODO: issue in fzf.vim), I have to first close it, resize and then
reopen fzf. I hope to fix this by using always the big tmux popup and
eliminating the need to resize at all. The issue remains when vim is in
a split window outside of tmux. I can imagine that this will become
annoying, but we'll see...
2025-04-30 17:44:15 +02:00
25c00c6efd vim:setts: Use ellipsis for lcs extends & precedes 2025-04-30 17:03:04 +02:00
ad025e7d9d vim:setts: Highlight trailing spaces a bit better
Switch from middle dot to bullet point, since it is a bit bigger.
2025-04-30 17:03:04 +02:00
d3cbc9d560 vim:setts: Change 'tabstop' to 8
I got used to code that is indented with (meant) tabs of width 8.
2025-04-30 17:03:04 +02:00
3599a147b8 vim:coc: Abort when coc is not loaded 2025-03-26 00:48:48 +01:00
bf4c5a1291 vim:keys: Alias <leader>g* to <leader>* 2025-03-25 18:03:59 +01:00
2b1bdf0fee vim:coc: Disable inlay hints 2025-03-20 12:51:02 +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
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
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
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