Skip to content
This repository has been archived by the owner on Aug 20, 2023. It is now read-only.

Commit

Permalink
debugging init
Browse files Browse the repository at this point in the history
  • Loading branch information
siph committed Mar 2, 2023
1 parent 84d1446 commit 339cf51
Show file tree
Hide file tree
Showing 7 changed files with 171 additions and 14 deletions.
51 changes: 51 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,22 @@
url = "github:weirongxu/plantuml-previewer.vim";
flake = false;
};

# Debugging
nvim-dap = {
url = "github:mfussenegger/nvim-dap";
flake = false;
};

nvim-dap-ui = {
url = "github:rcarriga/nvim-dap-ui";
flake = false;
};

telescope-dap = {
url = "github:nvim-telescope/telescope-dap.nvim";
flake = false;
};
};

outputs = {
Expand Down Expand Up @@ -359,6 +375,7 @@
};
vim.telescope = {
enable = true;
dap = true;
};
vim.markdown = {
enable = true;
Expand All @@ -369,6 +386,10 @@
gitsigns.enable = true;
};
vim.plantuml.enable = true;
vim.debugging = {
enable = false;
ui = false;
};
};
};

Expand Down
10 changes: 10 additions & 0 deletions modules/debugging/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
config,
lib,
pkgs,
...
}: {
imports = [
./nvim-dap.nix
];
}
50 changes: 50 additions & 0 deletions modules/debugging/nvim-dap.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.debugging;
in {
options.vim.debugging = {
enable = mkOption {
default = false;
type = types.bool;
description = "enable debugging with nvim-dap";
};

ui = mkOption {
default = false;
type = types.bool;
description = "enable better debugging interface";
};
};

config = mkIf cfg.enable (
let
writeIf = cond: msg:
if cond
then msg
else "";
in {
vim.startPlugins = [
"nvim-dap"
(
if cfg.ui
then "nvim-dap-ui"
else null
)
];
vim.luaConfigRC.debugging = nvim.dag.entryAnywhere ''
-- Nvim-Dap config
local dap = require("dap")
${writeIf cfg.ui ''
-- Nvim-Dap-Ui config
require("dapui").setup {}
''}
'';
}
);
}
3 changes: 3 additions & 0 deletions modules/lib/types-plugin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ with lib; let
"nvim-code-action-menu"
"nvim-compe"
"nvim-cursorline"
"nvim-dap"
"nvim-dap-ui"
"nvim-lightbulb"
"nvim-lspconfig"
"nvim-tree-lua"
Expand All @@ -41,6 +43,7 @@ with lib; let
"rust-tools"
"sqls-nvim"
"telescope"
"telescope-dap"
"tokyonight"
"trouble"
"vim-vsnip"
Expand Down
25 changes: 13 additions & 12 deletions modules/modules.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,25 @@
check ? true,
}: let
modules = [
./autopairs
./basic
./completion
./theme
./core
./basic
./statusline
./tabline
./debugging
./filetree
./visuals
./lsp
./treesitter
./tidal
./autopairs
./snippets
./git
./keys
./lsp
./markdown
./telescope
./git
./plantuml
./snippets
./statusline
./tabline
./telescope
./theme
./tidal
./treesitter
./visuals
];

pkgsModule = {config, ...}: {
Expand Down
25 changes: 23 additions & 2 deletions modules/telescope/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,27 @@ with builtins; let
in {
options.vim.telescope = {
enable = mkEnableOption "enable telescope";
dap = mkOption {
default = false;
type = types.bool;
description = "enable telescope-dap";
};
};

config = mkIf (cfg.enable) {
config = mkIf cfg.enable (
let
writeIf = cond: msg:
if cond
then msg
else "";
in {
vim.startPlugins = [
"telescope"
(
if cfg.dap
then "telescope-dap"
else null
)
];

vim.nnoremap =
Expand Down Expand Up @@ -72,6 +88,11 @@ in {
},
}
}
${writeIf cfg.dap ''
-- Debugging extension
require("telescope").load_extension("dap")
''}
'';
};
}
);
}

0 comments on commit 339cf51

Please sign in to comment.