mirror of
https://github.com/keanuplayz/dotfiles.git
synced 2024-08-15 02:33:12 +00:00
[zsh] save the real "man" command to history when F1 is pressed
This commit is contained in:
parent
8c65e3b5a3
commit
90c01434ef
3 changed files with 9 additions and 4 deletions
4
scripts/fzf-search-manpage
Executable file
4
scripts/fzf-search-manpage
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
set -eu
|
||||||
|
# https://superuser.com/a/207474
|
||||||
|
apropos . | fzf --no-multi --tiebreak=begin --query="$*" | sed -n 's/^\([^ ]\+\) \?(\([^)]\+\)).*$/\2 \1/p'
|
|
@ -1,4 +1,3 @@
|
||||||
#!/bin/sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
# https://superuser.com/a/207474
|
man $(fzf-search-manpage)
|
||||||
man $(apropos . | fzf --no-multi --tiebreak=begin --query="$*" | sed -n 's/^\([^ ]\+\) \?(\([^)]\+\)).*$/\2 \1/p')
|
|
||||||
|
|
|
@ -154,7 +154,9 @@
|
||||||
local words=("${(@z)BUFFER}")
|
local words=("${(@z)BUFFER}")
|
||||||
local cmd_name="${words[1]}"
|
local cmd_name="${words[1]}"
|
||||||
zle push-line
|
zle push-line
|
||||||
BUFFER="visman ${(q)cmd_name}"
|
local manpage=""
|
||||||
|
manpage="$(fzf-search-manpage "$cmd_name")"
|
||||||
|
BUFFER="man $manpage"
|
||||||
zle accept-line
|
zle accept-line
|
||||||
}
|
}
|
||||||
zle -N find-man-page _widget_find_man_page
|
zle -N find-man-page _widget_find_man_page
|
||||||
|
|
Loading…
Reference in a new issue