Set window title in Neovim, unset in Zsh preprompt

This commit is contained in:
Leonora Tindall 2024-08-31 18:28:18 -05:00
parent 074b29c7a1
commit 90ac84a759
2 changed files with 27 additions and 0 deletions

View File

@ -36,6 +36,27 @@ vim.keymap.set('n', '<leader>fb', tbuiltin.buffers, {})
vim.keymap.set('n', '<leader>fh', tbuiltin.help_tags, {})
vim.keymap.set('n', '<leader>fs', tbuiltin.spell_suggest, {})
-- set terminal title
function _G.current_tab()
local curr_buf = vim.fn.bufnr()
local total = 0
local curr_tab
for i = 1, vim.fn.tabpagenr('$') do
total = total + 1
for _, bufnr in ipairs(vim.fn.tabpagebuflist(i)) do
if bufnr == curr_buf then
curr_tab = i
end
end
end
return string.format('(%d of %d)', curr_tab, total)
end
vim.opt.title = true
vim.opt.titlestring = [[%f %h%m%r%w - %{v:progname} %{luaeval('current_tab()')}]]
-- vimsense (rich presence) options
vim.g.vimsense_small_text = "NeoVim"
vim.g.vimsense_small_image = "neovim"

View File

@ -21,6 +21,12 @@
fi
export NOTESDIR="$HOME/Notes"
export PATH="$HOME/.bin:$HOME/.local/bin:$NOTESDIR/bin:$PATH"
function set_win_title(){
echo -ne "\033]0;\007"
}
precmd_functions+=(set_win_title)
fortune
'';
};