Commit Graph

430 Commits

Author SHA1 Message Date
80b533d089 vim: Highlight non-ASCII characters 2022-08-25 03:35:27 +02:00
4415ff4653 vim: Fix broken highlight of trailing whitespaces
Apply the following:

1. Switch to `matchadd` as `match` can only be used for **one**
   highlight
2. Use an autocommand group for better behaviour when reloading the
   vimrc.
3. Use just one pattern as it seems to work always. (Apparently `\%#` is
   not matched in normal mode)
2022-08-25 03:33:11 +02:00
73aa0e9752 vim:keys: Use RFC 3339 when converting unix times
Use a format conforming to RFC 3339 instead of following the systems
locale.
2022-08-25 01:14:39 +02:00
bc7a539186 vim:keys: Add <leader>utc to convert unix time
Add `<leader>utc` to convert unix timestamps into a human readable
format.
2022-07-14 14:25:00 +02:00
83d991cb53 vim:keys: Map <leader>gg to `:G 2022-07-14 14:24:59 +02:00
46565c2d6b vim:keys: Nvim does not replace has('clipboard')
Neovim does not make `has('clipboard')` obsolete. It only simplifies
clipboard support but `has('clipboard')` will still return `0` if no
supported clipboard program is installed.

See `:help clipboard`

    Nvim has no direct connection to the system clipboard. Instead it
    depends on a |provider| which transparently uses shell commands to
    communicate with the system clipboard or any other clipboard
    "backend".

and `:help clipboard-tool`

    The presence of a working clipboard tool implicitly enables the '+'
    and '*' registers. Nvim looks for these clipboard tools, in order of
    priority:

      - |g:clipboard|
      - pbcopy, pbpaste (macOS)
      - wl-copy, wl-paste (if $WAYLAND_DISPLAY is set)
      - xclip (if $DISPLAY is set)
      - xsel (if $DISPLAY is set)
      - lemonade (for SSH) https://github.com/pocke/lemonade
      - doitclient (for SSH)
        http://www.chiark.greenend.org.uk/~sgtatham/doit/
      - win32yank (Windows)
      - termux (via termux-clipboard-set, termux-clipboard-set)
      - tmux (if $TMUX is set)
2022-07-12 21:00:11 +02:00
d1211dbc0d vim:settings: Add block to virtualedit
Let the cursor move beyond the EOL when in visual-block mode.
2022-07-12 21:00:08 +02:00
c906c5ffb6 vim:keys: Add <leader>h mapped to :Helptags 2022-07-12 21:00:07 +02:00
01ebc211bb vim:autocmd: Disable relative numbers in insert
As relative line numbers are only really needed in normal mode and in
the current buffer, disable them in insert mode or when the
buffer/window is not focused.
2022-07-12 21:00:05 +02:00
b2536d7c2f vim:settings: Set inccommand=split
Show partial off-screen effects of a command in a preview window.
2022-07-12 21:00:05 +02:00
b63bbc391f vim:ftplugin:python: Set foldmethod locally 2022-07-12 21:00:05 +02:00
39df041443 vim:ftplugin:vim: Use local <buffer> autocmd
Fix the issue that the vim config would always be reloaded on save
(jumping to the BOF; another TODO) even in non `*.vim` buffers, after a
vim file was opened once in the session.

Fix this by defining the autocmd only local to the current buffer.

See also :help autocmd-buflocal
2022-07-12 21:00:04 +02:00
40416ebd9c *: Move third-party plugins into .local/share/
Move all submodules that were under .config/ into .local/share/ (alias
XDG_DATA_HOME). I got convinced that they feel out of place in .config/.

Instead of updating the paths from which they are sourced (e.g.
`TMUX_PLUGIN_MANAGER_PATH` or `packpath`), keep a symlink in the old
location that points to the new one. This has the benefit that
everything related to one program remains mostly accessible from the
same place instead of spreading everything out.

I am still unsure if I really like the new location as I affiliate user
**data** more with something that has to be backed up as it is
non-recreatable. And moving them out of .config/ had the reasoning that
they are not my config files but rather data from the internet that
could be retrieved when deleting. But using XDG_CACHE_HOME seems
unreasonable as well.
We'll see.

Move the fzf-repo from ./local/bin/ to .local/share/.

Update all relative symlinks' (e.g. fzf) targets.
2022-07-12 21:00:01 +02:00
f13acebdb2 vim:keys: Format current paragraph with Q 2022-07-12 21:00:00 +02:00
58daf17e79 vim:keys: Add fugitive version of <leader>gcd
Add a fugitive version of the `<leader>gcd` mapping to jump to the root
of the repo.
2022-07-12 20:59:58 +02:00
9e18f6db16 vim:keys: Make git mappings fugitive independent
Make the git {add,stash,checkout} mappings independent of fugitive.vim.
2022-07-12 20:59:58 +02:00
733481900f vim:keys: Fix commit reference when at EOL
Fix the commit reference mapping `<leader>grc` in the case that nothing
follows the commit hash on the line. In that case the join would add a
trailing space.

`gJ` is not suitable as that would break in the other case that text
follows. When splitting the line behind the commit hash, the space in
front of whatever follows is deleted. Thus when joining everything
together at the end, there would be no space between the closing
parentheses and the rest.

Using the `system()` was the only solution I found to insert the subject
directly behind the hash without destroying the formatting and the text
behind it.

For this to work the trailing newline had to be cut off of git's output.
2022-07-12 20:59:58 +02:00
158dcb4b96 vim:keys: Add mapping to insert commit subject
Insert a commit's subject behind the SHA1 that the cursor is currently
on with `<leader>grc`.

Mnemonic: "git reference commit"
2022-06-23 23:59:02 +02:00
00927c8921 *: Use tabs for indentation where appropriate
I am a big supporter of the approach to indent with tabs and align with
spaces. (Read [here][1] f.e.) Thus at some places a simple `s/ {4}/\t/g`
(replace 4 with whatever fits) is not enough and a bit more thought is
needed. Because of that there are still places where I plan to
substitute the whitespace in the future.

This patch contains exclusively whitespace changes. Check for yourself
with `git diff --ignore-all-space`.

[1]: https://dmitryfrank.com/articles/indent_with_tabs_align_with_spaces
2022-06-23 23:59:01 +02:00
a3ede8f8bc vim: Use gitgutter's foldtext()
Use `gitgutter`'s `foldtext()` to display an indicator if a fold
contains lines that have been changed.
This is necessary as {,neo}vim does not display signs next to folded
lines.
2022-06-23 23:58:52 +02:00
6a538101a2 vim:plugs:tmux-navigator: Disable on zoomed pane
Disable tmux navigator when zooming the Vim pane.
2022-06-23 23:58:47 +02:00
4cf0eedd56 vim,tmux:plugs: Add vim-tmux-navigator
[vim-tmux-navigator][1]:

> Seamless navigation between tmux panes and vim splits

Add the hybrid vim/tmux plugin `vim-tmux-navigator` to switch between
tmux panes and vim splits with `C-[hjkl]`.

Add vim-tmux-navigator as a submodule in tmux/plugins and create a
symlink from vim/pack/plugins/start.

Get rid of similar switching keymappings in the vim and tmux configs.

[1]: https://github.com/christoomey/vim-tmux-navigator
2022-06-23 23:58:46 +02:00
4b421f6b78 vim:funcs: Silence checktime call
The checktime command is not available in the command line window. As
the `CheckTime` function runs every second, the command line window
spits out an error message every second making it practically unusable.

This patch silences the `checktime` call to fix this.
2022-06-23 23:58:43 +02:00
846d0fc6c6 gitmodules: Set foldmethod=expr per modeline
Fold away every submodule entry.

Add section headers.
2022-06-23 23:58:42 +02:00
464d4de64b vim:plugs: Add vim-sort-folds
> Sorting folds is not easily possible in vanilla vim. You could join
> all lines in a fold, sort and split them up again; however, it is time
> consuming and tedious.
>
> This little plugin solves that issue: It sorts a visually selected
> region while keeping closed folds intact. Since folds can be created
> in a variety of ways, it is therefore straight-forward to sort
> arbitrary groups of text based on their first line.
2022-06-23 23:58:41 +02:00
626ba1c345 vim:plugs: Add vim-textobj-comment
> This Vim plugin provides text objects for comments.
>
> `ac` selects a comment including the comment delimiters and `ic`
> selects just the comment content. (There's also a third text object,
> `aC`, which selects a comment including trailing or leading
> whitespace.) These mappings are available in Visual and
> Operator-pending mode.
>
> This plugin uses the `comments` and `commentstring` settings to
> determine what a comment looks like for a given filetype. It works
> with both `/* paired */` and `// simple` comment delimiters.
>
> This plugin depends on the textobj-user plugin.
2022-06-23 23:58:40 +02:00
4d8921c1c1 vim:plugs: Add vim-textobj-user 2022-06-23 23:58:39 +02:00
7eb4a29b4d vim:keys: Improve and add new git mappings
- Drop the mapping for `:Gcd` as I rarely use it and prefer to commit
  with one keystroke less.
