summaryrefslogtreecommitdiffstats
path: root/lua/tjk/misc.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/tjk/misc.lua')
-rw-r--r--lua/tjk/misc.lua29
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