File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -6,13 +6,13 @@ autocmd BufEnter,BufFilePost * call s:update_document(0)
6
6
" these events might change the nature of the file,
7
7
" so we try to refresh its icon
8
8
autocmd BufWritePost ,FileChangedShellPost ,ShellCmdPost * call s: update_document (1 )
9
- autocmd VimLeave * call s: set_osc6 (' ' )
9
+ autocmd VimLeave * call s: set_osc (' ' )
10
10
11
11
function ! s: update_document (refresh)
12
12
let path = expand (' %:p' )
13
13
if empty (path ) || ! filereadable (path )
14
14
" unnamed/unsaved file being edited
15
- call s: set_osc6 (' ' )
15
+ call s: set_osc (' ' )
16
16
else
17
17
let path = s: urlencode (path )
18
18
if a: refresh
@@ -21,14 +21,18 @@ function! s:update_document(refresh)
21
21
" reference to the same file
22
22
" (better than the flickering that happens when we temporarily set
23
23
" to empty)
24
- call s: set_osc6 (' file://' . path )
24
+ call s: set_osc (' file://localhost ' . path )
25
25
endif
26
- call s: set_osc6 (' file://' . hostname () . path )
26
+ call s: set_osc (' file://' . hostname () . path )
27
27
endif
28
28
endfunction
29
29
30
- function ! s: set_osc6 (pt )
31
- call system (' printf "\e]6;%s\a" >/dev/tty ' . shellescape (a: pt ))
30
+ function ! s: set_osc (pt )
31
+ let osc = ' 6'
32
+ if &term == ' xterm-ghostty'
33
+ let osc = ' 7'
34
+ endif
35
+ call system (' printf "\e]' . osc . ' ;%s\a" >/dev/tty ' . shellescape (a: pt ))
32
36
endfunction
33
37
34
38
You can’t perform that action at this time.
0 commit comments