feat: some shit

This commit is contained in:
2023-08-08 20:56:29 +02:00
parent ae9c44ba6c
commit f0bc628dfc
11 changed files with 106 additions and 158 deletions

View File

@ -79,7 +79,7 @@ autocmd({ "BufWinEnter", "BufAdd" }, {
if vim.bo[opts.buf].filetype == 'NvimTree' or vim.bo[opts.buf].filetype == "neo-tree" then
vim.opt.statuscolumn = ''
else
vim.opt.statuscolumn = [[%!v:lua.Status.column()]]
-- vim.opt.statuscolumn = [[%!v:lua.Status.column()]]
end
end,
})

View File

@ -1,107 +1,61 @@
return {
"mfussenegger/nvim-dap",
dependencies = {
"rcarriga/nvim-dap-ui",
"mxsdev/nvim-dap-vscode-js",
'mfussenegger/nvim-dap',
keys = {
{ '<F5>', ':DapContinue<CR>', desc = 'Debug continue' },
{
'<leader>db',
':DapToggleBreakpoint<CR>',
desc = 'Debug toggle breakpoint',
},
{ '<leader>do', ':DapStepOut<CR>', desc = 'Debug step out' },
{ '<leader>dv', ':DapStepOver<CR>', desc = 'Debug step over' },
{ '<leader>di', ':DapStepInto<CR>', desc = 'Debug step into' },
{ '<leader>dt', ':DapTerminate<CR>', desc = 'Debug terminate' },
},
dependencies = { 'rcarriga/nvim-dap-ui' },
config = function()
require("max.configs.dap")
local dap = require('dap')
local dapui = require('dapui')
local utils = require('dap.utils')
local dap, dapui = require("dap"), require("dapui")
-- Add listeners to automatically open and close dapui
dapui.setup()
dap.listeners.after.event_initialized["dapui_config"] = function()
dap.listeners.after.event_initialized['dapui_config'] = function()
dapui.open({})
end
dap.listeners.before.event_terminated["dapui_config"] = function()
dap.listeners.before.event_terminated['dapui_config'] = function()
dapui.close({})
end
dap.listeners.before.event_exited["dapui_config"] = function()
dap.listeners.before.event_exited['dapui_config'] = function()
dapui.close({})
end
require("dap-vscode-js").setup({
-- node_path = "node", -- Path of node executable. Defaults to $NODE_PATH, and then "node"
-- debugger_path = "(runtimedir)/site/pack/packer/opt/vscode-js-debug", -- 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 = { 'pwa-node', 'pwa-chrome' }, -- which adapters to register in nvim-dap
})
dap.adapters.node2 = {
type = 'executable',
command = 'node',
args = { vim.fn.stdpath "data" .. '/mason/packages/node-debug2-adapter/out/src/nodeDebug.js' },
}
dap.adapters.firefox = {
type = "executable",
command = "node",
options = {
initialize_timeout_sec = 10,
disconnect_timeout_sec = 10,
max_retries = 30,
},
args = { vim.fn.stdpath("data") .. "/mason/packages/firefox-debug-adapter/dist/adapter.bundle.js" },
dap.adapters["pwa-node"] = {
type = "server",
host = "localhost",
port = "${port}",
executable = {
command = "node",
args = { "/home/max/.local/bin/js-debug/src/dapDebugServer.js", "${port}" },
}
}
dap.configurations.typescript = {
{
name = "Debug with Firefox",
type = "firefox",
request = "launch",
reAttach = true,
webRoot = "${workspaceFolder}",
url = "http://localhost:8080",
firefoxExecutable = "/sbin/firefox-developer-edition",
},
{
name = 'Launch',
type = 'node2',
type = 'pwa-node',
request = 'launch',
program = '${file}',
cwd = vim.fn.getcwd(),
sourceMaps = true,
protocol = 'inspector',
console = 'integratedTerminal',
},
{
-- For this to work you need to make sure the node process is started with the `--inspect` flag.
name = 'Attach to process',
type = 'node2',
request = 'attach',
sourceMaps = true,
name = "Launch debug task",
runtimeExecutable = "deno",
runtimeArgs = {
"task",
"debug",
},
cwd = "${workspaceFolder}",
processId = require 'dap.utils'.pick_process,
},
{
type = "pwa-node",
request = "attach",
name = "Attach",
processId = require 'dap.utils'.pick_process,
cwd = "${workspaceFolder}",
}
}
dap.configurations.typescriptreact = {
{
name = 'debug with firefox',
type = 'firefox',
request = 'launch',
reattach = true,
url = 'http://localhost:4200',
webRoot = '/home/max/Projects/ruumio/main/apps/events-standalone/',
firefoxExecutable = '/home/max/Downloads/firefox/firefox'
},
{
name = 'debug with chrome',
type = 'pwa-chrome',
request = 'launch',
reattach = true,
url = 'http://localhost:4200',
webroot = '${workspacefolder}',
runtimeExecutable = '/mnt/c/Program Files/Google/Chrome/Application/chrome.exe'
attachSimplePort = 9229,
},
}
dap.configurations.javascript = dap.configurations.typescript;
vim.keymap.set('n', '<leader>dc', dapui.close, { desc = 'Dapui close' })
end,
}

View File

@ -45,11 +45,11 @@ return {
if client.name == 'denols' then
for _, client_ in pairs(active_clients) do
-- stop tsserver if denols is already active
if client_.name == 'tsserver' then
if client_.name == 'tsserver' or client_.name == "typescript-tools" then
client_.stop()
end
end
elseif client.name == 'tsserver' then
elseif client.name == 'tsserver' or client.name == "typescript-tools" then
for _, client_ in pairs(active_clients) do
-- prevent tsserver from starting if denols is already active
if client_.name == 'denols' then

View File

@ -2,6 +2,9 @@ return {
"glepnir/lspsaga.nvim",
event = "BufRead",
opts = {
lightbulb = {
enable = false,
},
symbol_in_winbar = {
enable = false,
},

View File

@ -0,0 +1,23 @@
return {
"luukvbaal/statuscol.nvim",
lazy = false,
config = function()
local builtin = require("statuscol.builtin")
require("statuscol").setup({
--configuration goes here, for example:
relculright = false,
segments = {
{ text = { builtin.foldfunc }, click = "v:lua.ScFa" },
{
sign = { name = { "Diagnostic" }, maxwidth = 2, auto = true },
click = "v:lua.ScSa"
},
{ text = { builtin.lnumfunc }, click = "v:lua.ScLa", },
{
sign = { name = { ".*" }, maxwidth = 2, colwidth = 1, auto = true, wrap = true },
click = "v:lua.ScSa"
},
}
})
end,
}

View File

@ -1,2 +1 @@
require("max.plugins.theme.statuscolumn")
return require("max.plugins.theme.catpuccin");

View File

@ -1,32 +0,0 @@
local M = {}
_G.Status = M
---@return {name:string, text:string, texthl:string}[]
function M.get_signs()
local buf = vim.api.nvim_win_get_buf(vim.g.statusline_winid)
return vim.tbl_map(function(sign)
return vim.fn.sign_getdefined(sign.name)[1]
end, vim.fn.sign_getplaced(buf, { group = "*", lnum = vim.v.lnum })[1].signs)
end
function M.column()
local sign, git_sign
for _, s in ipairs(M.get_signs()) do
if s.name:find("GitSign") then
git_sign = s
else
sign = s
end
end
local components = {
sign and ("%#" .. sign.texthl .. "#" .. sign.text .. "%*") or " ",
[[%=]],
[[%{&nu?(&rnu&&v:relnum?v:relnum:v:lnum):''} ]],
git_sign and ("%#" .. git_sign.texthl .. "#" .. git_sign.text .. "%*") or " ",
}
return table.concat(components, "")
end
vim.opt.statuscolumn = [[%!v:lua.Status.column()]]
return M

View File

@ -1,6 +1,7 @@
return {
"pmizio/typescript-tools.nvim",
ft = { "typescript", "typescriptreact" },
enabled = false,
dependencies = { "nvim-lua/plenary.nvim", "neovim/nvim-lspconfig" },
opts = {},
}