Commit Graph

319 Commits

Author SHA1 Message Date
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
dc25c88fe7 zsh:alias: Add --full --list-full to pgrep 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
1d99d5dbf5 zsh:glog: Do not pass --graph by default
`--graph` can get very slow for large repos with many branches. Make
`glog` independent of it and rather add an alias that uses `glog
--graph`.
2022-10-05 17:13:52 +02:00
bf7d9dbeeb zsh:keys: Use consistent notation for ASCII escape 2022-09-28 01:19:32 +02:00
14f615f5e1 zsh:keys:ratio_dots: Fix preview of first word
Previously the path preview misbehaved when typing dots on the first
shell word (e.g. executing a script in a parent directory). This
happened as the `(z)` parameter expansion flag does not expand to an
array rather a scalar. Because of that, `[-1]` returns the last
character.

Work around this issue by prepending LBUFFER with a dummy word, so that
it always contains at least 2 words.
2022-09-22 15:15:07 +02:00
9a5536c5c5 zsh:keys:rationalize_dots: Add comments 2022-09-22 15:14:38 +02:00
8792518bcb zsh:keys:rationalize_dots: Add .. scenario
Handle an LBUFFER value of `..` before pressing `.` by adding `/../`.
This scenario can only occur by deleting previously added segments or
using the new `default_dot` (See previous commit 72a8cfbcb ("zsh:keys:
Add normal `.` behaviour on `Ctrl-.`")).
2022-09-22 15:09:39 +02:00
72a8cfbcb0 zsh:keys: Add normal . behaviour on Ctrl-.
Having bound `.` to `rationalize_dots` makes typing paths with multiple
`../` segments super easy. This gets cumbersome in some situations
though.

Typing a path like `../.local` is only possible by either typing
`../.<BS><BS>local` (as it is expanded to `../../` on the third dot) or
`..//.local` which is not as annoying but somehow breaks completion on
further path segments.

Bind `Ctrl-.` (i.e. `^N`) to insert a normal dot.
2022-09-22 14:39:20 +02:00
d7c9bda8a7 zsh:options: Enable CSH_NULL_GLOB
Error only if all patterns of a command have no matches.
2022-09-22 03:02:24 +02:00
181971c1db zsh: Add $fzf_default_no_rg
Move the fallback for $FZF_DEFAULT_COMMAND into the variable
fzf_default_no_rg that is always set.

This way FZF_ALT_C_COMMAND can reuse it instead of spawning a new shell
and messing with PATH.
2022-09-19 13:01:30 +02:00
1dab31ecda zsh:keys: Reuse the default fallback for FZF_ALT_C
Instead of implementing it twice, simulate a shell without ripgrep to
get the fallback of FZF_DEFAULT_COMMAND and modify it for use with
directories.
2022-09-19 12:52:00 +02:00
85b95dce37 zsh:keys: Set FZF_{CTRL_T,ALT_C}_COMMAND
Do not ignore hidden files.
2022-09-19 12:45:26 +02:00
ec292c0dd1 zsh:alias:vimdiff: Do not set listchars
As this is done by my vimrc already.
2022-09-19 11:55:01 +02:00
d9673498cb zsh:alias: Add -p to mkdir 2022-09-18 19:43:41 +02:00
dc72de809b zsh:alias: Remove mkdir=mkcd
I changed my mind. This gets really annoying.
2022-09-18 19:41:46 +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
2177031c68 zsh:history: Increase file size limit 2022-09-10 00:35:03 +02:00
22ad215f62 zsh:alias: Add sizes for du -sch * | sort -h 2022-09-09 01:35:58 +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
165b0ee7af zsh:alias: Add glog --branches --remotes 2022-08-28 01:12:51 +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
7834a6bee2 zsh:alias: Alias mkdir to mkcd 2022-07-14 14:24:58 +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
d4ee271740 zsh:alias:qmv: Use destination-only edit format
Use the `destination-only` edit format when renaming files with `qmv`.

`dual-column` mode got on my nerves as I tend to forget with side is
source and which is destination. On top, the `swap` option breaks as
soon as I change the length of a filename.

`single-column` mode is useless for me, as I tend to make changes in
visual block mode.
2022-07-13 12:14:39 +02:00
0ccca77457 zsh:settings: Set HIST_REDUCE_BLANKS
Remove superfluous blanks from each command line being added to the
history list.
2022-07-12 21:00:11 +02:00
7b40b3ea98 zsh:alias: Exclude .git & tags when grepping
Those are more or less never a place that I want to include when
grepping recursively or through a glob.
2022-07-12 21:00:10 +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
127cce45a1 zsh:p10k: Add vim modeline 2022-07-12 21:00: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