diff options
| -rw-r--r-- | after/ftplugin/nix.lua (renamed from ftplugin/nix.lua) | 0 | ||||
| -rw-r--r-- | after/ftplugin/sass.lua | 7 | ||||
| l--------- | after/ftplugin/scss.lua | 1 | ||||
| -rw-r--r-- | lua/tjk/misc.lua | 29 |
4 files changed, 23 insertions, 14 deletions
diff --git a/ftplugin/nix.lua b/after/ftplugin/nix.lua index a1371c2..a1371c2 100644 --- a/ftplugin/nix.lua +++ b/after/ftplugin/nix.lua diff --git a/after/ftplugin/sass.lua b/after/ftplugin/sass.lua new file mode 100644 index 0000000..049ac89 --- /dev/null +++ b/after/ftplugin/sass.lua @@ -0,0 +1,7 @@ +-- tabs instead of spaces +vim.opt_local.expandtab = false +--vim.opt_local.cinoptions = true +--vim.opt_local.preserveindent = true +vim.opt_local.softtabstop = 0 +vim.opt_local.shiftwidth = 4 +vim.opt_local.tabstop = 4 diff --git a/after/ftplugin/scss.lua b/after/ftplugin/scss.lua new file mode 120000 index 0000000..a593f83 --- /dev/null +++ b/after/ftplugin/scss.lua @@ -0,0 +1 @@ +sass.lua
\ No newline at end of file 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 |
