Commit Graph

115 Commits

Author SHA1 Message Date
f636479b70 zsh:diffcmds: Improve usage description 2025-06-20 12:24:17 +02:00
f2adfbf27d zsh:conf: Set local extendedglob instead of (*)
The * parameter expansion flag was only introduced in zsh-5.9. I
currently use a system that still uses 5.8.1 and thus throws:

    conf:29: error in flags
2025-05-28 13:28:48 +02:00
68e1af0328 zsh:conf: Fix HOME fallback
Actually use `_get_config_dir`'s exit code instead of `local`'s (i.e.
always™ zero). This was broken since always.
2025-05-14 18:17:18 +02:00
4914a94ee9 zsh:conf: Stop opening ~/.config as a fallback
This has been a bug for far too long. The entries `config`, `conf` and
`config.ini` of `CONF_PATTERNS` only make sense when looking outside of
`HOME`.
2025-05-14 18:15:28 +02:00
6d5245a56e zsh:conf: Remove trailing slashes before processing
Previously when the program name had a trailing slash, `conf` would not
find the right file as it would check for filenames that include a slash
(e.g. `prog/rc`). This was especially annoying, since conf's completion
function inserts a slash automatically when subdirectories exists.
2025-05-14 18:08:19 +02:00
b722b9aaec zsh:funcs: Fix non-empty dir filter in bfs/find wrapper
The previous filter would filter out every non-regular file (e.g.
symbolic links).
2025-03-28 16:23:05 +01:00
e956b8955e zsh: Remove chpwd-readme hook
The hook was never added since the `functions` array was misspelled. I
fixed that and left it turned on the last few days and absolutely hate
it. No idea why I ever thought that this could be nice.
2025-03-13 14:32:02 +01:00
d57ee922c9 zsh:funcs: Add find() wrapper analog to bfs()
Only difference is that it places a trailing slash behind (empty)
directory names to differentiate them better. bfs does this already.

TODO: Bring these together into one function that checks $0
2025-02-05 16:53:14 +01:00
ed2b9e760c zsh:bfs(): Make sure that std{out,err} are ttys
When piping its output, I want the normal behaviour.

Also swap the if and else branches for better readability.
2025-02-05 16:53:14 +01:00
f60d25e47c zsh:bfs(): Don't print non-empty dirs by default
I sometimes use find (nowadays bfs) to get an overview of a directory.
In that case I want the output to be as short as possible.
2025-02-05 16:53:13 +01:00
767e5f3019 zsh:rmdir(): Don't change PWD when removing fails 2025-02-05 16:53:13 +01:00
6dd226d305 zsh:diffcmds: Quote only once, for real now 2024-03-24 18:27:41 +01:00
e5593e1c98 zsh:diffcmds: Refactor: make code less redundant
Instead of always operating on `$@` and using complex parameter
substitutions, split `$@` once into two arrays and use those for
everything further.
2024-03-24 18:27:37 +01:00
52e5d1ab4d zsh:diffcmds: Do the quotation only once 2024-03-24 18:16:02 +01:00
09f437a860 zsh:diffcmds: Do not unquote pipes in args list
diffcmds echo foo %% cat -- '|'

is expected to output `foo | cat` and not `foo`.

Fix this by changing the order of the substitution and {,un}quoting.
2024-03-24 17:38:16 +01:00
ee31064286 zsh:diffcmds: Improve comments and example 2024-03-24 17:29:18 +01:00
92cc28c480 zsh:finddup(): Replace awk solution with uniq
Replace custom awk solution with uniq, by first flipping filename and
filesize so that uniq's `-f` flag can be utilized (as there is no
inverse of it, i.e. "only look at field n").

This increases performance by quite a bit.
2024-01-05 17:17:56 +01:00
30ef936fbd zsh:mvln(): Actually use $flags variable
Fix 5359298bed ("zsh:mvln(): Implement relative flag `-r`"), that
forgot to actually use $flags after adding it.
2024-01-05 16:27:23 +01:00
5359298bed zsh:mvln(): Implement relative flag -r 2023-11-30 18:44:15 +01:00
f193e0071d zsh:mvln(): Revert "Create relative symlinks"
This reverts commit 226f09b046.

I don't want to have relative links all the time.

TODO: If target is a relative path, make the link relative too
TODO: Support --relative flag
2023-07-10 14:03:50 +02:00
2d277c5f54 zsh:funcs: Add rmdir wrapper to delete CWD 2023-07-10 00:12:07 +02:00
e324273567 zsh:diffcmds(): Add pipes TODO and format 2023-07-07 11:53:16 +02:00
a7c529a93c zsh:diffcmds(): Unquote single pipes
This makes it possible to diff command chains. For example:

    diffcmds git format-patch -1 --stdout HEAD~ '|' \
        grep '^%%' '|' \
        cut -c2- \
        -- - +

