Commit Graph

719 Commits

Author SHA1 Message Date
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
8107bc6ec0 zsh:funcs: Get rid of double comment prefixes ## 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
8cd490ea0a zsh: Move 'change directory into repo root' logic
Add an alias that switches directories into the repository root, instead
of having the normal `cd` command behave like that.

Sadly this is not possible (AFAIK) with a git alias as that will always
spawn a subshell.
2022-06-23 23:58:39 +02:00
e97ade48e2 zsh:alias: Add py for python3 2022-06-23 23:58:38 +02:00
476081e2a2 git: Set log.follow
I always want to 'follow' if possible.
2022-06-23 23:58:37 +02:00
2133d52fc8 zsh:funcs:git-log-staged-files: Add log.follow 2022-06-23 23:58:36 +02:00
1149424d0d git:alias: Add autofixup and autosquash
Automatically fixup/squash marked commits without opening the
git-rebase-todo.
2022-06-23 23:58:36 +02:00
f76d16f01b git: Move user.config include block to EOF 2022-06-23 23:58:35 +02:00
c2390f5fcd vim:fugitive: Fix committing with locked gpg-key 2022-06-23 23:58:34 +02:00
f620e6d577 meta:hooks:commit-msg: Improve body recognition
Before, the commit-msg hook would not catch too long lines when
squashing commits, as the provided message starts immediately with a
commented line.

Instead of simply using all lines until the first comment, use all lines
until git's cut-line and remove all commented lines in between.

Do not hard-code git's commentary character but rather use
`core.commentChar`. `auto` is depending of the context interpreted as
'any character' or `#`.
2022-06-23 23:58:34 +02:00
7126a40c71 meta:hooks:commit-msg: Allow {fixup,squash} prefix
Allow the "fixup! " and "squash! " prefix' created by the
`--fixup`/`--squash` flags to `git-commit`
2022-06-23 23:58:33 +02:00
f387b08d78 zsh:funcs: Add git-log-staged-files
Display the log for the staged files (excluding additions, as they do
not have a history and I prefer the full log instead of nothing in that
case).
2022-06-23 23:58:32 +02:00
6119d8634f zsh:alias: Use single quotes 2022-06-23 23:58:32 +02:00
5f52d8b463 zsh:alias: Add gch for git checkout 2022-06-23 23:58:31 +02:00
1bd7c959e0 zprofile: Fix typo by dropping trailing character 2022-06-23 23:58:30 +02:00
e594799835 git:ignore: Add Obsession.vim session files 2022-06-23 23:56:53 +02:00
ce4dae3b1a zsh:comp: Complete insensitive between - and _ 2022-06-23 23:56:53 +02:00
e13ab8e855 zk: Add a horizontal ruler before the modeline
When using the zettel as a commit message this is also convenient as git
will ignore everything behind it. (Which also means that all horizontal
rulers in a zettel should use atleast 4 dashes)
2022-06-23 23:56:53 +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
5c51bd87c4 zsh:completion: Autoload and run bashcompinit
zshcompsys(1):

> The function bashcompinit provides compatibility with bash's
> programmable completion system. When run it will define the functions,
> compgen and complete which correspond to the bash builtins with the
> same names. It will then be possible to use completion specifications
> and functions written for bash.
2022-06-23 23:56:50 +02:00
39bec7a71a tmux: Fix resurrect keybindings
This was a typo/copy-paste error.
2022-06-23 23:56:49 +02:00
173b21ba05 tmux: Restore {,neo}vim sessions with obsession
Restore {,neo}vim sessions with the help of [tpope/vim-obsession][1]

[1]: https://github.com/tpope/vim-obsession
2022-06-23 23:56:47 +02:00
8ad05e53fc vim:plugs: Add vim-obsession
> obsession.vim: continuously updated session files
2022-06-23 23:56:46 +02:00
15f4bac670 zprofile: Exit after tmux instead of exec-ing
Instead of exec-ing the tmux process, run it normally and exit
afterwards. Otherwise the zlogout is not read as mentioned a couple of
lines above and in `zsh(1)`:

> However, if the shell terminates due to exec'ing another process, the
> logout files are not read.
2022-06-23 23:56:34 +02:00
3b29820957 zprofile: Use exec when attaching to tmux
When connected over ssh and attaching to/creating a tmux session, the
shell should `exec` the tmux command so that detaching from the session
automatically also closes the ssh connection.

