Repository navigation
Expand file tree
/
Copy pathinit.lua
More file actions
58 lines (54 loc) · 1.59 KB
/
Copy pathinit.lua
File metadata and controls
58 lines (54 loc) · 1.59 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
-- Map leader key
require("mapleader")
-- Load Lazy nvim and its plugins first
require("lazynvim")
-- Keymaps
require("keymap")
-- Load vimscript
local current_file = vim.fn.expand("<sfile>")
local current_dir = vim.fn.fnamemodify(current_file, ":p:h")
local scriptPath = current_dir .. "/vimsettings.vim"
-- Show line diagnostics automatically in hover window
vim.o.updatetime = 250
vim.cmd([[autocmd CursorHold,CursorHoldI * lua vim.diagnostic.open_float(nil, {focus=false})]])
vim.cmd("source " .. scriptPath)
vim.filetype.add({
-- Detect and assign filetype based on the extension of the filename
extension = {
mdx = "mdx",
log = "log",
conf = "conf",
env = "dotenv",
},
-- Detect and apply filetypes based on the entire filename
filename = {
[".env"] = "dotenv",
["env"] = "dotenv",
["tsconfig.json"] = "jsonc",
},
-- Detect and apply filetypes based on certain patterns of the filenames
pattern = {
-- INFO: Match filenames like - ".env.example", ".env.local" and so on
["%.env%.[%w_.-]+"] = "dotenv",
},
})
vim.api.nvim_set_hl(0, "NeoTreeGitModified", { fg = "#FA8128", bg = nil, bold = true })
-- Show diagnostic source in virtual text
vim.diagnostic.config({
virtual_text = {
source = true,
format = function(diagnostic)
if diagnostic.user_data and diagnostic.user_data.code then
return string.format("%s %s", diagnostic.user_data.code, diagnostic.message)
else
return diagnostic.message
end
end,
},
signs = true,
float = {
header = "Diagnostics",
source = true,
border = "rounded",
},
})