Commit Graph

284 Commits

Author SHA1 Message Date
ef5b2911bf vim:coc: Select first item before confirming
I believe I had the problem in the past that the completion wouldn't
automatically select the first entry but simply display the menu. Thus
it would simply insert a new line when pressing return to accept it.

Unfortunately I didn't commit it back then and I can't reproduce it now.
But it doesn't not hurt so I commit it to be safe.
2025-09-17 21:55:00 +02:00
768cb4ed4a vim:keys: Add mapping for git-commit-last-msg 2025-09-17 21:46:43 +02:00
f2ce78b6b3 vim:fzf: Use location list instead of the quickfix
Since the quickfix is a global list I can't keep multiple ripgrep
searches open at once. The location list is window-local thus solving
this issue.
2025-09-17 21:44:46 +02:00
a34cdab694 vim:keys: Revert "Add <leader>g[pP] for system clipboard"
This reverts commit 2bceafeb4e.

`<leader>gp` conflicts with GitGutterPreviewHunk.
2025-09-03 15:01:57 +02:00
456f71d939 vim:keys:TODO: Add <leader>[h 2025-09-03 13:33:09 +02:00
2bceafeb4e vim:keys: Add <leader>g[pP] for system clipboard 2025-09-03 13:18:17 +02:00
af0d9e8fd1 vim:keys: Disable gp mapping for now
It conflicts with the default.
2025-09-03 13:18:17 +02:00
d57fbf0e66 vim:keys: Prepend fzf bindings with f
All fzf related bindings should start with `<leader>f`. This resolves
the clash between `GFiles` and the git actions targeting the full file.
2025-09-03 13:18:16 +02:00
a23159e50d vim:keys: Merge fzf mappings 2025-09-03 13:18:16 +02:00
e8a8f9637a vim:coc: Re-enable backup files
CoC disables backup files due to a problem with a typescript
language-server (it becoming slow when the backup file is written,
triggering a `structureChanged`). But:

1. I want backup files
2. I do not use that language server
3. If I would:
	1. I could disable backup files in a filetype plugin
	2. The linked issue is from 2019 - no idea if this is still
	   present today
4. I don't think this issue is even a thing with a `&backupdir` that
   does not include relative directories (which is the case for me)

So remove the lines disabling backups and go back to vim's defaults:
`nobackup` and `writebackup`.

Link: https://github.com/neoclide/coc.nvim/issues/649
2025-09-03 11:54:50 +02:00
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