Commit Graph

465 Commits

Author SHA1 Message Date
c22fcf5fce git,zsh:autoload: Move spull into own function
Move `git-track` into its own autoloadable function.

This way it is better maintainable as in one-liner format and brings the
possibility of having more complexity (e.g. for better portability).

By that it is also now executable as `git-spull` as well as `git spull`
as before.
2022-07-12 20:59:59 +02:00
0146956dd4 git:core.pager:,less: Use long flag variants 2022-07-12 20:59:59 +02:00
d5350276dc less: Add --quit-if-one-screen
Before v530 `less` would need the -X flag as well for -F to be useful.
With v530 it does not enter alternate mode if the content fits in one
screen.
2022-07-12 20:59:59 +02:00
932c2eee35 git:checkout-worktree: Format description comment 2022-06-23 23:59:01 +02:00
b96d32996b *: Wrap lines at 80 columns where appropriate
Wrap lines at 80 columns where appropriate and I had the energy to think
about how/where to wrap.

There are still lines longer than that, which I plan to wrap in the
future. But that is enough for now.
2022-06-23 23:59:00 +02:00
9a018d6835 zsh:funcs:shellcheck: Fall back to web service
Add a shellcheck wrapper that falls back to the web service if
shellcheck is not installed.
2022-06-23 23:58:59 +02:00
6458a45461 zsh:keys: Bind ^W to backward-kill-word
For deleting a word while in the shell, I find it easier/faster to use
emacs bindings or Ctrl-Backspace and backward-kill-word instead of the
vi version.

In tmux, Ctrl-H (same esacape sequnce as Ctrl-Backspace) is used for
switching panes since f11b7fa56545 ("vim,tmux:plugs: Add
`vim-tmux-navigator`"), so I need to use Ctrl-W.

As that is bound to vi-backword-kill-word, rebind it to use the emacs
version.
2022-06-23 23:58:58 +02:00
ce4b8fa3dd zsh: Only source *.zsh files
Only source `*.zsh` files to prevent confusion or errors on startup.

Rename all files in 90-external-plugins accordingly.
2022-06-23 23:58:49 +02:00
a912530f6f zsh:p10k: Modify context segment format template
Display only `user` when not in a remote shell and `user@hostname` when
connected.

Display the content in bold when running with privileges (no SSH & SSH).
2022-06-23 23:58:49 +02:00
33f9a34895 zsh:p10k: Move bg-jobs, exec-time & status to end
Have those three always the furthest right in the `RPROMPT`. Also
reorder them to be in this order (up -> down : left -> right):

    - background_jobs
    - command_execution_time
    - status
2022-06-23 23:58:48 +02:00
8107bc6ec0 zsh:funcs: Get rid of double comment prefixes ## 2022-06-23 23:58:41 +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
2133d52fc8 zsh:funcs:git-log-staged-files: Add log.follow 2022-06-23 23:58:36 +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
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
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
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
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
9968edaf09 zsh: Make git-checkout-worktree autoloadable
Transform `git-checkout-worktree` into an autoloadable function.
2022-03-31 15:19:56 +02:00
fa8a6b10fa zsh:alias:git: Add diff --staged and rebase -i 2022-03-31 00:53:26 +02:00
74e72c18c6 zsh:alias: Sort git aliases + Add comment 2022-03-31 00:51:35 +02:00
0ba0c04c56 zsh: Use $+commands[] instead of command -v 2022-03-31 00:46:46 +02:00
0671f028e7 zsh:comp: Rephrase completion copy comment
Add note to useful bindings.
2022-03-30 03:01:20 +02:00
541ff31af4 zsh:comp: Don't sort git-{rebase,show,signoff}
Do not sort completion functions of git-{rebase,show,signoff}.
2022-03-30 03:01:20 +02:00
e024ca9f0a zsh:auto,comp: Add git-signoff function
Add `git-signoff` to signoff commits in given range.
Reuse the `_git-rebase` completion function for `git-signoff`.
2022-03-30 03:00:48 +02:00
d4350dbd7c zsh:auto:git-submodule-rm: Keep git exit code
Split `toplevel` definition and assignment as the `local` builtin has
it's own exit code. Thus the function previously did not return if the
`PWD` was not in a git repo.
2022-03-30 03:00:46 +02:00
4ae8a2db83 zsh:funcs: Add pgrep that uses ps aux | grep
I sometimes find `pgrep` not matching the processes I am searching for,
but `ps aux | grep ...` did not disappoint yet.
2022-03-30 01:43:17 +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
11530608c9 zsh:p10k: Reenable time segment
I disabled that in the past but want have it again.
2022-03-10 14:57:17 +01:00
72c616d378 zsh:p10k: Reapply custom changes
I wanted to have them standalone in a commit once for better
transparency instead of reapplying them before committing the updated
theme in the last commit:
529c41abcf ("zsh:p10k: Reset to `p10k configure`")
2022-03-10 14:56:47 +01:00
529c41abcf zsh:p10k: Reset to p10k configure
Rerun the p10k configurator with the current version.
2022-03-10 14:56:24 +01:00
1ff96687d3 zsh:syntax-highlighting: Update to include 0ddb1a8
Update zsh-syntax-highlighting to include 0ddb1a8d5120 as this fixes a
highlighting bug with zsh-autosuggestions introduced with zsh 5.8.1.
See following issues:
 - 662 in zsh-autosuggestions
 - 857 in zsh-syntax-highlighting
2022-02-28 12:11:44 +01:00
020a132c13 zsh:alias: Alias gp to git push
As I mostly fetch and then merge or rebase instead of pulling `git push`
can have the shorter variant of its alias.
2022-02-20 23:52:13 +01:00