feat(nvim): add config
This commit is contained in:
15
nvim/lua/configs/conform.lua
Normal file
15
nvim/lua/configs/conform.lua
Normal file
@@ -0,0 +1,15 @@
|
||||
local options = {
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
-- css = { "prettier" },
|
||||
-- html = { "prettier" },
|
||||
},
|
||||
|
||||
-- format_on_save = {
|
||||
-- -- These options will be passed to conform.format()
|
||||
-- timeout_ms = 500,
|
||||
-- lsp_fallback = true,
|
||||
-- },
|
||||
}
|
||||
|
||||
require("conform").setup(options)
|
||||
57
nvim/lua/configs/dap.lua
Normal file
57
nvim/lua/configs/dap.lua
Normal file
@@ -0,0 +1,57 @@
|
||||
local dap = require("dap")
|
||||
local DEBUGGER_PATH = vim.fn.stdpath('data') .. "/lazy/vscode-js-debug"
|
||||
|
||||
require("dap-vscode-js").setup({
|
||||
-- node_path = "node", -- Path of node executable. Defaults to $NODE_PATH, and then "node"
|
||||
debugger_path = DEBUGGER_PATH, -- Path to vscode-js-debug installation.
|
||||
-- debugger_cmd = { "js-debug-adapter" }, -- Command to use to launch the debug server. Takes precedence over `node_path` and `debugger_path`.
|
||||
adapters = { 'firefox', 'pwa-node', 'pwa-chrome', 'pwa-msedge', 'node-terminal', 'pwa-extensionHost' }, -- which adapters to register in nvim-dap
|
||||
-- log_file_path = "(stdpath cache)/dap_vscode_js.log" -- Path for file logging
|
||||
-- log_file_level = false -- Logging level for output to file. Set to false to disable file logging.
|
||||
-- log_console_level = vim.log.levels.ERROR -- Logging level for output to console. Set to false to disable console output.
|
||||
})
|
||||
|
||||
local js_langs = {
|
||||
"javascript",
|
||||
"typescript",
|
||||
"javascriptreact",
|
||||
"typescriptreact",
|
||||
}
|
||||
|
||||
for _, lang in ipairs(js_langs) do
|
||||
|
||||
dap.configurations[lang] = {
|
||||
{
|
||||
name = 'Next.js: debug server-side',
|
||||
type = "pwa-node",
|
||||
request = "launch",
|
||||
skipFiles = {"<node_internals>/**"},
|
||||
cwd = "${workspaceFolder}",
|
||||
runtimeExecutable = "npm",
|
||||
runtimeArgs = {"run-script", "dev"},
|
||||
},
|
||||
{
|
||||
name = 'Next.js: debug client-side',
|
||||
type = 'pwa-chrome',
|
||||
request = 'launch',
|
||||
url = 'http://localhost:3000',
|
||||
webRoot = '${workspaceFolder}',
|
||||
sourceMaps = true, -- https://github.com/vercel/next.js/issues/56702#issuecomment-1913443304
|
||||
sourceMapPathOverrides = {
|
||||
['webpack://_N_E/*'] = '${webRoot}/*',
|
||||
},
|
||||
},
|
||||
{
|
||||
name = "Next.js: debug full stack",
|
||||
type = "node-terminal",
|
||||
request = "launch",
|
||||
command = "npm run dev",
|
||||
serverReadyAction = {
|
||||
pattern = "- Local:.+(https?://.+)",
|
||||
uriFormat = "%s",
|
||||
action = "debugWithChrome"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end;
|
||||
19
nvim/lua/configs/highlights.lua
Normal file
19
nvim/lua/configs/highlights.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
require "nvim-treesitter.configs".setup {
|
||||
highlight = {
|
||||
enable = true,
|
||||
},
|
||||
playground = {
|
||||
enable = true,
|
||||
}
|
||||
}
|
||||
|
||||
-- require 'colorizer'.setup {
|
||||
-- user_default_options = { names = false },
|
||||
-- filetypes = {
|
||||
-- css = {
|
||||
-- rgb_fn = true;
|
||||
-- names = true;
|
||||
-- }; -- Enable parsing rgb(...) functions in css.
|
||||
-- html = { names = false; } -- Disable parsing "names" like Blue or Gray
|
||||
-- },
|
||||
-- }
|
||||
47
nvim/lua/configs/lazy.lua
Normal file
47
nvim/lua/configs/lazy.lua
Normal file
@@ -0,0 +1,47 @@
|
||||
return {
|
||||
defaults = { lazy = true },
|
||||
install = { colorscheme = { "nvchad" } },
|
||||
|
||||
ui = {
|
||||
icons = {
|
||||
ft = "",
|
||||
lazy = " ",
|
||||
loaded = "",
|
||||
not_loaded = "",
|
||||
},
|
||||
},
|
||||
|
||||
performance = {
|
||||
rtp = {
|
||||
disabled_plugins = {
|
||||
"2html_plugin",
|
||||
"tohtml",
|
||||
"getscript",
|
||||
"getscriptPlugin",
|
||||
"gzip",
|
||||
"logipat",
|
||||
"netrw",
|
||||
"netrwPlugin",
|
||||
"netrwSettings",
|
||||
"netrwFileHandlers",
|
||||
"matchit",
|
||||
"tar",
|
||||
"tarPlugin",
|
||||
"rrhelper",
|
||||
"spellfile_plugin",
|
||||
"vimball",
|
||||
"vimballPlugin",
|
||||
"zip",
|
||||
"zipPlugin",
|
||||
"tutor",
|
||||
"rplugin",
|
||||
"syntax",
|
||||
"synmenu",
|
||||
"optwin",
|
||||
"compiler",
|
||||
"bugreport",
|
||||
"ftplugin",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
9
nvim/lua/configs/lsp.lua
Normal file
9
nvim/lua/configs/lsp.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
callback = function(args)
|
||||
local bufnr = args.buf
|
||||
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||
|
||||
client.server_capabilities.semanticTokensProvider = nil
|
||||
|
||||
end,
|
||||
})
|
||||
24
nvim/lua/configs/lspconfig.lua
Normal file
24
nvim/lua/configs/lspconfig.lua
Normal file
@@ -0,0 +1,24 @@
|
||||
-- load defaults i.e lua_lsp
|
||||
require("nvchad.configs.lspconfig").defaults()
|
||||
|
||||
local lspconfig = require "lspconfig"
|
||||
|
||||
-- EXAMPLE
|
||||
local servers = { "html", "cssls" }
|
||||
local nvlsp = require "nvchad.configs.lspconfig"
|
||||
|
||||
-- lsps with default config
|
||||
for _, lsp in ipairs(servers) do
|
||||
lspconfig[lsp].setup {
|
||||
on_attach = nvlsp.on_attach,
|
||||
on_init = nvlsp.on_init,
|
||||
capabilities = nvlsp.capabilities,
|
||||
}
|
||||
end
|
||||
|
||||
-- configuring single server, example: typescript
|
||||
-- lspconfig.tsserver.setup {
|
||||
-- on_attach = nvlsp.on_attach,
|
||||
-- on_init = nvlsp.on_init,
|
||||
-- capabilities = nvlsp.capabilities,
|
||||
-- }
|
||||
18
nvim/lua/configs/nvim-ts-autotag.lua
Normal file
18
nvim/lua/configs/nvim-ts-autotag.lua
Normal file
@@ -0,0 +1,18 @@
|
||||
require("vim-react-snippets").lazy_load()
|
||||
|
||||
require('nvim-ts-autotag').setup({
|
||||
opts = {
|
||||
-- Defaults
|
||||
enable_close = true, -- Auto close tags
|
||||
enable_rename = true, -- Auto rename pairs of tags
|
||||
enable_close_on_slash = false -- Auto close on trailing </
|
||||
},
|
||||
-- Also override individual filetype configs, these take priority.
|
||||
-- Empty by default, useful if one of the "opts" global settings
|
||||
-- doesn't work well in a specific filetype
|
||||
per_filetype = {
|
||||
["html"] = {
|
||||
enable_close = false
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user