- Add the current file instead of calling `git add -p` for the whole
  repository. If I want to add hunks I can do that with the gitgutter
  mappings.
- Add mappings to stash and checkout the current file.
- Use mnemonic 'add' instead of 'stage' for `GitGutterStageHunk`
  mappings.

TODO: Extend gitgutter for a `GitGutterStashHunk` function
2022-06-23 23:56:52 +02:00
bc72d3507c vim: Set nofixendofline
Do not automatically restore missing <EOL> at EOF when writing.
This is rarely a change worth committing and I'd rather prefer vim to
not touch stuff I did not actively modify myself.
2022-06-23 23:56:52 +02:00
2def35d0e7 vim:keys: Add gm to open a manpage
Open the manpage in the WORD under the cursor.
2022-06-23 23:56:52 +02:00
8ad05e53fc vim:plugs: Add vim-obsession
> obsession.vim: continuously updated session files
2022-06-23 23:56:46 +02:00
8008cb1a63 vim:plugs: Fix nodejs executable check 2022-03-30 14:58:23 +02:00
55cfb89a8d vim:keys: Add mapping for "+Y 2022-03-30 14:55:39 +02:00
ef438aeac1 vim:keys: Bind clipboard mappings to all modes
Also bind the system clipboard mappings to visual, etc.
2022-03-30 14:54:32 +02:00
10da37b676 vim:keys: Make call to NewSpellLang silent 2022-03-30 14:47:09 +02:00
241f315eec vim:keys: Add more git mappings 2022-03-30 14:36:40 +02:00
a8e72814c0 vim:ftplugs: Auto format paragraphs in markdown
We'll see how this goes.
2022-03-30 14:01:01 +02:00
99e6ac7002 vim:sets: Recognize numbered lists when formatting
Add `n` to `formatoptions` to recognize numbered lists when formatting.
2022-03-30 13:59:10 +02:00
87c804f2e1 zsh:keys: Add TODO about :keepjumps
The bindings that correct the previous or next misspelled word should
not modify the jumplist but `:keepjumps` disallows <C-O>.
2022-03-30 03:01:31 +02:00
efe4b7a1d8 vim:plugs: Check for nodejs executable for Coc 2022-03-30 03:00:27 +02:00
291af2fdb0 vim:keys: Hotfix loaded_gutentags
`loaded_gutentags` has stopped working, leading to `:Tags` not being
binded.
2022-03-29 16:56:45 +02:00
4c7b054336 vim:keys: Correct the next/last misspelled word 2022-03-29 16:48:08 +02:00
5df9e4d6ee zsh,vim: Add WIP Zettelkasten tooling
Add `zk`, an autoloadable function that creates a new zettel after a
template in the right directory.
Add `zettel` vim ftplugin.
2022-03-28 23:48:51 +02:00
dc76a341a0 vim:ftplugin: Adjust to new colorcolumn settings
Since
a98457e66b ("vim:autocmd: Adjust colorcolumn with &textwidth")
or correctly sine
fc0969abba ("vim: Drop textwidth autocmd for native way")
it is not necessary to add the `textwidth` manually to `colorcolumn`.
The colorcolumns are now also placed *behind* textwidth.
2022-03-28 23:42:22 +02:00
fc0969abba vim: Drop textwidth autocmd for native way
Instead of needing a manual autocmd that triggers on textwidth changes,
colorcolumn supports offsets to textwidth natively.
2022-03-22 16:18:58 +01:00
94271371dc vim:autocmd: Fix typo in OptionSet textwidth
The old `textwidth` value is meant to be subtracted from colorcolumn, to
then add the new one.

Fixes: 41656d28d6 ("vim:autocmd: Reset textwidth value in colorcolumn")
2022-03-21 15:24:31 +01:00
41656d28d6 vim:autocmd: Reset textwidth value in colorcolumn
Instead of overwriting the entire colorcolumn value, reset only the
textwidth value, by subtracting it first and then readding it.
2022-03-18 17:33:56 +01:00
a4760b7518 vim:plugins: Source optional plugins directly
When adding the `!` only the paths are added to the `runtimepath` and
nothing is sourced (yet). As `keys.vim` for example checks if gutentags
is loaded before creating a binding to :Tags this has to change and the
plugins need to be sourced directly.
2022-03-03 01:19:14 +01:00
0369218114 vim:settings: Include - in &iskeyword 2022-02-24 17:39:48 +01:00
fafc7e1bef vim: Deactivate cursorline
With the highlighting of the word under the cursor this kind of gets in
the way as both are using the same color to highlight.
2022-02-17 15:22:32 +01:00