Commit Graph

50 Commits

Author SHA1 Message Date
b61429a176 zsh:funcs:pgrep: Format + rephrase comment 2022-07-12 21:00:03 +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
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
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
9968edaf09 zsh: Make git-checkout-worktree autoloadable
Transform `git-checkout-worktree` into an autoloadable function.
2022-03-31 15:19:56 +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
a14478f758 zsh: Add _page_readme_chpwd_handler()
Open READMEs in a pager when going into a directory that contains one.
2022-02-07 04:22:32 +01:00
6d64a0e609 zsh:funcs:nvim-man: Format nvim commands 2022-02-03 18:30:56 +01:00
dd7302f311 zsh:funcs:nvim-man: Use subjunctive in comment 2022-02-03 18:30:54 +01:00
5312e42a09 zsh:funcs:nvim-man: Use [[ for option check
"${1#-}" is not properly parsed in `((` when long options containing a
`=` are passed (`bad math expression: operand expected`).
2022-02-03 18:30:42 +01:00
3dbffbc08e zsh:funcs:nvim-man: Check if stdout is terminal
If `stdout` is not a terminal, `command man` should be used as `nvim`
won't work.
2022-02-03 18:30:39 +01:00
46605c7a84 zsh:funcs:nvim-man: Use man if option is passed
If an option without arguments like `--version` is passed, `nvim-man`
should use `command man` as well.
2022-02-03 18:30:38 +01:00
e55652fd44 zsh:funcs:nvim-man: Move page existence check call
Check for the existence of the page only if `nvim` would be executed.
2022-02-03 18:30:36 +01:00
1be26adfc9 zsh:funcs:nvim-man: Use minimal config + scrolloff
Load only the `man.vim` plugin, nothing else. This should speed up the
startup a bit. It will never be as fast as `less` though, as it loads
the whole file first.
2022-02-03 18:29:37 +01:00
9817ef3f63 zsh:autoload:crypt-*: Rename to crypt-{open,close}
Rename `crypt-{,u}mount` to `crypt-{open,close}` as in these functions a
lot more happens than just {,un}mounting.
2022-02-01 01:18:15 +01:00
eac6953150 zsh:autoload:crypt-*mount: Get basename natively
Use zsh's builtin history expansion modifiers `:t` to get the basename
of the block device.
2022-02-01 01:15:42 +01:00
271f5bcf25 zsh:funcs:crypt-*mount: Set pipe_fail
Set `pipe_fail` so that if for example the `grep` fails while getting
`$mount_point`, the function returns early.
2022-01-30 00:37:13 +01:00
4c9bb36d33 zsh:funcs:crypt-umount: Fix $mount_point
Get `$mount_point` before unmounting making it then disappear naturally.
2022-01-30 00:34:50 +01:00
4623688fa8 zsh:funcs:crypt-umount: Fix typo
Remove the basename of `$mount_point` as this is the actual symlink name
in `~/mounts/`.
2022-01-30 00:33:39 +01:00
e9c4d7f608 vim:funcs:crypt-*mount: Split local declarations
Split up local declarations into definition and declaration to get the
exit code of the command substitution.
With `err_return` the function now aborts early if `$mount_point`
couldn't be set properly.
2022-01-30 00:09:08 +01:00
546b37681f zsh:funcs:crypt-*mount: Create mountpoint symlink 2022-01-30 00:08:09 +01:00
c2c0d4fc04 zsh:funcs:crypt-*mount: Test for block special 2022-01-30 00:04:22 +01:00
94d4a32a43 zsh:funcs:crypt-*mount: Use err_return option 2022-01-30 00:04:22 +01:00
f37afc9400 zsh:funcs:crypt-umount: Define $name variable 2022-01-30 00:04:22 +01:00
1c36ae8cac zsh:funcs: Add create_venv 2021-07-27 03:54:10 +02:00
64ca1b72f9 zsh: Move {,un}bkp from aliases to functions
Since both were functions already their place seems more appropriate in
functions.zsh. This also fixes the completion of both, since they did
not complete files before.

Other changes in `unbkp`:
    - Use `mv` instead of `cp`
    - Fix little typo (forgotten quote) and support specifying the
      original name instead of only the backup.
    - Do not "rename" the file if there is no change in name
      (Leading to the prompt if the file should be overwritten)
2021-07-23 12:10:31 +02:00
15c0252fda zsh:funcs: Create trash wrapper only if exists 2021-07-22 15:38:14 +02:00
79be1cfc71 zsh:git-checkout-worktree: Break if dir is deleted
Break the loop if `$REPO_DIR` does not exist anymore because it was
deleted other ways instead of looping forever as `git worktree remove`
fails on non-existing directories.
2021-07-15 16:01:38 +02:00
111c851055 zsh:funcs: Add git-rebase-add-stash 2021-07-15 01:20:35 +02:00
4606f9ad80 zsh:git-commit-last-msg(): Support additional args
Pass additional arguments to git-commit so that flags can be passed
e.g `-n` to bypass the commit hooks.
Also use the according completion for `git-commit-last-msg`.
2021-07-07 11:50:52 +02:00
53ae5a067e zsh:funcs:crypt-mount: cd into mount-point 2021-07-07 11:47:54 +02:00
db6303aa51 zsh:funcs:g-ch-worktree: Restart on issues
Restart the subshell until every issue is resolved and the worktree is
removed.
2021-05-31 23:17:47 +02:00
00da37623a zsh:funcs:git-checkout-worktree: Remove -p flag
As under OSX the -p flag does not exist, it seems safer to just use
`mktemp -d` and create the worktree under that directory.
This just has the disadvantage of one more dir to display in the `PWD`.
2021-05-15 04:06:14 +02:00
492c29c096 git:functions: Remove old unused nemo wrapper 2021-05-10 17:30:46 +02:00
1d8f21b565 zsh:functions: Add git-checkout-worktree 2021-05-10 16:12:23 +02:00
17ef6a23e5 zsh:functions:nvim-man: Use portable flag for man
The macos version of man does not have the long versions of the flags.
2021-03-10 13:35:33 +01:00
bd1e968f6f zsh:funcs:cd: Recognize ls suffix in paths 2021-01-25 10:20:55 +01:00
5c95111b0f zsh:func:nvim-man: Fail if no manpage found 2021-01-15 12:39:47 +01:00
d0cd6ffef0 zsh: Move man wrapper into function for completion 2021-01-04 16:34:16 +01:00
a440e8b61e zsh: Use dictionary for command existence check
Use the `commands` dictionary from zsh instead of always calling
`command`.

Regex used:
s/command -v \([^ ]*\) &>\/dev\/null/(( $+commands[\1] ))/g
2020-12-28 02:58:46 +01:00
6e29b8b51a vim:crypt-umount(): Continue if already unmounted 2020-12-23 19:53:28 +01:00
380473bda9 zsh:functions:mvln: Bug fix and multiple arguments
Support multiple arguments now with a behaviour similar to `mv`.

Fix that the created symlink did not point to the right file when mvln
was used to rename directories. In that case it pointed to a
subdirectory with the old name. Fixed by moving the directory check of
the target before the `mv` call.
2020-11-28 19:57:22 +01:00
druckdev
6cac0dc53a git: Show patch of the changes in commit message
The changes are only shown in the editor and do not land in the final
commit message.

For that setting the git-commit-last-msg function and the commit-msg
hook had to be updated.
The function is now a standalone function instead of anonymous and
uses every line until the first comment in COMMIT_EDITMSG discarding the
new information too.
The hook breaks now when checking line lengths when the changes start
since for some weird reason they are passed together with the rest of
the message instead of being deleted like the comments.
2020-11-23 01:27:51 +01:00
druckdev
6fed362d4c zsh:functions: Rewrite resolve()
It was a mess and had to be rewritten. The new version is a bit simpler
by dropping unstable features that I never used anyway.
It still supports a verbose flag that prints every step of the process.
2020-11-23 01:23:23 +01:00
druckdev
9d6086740e zsh:safe-remove(): Accept drive names too 2020-11-17 02:51:26 +01:00
druckdev
aed39d0f4c zsh:safe-remove(): Don't fail if already unmounted 2020-11-15 01:22:20 +01:00
druckdev
bf46c5f687 zsh: Divide zshrc into zshrc.d
Move every file from plugins into zshrc.d as well as all bigger blobs in
the zshrc into their own files there.
Some stuff is still in there that I am not all too sure where it
belongs. TODO: Move.

Because all external plugins are now sourced over a symlink I had to
create a fork of fzf-tab for now that supports that.
See: https://github.com/Aloxaf/fzf-tab/pull/153
2020-11-10 02:58:22 +01:00