Skip to content

Commit

Permalink
config_terminal_tmux: finally fix less prompt for fdfind/locate short…
Browse files Browse the repository at this point in the history
…cuts

Had the escaping wrong..

Original definition of less' prompt in less/prompt.c (last modified 21 years ago):
> 45 static constant char M_proto[] =
> 46   "?f%f .?n?m(%T %i of %m) ..?ltlines %lt-%lb?L/%L. :byte %bB?s/%s. .?e(END) ?x- Next\\: %x.:?pB%pB\\%..%t";

& 🎉 KUDOS @ Mark!
> Copyright (C) 1984-2023  Mark Nudelman
thanks for maintaining this crucial piece of free
open source software for as long as I live..
  • Loading branch information
eMPee584 committed Oct 9, 2023
1 parent b7d90ad commit 8e4709f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ bind-key . set-window-option remain-on-exit\; display-message "remain-on-exit is
bind-key \; split-window -l 1 "chvt 1"
bind-key t split-window -p 80 -c "#{pane_current_path}" 'tmux-pane-wrap tig --all'
bind-key T new-window -c "#{pane_current_path}" "tree-less -f"
bind-key f command-prompt -p "fdfind --no-ignore --hidden --full-path:" "new-window -c '#{pane_current_path}' -n find(%1) '{ lstrail .; echo; fd --no-ignore --hidden -X ls --color=always -ladh {} \\; %1; }|&less -SRiM~ --shift 1 -PM\"find %1: ?f%%f .?n?m(file %%i of %%m) ..?ltlines %%lt-%%lb?L/%%L.:byte %%bB?s/%%s. .?e(END) ?x- Next\: %%x.:?pB%%pB\%..%%t\"'"
bind-key f command-prompt -p "fdfind --no-ignore --hidden --full-path:" "new-window -c '#{pane_current_path}' -n fdfind(%1) '{ lstrail .; echo; fdfind --no-ignore --hidden -X ls --color=always -ladh {} \\; %1; }|&less -SRiM~ --shift 1 -PM\"fdfind %1\\: ?f%f .?n?m(%T %i of %m) ..?ltlines %lt-%lb?L/%L. :byte %bB?s/%s. .?e(END) ?x- Next\\: %x.:?pB%pB\\%..%t\"'"
bind-key F command-prompt -p "tail -F:" "new-window -n \"%1\" 'ls --color=auto -Flah --time-style=+\" %^a %F %R\" \"%1\"; tail --lines=45 -F \"%%\"|ccze -A -o nolookups'"
bind-key C-F command-prompt -p "log navigator:" "new-window -n \"%1\" 'lnav \"%1\"'"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# TODO: better document each line (some black magic and lots of dependencies in here)

# a nicer locate that sends it's files to ls -lah, with colors
bind-key a command-prompt -p "allilocate (* = wildcard):" "split-window -p 60 'source /etc/profile.d/less-termcaps.sh && eval $(dircolors -b /etc/DIR_COLORS) && locate -0i \"*%%*\" | xargs -0r ls -lahd --color=always --time-style=+\"%a %F %R\"|& less -SRiM~ --shift 1 -PM\"locate -i %1: ?f%%f .?n?m(file %%i of %%m) ..?ltlines %%lt-%%lb?L/%%L.:byte %%bB?s/%%s. .?e(END) ?x- Next\: %%x.:?pB%%pB\%..%%t\"'"
bind-key a command-prompt -p "locate -i (* = wildcard):" "split-window -p 60 'source /etc/profile.d/less-termcaps.sh && eval $(dircolors -b /etc/DIR_COLORS) && locate -0i \"*%1*\" | xargs -0r ls -lahd --color=always --time-style=+\"%a %F %R\"|& less -SRiM~ --shift 1 -PM\"locate -i %1\\: ?f%f .?n?m(%T %i of %m) ..?ltlines %lt-%lb?L/%L. :byte %bB?s/%s. .?e(END) ?x- Next\\: %x.:?pB%pB\\%..%t\"'"

# read manuals
bind-key m command-prompt -p "man:" "split-window -c '#{pane_current_path}' -p 90 'source /etc/profile.d/less-termcaps.sh && LESS=\"-SRiMJj.2~ --shift 5\" man %1 || read -n1'; select-pane -T 'manual(%1)'"
Expand Down

0 comments on commit 8e4709f

Please sign in to comment.