Commit Graph

68 Commits

Author SHA1 Message Date
27791acf50 bin:no-ansi: Correct allowed byte ranges
Correct the allowed byte ranges of the APC, DCS, OSC, PM & SOS
sequences. All but the SOS sequence allow additionally the bytes in the
range `0x8 - 0xD` and SOS may be followed by any sequence of bytes
except for SOS and ST (i.e. `\eX` & `\e\\`).

Link: https://www.ecma-international.org/wp-content/uploads/ECMA-48_5th_edition_june_1991.pdf#page=27
2025-09-19 00:51:47 +02:00
8aa76b3ee6 bin:no-ansi: Don't just match CSI sequences
Try to match all ANSI escape sequences, not just CSI (i.e. `\e[`) - also
the ones that are followed by additional bytes (e.g. CSI, OSC).
2025-09-19 00:26:36 +02:00
6b866f5474 bin:no-ansi*: Use printf for escape byte
I dislike having the raw escape byte in these scripts. Unfortunately
`sed` does not support interpreting it via an escape sequence, so use
printf for that. To remain POSIX compatible use `\033` and not `\e` or
`\x1b` since I couldn't find these in the printf(1p) manpage.
Unfortunately this brings a second layer of escaping.
2025-09-19 00:13:28 +02:00
6db1a710c6 git: Rename zsh-autoload.sh -> external-script.sh
With the last commit 9c1e3f4679 (git:zsh-autoload: Use relative
scripts/ folder, 2025-09-12), `zsh-autoload.sh` could execute any type
of external script. Rename it to a more generic name.
2025-09-12 16:25:39 +02:00
ca15f2399e bin:no-ansi: Fix final byte range
Don't know why I put `z`, the range goes until `~` (i.e. 0x7E).
2025-09-01 16:50:03 +02:00
c09ed22389 i3: Move kitty daemonization into own script 2025-08-26 13:06:08 +02:00
8380d4cc29 bin: Add no-ansi to remove ANSI escape sequences
Similar to `no-ansi-sgr` but removes all ANSI escape sequence, not just
the SGR ones.

See the previous commit bbf9a1da58 (bin:no-ansi-sgr: Set LC_ALL=C for
`[0-?]` range, 2025-07-30) for an explanation of why LC_ALL has to be
set.
2025-08-04 11:00:14 +02:00
bbf9a1da58 bin:no-ansi-sgr: Set LC_ALL=C for [0-?] range
Setting LC_ALL=C makes it possible to use the range `[0-?]` instead of
splitting it into `[0-9:-?]` as done previously. Without LC_ALL, sed
complains with:

	sed: -e expression #1, char 21: Invalid range end

The GNU manual explains this partially, although I still don't quite
understand why this range specifically does not work in `en_US.utf8`.
See:

> Within a bracket expression, a *range expression* consists of two
> characters separated by a hyphen. It matches any single character that
> sorts between the two characters, inclusive. In the default C locale,
> the sorting sequence is the native character order; for example,
> `[a-d]` is equivalent to `[abcd]`.

