diff options
| author | Tim Keller <tjk@tjkeller.xyz> | 2026-09-21 18:25:43 -0500 |
|---|---|---|
| committer | Tim Keller <tjk@tjkeller.xyz> | 2026-09-21 18:25:43 -0500 |
| commit | 4f76a8550fe8a70d75a487d12205885aa72ea49a (patch) | |
| tree | 333a9288332f2818c3ccb8866d2d8dc4c0f186c6 /lua/tjk | |
| parent | 0ed8b1e03c7ffa1dc2a30392b65078606a5c8427 (diff) | |
| download | nvim-4f76a8550fe8a70d75a487d12205885aa72ea49a.tar.xz nvim-4f76a8550fe8a70d75a487d12205885aa72ea49a.zip | |
add user@host marker to statusline in ssh and window title. move tabs options for sass into ftplugin. move ftplugin to after/ftplugin to load and override official ftplugins
Diffstat (limited to 'lua/tjk')
| -rw-r--r-- | lua/tjk/misc.lua | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/lua/tjk/misc.lua b/lua/tjk/misc.lua index 14c5bd8..56ba209 100644 --- a/lua/tjk/misc.lua +++ b/lua/tjk/misc.lua @@ -1,21 +1,22 @@ --- Use tabs instead of spaces for certain filetypes -local tabs_instead_of_spaces_filetypes = { - "sass", - "scss", -} +local user_at_host = vim.uv.os_get_passwd().username .. "@" .. vim.uv.os_gethostname() -local tabs_instead_of_spaces = function(args) - local o = vim.opt_local - o.expandtab = false - --o.cinoptions = true - o.preserveindent = true - o.softtabstop = 0 - o.shiftwidth = 4 - o.tabstop = 4 +-- insert user@host into statusline if running in ssh session +if vim.env.SSH_CONNECTION ~= nil or vim.env.SSH_TTY ~= nil then + local ssh_status = "[" .. user_at_host .. "] " + vim.o.statusline = vim.o.statusline:gsub("%%f", ssh_status .. "%%f", 1) -- before filename end -vim.api.nvim_create_autocmd("FileType", { pattern = tabs_instead_of_spaces_filetypes, callback = tabs_instead_of_spaces }) +-- insert user@host into titlestring +-- builtin titlestring must be reconstructed +function _G.title_flags() + local f = (vim.bo.readonly and "=" or "") .. (vim.bo.modified and "+" or "") + if not vim.bo.modifiable then f = f .. "-" end + return f ~= "" and (" " .. f) or "" +end + +vim.o.titlestring = '%t%{v:lua.title_flags()} (' .. user_at_host .. ' %{expand("%:~:h")}%a) - Nvim' +-- vim.cmd [[ "" Extra functionality |
