Compare commits

...

2 commits

Author SHA1 Message Date
48b93a848e
remove dap 2025-09-25 11:21:07 +08:00
b99f7b5386
update completions logic 2025-09-25 11:20:44 +08:00
6 changed files with 63 additions and 260 deletions

View file

@ -11,15 +11,13 @@
./plugins/collections/mini.nix ./plugins/collections/mini.nix
./plugins/collections/snacks.nix ./plugins/collections/snacks.nix
# LSP and Formatting
./plugins/lsp/conform.nix
./plugins/lsp/lsp.nix
# Completion & AI Assistancee # Completion & AI Assistancee
./plugins/cmp/cmp.nix ./plugins/cmp/cmp.nix
# Debugging (DAP)
./plugins/dap/dap.nix
./plugins/dap/dap-ui.nix
./plugins/dap/dap-virtual-text.nix
./plugins/dap/dap-python.nix
# Editor Enhancements # Editor Enhancements
./plugins/editor/commentary.nix ./plugins/editor/commentary.nix
./plugins/editor/harpoon.nix ./plugins/editor/harpoon.nix
@ -34,10 +32,6 @@
./plugins/ui/web-devicons.nix ./plugins/ui/web-devicons.nix
./plugins/ui/whichkey.nix ./plugins/ui/whichkey.nix
# LSP and Formatting
./plugins/lsp/conform.nix
./plugins/lsp/lsp.nix
# Git Integration # Git Integration
./plugins/git/fugitive.nix ./plugins/git/fugitive.nix
./plugins/git/gitsigns.nix ./plugins/git/gitsigns.nix

View file

@ -6,47 +6,76 @@
# Options provided to the require('cmp').setup function. # Options provided to the require('cmp').setup function.
settings = { settings = {
# Disable autocompletion by default
completion.autocomplete = false;
# The sources to use # The sources to use
sources = [ sources = [
{ # Language Server Protocol # Language Server Protocol
name = "nvim_lsp"; { name = "nvim_lsp"; }
}
{ # Buffer Words # Buffer Words
name = "buffer"; { name = "buffer"; }
}
{ # Filesystem paths # Filesystem paths
name = "path"; { name = "path"; }
}
{ # Markdown # Markdown
name = "render_markdown"; { name = "render_markdown"; }
}
{ # VimTex # VimTex
name = "vimtex"; { name = "vimtex"; }
}
{ # Neorg # Neorg
name = "neorg"; { name = "neorg"; }
}
]; ];
# Key mappings for the completion menu. # Key mappings for the completion menu.
mapping = { mapping = {
"<esc>" = # Confirm candidate on TAB immediately when there's only one completion entry
# Lua "<Tab>" = /* lua */ ''
"cmp.mapping.close()"; cmp.mapping(function(fallback)
"<Down>" = local line, col = unpack(vim.api.nvim_win_get_cursor(0))
# Lua
"cmp.mapping(cmp.mapping.select_next_item({behavior = cmp.SelectBehavior.Select}), {'i', 's'})"; -- When the selection menu is open select the next item
"<Up>" = if cmp.visible() then
# Lua cmp.select_next_item({behavior = cmp.SelectBehavior.Select})
"cmp.mapping(cmp.mapping.select_prev_item({behavior = cmp.SelectBehavior.Select}), {'i', 's'})"; -- Ensure we are mid word
"<cr>" = elseif col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil then
# Lua -- Open the selection menu
"cmp.mapping.confirm({ select = true })"; cmp.complete()
-- Autocomplete when there is only 1 selection available
if #cmp.get_entries() == 1 then
cmp.confirm({ select = true })
end
-- Select the firt item
cmp.select_next_item({behavior = cmp.SelectBehavior.Select})
-- Keep regular functionality of tab
else
fallback()
end
end, {'i', 's'})
'';
# Confirm selection
"<CR>" = /* lua */ ''
cmp.mapping.confirm({ select = true })
'';
# Select the next item in the menu
"<Down>" = /* lua */ ''
cmp.mapping(cmp.mapping.select_next_item({behavior = cmp.SelectBehavior.Select}), {'i', 's'})
'';
# Select the prev item in the menu
"<Up>" = /* lua */ ''
cmp.mapping(cmp.mapping.select_prev_item({behavior = cmp.SelectBehavior.Select}), {'i', 's'})
'';
# Exit the completion menu
"<esc>" = /* lua */ ''
cmp.mapping.close()
'';
}; };
}; };
}; };