Link: https://www.gnu.org/software/sed/manual/sed.html#Character-Classes-and-Bracket-Expressions
2025-08-04 11:00:01 +02:00
75fb2f56a2 bin:no-ansi-sgr: Conform to specification
Previously - in the existence of other ANSI escape sequences - the
script deleted text due to the too broad regex. For example in:

    foo^[[K bar m

everything behind `foo` was deleted. Thus, only remove SGR sequences by
only matching the spec-allowed bytes.
2025-08-04 11:00:00 +02:00
5078b6a63f *.sh: Fix some shellcheck issues 2025-06-27 12:59:13 +02:00
3f621617ef less: Open file (also stdin) in vim with e/E
The current file can be edited with `v` already, but this doesn't work
when reading from stdin.
2025-06-20 15:41:35 +02:00
6cb3cbe30a kitty-cwd: Fix accidental absolute symlink 2025-05-30 00:27:05 +02:00
a34a00eae6 i3: Fix opening kitty in the current working dir
Since I run kitty with --single-instance, xcwd does not work for it.
Replace it with a short script that retrieves the CWD for the focused
window through the remote-control ls command.

This changes the current behaviour slightly, since now only terminals
are used and not any X window (which I rarely used or needed) and that
the working dir of the shell running in kitty will be used and not of
any deeper children. I'm still unsure if I want the latter back, but
will figure this out in the future.

This is an addendum to 0139294831 ("Use kitty instead of st as
terminal").
2025-05-27 18:24:06 +02:00
0c17ae8280 *: Use xargs instead of while read one-line loops 2025-05-27 17:00:35 +02:00
bbc6d5c9e0 git: Fix working directory of shell aliases
In git aliases, shell commands are executed from the top-level directory
of the repo. Because of this, something like `git glog -- file` didn't
work in subdirectories.

Fix this by creating a wrapper script that first changes into
$GIT_PREFIX before executing the script. Since (currently) the only
use-case is to launch the functions in `autoload/git/`, most of the path
could move into the script, making the git config a lot cleaner.
2025-05-23 16:30:58 +02:00
6a87b14611 gpg: Move gpg.loopback back to .config and symlink
It was moved back in 020b39887e ("gpg,git: Move gpg.loopback into
PATH"), because git had problems with the "dynamic" path of HOME. I like
to have everything at one place though (And I searched for this script
in the wrong place, just now).
2025-03-11 11:45:48 +01:00
dc6bf773ea bin: Add fitX
Sometimes after an update my key repeat rate and touchpad settings are
messed up. This script fixes these quickly.
2024-11-04 23:14:52 +01:00
8a8726c3cb bin:raw2preview: Takeover EXIF tags from TIFFs too 2023-12-07 02:57:03 +01:00
d969fb3d5e bin:trans: Fix argument parsing 2023-06-26 13:32:02 +02:00
5d0616c34f bin:raw2preview: Add more tags to transfer 2023-06-21 13:37:53 +02:00
97f50919ec bin:raw2preview: Put output folder into a variable 2023-06-21 13:37:06 +02:00
979d49612d bin:shcwd: Sort reversely
Sort the other way so that `/` is on the last line instead of the first.
2023-02-23 14:44:59 +01:00
3480b7fa46 bin: Add shcwd to get CWD of all running SHELLs
This script is meant to be used in the future in an interactive fzf
window bound to a key, so that one can quickly cd into the CWD of
another running shell.
2022-12-22 11:09:31 +01:00
91a06e6796 monitor-setup: Do not discard error message 2022-10-09 19:51:03 +02:00
9e477ff5a4 monitor-setup: Put redundant arguments in fzf_args
# Conflicts:
#	.local/bin/monitor-setup
2022-10-09 19:51:03 +02:00
cfec9334ef monitor-setup: Support resolution and refresh rate
Also place multiple monitors side-by-side.
2022-10-09 19:51:03 +02:00
e0c0119a36 monitor-setup: Rewrite 2022-10-09 19:50:56 +02:00
7666086dba *: Move die() into .local/bin/helpers.sh
The function `die` was redundantly implemented in various files.

Move the function into .local/bin/helpers.sh and source that where
previously implemented.

Also prepend the program's name to the message and always terminate the
message with a newline. The newline was previously needed for a small
but unnecessary hack that prevented the need of the `[ -z "$1" ]` test.
2022-09-22 14:39:20 +02:00
4ccf7961b2 bin: Add trans to translate text with DeepL 2022-09-19 14:23:47 +02:00
2643445ed0 .local:bin:timetracking: Update tail command 2022-07-14 14:24:59 +02:00
03163a92a4 git:filter-repo: Add to $PATH 2022-07-12 21:00:02 +02:00
40416ebd9c *: Move third-party plugins into .local/share/
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.
2022-07-12 21:00:01 +02:00
00927c8921 *: Use tabs for indentation where appropriate
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
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
020b39887e gpg,git: Move gpg.loopback into PATH
Move gpg.loopback into PATH as git's `gpg.program` does not handle paths
with `~` or other environment variables very well.
2022-06-23 23:58:54 +02:00
5caff096cb bin:timetracking: Sort weeks numerically 2022-03-30 03:00:47 +02:00
25ba34c913 bin:timetracking: Print difference to expected hs
Print difference between the sum of all hours and the expected numbers
of hours.
2022-03-30 03:00:47 +02:00
3c4a0d4038 bin:timetracking: Fix octal representation
Fix unwanted octal representation.

Fixes a49bc5f1b5 ("bin:timetracking: Remove padding `0` prefix")
2022-03-30 03:00:47 +02:00
a49bc5f1b5 bin:timetracking: Remove padding 0 prefix
Remove a potential padding `0` as prefix as the number is then
recognized as an octal number.
2022-02-24 17:39:07 +01:00
e268a2fd57 bin:timetracking: stdin, curr year, soft columns 2022-02-17 15:17:33 +01:00
cb7263e77d *: Update plugins and other submodules 2022-01-29 22:42:33 +01:00
eaa4b938c3 bin: Add timetracking 2022-01-28 16:35:57 +01:00
b1d396babd *: Use /usr/bin/env in shebangs for bash & zsh
To increase the portability (OSX for example has zsh under `/bin/zsh`).
2021-07-14 13:48:21 +02:00
029aa73759 bin:raw2preview: Do not always exit with code 1
When a preview was generated and `JPGs` exist at the end, `rmdir` would
fail and the script would always exit with that same return code.
2021-07-13 17:04:28 +02:00
4650ebe641 bin:raw2preview: Add support of TIFFs
I know that TIFFs are not strictly speaking raw files. But I don't
bother remaining the script.
2021-07-13 17:01:54 +02:00
987cabb841 bin:zoom-links: Only copy if browser opened
Do not overwrite the link in the clipboard if nothing opened.
2021-04-19 18:17:36 +02:00
fb72813e0c bin:raw2preview: Refactor + skip directories 2021-04-08 18:30:17 +02:00
60761055d3 bin:filterHistory: Update characters to escape 2021-04-02 18:45:12 +02:00
f0ebab3ca2 repo: Update submodules 2021-03-08 01:05:32 +01:00
0d35030132 bin: Add monitor selection script using xrandr+fzf 2021-01-05 23:18:04 +01:00