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)
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)
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.
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
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.
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.
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
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.
[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
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.
> 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.
> 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.
- 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
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.
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.
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")
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.