Skip to content

Commit

Permalink
[Search processes] use clearer ps field names in preview
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickF1 committed Jan 30, 2022
1 parent d86bc56 commit 4f926c3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions functions/_fzf_search_processes.fish
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
function _fzf_search_processes --description "Search all running processes. Replace the current token with the pid of the selected process."
# use all caps to be consistent with ps default format
# snake_case because ps doesn't seem to allow spaces in the field names
set ps_preview_fmt (string join ',' 'pid' 'ppid=PARENT_PID' 'user' '%cpu' 'rss=RSS_IN_KB' 'start=START_TIME' 'command')
set processes_selected (
ps -A -opid,command | \
_fzf_wrapper --multi \
--query (commandline --current-token) \
--ansi \
# first line outputted by ps is "PID COMMAND", so we need to mark that as the header
# first line outputted by ps is a header, so we need to mark it as so
--header-lines=1 \
--preview='ps -o pid,user,ppid,%cpu,rss,time,start,command -p {1}' \
--preview="ps -o '$ps_preview_fmt' -p {1}" \
$fzf_processes_opts
)

Expand Down

0 comments on commit 4f926c3

Please sign in to comment.