Commit Graph

41 Commits

Author SHA1 Message Date
93467176f6 zsh:keys: Set sensible fzf args for go-shcwd
Copy arguments from shell/key-bindings.zsh of the fzf repo.
2023-11-20 19:27:17 +01:00
063b0559c9 fzf: Use fd as default command if installed 2023-06-23 17:08:57 +02:00
2114987106 zprofile: Fix non-export of FZF_DEFAULT_NO_RG
I never really noticed but `$FZF_ALT_C_COMMAND` was never set as
`$fzf_default_no_rg` would be empty. Because the variable was not
exported, the X session would not have it in it's environment.
2023-06-23 13:36:23 +02:00
072204c10c vim:keys: Discard stderr in FZF_CTRL_T_COMMAND
The prompt gets messed up on error messages from `find` (e.g. permission
errors). Discard them.
2023-04-11 22:49:15 +02:00
112b195d7b zsh:keys:TODO: Rather insert line on ^R 2023-02-27 14:11:43 +01:00
8e183a37bf zsh:keys: Bind ^U to cd ..
I do not use readline/emacs(?) mapping to clear the line with ^U anyways
as I have my beloved vim bindings.
2023-02-23 14:44:59 +01:00
a85d6c53c4 zsh:keys:go-shcwd: Only exclude exact $PWD
Fix the grep call to only exclude lines that are exactly the PWD instead
of containing it.
2023-02-23 14:44:59 +01:00
cf48efb4cb zsh:keys:go-shcwd: Do not suggest $PWD 2023-02-23 14:44:59 +01:00
86c3c1992a zsh:keys: Bind ^G to fuzzy shcwd 2023-02-23 14:44:59 +01:00
51a2ab77d7 zsh:keys: Extract redraw-prompt from cd-rotate
This makes it possible to use it in other bindings.
2023-02-23 14:32:54 +01:00
a7b975ae71 zsh:keys:cmd-on-enter: Check PREBUFFER as well
When typing a multi-line input (e.g. `echo foo\<CR>`) BUFFER can be
empty, even though the entire input is not.

Fix this by checking if PREBUFFER and BUFFER are empty.
2023-01-17 00:33:19 +01:00
5c1b67ddfc zsh:keys:cmd-on-enter: Don't place cmds in history 2022-12-29 18:09:20 +01:00
c41e395325 vim:keys: Use non-vi versions of backward delete
The `vi-` versions stop working after using `push-input` and trying to
edit the reappeared line.

This could be an upstream bug, as I can recreate it with `zsh -f`.
2022-10-21 17:33:57 +02:00
1930c8758f zsh:keys: Make shift-return act like return 2022-10-21 11:05:18 +02:00
350dd257f0 zsh:keys: Change ctrl-dot sequence to libtermkey 2022-10-21 01:25:36 +02:00
49e8e3a756 zsh:keys: Move through dirs like vims jumplist 2022-10-21 01:25:00 +02:00
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
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
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
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
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
6b2a03222b zsh:keys: Bind ^3 to pound-insert 2022-02-20 23:48:59 +01:00
fe8a656dfe zsh:keys:cmd-on-enter: Refactor for real cmd cycle
Refactor the function to keep an array of commands with requirements
that have to be met. Those commands are then cycled over a wrap around
index instead of the inflexible switch statement.
2021-12-29 18:58:45 +01:00
b6d2299444 zsh:keys:cmd-on-enter: Remove zle message print
It did nothing.
2021-12-29 17:33:33 +01:00
9f99ceafd4 zsh:keys:cmd-on-enter: Use ll instead of ls 2021-12-29 17:28:41 +01:00
2d65f187f4 zsh: Fix forgotten ZSH_CONF use
`$ZSH_CONF` was removed in af49c39ba3.
2021-07-15 02:44:04 +02:00
8890a4b604 zsh:keys: Remove fzf-hist functionality
Go back to a simpler approach, that the `fzf-history-widget` is only
called on <C-Up> and ^K in normal mode and <Up> & <Down> scroll through
the history normally.

The reason behind this change is that there were still some edge cases
in which the widget was wrongfully called when normal scrolling was
intended.
This change also makes it now possible that I can use commands in the
'surrounding' of a past command by first navigating to it with the
fzf-widget and then just using <Up> & <Down>.
2021-07-14 14:35:20 +02:00
48dc9ca561 zsh:keys:cmd-on-enter: Add reset on other command
If a command is normally executed CMD_ON_ENTER is reseted to `ls`.
Otherwise problems can occur when for example switching the directory to
a non-repo when CMD_ON_ENTER contains `gs`.
2021-03-09 15:47:09 +01:00
93225e2d66 zsh:keys:cmd-on-enter: Cycle between ls & gs too 2021-03-08 01:10:09 +01:00
2c30d57573 zsh:keys: Fix fzf abort check
The file should be opened if fzf returned something not the other way
around. This probably happened in the last refactoring session before
committing.
2021-01-05 22:07:07 +01:00
ec2b7d58ed zsh:keys: Simulate <leader>f from vim config 2021-01-03 22:33:23 +01:00
5c91bc23a2 zsh:keys: Increase KEYTIMEOUT a bit 2021-01-02 00:40:01 +01:00
druckdev
bf46c5f687 zsh: Divide zshrc into zshrc.d
Move every file from plugins into zshrc.d as well as all bigger blobs in
the zshrc into their own files there.
Some stuff is still in there that I am not all too sure where it
belongs. TODO: Move.

Because all external plugins are now sourced over a symlink I had to
create a fork of fzf-tab for now that supports that.
See: https://github.com/Aloxaf/fzf-tab/pull/153
2020-11-10 02:58:22 +01:00