If something should happen and the `tmux` command bricks the remote
shell this can fixed by logging in with:

    ssh [destination] zsh -dfi
2022-06-23 23:55:53 +02:00
79c7cdf416 git:checkout-worktree: Escape slashes in branch
Escape slashes in the branch name before passing it to `mktemp`.
Otherwise it would complain with:

    mktemp: invalid suffix [...], contains directory separator
2022-06-23 23:54:13 +02:00
6fdade90c6 ignore: Add comments and remove outdated lines 2022-03-31 18:09:26 +02:00
98a1404647 ignore: Add .config/git/gitk 2022-03-31 18:08:50 +02:00
be1bd6f08d git:checkout-worktree: Add scripted-use examples 2022-03-31 17:56:07 +02:00
ab53cff2a3 git:checkout-worktree: Update description
Add description in one sentence and use cases for this.
Remove sentence about removing `TEMP_DIR` that is outdated since:
5a8b5ffd21 ("git:checkout-worktree: Use `mktemp` template")
2022-03-31 17:48:05 +02:00
71450ad133 git:checkout-worktree: Fix endless loop
Fix endless loop when commands are passed via stdin that result in the
worktree not being removable. Fix by then dropping into an interactive
shell.
2022-03-31 17:28:05 +02:00
399b571e85 git:checkout-worktree: Refactor into one loop 2022-03-31 17:11:59 +02:00
a60c955d3d git:checkout-worktree: Set err_return + no_unset
If anything happens abnormally, return early and leave it to the user to
fix things.
2022-03-31 16:57:46 +02:00
d56979362a git:checkout-worktree: s/REPO_DIR/WORKTREE_PATH/ 2022-03-31 16:15:46 +02:00
5a8b5ffd21 git:checkout-worktree: Use mktemp template
Use a template that directly includes the repository name and the branch
checked out. This makes finding and deleting the worktree directory if
anything goes wrong a lot easier.

Checkout the worktree directly in the temporary directory. With that
`TEMP_DIR` becomes obsolete.
2022-03-31 16:00:47 +02:00
976d3f9000 git:checkout-worktree: Mention non-interactive use 2022-03-31 15:43:49 +02:00
02a0e17bcb git:checkout-worktree: Fix exit when not in repo
Fix the exit condition when the function is called outside of a git
repository.
Use zsh's `:t` History Expansion Modifier, as `$?` does not keep `git
rev-parse`'s exit code, but rather `basename`'s.
2022-03-31 15:33:53 +02:00
eb323992dc git:checkout-worktree: Keep the shell's exit code
Exit with the exit code of the last spawned shell.
2022-03-31 15:29:53 +02:00
b44ff72210 git:checkout-worktree: Rephrase description 2022-03-31 15:27:29 +02:00
f44125937f git:alias: Add checkout-worktree
Reuse the autoloadable function as git alias. This way
`git-checkout-worktree` as well as `git checkout-worktree` are possible.
2022-03-31 15:21:22 +02:00
9968edaf09 zsh: Make git-checkout-worktree autoloadable
Transform `git-checkout-worktree` into an autoloadable function.
2022-03-31 15:19:56 +02:00
869a1bce6e git: Readd function in spull alias
This reverts commit 54d716510b ("git: Drop function in `spull`").

I apparently oversaw the use of arguments passed to `git pull`. This
makes the function necessary.
2022-03-31 14:20:09 +02:00
2efa7da040 ignore: Ignore .ssh/* instead of the folder
This fixes the issue, that `.ssh/config` was not listed by `fzf.vim`s
`:Files` command.
2022-03-31 03:41:45 +02:00
c087e76ab2 ignore: Everything in .ssh/ except config
This contradicts a bit what I wanted in

1497fe3ed4 ("meta:install: Link all files in .ssh/"):
> This way potential new files in `.ssh/` do not have to be tracked
> manually.

as now, even though they do not have to be tracked manually in the
install.conf.yaml, that is the case for the .gitignore

But the consequences of private keys being pushed by accident (even
though not the entire folder is symlinked) are far greater than
potentially missing a symlink, making this a sensible step.
(And the overhead of adding one file is much smaller in the .gitignore)
2022-03-31 03:37:51 +02:00