to see if a commit only reordered lines without modifying them.

I am not happy with this solution and would prefer a different form of
escaping (e.g. with %).
2023-07-06 15:26:43 +02:00
40dad5f672 zsh:diffcmds():TODO: Support own arguments
Support own arguments for example to switch the placeholder or the
diffcmd.
2023-06-23 23:13:17 +02:00
e3085efc46 zsh:diffcmds(): Handle some edge cases 2023-06-23 23:11:43 +02:00
3fea8b821a zsh:diffcmds(): Change ps subs depending on diff*
Process substitution via file descriptor/fifo should be preferred.
2023-06-23 23:09:42 +02:00
393f7ec6e1 zsh:diffcmds(): Add a layer of quotation
Add a layer of quotation as eval removes one. For example using
parameters in single quotes would still be expanded.
2023-06-23 22:36:58 +02:00
a4d1877341 zsh:diffcmds(): Build cmdline as an array
It seems nicer to build a new array instead of building a string and
then splitting it again.
2023-06-23 22:30:37 +02:00
6b0b8f738e zsh:diffcmds(): Rephrase comment to be more clear 2023-06-23 22:11:16 +02:00
ced1f1b7db zsh:diffcmds(): Get index of last -- occurrence 2023-06-23 22:03:28 +02:00
9350213939 zsh:diffcmds(): Use vimdiff depending on $EDITOR 2023-06-23 21:58:45 +02:00
7d1dff6fa9 zsh:diffcmds(): Abort without CMD 2023-06-23 21:43:52 +02:00
252be099fa zsh:diffcmds(): Improve usage printout 2023-06-23 21:43:44 +02:00
0d45f2f61a zsh:suffix(): Use bfs if installed 2023-06-21 13:34:45 +02:00
68fdf4ec13 zsh:diffcmds(): Append args at the back w/o %% 2023-05-24 12:19:50 +02:00
fcfbf3354d vim:diffcmds(): Error if no args were supplied 2023-05-24 12:19:49 +02:00
09ace58f59 zsh:funcs: Add diffcmds() 2023-05-24 12:19:49 +02:00
4640dec63d zsh:suffix(): Use zshisms to find --'s index 2023-02-27 14:13:54 +01:00
226f09b046 zsh:mvln(): Create relative symlinks
When using ln's `-a` flag, absolute paths are not necessary.
2023-02-09 17:08:49 +01:00
7739d0a9c3 zsh:mvln(): Refactor to fewer lines and zshisms 2023-02-09 17:08:48 +01:00
69f8bd8631 zsh:mvln(): Make variables local 2023-02-09 17:08:42 +01:00
5d750e5962 zsh:pdfunite(): Fix execution through missing $0
I don't know what happened there. Apparently I just checked that the
early-abort condition works.
2023-01-23 01:25:39 +01:00
e9a82452fd zsh:psofof(): Remove duplicates 2023-01-21 02:00:59 +01:00
884d12d237 zsh:funcs: Add psofof to list pids from lsof 2023-01-21 01:59:23 +01:00
6bfc7bbcbc zsh:funcs: Write a wrapper for pdfunite
Write a wrapper for pdfunite that tries to prevent an overwrite of an
existing file when forgetting to specify the destination-file.
2023-01-11 22:03:19 +01:00
6672387bee zsh:funcs:finddup: Use byte size for first filter
Use the byte size as first filter instead of the size in 1KB blocks.

This way the filter is way more accurate and filters out more files
for which the md5sum does not need to be calculated.
2022-12-28 02:02:04 +01:00
6bb26ac2fd zsh:funcs:finddup: Add TODO to use CRC instead md5 2022-12-28 01:56:55 +01:00
b38e01c72a zsh:funcs:finddup: Support filenames with spaces
Previously when filenames contained spaces, the function would break as
`awk {print $2,$1}` would only print a part of the filename.

The field swap was used as a workaround so that `uniq` only compares the
sizes, and `uniq` unfortunately only has a flag to **skip** fields.

Fix this issue by using a short awk script that mimics `uniq` but only
with the first field (i.e. the size).

My awk foo is unfortunately not very good, and that is why the one-liner
prints out the first duplicated line multiple time. The `sort -u` pipe
afterwards gets rid of those.
2022-12-28 01:52:56 +01:00
faddf9dbb1 zsh:funcs: Add pyhelp to display python help pages 2022-10-10 20:30:40 +02:00
eb160de09b zsh: Remove nvim-man and use neovim as MANPAGER
`:Man` wraps to the window width if `$MANWIDTH` is not set, making
`nvim-man` as man wrapper obsolete.
2022-10-09 19:51:03 +02:00