Skip to content

Commit

Permalink
refactor(scripts/ton): get pid of nvim and parent process in outer fo…
Browse files Browse the repository at this point in the history
…r loop (#4)

Co-authored-by: kenkone-evan <evan.wu@kenkone.com>
  • Loading branch information
evanhongo and kenkone-evan authored Jan 5, 2024
1 parent 36b18c0 commit 676e35b
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions scripts/ton
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,15 @@ for pane in "${panes[@]}"; do
id=${pane_ids[0]}
pid=${pane_ids[1]}

for sock in "${LISTEN_SOCKS[@]}"; do

# Get pid of nvim process
cpid=$(pgrep -P "$pid" nvim)
ppid=0
if [ $cpid ]; then
# Get pid of nvim parent process
ppid=$(pgrep -P "$cpid" nvim)
fi
# Get pid of nvim process
cpid=$(pgrep -P "$pid" nvim)
ppid=0
if [ $cpid ]; then
# Get pid of nvim parent process
ppid=$(pgrep -P "$cpid" nvim)
fi

for sock in "${LISTEN_SOCKS[@]}"; do
if [[ $sock == *$cpid* ]] || [[ $sock == *$ppid* ]]; then
# Open on remote!
nvim --server "$sock" --remote-send "<esc>$OPEN_STRATEGY $FILE<cr>"
Expand Down

0 comments on commit 676e35b

Please sign in to comment.