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).
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.
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.
`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.
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.
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-.`")).
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.
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.
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.
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.
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.
I sometimes need the `<prefix>[hjkl]` bindings over `C-[hjkl]` (e.g. vim
insert mode). Then it is nice to have them repeatable when navigating to
a pane further away.