Commit Graph

580 Commits

Author SHA1 Message Date
286baf335f zsh:keys: Shift-{,Back}space should act like w/o 2022-10-21 01:23:43 +02:00
8651b073eb zsh:keys: Rely more on terminfo and use libtermkey
Introduce first mapping that follows the 'fixed keyboard input'[^1]
sequences. They allow the differentiation of all keys with each modifier
without gotchas like `tab` send the same sequence as `ctrl-i`.

[^1] - https://www.leonerd.org.uk/hacks/fixterms/
2022-10-21 01:22:52 +02:00
658797bda2 zsh:keys: Use vi- variants of navigation binds
They seem to be more consistent in doing the same/reversed thing when
triggering them backwards.
2022-10-21 01:22:51 +02:00
e15fc71054 zsh,git: Add git-make-fork 2022-10-17 17:28:31 +02:00
61e8ccc176 zsh:glog: Add bindings for faster navigation 2022-10-15 19:01:18 +02:00
af2c96cd5c zsh:glog: Cycle preview positions with ctrl-space 2022-10-15 18:57:11 +02:00
87e3232780 zsh:glog: Require 152 columns for preview on right
This seem to make more sense especially for smaller terminals where the
previous formula would have resulted in both sides being unreadable.
2022-10-15 18:56:26 +02:00
f7c43d5044 zsh:keys: Use ^s for vi-pound-insert
Change the binding from `^3` to `^s` and use vi-pound-insert as that one
does not accept the line.
2022-10-11 00:43:27 +02: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
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
69edbd6f10 zsh:ls-show-hidden: Add -- support
All arguments following `--` should be taken as either files or
directories not flags, even if they start with a dash.
2022-09-27 01:28:10 +02:00
e5010d76b5 zsh:ls-show-hidden: Correct print format
When an argument is passed that does not exist, `ls` always prints the
directory name for the existing ones, even if there is only one
remaining directory that is listed.
2022-09-27 01:16:19 +02:00
82fc29f9c0 zsh:ls-show-hidden: Fix non_existing arg parsing
`ls` prints a warning if a non-flag argument is specified that does not
exist.

Previously ls-show-hidden assumed that all arguments that are neither a
directory nor an otherwise existing file are flags. As all flags are
passed to the ls call the warning still got printed, but this also lead
to the current working directory (i.e. `.`) being added to the
directories to process.

If `ls` expects an argument to a flag, it is always passed in the format
`--flag=arg` where the equal sign is mandatory. This makes it possible
to simply filter out all flags (and their arguments) from the other
arguments without needing to know which flags take an argument and which
don't.

Fix this behaviour by printing the same warning as `ls` does when an
argument is neither a flag, nor a directory nor an existing file. Also
only add `.` to the directories if *really* only flags were passed.
2022-09-27 01:05:42 +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
ccea907173 zprofile: Source private variant 2022-09-19 13:39:18 +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
ed1bfc6ebf zprofile:FZF_DEFAULT_COMMAND: Cut off ./ 2022-09-19 12:57:45 +02:00
bed1ba1840 zprofile: Add -mindepth 1 to FZF_DEFAULT_COMMAND
Do not print `.`.
2022-09-19 12:56:42 +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
bc16774f1d zprofile:FZF_DEFAULT_COMMAND: Follow symlinks 2022-09-19 12:36:42 +02:00
0ffd542d0b zprofile: Cleanup comments to FZF_DEFAULT_COMMAND 2022-09-19 12:23:16 +02:00
5cf9aa2905 zprofile: Prune __pycache__ in FZF_DEFAULT_COMMAND 2022-09-19 12:16:31 +02:00
83ae0c1642 zprofile: Refactor FZF_DEFAULT_COMMAND fallback
Group all names that are pruned in parentheses, but remove the unneeded
parentheses around `-type f -print` by removing the `-a`.
2022-09-19 12:05:52 +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
43d87467d2 git:checkout-worktree: Pass all arguments
Pass all given arguments to `git worktree add`. This makes it possible
to directly create a new branch with `-b` for example. As the arguments
are not used anywhere else, this should not introduce any parsing
issues.
2022-07-12 21:00:12 +02:00