View file

@ -1,53 +0,0 @@
{ ... }: {
plugins.dap-python = {
enable = true;
};
keymaps = [
{
mode = ["n" "v"];
key = "<leader>dP";
action = "<NOP>";
options = {
silent = true;
desc = "+python";
};
}
{
mode = ["n"];
key = "<leader>dPm";
action = {
__raw = "require('dap-python').test_method";
};
options = {
silent = true;
desc = "Test method";
};
}
{
mode = ["n"];
key = "<leader>dPc";
action = {
__raw = "require('dap-python').test_class";
};
options = {
silent = true;
desc = "Test Class";
};
}
{
mode = ["v"];
key = "<leader>dPs";
action = {
__raw = "require('dap-python').debug_selection";
};
options = {
silent = true;
desc = "Debug selection";
};
}
];
}

View file

@ -1,19 +0,0 @@
{...}: {
plugins.dap-ui = {
enable = true;
};
keymaps = [
{
mode = ["n"];
key = "<leader>du";
action = {
__raw = "require('dapui').toggle";
};
options = {
silent = true;
desc = "Toggle UI";
};
}
];
}

View file

@ -1,5 +0,0 @@
{ ... }: {
plugins.dap-virtual-text = {
enable = true;
};
}

View file

@ -1,143 +0,0 @@
{...}: {
plugins.dap = {
enable = true;
};
keymaps = [
# Prefix: dap
{
mode = ["n" "v"];
key = "<leader>d";
action = "<NOP>";
options = {
silent = true;
desc = "+dap";
};
}
# Session management:
{
mode = ["n"];
key = "<leader>dc";
action = "<cmd>DapContinue<cr>";
options = {
silent = true;
};
}
{
mode = ["n"];
key = "<leader>dq";
action = "<cmd>DapDisconnect<cr>";
options = {
silent = true;
};
}
{
mode = ["n"];
key = "<leader>dn";
action = "<cmd>DapNew<cr>";
options = {
silent = true;
};
}
{
mode = ["n"];
key = "<leader>dQ";
action = "<cmd>DapTerminate<cr>";
options = {
silent = true;
};
}
# Stepping:
{
mode = ["n"];
key = "<leader>dr";
action = "<cmd>DapRestartFrame<cr>";
options = {
silent = true;
};
}
{
mode = ["n"];
key = "<leader>di";
action = "<cmd>DapStepInto<cr>";
options = {
silent = true;
};
}
{
mode = ["n"];
key = "<leader>dO";
action = "<cmd>DapStepOut<cr>";
options = {
silent = true;
};
}
{
mode = ["n"];
key = "<leader>do";
action = "<cmd>DapStepOver<cr>";
options = {
silent = true;
};
}
{
mode = ["n"];
key = "<leader>dp";
action = "<cmd>DapPause<cr>";
options = {
silent = true;
};
}
# Repl:
{
mode = ["n"];
key = "<leader>dE";
action = "<cmd>DapEval<cr>";
options = {
silent = true;
};
}
{
mode = ["n"];
key = "<leader>dR";
action = "<cmd>DapToggleRepl<cr>";
options = {
silent = true;
};
}
# Breakpoints:
{
mode = ["n"];
key = "<leader>dB";
action = "<cmd>DapClearBreakpoints<cr>";
options = {
silent = true;
};
}
{
mode = ["n"];
key = "<leader>db";
action = "<cmd>DapToggleBreakpoint<cr>";
options = {
silent = true;
};
}
];
}