-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
67 lines (55 loc) · 1.66 KB
/
Copy pathinit.lua
File metadata and controls
67 lines (55 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
-- 1. Set the local leader to comma
-- This makes ,ee, ,eb, etc. work out of the box
vim.g.maplocalleader = ","
vim.g.mapleader = " "
vim.opt.splitbelow = true
require("dex")
-- Keep tabs hidden forever
vim.opt.showtabline = 0
-- Enable terminal title setting (so nvim sends OSC 0 to vterm)
vim.o.title = true
-- Format: filename [modified] - line,column
vim.o.titlestring = "%f %m - %l,%c"
-- Force title update on cursor move (so line/col updates instantly)
vim.api.nvim_create_autocmd("CursorMoved", {
pattern = "*",
callback = function()
vim.o.titlestring = "%f %m - %l,%c"
end,
})
-- Also update title when buffer changes (e.g., :w)
vim.api.nvim_create_autocmd("BufWritePost", {
pattern = "*",
callback = function()
vim.o.titlestring = "%f %m - %l,%c"
end,
})
vim.o.title = true
local function update_title()
local fname = vim.fn.expand("%:t")
if fname == "" then
fname = "[No Name]"
end
local mod = vim.bo.modified and " +" or ""
local line = vim.fn.line(".")
local col = vim.fn.col(".")
vim.o.titlestring = string.format("%s%s - %d,%d", fname, mod, line, col)
end
vim.api.nvim_create_autocmd({ "CursorMoved", "BufWritePost", "BufEnter" }, { callback = update_title })
update_title()
local bars_on = true
function _G.toggle_bars()
if bars_on then
vim.opt.laststatus = 0
bars_on = false
else
-- Only show the bottom bar
vim.opt.laststatus = 3
bars_on = true
end
end
-- hide and unhide status bar bellow
vim.keymap.set("n", "<leader>z", _G.toggle_bars)
-- vim.opt.title = true
-- -- Shows: filename line:column
-- vim.opt.titlestring = "%f %m - %l,%c"