Commit Graph

83 Commits

Author SHA1 Message Date
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
c0a741889b zsh:funcs:psgrep: Pass regex directly
If a pattern is passed that starts with a special character, the
`[]`-"quoting" would possible lead to errors or change it's meaning.

To prevent that, pass the argument directly to grep if it looks like a
regex (i.e. contains a special character).
2022-10-09 19:51:03 +02:00
b398375020 zsh:funcs:psgrep: Print column info 2022-10-09 19:51:03 +02:00
6a1537eda8 zsh:funcs: Rename pgrep to psgrep
Instead of replacing pgrep, have this function under a slightly
different name.

Also add support for multiple arguments as the function does not aim to
be called under the same name now.
2022-10-09 19:51:03 +02:00
553a2679cf zsh:alias: Turn tmsu into a smarter function
Instead of simply pointing the database to XDG_DATA_HOME, write a
wrapper function that searches for `.tmsu/db` in all parent directories
and fallbacks to XDG_DATA_HOME if not found.

Also create XDG_DATA_HOME/tmsu if necessary.
2022-09-18 19:37:30 +02:00
515dbf1117 vim:nvim-man: Source vimrc and fix weird input
Remove `NORC` as settings like `smartcase` or my color scheme are things
I do not want to miss and the startup time delta feels negligible.

Fix a weird issue with presumably the line breaks and tabs in the
command string that would make vim send key inputs when starting through
`nvim-man`. This would lead to tmux switching panes and tmux-resurrect
failing to recover panes with vim opened like this.
2022-09-08 17:41:41 +02:00
bef12252ba zsh:funcs: Add finddup to find duplicate files 2022-08-31 15:02:57 +02:00
0ad0ccb0c8 git: Make commit-last-msg available as alias
Move `git-commit-last-msg` into an autoloadable function. This way it
can also be executed as external script and thus in a git alias. This
makes it additionally possible to call it in vim over fugitive's `:Git`.
2022-08-30 19:52:24 +02:00
a38ac0e738 zsh:funcs:mkcd: Prevent recursion with command
Call the external command `mkdir` to prevent recursion through the alias
added in 7834a6bee2 ("zsh:alias: Alias `mkdir` to `mkcd`").
2022-07-14 17:19:30 +02:00
e931f20a7e zsh:funcs:mkcd: Support - and -- arguments 2022-07-13 17:49:45 +02:00
ee1ec50322 zsh:funcs:mkcd: Improve argument parsing
Do not switch into a directory, if multiple were created. Support flags
given at the end of the commandline (e.g. `mkdir foo/bar -p`)
2022-07-13 17:28:40 +02:00
be6e5df3ea zsh:funcs:suffix: Do not quote extra
Since 5258b5ed4217 ("zsh:funcs:suffix: Support quotes), all special are
escaped anyway (including whitespace), making it unnecessary to quote
the names extra.
2022-07-12 21:00:04 +02:00
818ebdc144 zsh:funcs:suffix: Support quotes
Quotes need to be escaped, otherwise `(Q)` will not work on potential
uneven number of quotes.
2022-07-12 21:00:04 +02:00
bf1eadbb79 zsh:funcs:suffix: Fix multiple suffixes
While trying to handle whitespace in the suffixes the support for
passing multiple suffixes broke.

This should now support multiple suffixes as well as included
whitespaces.
2022-07-12 21:00:03 +02:00
efa7054b82 zsh:funcs: Add suffix
Find files that end with one of multiple given suffixes.

Usage:
suffix sfx... [-- path...]

`sfx` is given to `find` in the form `-name "*$sfx"`.
`path` is given as starting point to `find`, defaulting to `.`.
2022-07-12 21:00:03 +02:00
fd575d3784 zsh:funcs:spellcheck: Fix indentation
I forgot to reindent part of the function after moving the

    if (( $+commands[shellcheck] ))

check into the function. Before it was wrapping the function definition.
2022-07-12 21:00:03 +02:00
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