Skip to content

Commit 066713f

Browse files
committed
fix(yazi): now powershell can be open inside bracket directory e.g. [directory]
1 parent d626ccb commit 066713f

2 files changed

Lines changed: 15 additions & 15 deletions

File tree

yazi/keymap.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ prepend_keymap = [
3131
{ on = [ "f", "z" ], run = "find_do '^z' --smart", desc = "find ^z" },
3232

3333
# Filter
34-
{ on = [ "F" ], run = """ filter --smart """, desc = "Filter" },
35-
{ on = [ "g", "d" ], run = """ cd ~/Documents """, desc = "Goto ~/Documents" },
36-
{ on = [ "g", "D" ], run = """ cd ~/Downloads """, desc = "Goto ~/Downloads" },
37-
{ on = [ "g", "r" ], run = """ shell -- ya emit cd "$(git rev-parse --show-toplevel)" """, for = "unix", desc = "Goto git root" },
38-
{ on = [ "g", "r" ], run = """ shell -- powershell -c "ya emit cd $(git rev-parse --show-toplevel)" """, for = "windows", desc = "Goto git root" }, # bracket e.g. [directory] and whitespaces e.g. /direc tory/ supported
39-
{ on = [ "i" ], run = """ shell --block -- bat --paging always --wrap never "$@" """, for = "unix", desc = "Bat open selected" },
40-
{ on = [ "i" ], run = """ shell --block -- bat --paging always --wrap never %* """, for = "windows", desc = "Bat open selected" },
34+
{ on = [ "F" ], run = """ filter --smart """, desc = "Filter" },
35+
{ on = [ "g", "d" ], run = """ cd ~/Documents """, desc = "Goto ~/Documents" },
36+
{ on = [ "g", "D" ], run = """ cd ~/Downloads """, desc = "Goto ~/Downloads" },
37+
{ on = [ "g", "r" ], run = """ shell -- ya emit cd "$(git rev-parse --show-toplevel)" """, for = "unix", desc = "Goto git root" },
38+
{ on = [ "g", "r" ], run = """ shell -- powershell -noprofile -c "ya emit cd $(git -C %CD% rev-parse --show-toplevel)" """, for = "windows", desc = "Goto git root" }, # bracket e.g. [directory] and whitespaces e.g. /direc tory/ supported
39+
{ on = [ "i" ], run = """ shell --block -- bat --paging always --wrap never "$@" """, for = "unix", desc = "Bat open selected" },
40+
{ on = [ "i" ], run = """ shell --block -- bat --paging always --wrap never %* """, for = "windows", desc = "Bat open selected" },
4141

4242
# Navigation
4343
{ on = [ "J" ], run = "seek 1", desc = "preview down 3 lines" },
@@ -104,7 +104,7 @@ on = [ "s", "S" ]
104104
run = '''
105105
shell
106106
--block
107-
-- powershell -noexit -c "set-psreadlineoption -editmode vi; function y() { yazi $PWD --cwd-file=$HOME/.yazi; cd $(cat $HOME/.yazi); };"
107+
-- powershell -noexit -c " cd $((echo %CD%) -replace '\[', '`[' -replace '\]', '`]'); set-psreadlineoption -editmode vi "
108108
'''
109109
for = "windows"
110110
desc = "powershell" # bracket e.g. [directory] and whitespaces e.g. /direc tory/ supported

yazi/yazi.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ show_symlink = false
66

77
[opener]
88
play = [
9-
{ run = """ "vlc "$@" """, orphan = true, for = "unix" },
10-
{ run = """ "vlc %* """, orphan = true, for = "windows" }
9+
{ run = """ vlc "$@" """, orphan = true, for = "unix" },
10+
{ run = """ vlc %* """, orphan = true, for = "windows" }
1111
]
1212
edit = [
13-
# { run = """ %EDITOR% %* 2>nul || nvim %* & powershell -noprofile -c "$env:YAZI_CMD" """, block = true, desc = "$EDITOR", for = "windows" },
14-
{ run = """ powershell -noprofile -c "try { & $env:EDITOR %* } catch { & nvim %* } $env:YAZI_CMD" """, block = true, desc = "$EDITOR", for = "windows" },
15-
{ run = """ ${EDITOR:-nvim} "$@"; $YAZI_CMD """, block = true, desc = "$EDITOR", for = "unix" },
16-
{ run = """ code %* """, orphan = true, desc = "vscode", for = "windows" },
17-
{ run = """ code "$@" """, orphan = true, desc = "vscode", for = "unix" },
13+
# { run = """ %EDITOR% %* 2>nul || nvim %* & powershell -noprofile -c "try { iex $env:YAZI_CMD } catch { exit 0 }" """, block = true, desc = "$EDITOR", for = "windows" },
14+
{ run = """ powershell -noprofile -c "try { & $env:EDITOR %* } catch { & nvim %* }; try { iex $env:YAZI_CMD } catch { exit 0 }" """, block = true, desc = "$EDITOR", for = "windows" },
15+
{ run = """ ${EDITOR:-nvim} "$@"; $YAZI_CMD """, block = true, desc = "$EDITOR", for = "unix" },
16+
{ run = """ code %* """, orphan = true, desc = "vscode", for = "windows" },
17+
{ run = """ code "$@" """, orphan = true, desc = "vscode", for = "unix" },
1818
]

0 commit comments

Comments
 (0)