pimp up nvim functionality for other languages (not only Python)

This commit is contained in:
Mathias Schneider
2026-04-07 13:29:31 +02:00
parent e674149cdf
commit d1cab8ceef
6 changed files with 88 additions and 3 deletions
+2 -1
View File
@@ -5,7 +5,8 @@ sudo pacman -S --needed \
fastfetch \
tree-sitter-cli \
ruff \
python-ruff
python-ruff \
chromium
npm install -g vscode-js-debug
npm install -g eslint_d
@@ -11,6 +11,17 @@ return {
"theHamsta/nvim-dap-virtual-text",
dependencies = "mfussenegger/nvim-dap",
},
{
"mxsdev/nvim-dap-vscode-js",
dependencies = {
"mfussenegger/nvim-dap",
{
"microsoft/vscode-js-debug",
version = "1.x",
build = "npm ci --legacy-peer-deps && npx gulp vsDebugServerBundle && mv dist out",
},
},
},
{
"mfussenegger/nvim-dap-python",
dependencies = "mfussenegger/nvim-dap",
@@ -19,6 +30,52 @@ return {
local dapui = require("dapui")
require("dap-python").setup()
-- JavaScript/TypeScript debugging
require("dap-vscode-js").setup({
debugger_path = vim.fn.stdpath("data") .. "/lazy/vscode-js-debug",
adapters = { "pwa-node", "pwa-chrome", "pwa-msedge", "node-terminal", "pwa-extensionHost" },
})
for _, language in ipairs({ "typescript", "javascript", "typescriptreact", "javascriptreact" }) do
dap.configurations[language] = {
{
type = "pwa-node",
request = "launch",
name = "Launch file",
program = "${file}",
cwd = "${workspaceFolder}",
},
{
type = "pwa-node",
request = "attach",
name = "Attach",
processId = require("dap.utils").pick_process,
cwd = "${workspaceFolder}",
},
{
type = "pwa-node",
request = "launch",
name = "Debug Jest Tests",
runtimeExecutable = "node",
runtimeArgs = {
"./node_modules/jest/bin/jest.js",
"--runInBand",
},
rootPath = "${workspaceFolder}",
cwd = "${workspaceFolder}",
console = "integratedTerminal",
internalConsoleOptions = "neverOpen",
},
{
type = "pwa-chrome",
request = "launch",
name = "Launch Chrome",
url = "http://localhost:3000",
webRoot = "${workspaceFolder}",
},
}
end
dapui.setup({
icons = { expanded = "", collapsed = "", current_frame = "" },
mappings = {
@@ -10,7 +10,15 @@ return {
jsx = { "prettier", "eslint" },
typescript = { "prettier", "eslint" },
typescriptreact = { "prettier", "eslint" },
json = { "prettier" },
jsonc = { "prettier" },
html = { "prettier" },
css = { "prettier" },
scss = { "prettier" },
yaml = { "prettier" },
markdown = { "prettier" },
sh = { "shfmt" },
bash = { "shfmt" },
},
format_on_save = {
timeout_ms = 500,
@@ -7,6 +7,12 @@ return {
typescript = { "eslint_d" },
typescriptreact = { "eslint_d" },
python = { "ruff" },
lua = { "selene" },
sh = { "shellcheck" },
bash = { "shellcheck" },
json = { "jsonlint" },
yaml = { "yamllint" },
markdown = { "markdownlint" },
}
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
+1 -1
View File
@@ -4,7 +4,7 @@ return {
config = function()
require("toggleterm").setup({
size = 10,
open_mapping = [[<c-ß>]],
open_mapping = [[<C-ß>]],
hide_numbers = true,
shade_filetypes = {},
shade_terminals = true,
+14 -1
View File
@@ -8,7 +8,20 @@ return {
if ok then
configs.setup({
auto_install = true,
ensure_installed = { "python", "lua", "json", "yaml", "javascript", "typescript" },
ensure_installed = {
"python",
"lua",
"json",
"yaml",
"javascript",
"typescript",
"tsx",
"html",
"css",
"bash",
"markdown",
"markdown_inline",
},
highlight = { enable = true },
indent = { enable = true },
folding = { enable = true },