nvim: Only use wezterm integration if binary exists
This commit is contained in:
parent
1b5e7e71dd
commit
33f9deda29
1 changed files with 12 additions and 10 deletions
|
@ -1,14 +1,16 @@
|
||||||
(let [wezterm (require :wezterm)
|
(let [wezterm (require :wezterm)
|
||||||
|
wezterm-exists (vim.fn.executable :wezterm)
|
||||||
augroup (vim.api.nvim_create_augroup :NifocWezterm {:clear true})
|
augroup (vim.api.nvim_create_augroup :NifocWezterm {:clear true})
|
||||||
aucmd vim.api.nvim_create_autocmd]
|
aucmd vim.api.nvim_create_autocmd]
|
||||||
(wezterm.setup {:create_commands false})
|
(when (= wezterm-exists 1)
|
||||||
(aucmd :BufEnter {:callback (fn [args]
|
(wezterm.setup {:create_commands false})
|
||||||
(let [path (vim.api.nvim_buf_get_name args.buf)
|
(aucmd :BufEnter {:callback (fn [args]
|
||||||
name (vim.fs.basename path)
|
(let [path (vim.api.nvim_buf_get_name args.buf)
|
||||||
title (if (and name (> (length name) 0))
|
name (vim.fs.basename path)
|
||||||
(.. "nvim " name)
|
title (if (and name (> (length name) 0))
|
||||||
"")]
|
(.. "nvim " name)
|
||||||
(wezterm.set_tab_title title)))
|
"")]
|
||||||
:group augroup})
|
(wezterm.set_tab_title title)))
|
||||||
(aucmd :VimLeavePre {:callback #(wezterm.set_tab_title "") :group augroup}))
|
:group augroup})
|
||||||
|
(aucmd :VimLeavePre {:callback #(wezterm.set_tab_title "") :group augroup})))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue