Compare commits

..

12 Commits

Author SHA1 Message Date
24f67e2676 set dap-python path to use system python 2025-03-18 13:09:52 -05:00
373cbf1815 update lldb path? 2025-03-18 12:22:45 -05:00
71bf667d83 remove redundant file 2025-03-18 12:11:59 -05:00
86428c0a28 still mapping issues 2025-03-18 12:09:33 -05:00
f5612d98c5 change buffernext/prev binds 2025-03-18 12:05:51 -05:00
3c7ac8bf4e add debug keymaps 2025-03-18 11:58:38 -05:00
594ead9898 separate config into files 2025-03-18 11:45:00 -05:00
469864dd50 change deprecated settings 2025-03-18 11:30:16 -05:00
31fabb6b78 adding debugging 2025-03-18 11:25:59 -05:00
65d54f0c2e adding debugging 2025-03-18 11:06:10 -05:00
3d764647bd add glsl to treesitter 2025-03-17 22:54:09 -05:00
149b02f6a1 add glsl support 2025-03-17 22:42:58 -05:00
7 changed files with 526 additions and 281 deletions

View File

@@ -1,6 +0,0 @@
{
plugins = {
bufferline.enable = true;
web-devicons.enable = true;
};
}

43
config/cmp.nix Normal file
View File

@@ -0,0 +1,43 @@
{ ... }: {
plugins = {
cmp-nvim-lsp.enable = true;
cmp = {
enable = true;
autoEnableSources = true;
settings = {
sources = [
{ name = "nvim_lsp"; }
{ name = "path"; }
{ name = "buffer"; }
{ name = "luasnip"; }
# { name = "cmdline"; }
];
completion = {
completeopt = "menu,menuone,noinsert";
};
mapping = {
"<C-n>" = "cmp.mapping.select_next_item()";
"<C-p>" = "cmp.mapping.select_prev_item()";
"<C-y>" = "cmp.mapping.confirm({ select = true })";
"<C-Space>" = "cmp.mapping.complete()";
"<C-e>" = "cmp.mapping.abort()";
"<C-b>" = "cmp.mapping.scroll_docs(-4)";
"<C-f>" = "cmp.mapping.scroll_docs(4)";
};
snippet.expand = ''
function(args)
require("luasnip").lsp_expand(args.body)
end
'';
};
};
};
}

116
config/dap.nix Normal file
View File

@@ -0,0 +1,116 @@
{ lib, pkgs, ... }: {
plugins = {
dap = {
enable = true;
adapters = {
executables = {
lldb = {
command = lib.getExe' pkgs.lldb "lldb-dap";
};
};
servers = {
codelldb = {
port = 13000;
executable = {
command = "${pkgs.vscode-extensions.vadimcn.vscode-lldb}/share/vscode/extensions/vadimcn.vscode-lldb/adapter/codelldb";
args = [
"--port"
"13000"
];
};
};
};
};
configurations = let
codelldb-config = {
name = "Launch (CodeLLDB)";
type = "codelldb";
request = "launch";
program.__raw = ''
function()
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. '/', "file")
end
'';
cwd = ''''${workspaceFolder}'';
stopOnEntry = false;
};
lldb-config = {
name = "Launch (LLDB)";
type = "lldb";
request = "launch";
program.__raw = ''
function()
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. '/', "file")
end'';
cwd = ''''${workspaceFolder}'';
stopOnEntry = false;
};
in {
c = [ lldb-config ];
cpp =
[ lldb-config ]
++ lib.optionals pkgs.stdenv.isLinux [
codelldb-config
];
rust =
[ lldb-config ]
++ lib.optionals pkgs.stdenv.isLinux [
codelldb-config
];
};
};
dap-ui = {
enable = true;
# Set icons to characters that are more likely to work in every terminal.
# Feel free to remove or use ones that you like more! :)
# Don't feel like these are good choices.
settings = {
icons = {
expanded = "";
collapsed = "";
current_frame = "*";
};
controls = {
icons = {
pause = "";
play = "";
step_into = "";
step_over = "";
step_out = "";
step_back = "b";
run_last = "";
terminate = "";
disconnect = "";
};
};
};
};
dap-virtual-text.enable = true;
# Add debuggers here
dap-python = {
enable = true;
adapterPythonPath = "python";
};
dap-lldb = {
enable = true;
settings.codelldb_path = "${pkgs.vscode-extensions.vadimcn.vscode-lldb}/share/vscode/extensions/vadimcn.vscode-lldb/adapter/codelldb";
};
};
}

View File

@@ -1,190 +1,18 @@
{ pkgs, opts, ... }: { { pkgs, opts, ... }: {
# Import all your configuration modules here # Import all your configuration modules here
imports = [ ./bufferline.nix ]; imports = [
./cmp.nix
plugins = { ./dap.nix
./lsp.nix
lualine.enable = true; ./plugins.nix
./keymaps.nix
luasnip.enable = true;
barbar.enable = true;
nvim-tree.enable = true;
noice.enable = true;
mini.enable = true;
notify.enable = true;
telescope.enable = true;
treesitter.enable = true;
render-markdown.enable = true;
web-devicons.enable = true;
cmp-nvim-lsp.enable = true;
lsp = {
enable = true;
servers = {
#js/typescript
ts_ls.enable = true;
#c/c++
ccls.enable = true;
#nix
nil_ls.enable = true;
#python
pyright.enable = true;
#bash
bashls.enable = true;
#css
cssls.enable = true;
};
keymaps = {
# Diagnostic keymaps
diagnostic = {
"<leader>q" = {
#mode = "n";
action = "setloclist";
desc = "Open diagnostic [Q]uickfix list";
};
};
extra = [
# Jump to the definition of the word under your cusor.
# This is where a variable was first declared, or where a function is defined, etc.
# To jump back, press <C-t>.
{
mode = "n";
key = "gd";
action.__raw = "require('telescope.builtin').lsp_definitions";
options = {
desc = "LSP: [G]oto [D]efinition";
};
}
# Find references for the word under your cursor.
{
mode = "n";
key = "gr";
action.__raw = "require('telescope.builtin').lsp_references";
options = {
desc = "LSP: [G]oto [R]eferences";
};
}
# Jump to the implementation of the word under your cursor.
# Useful when your language has ways of declaring types without an actual implementation.
{
mode = "n";
key = "gI";
action.__raw = "require('telescope.builtin').lsp_implementations";
options = {
desc = "LSP: [G]oto [I]mplementation";
};
}
# Jump to the type of the word under your cursor.
# Useful when you're not sure what type a variable is and you want to see
# the definition of its *type*, not where it was *defined*.
{
mode = "n";
key = "<leader>D";
action.__raw = "require('telescope.builtin').lsp_type_definitions";
options = {
desc = "LSP: Type [D]efinition";
};
}
# Fuzzy find all the symbols in your current document.
# Symbols are things like variables, functions, types, etc.
{
mode = "n";
key = "<leader>ds";
action.__raw = "require('telescope.builtin').lsp_document_symbols";
options = {
desc = "LSP: [D]ocument [S]ymbols";
};
}
# Fuzzy find all the symbols in your current workspace.
# Similar to document symbols, except searches over your entire project.
{
mode = "n";
key = "<leader>ws";
action.__raw = "require('telescope.builtin').lsp_dynamic_workspace_symbols";
options = {
desc = "LSP: [W]orkspace [S]ymbols";
};
}
]; ];
lspBuf = { extraPackages = with pkgs; [
# Rename the variable under your cursor. coreutils
# Most Language Servers support renaming across files, etc. lldb_18
"<leader>rn" = {
action = "rename";
desc = "LSP: [R]e[n]ame";
};
# Execute a code action, usually your cursor needs to be on top of an error
# or a suggestion from your LSP for this to activate.
"<leader>ca" = {
#mode = "n";
action = "code_action";
desc = "LSP: [C]ode [A]ction";
};
# WARN: This is not Goto Definition, this is Goto Declaration.
# For example, in C this would take you to the header.
"gD" = {
action = "declaration";
desc = "LSP: [G]oto [D]eclaration";
};
};
};
};
cmp = {
enable = true;
autoEnableSources = true;
settings = {
sources = [
{ name = "nvim_lsp"; }
{ name = "path"; }
{ name = "buffer"; }
{ name = "luasnip"; }
# { name = "cmdline"; }
]; ];
completion = {
completeopt = "menu,menuone,noinsert";
};
mapping = {
"<C-n>" = "cmp.mapping.select_next_item()";
"<C-p>" = "cmp.mapping.select_prev_item()";
"<C-y>" = "cmp.mapping.confirm({ select = true })";
"<C-Space>" = "cmp.mapping.complete()";
"<C-e>" = "cmp.mapping.abort()";
"<C-b>" = "cmp.mapping.scroll_docs(-4)";
"<C-f>" = "cmp.mapping.scroll_docs(4)";
};
snippet.expand = ''
function(args)
require("luasnip").lsp_expand(args.body)
end
'';
};
};
};
globals = {
mapleader = " ";
maplocalleader = " ";
};
opts = { opts = {
nu = true; nu = true;
rnu = true; rnu = true;
@@ -204,102 +32,14 @@
incsearch = true; incsearch = true;
}; };
keymaps = [
{
mode = "n";
key = "<leader>ff";
action = "<cmd>Telescope find_files hidden=true<CR>";
}
{
mode = "n";
key = "<leader>fc";
action = "<cmd>Telescope treesitter<CR>";
}
{
mode = "n";
key = "<leader>t";
action = "<cmd>NvimTreeToggle<CR>";
}
{
mode = "n";
key = "<C-.>";
action = "<cmd>BufferNext<CR>";
}
{
mode = "n";
key = "<C-,>";
action = "<cmd>BufferPrevious<CR>";
}
{
mode = "n";
key = "<C-h>";
action = "<cmd>wincmd h<CR>";
}
{
mode = "n";
key = "<C-j>";
action = "<cmd>wincmd j<CR>";
}
{
mode = "n";
key = "<C-k>";
action = "<cmd>wincmd k<CR>";
}
{
mode = "n";
key = "<C-l>";
action = "<cmd>wincmd l<CR>";
}
{
mode = "n";
key = "Q";
action = "<nop>";
}
{
mode = "v";
key = "J";
action = ":m '>+1<CR>gv=gv";
}
{
mode = "v";
key = "K";
action = ":m '<-2<CR>gv=gv";
}
{
mode = "n";
key = "<leader>y";
action = "\"+y";
}
{
mode = "v";
key = "<leader>y";
action = "\"+y";
}
{
mode = "n";
key = "<leader>s";
action = ":%s/\\<<C-r><C-w>\\>/<C-r><C-w>/gI<Left><Left><Left>";
}
];
extraConfigLua = '' extraConfigLua = ''
vim.filetype.add({ vim.filetype.add({
pattern = { [".*/hypr/.*%.conf"] = "hyprlang" }, pattern = { [".*/hypr/.*%.conf"] = "hyprlang" },
}) })
require('dap').listeners.after.event_initialized['dapui_config'] = require('dapui').open
require('dap').listeners.before.event_terminated['dapui_config'] = require('dapui').close
require('dap').listeners.before.event_exited['dapui_config'] = require('dapui').close
''; '';
extraPlugins = with pkgs.vimPlugins; [ extraPlugins = with pkgs.vimPlugins; [
@@ -308,6 +48,8 @@
llm-nvim llm-nvim
nvim-lspconfig nvim-lspconfig
nvim-treesitter-parsers.glsl
]; ];
colorscheme = if opts.pywal then "pywal" else "tokyonight-storm"; colorscheme = if opts.pywal then "pywal" else "tokyonight-storm";

188
config/keymaps.nix Normal file
View File

@@ -0,0 +1,188 @@
{ ... }: {
globals = {
mapleader = " ";
maplocalleader = " ";
};
keymaps = [
{
mode = "n";
key = "<leader>ff";
action = "<cmd>Telescope find_files hidden=true<CR>";
}
{
mode = "n";
key = "<leader>fc";
action = "<cmd>Telescope treesitter<CR>";
}
{
mode = "n";
key = "<leader>t";
action = "<cmd>NvimTreeToggle<CR>";
}
{
mode = "n";
key = "<leader>.";
action = "<cmd>BufferNext<CR>";
}
{
mode = "n";
key = "<leader>,";
action = "<cmd>BufferPrevious<CR>";
}
{
mode = "n";
key = "<C-h>";
action = "<cmd>wincmd h<CR>";
}
{
mode = "n";
key = "<C-j>";
action = "<cmd>wincmd j<CR>";
}
{
mode = "n";
key = "<C-k>";
action = "<cmd>wincmd k<CR>";
}
{
mode = "n";
key = "<C-l>";
action = "<cmd>wincmd l<CR>";
}
{
mode = "n";
key = "Q";
action = "<nop>";
}
{
mode = "v";
key = "J";
action = ":m '>+1<CR>gv=gv";
}
{
mode = "v";
key = "K";
action = ":m '<-2<CR>gv=gv";
}
{
mode = "n";
key = "<leader>y";
action = "\"+y";
}
{
mode = "v";
key = "<leader>y";
action = "\"+y";
}
{
mode = "n";
key = "<leader>s";
action = ":%s/\\<<C-r><C-w>\\>/<C-r><C-w>/gI<Left><Left><Left>";
}
{
mode = "n";
key = "<F5>";
action.__raw = ''
function()
require('dap').continue()
end
'';
options = {
desc = "Debug: Start/Continue";
};
}
{
mode = "n";
key = "<F1>";
action.__raw = ''
function()
require('dap').step_into()
end
'';
options = {
desc = "Debug: Step Into";
};
}
{
mode = "n";
key = "<F2>";
action.__raw = ''
function()
require('dap').step_over()
end
'';
options = {
desc = "Debug: Step Over";
};
}
{
mode = "n";
key = "<F3>";
action.__raw = ''
function()
require('dap').step_out()
end
'';
options = {
desc = "Debug: Step Out";
};
}
{
mode = "n";
key = "<leader>b";
action.__raw = ''
function()
require('dap').toggle_breakpoint()
end
'';
options = {
desc = "Debug: Toggle Breakpoint";
};
}
{
mode = "n";
key = "<leader>B";
action.__raw = ''
function()
require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ')
end
'';
options = {
desc = "Debug: Set Breakpoint";
};
}
# Toggle to see last session result. Without this, you can't see session output
# in case of unhandled exception.
{
mode = "n";
key = "<F7>";
action.__raw = ''
function()
require('dapui').toggle()
end
'';
options = {
desc = "Debug: See last session result.";
};
}
];
}

124
config/lsp.nix Normal file
View File

@@ -0,0 +1,124 @@
{ pkgs, ... }: {
plugins = {
lsp = {
enable = true;
servers = {
#js/typescript
ts_ls.enable = true;
#c/c++
ccls.enable = true;
#nix
nil_ls.enable = true;
#python
pyright.enable = true;
#bash
bashls.enable = true;
#css
cssls.enable = true;
#glsl
glsl_analyzer.enable = true;
};
keymaps = {
# Diagnostic keymaps
diagnostic = {
"<leader>q" = {
#mode = "n";
action = "setloclist";
desc = "Open diagnostic [Q]uickfix list";
};
};
extra = [
# Jump to the definition of the word under your cusor.
# This is where a variable was first declared, or where a function is defined, etc.
# To jump back, press <C-t>.
{
mode = "n";
key = "gd";
action.__raw = "require('telescope.builtin').lsp_definitions";
options = {
desc = "LSP: [G]oto [D]efinition";
};
}
# Find references for the word under your cursor.
{
mode = "n";
key = "gr";
action.__raw = "require('telescope.builtin').lsp_references";
options = {
desc = "LSP: [G]oto [R]eferences";
};
}
# Jump to the implementation of the word under your cursor.
# Useful when your language has ways of declaring types without an actual implementation.
{
mode = "n";
key = "gI";
action.__raw = "require('telescope.builtin').lsp_implementations";
options = {
desc = "LSP: [G]oto [I]mplementation";
};
}
# Jump to the type of the word under your cursor.
# Useful when you're not sure what type a variable is and you want to see
# the definition of its *type*, not where it was *defined*.
{
mode = "n";
key = "<leader>D";
action.__raw = "require('telescope.builtin').lsp_type_definitions";
options = {
desc = "LSP: Type [D]efinition";
};
}
# Fuzzy find all the symbols in your current document.
# Symbols are things like variables, functions, types, etc.
{
mode = "n";
key = "<leader>ds";
action.__raw = "require('telescope.builtin').lsp_document_symbols";
options = {
desc = "LSP: [D]ocument [S]ymbols";
};
}
# Fuzzy find all the symbols in your current workspace.
# Similar to document symbols, except searches over your entire project.
{
mode = "n";
key = "<leader>ws";
action.__raw = "require('telescope.builtin').lsp_dynamic_workspace_symbols";
options = {
desc = "LSP: [W]orkspace [S]ymbols";
};
}
];
lspBuf = {
# Rename the variable under your cursor.
# Most Language Servers support renaming across files, etc.
"<leader>rn" = {
action = "rename";
desc = "LSP: [R]e[n]ame";
};
# Execute a code action, usually your cursor needs to be on top of an error
# or a suggestion from your LSP for this to activate.
"<leader>ca" = {
#mode = "n";
action = "code_action";
desc = "LSP: [C]ode [A]ction";
};
# WARN: This is not Goto Definition, this is Goto Declaration.
# For example, in C this would take you to the header.
"gD" = {
action = "declaration";
desc = "LSP: [G]oto [D]eclaration";
};
};
};
};
};
}

38
config/plugins.nix Normal file
View File

@@ -0,0 +1,38 @@
{ pkgs, ... }: {
plugins = {
lualine.enable = true;
luasnip.enable = true;
barbar.enable = true;
nvim-tree.enable = true;
noice.enable = true;
mini.enable = true;
notify.enable = true;
telescope.enable = true;
treesitter = {
enable = true;
settings = {
highlight.enable = true;
grammarPackages = pkgs.vimPlugins.nvim-treesitter.passthru.allGrammars ++ [
pkgs.vimPlugins.nvim-treesitter-parsers.glsl
];
};
};
render-markdown.enable = true;
web-devicons.enable = true;
bufferline.enable = true;
};
}