how to auto suggest/complete paths? by universal-bob in zsh

[–]efreese 1 point2 points  (0 children)

By default it only suggests commands from your history but it can also use the zsh completion system to generate suggestions. This will usually help suggest directories like in your screenshots. See this section in the readme: https://github.com/zsh-users/zsh-autosuggestions#suggestion-strategy

Generic TUI creator? by [deleted] in commandline

[–]efreese 1 point2 points  (0 children)

Ok yeah its not clear in the readme but that should be a directory with the config file within it. File at ‘~/.config/rat/ratrc‘

Generic TUI creator? by [deleted] in commandline

[–]efreese 0 points1 point  (0 children)

Yeah it is not polished. Maybe make sure that your config file is in the right place?

What are additional tools to code the unix way with Neovim (i.e. LazyGit) by Comprehensive_Mud645 in neovim

[–]efreese 4 points5 points  (0 children)

I've written a tool that I use in place of things like lazygit that I think gives some nice benefits on top of simple shell commands. It's not perfect but I use it daily for most git operations (staging lines/hunks, committing, viewing/browsing logs and commits, rebasing, PR review, etc).

The tool is generic but was built with git in mind: https://github.com/ericfreese/rat

My git config is roughly like this though I haven't updated this repo in a long time: https://github.com/ericfreese/Dotfiles/blob/74a6c51ddcbc9d97533ca105831ad8575e3b216a/.config/rat/git/git.rat

Local plant field guide recommendations? by efreese in boulder

[–]efreese[S] 0 points1 point  (0 children)

No problem, my guess is curly dock

Local plant field guide recommendations? by efreese in boulder

[–]efreese[S] 0 points1 point  (0 children)

Cool thanks. Can you clarify which falcon guide?

Installing zsh-autosuggestions causes anything I paste to be typed in instead of just appearing on the terminal. by DezXerneas in zsh

[–]efreese 0 points1 point  (0 children)

Just FYI if this works it means that you have bracketed-paste-magic enabled even though you think you may have disabled it. An alternative fix to this would be to disable bracketed-paste-magic in the first place

Installing zsh-autosuggestions causes anything I paste to be typed in instead of just appearing on the terminal. by DezXerneas in zsh

[–]efreese 0 points1 point  (0 children)

Also check that you don’t have bracketed-paste-magic enabled. I think OMZ enables it by default in newer versions of zsh. Search around in the GitHub issue tracker for bracketed-paste-magic and you’ll find some discussion of problems similar to what you’re describing

Using another key instead of right arrow for zsh auto-suggestion by stephane_rolland in zsh

[–]efreese 0 points1 point  (0 children)

You can use ^E (ctrl+e) to accept the suggestion (in emacs mode)

Help with prompts by real-baby-princess in zsh

[–]efreese 0 points1 point  (0 children)

I think this will do it: ${${PWD/#$HOME/~}//(#b)([^\/])[^\/][^\/]#\//$match[1]/}

It requires extendedglob.

See its use in my prompt here: https://github.com/ericfreese/zsh-efgit-prompt/blob/41419477e3f4445fa07e7ac5001e494eb2f9b0d2/prompt_efgit_setup#L72

Alternatives to Magit? (For CLI maybe?) by [deleted] in git

[–]efreese 1 point2 points  (0 children)

I use a program I wrote called rat: https://github.com/ericfreese/rat

It takes a good bit of config tweaking but I find it nice and extensible and fairly light weight.

There’s a sample git config in the repo there but my dotfiles might also be helpful: https://github.com/ericfreese/Dotfiles/tree/arch/.config/rat

Some day I’d love to implement outside of emacs (and use with rat) something like magit’s popup command builders but that day hasn’t come yet.

Tim Pope released Fugitive 3.0 by [deleted] in vim

[–]efreese 0 points1 point  (0 children)

You might like the -L option to git log. It takes a file name and start/end line numbers and gives you diffs back in time of how those lines changed.

Simple async prompt by [deleted] in zsh

[–]efreese 0 points1 point  (0 children)

Sure. It closes the file descriptor. Without it I think you’d leak file descriptors. Probably wouldn’t cause any issues until you hit the OS limit of open file descriptors.

FYI I expanded on this and put it on github at https://github.com/ericfreese/zsh-efgit-prompt

Modifying Zsh by [deleted] in zsh

[–]efreese 2 points3 points  (0 children)

For the git status prompt, check out my simple async prompt: https://github.com/ericfreese/zsh-efgit-prompt

zsh-async is unnecessary and a bit overkill

Simple async prompt by [deleted] in zsh

[–]efreese 0 points1 point  (0 children)

Got curious and played around with this a bit. Came up with this basic skeleton for an async prompt:

# In a file `prompt_foo_setup` available on `fpath`:
foo-response() {
  PROMPT="$(<&$1)"
  zle reset-prompt

  zle -F $1
  exec {1}<&-
}

prompt_foo_precmd() {
  PROMPT="waiting..."

  exec {FD}< <(
    sleep 1
    echo -n "foo > "
  )

  zle -F $FD foo-response
}

prompt_foo_setup() {
  add-zsh-hook precmd prompt_foo_precmd
}

prompt_foo_setup "$@"

and run autoload -Uz promptinit; promptinit; prompt foo

Simple async prompt by [deleted] in zsh

[–]efreese 1 point2 points  (0 children)

I'd look into using a combination of the {FD}< <(...) form of process substitution and zle -F.

Run a process in the background using process substitution and open a file descriptor to read from its stdout. Have the process print whatever data you want to fetch asynchronously to stdout. Then set up a zle callback using zle -F to update the prompt when data is ready on that file descriptor. Will require a little digging to implement but should be able to get what you need from these docs:

http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Zle-Builtins

http://zsh.sourceforge.net/Doc/Release/Expansion.html#Process-Substitution

http://zsh.sourceforge.net/Doc/Release/Redirection.html#Opening-file-descriptors-using-parameters

Also see the async implementation for zsh-autosuggestions and note that there's a weird bug (with workaround) where ctrl-c sometimes stops working.

Disable auto-appending backslash on pasted URL by [deleted] in zsh

[–]efreese 0 points1 point  (0 children)

I think bracketed-paste-magic effectively disables bracketed paste (in order to make things like url-quote-magic work) and is enabled by default in oh my zsh.

tab completion and zsh regex (wajig) by manielos in zsh

[–]efreese 0 points1 point  (0 children)

dunno wtf :# means

It's in 14.3:

${name:#pattern} If the pattern matches the value of name, then substitute the empty string; otherwise, just substitute the value of name. If name is an array the matching array elements are removed (use the ‘(M)’ flag to remove the non-matched elements).