-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathminimal.lua
More file actions
111 lines (106 loc) · 2.89 KB
/
Copy pathminimal.lua
File metadata and controls
111 lines (106 loc) · 2.89 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
vim.g.mapleader = " "
vim.g.maplocalleader = "\\"
require("lazy").setup({
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
event = { "BufReadPost", "BufNewFile" },
dependencies = {
"nvim-treesitter/nvim-treesitter-textobjects",
},
opts = {
context_commentstring = {
enable = true,
},
ignore_install = { "help" },
ensure_installed = {
"astro",
"html",
"javascript",
"lua",
"tsx",
"typescript",
},
auto_install = true,
indent = {
enable = true,
},
},
config = function(_, opts)
require("nvim-treesitter.configs").setup(opts)
-- Detect astro files and set filetype
vim.api.nvim_create_autocmd("BufEnter", {
pattern = { "*.astro" },
callback = function()
vim.cmd([[ set filetype=astro ]])
end,
})
-- Detect jsx files and set filetype to javascript
vim.api.nvim_create_autocmd("BufEnter", {
pattern = { "*.jsx" },
callback = function()
vim.cmd([[set filetype=javascript]])
end,
})
end,
{
"williamboman/mason.nvim",
build = ":MasonUpdate", -- :MasonUpdate updates registry contents
config = function()
require("mason").setup({})
end,
},
{
"williamboman/mason-lspconfig.nvim",
config = function()
require("mason-lspconfig").setup({
ensure_installed = { "emmet_ls", "ts_ls" },
automatic_installation = true,
})
end,
},
{
"saghen/blink.cmp",
version = "*",
opts = {},
},
{
"neovim/nvim-lspconfig",
config = function()
local capabilities = require("blink.cmp").get_lsp_capabilities()
local lspconfig = require("lspconfig")
local root_pattern = require("lspconfig").util.root_pattern
lspconfig.emmet_ls.setup({
filetypes = { "html", "css", "javascriptreact", "typescriptreact", "vue", "php" },
capabilities = capabilities,
})
lspconfig.ts_ls.setup({
filetypes = {
"javascript",
"javascriptreact",
"javascript.jsx",
"typescript",
"typescriptreact",
"typescript.tsx",
},
cmd = { "typescript-language-server", "--stdio" },
root_dir = root_pattern("package.json", "tsconfig.json", "jsconfig.json", "index.js", "app.js"),
capabilities = capabilities,
})
end,
},
})