worked
This commit is contained in:
parent
cb28a1d6dd
commit
ba3b50e935
7 changed files with 54 additions and 458 deletions
|
|
@ -1,89 +0,0 @@
|
|||
{ inputs, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
inputs.nixvim.homeManagerModules.nixvim
|
||||
./language.nix
|
||||
./running.nix
|
||||
./shortcuts.nix
|
||||
];
|
||||
|
||||
home.packages = [
|
||||
# used by telescope find_files and file_browser
|
||||
pkgs.fd
|
||||
];
|
||||
|
||||
# adds and configures neovim using
|
||||
# https://github.com/nix-community/nixvim
|
||||
# todo: git, zooming in and out,
|
||||
# better indentation,
|
||||
# latex, competative programming, ...
|
||||
|
||||
# These are some misc thingies
|
||||
programs.nixvim = {
|
||||
enable = true;
|
||||
|
||||
withRuby = false;
|
||||
|
||||
colorschemes.onedark = {
|
||||
enable = true;
|
||||
settings.style = "darker";
|
||||
};
|
||||
|
||||
clipboard = {
|
||||
providers.wl-copy.enable = true;
|
||||
};
|
||||
|
||||
opts = {
|
||||
relativenumber = true;
|
||||
number = true; # Display the absolute line number of the current line
|
||||
|
||||
expandtab = true;
|
||||
autoindent = true;
|
||||
shiftwidth = 4;
|
||||
tabstop = 4;
|
||||
};
|
||||
|
||||
# TODO Should be removed when upgrading from 24.05,
|
||||
# see ./language.nix, plugins.lsp.inlayHints
|
||||
package = (import inputs.nixos-unstable { inherit (pkgs) system; }).neovim-unwrapped;
|
||||
|
||||
# TODO enable performance stuff once upgrading 24.05
|
||||
|
||||
plugins = {
|
||||
lualine.enable = true;
|
||||
comment.enable = true;
|
||||
nvim-autopairs.enable = true;
|
||||
diffview.enable = true;
|
||||
neoscroll.enable = true;
|
||||
gitsigns.enable = true;
|
||||
hop.enable = true;
|
||||
|
||||
# Does not exist yet?
|
||||
# guess-indent.enable = true;
|
||||
|
||||
toggleterm = {
|
||||
enable = true;
|
||||
settings = {
|
||||
direction = "horizontal";
|
||||
size = 15;
|
||||
};
|
||||
};
|
||||
|
||||
telescope = {
|
||||
enable = true;
|
||||
|
||||
extensions = {
|
||||
# better selection ui, used for code actions
|
||||
ui-select.enable = true;
|
||||
fzf-native.enable = true;
|
||||
file-browser = {
|
||||
enable = true;
|
||||
settings.hijack_netrw = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,89 +0,0 @@
|
|||
{ inputs, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
inputs.nixvim.homeManagerModules.nixvim
|
||||
./language.nix
|
||||
./running.nix
|
||||
./shortcuts.nix
|
||||
];
|
||||
|
||||
home.packages = [
|
||||
# used by telescope find_files and file_browser
|
||||
pkgs.fd
|
||||
];
|
||||
|
||||
# adds and configures neovim using
|
||||
# https://github.com/nix-community/nixvim
|
||||
# todo: git, zooming in and out,
|
||||
# better indentation,
|
||||
# latex, competative programming, ...
|
||||
|
||||
# These are some misc thingies
|
||||
programs.nixvim = {
|
||||
enable = true;
|
||||
|
||||
withRuby = false;
|
||||
|
||||
colorschemes.onedark = {
|
||||
enable = true;
|
||||
settings.style = "darker";
|
||||
};
|
||||
|
||||
clipboard = {
|
||||
providers.wl-copy.enable = true;
|
||||
};
|
||||
|
||||
opts = {
|
||||
relativenumber = true;
|
||||
number = true; # Display the absolute line number of the current line
|
||||
|
||||
expandtab = true;
|
||||
autoindent = true;
|
||||
shiftwidth = 4;
|
||||
tabstop = 4;
|
||||
};
|
||||
|
||||
# TODO Should be removed when upgrading from 24.05,
|
||||
# see ./language.nix, plugins.lsp.inlayHints
|
||||
package = (import inputs.nixos-unstable { inherit (pkgs) system; }).neovim-unwrapped;
|
||||
|
||||
# TODO enable performance stuff once upgrading 24.05
|
||||
|
||||
plugins = {
|
||||
lualine.enable = true;
|
||||
comment.enable = true;
|
||||
nvim-autopairs.enable = true;
|
||||
diffview.enable = true;
|
||||
neoscroll.enable = true;
|
||||
gitsigns.enable = true;
|
||||
hop.enable = true;
|
||||
|
||||
# Does not exist yet?
|
||||
# guess-indent.enable = true;
|
||||
|
||||
toggleterm = {
|
||||
enable = true;
|
||||
settings = {
|
||||
direction = "horizontal";
|
||||
size = 15;
|
||||
};
|
||||
};
|
||||
|
||||
telescope = {
|
||||
enable = true;
|
||||
|
||||
extensions = {
|
||||
# better selection ui, used for code actions
|
||||
ui-select.enable = true;
|
||||
fzf-native.enable = true;
|
||||
file-browser = {
|
||||
enable = true;
|
||||
settings.hijack_netrw = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,130 +0,0 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
programs.nixvim = {
|
||||
# Automaticly open and close dap-ui
|
||||
extraConfigLuaPost = ''
|
||||
local dap, dapui = require("dap"), require("dapui")
|
||||
dap.listeners.before.attach.dapui_config = dapui.open
|
||||
dap.listeners.before.launch.dapui_config = dapui.open
|
||||
dap.listeners.before.event_terminated.dapui_config = dapui.close
|
||||
dap.listeners.before.event_exited.dapui_config = dapui.close
|
||||
'';
|
||||
|
||||
|
||||
plugins = {
|
||||
|
||||
competitest = {
|
||||
enable = true;
|
||||
settings = {
|
||||
template_file.cpp = "${./cp-template.cpp}";
|
||||
evaluate_template_modifiers = true;
|
||||
date_format = "%Y-%m-%d %H:%M:%S";
|
||||
|
||||
testcases_use_single_file = true;
|
||||
testcases_single_file_format = "./tests/$(FNOEXT).testcases";
|
||||
|
||||
compile_command.cpp = {
|
||||
exec = "g++";
|
||||
args = [ "-Wall" "$(FNAME)" "-o" "./bin/$(FNOEXT)" ];
|
||||
};
|
||||
run_command.cpp = {
|
||||
exec = "./bin/$(FNOEXT)";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
dap = {
|
||||
enable = true;
|
||||
|
||||
extensions.dap-ui ={
|
||||
enable = true;
|
||||
|
||||
layouts = [
|
||||
{
|
||||
elements = [
|
||||
{ id = "breakpoints"; size = 0.25; }
|
||||
{ id = "stacks"; size = 0.25; }
|
||||
{ id = "watches"; size = 0.25; }
|
||||
{ id = "scopes"; size = 0.25; }
|
||||
];
|
||||
position = "left";
|
||||
size = 40;
|
||||
}
|
||||
{
|
||||
elements = [
|
||||
{ id = "repl"; size = 0.7; }
|
||||
{ id = "console"; size = 0.3; }
|
||||
];
|
||||
position = "bottom";
|
||||
size = 10;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
signs = {
|
||||
dapBreakpoint.text = " ";
|
||||
dapBreakpointCondition.text = " ";
|
||||
dapBreakpointRejected.text = " ";
|
||||
dapLogPoint.text = " ";
|
||||
dapStopped.text = " ";
|
||||
};
|
||||
|
||||
adapters.servers = {
|
||||
# Used for c++ and rust
|
||||
codelldb = {
|
||||
port = "\${port}";
|
||||
executable = {
|
||||
command = "${pkgs.vscode-extensions.vadimcn.vscode-lldb}/share/vscode/extensions/vadimcn.vscode-lldb/adapter/codelldb";
|
||||
args = [ "--port" "\${port}" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
configurations = let
|
||||
# For all supported subsitutions see :h dap-configuration
|
||||
workspace = "\${workspaceFolder}";
|
||||
in {
|
||||
cpp = [
|
||||
{
|
||||
name = "Debug cpp file";
|
||||
type = "codelldb";
|
||||
request = "launch";
|
||||
cwd = workspace;
|
||||
expressions = "native";
|
||||
program = { __raw = ''
|
||||
function()
|
||||
local sourceFile = vim.fn.expand("%");
|
||||
local resFolder = vim.fn.expand("%:h") .. "/bin/"
|
||||
local exeFile = resFolder .. vim.fn.expand("%:t:r") .. ".dap";
|
||||
|
||||
-- The -g flag compiles with debug info
|
||||
vim.system({"mkdir", resFolder}):wait();
|
||||
vim.system({"g++", "-g", sourceFile, "-o", exeFile}):wait();
|
||||
|
||||
return exeFile;
|
||||
end
|
||||
''; };
|
||||
}
|
||||
];
|
||||
rust = [
|
||||
{
|
||||
# Did not get this working: https://github.com/vadimcn/codelldb/blob/master/MANUAL.md#cargo-support
|
||||
# So instead this follows: https://alighorab.github.io/neovim/nvim-dap/
|
||||
name = "Debug cargo project";
|
||||
type = "codelldb";
|
||||
request = "launch";
|
||||
expressions = "native";
|
||||
program = { __raw = ''
|
||||
function ()
|
||||
os.execute("cargo build &> /dev/null")
|
||||
return "target/debug/''${workspaceFolderBasename}"
|
||||
end
|
||||
''; };
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,89 +0,0 @@
|
|||
{ lib, ... }:
|
||||
|
||||
{
|
||||
programs.nixvim = {
|
||||
globals.mapleader = " ";
|
||||
|
||||
keymaps =
|
||||
let
|
||||
normalVisual =
|
||||
lib.mapAttrsToList
|
||||
(key: action: {
|
||||
mode = [ "n" "v" ];
|
||||
inherit action key;
|
||||
})
|
||||
{
|
||||
# show terminal
|
||||
"<C-\\>" = "<cmd>ToggleTerm<CR>";
|
||||
|
||||
# hop!
|
||||
"f" = "<cmd>HopWord<CR>";
|
||||
|
||||
# Setup for custom keybinds
|
||||
";" = "<NOP>";
|
||||
"<space>" = "<NOP>";
|
||||
|
||||
# Telescope
|
||||
"<space>f" = "<cmd>Telescope find_files<CR>";
|
||||
"<space>b" = "<cmd>Telescope buffers<CR>";
|
||||
"<space>d" = "<cmd>Telescope lsp_definitions<CR>";
|
||||
"<space>R" = "<cmd>Telescope lsp_references<CR>";
|
||||
"<space>e" = "<cmd>Telescope file_browser<CR>";
|
||||
"<space>c" = "<cmd>Telescope git_bcommits<CR>";
|
||||
"<space>g" = "<cmd>Telescope git_status<CR>";
|
||||
|
||||
# Lsp
|
||||
"<space>a" = "<cmd>lua vim.lsp.buf.code_action()<CR>";
|
||||
"<space>D" = "<cmd>lua vim.lsp.buf.declaration()<CR>";
|
||||
"<space>h" = "<cmd>lua vim.lsp.buf.hover()<CR>";
|
||||
"<space>r" = "<cmd>lua vim.lsp.buf.rename()<CR>";
|
||||
"<space>o" = "<cmd>lua vim.diagnostic.open_float()<CR>";
|
||||
"<space>l" = "<cmd>lua require('lsp_lines').toggle()<CR>";
|
||||
|
||||
# Debugger
|
||||
"<F5>" = "<cmd>lua require('dap').continue()<CR>";
|
||||
"<F8>" = "<cmd>lua require('dap').terminate()<CR>";
|
||||
"<F10>" = "<cmd>lua require('dap').step_over()<CR>";
|
||||
"<F11>" = "<cmd>lua require('dap').step_into()<CR>";
|
||||
"<F12>" = "<cmd>lua require('dap').step_out()<CR>";
|
||||
";d" = "<cmd>lua require('dap').toggle_breakpoint()<CR>";
|
||||
";s" = "<cmd>lua require('dap').set_breakpoint(vim.fn.input('Breakpoint condition: '))<CR>";
|
||||
|
||||
# Competitest
|
||||
";r" = "<cmd>CompetiTest receive problem<CR>";
|
||||
";t" = "<cmd>CompetiTest run<CR>";
|
||||
";a" = "<cmd>CompetiTest add_testcase<CR>";
|
||||
";e" = "<cmd>CompetiTest edit_testcase<CR>";
|
||||
";l" = "<cmd>CompetiTest delete_testcase<CR>";
|
||||
";c" = "<cmd>CompetiTest convert auto<CR>";
|
||||
|
||||
# resize windows with arrows
|
||||
"<C-Up>" = "<cmd>resize -2<CR>";
|
||||
"<C-Down>" = "<cmd>resize +2<CR>";
|
||||
"<C-Left>" = "<cmd>vertical resize +2<CR>";
|
||||
"<C-Right>" = "<cmd>vertical resize -2<CR>";
|
||||
|
||||
|
||||
# TODO: make shortcuts for diffview
|
||||
# or use telescope to view git stuff
|
||||
};
|
||||
vni =
|
||||
lib.mapAttrsToList
|
||||
(key: action: {
|
||||
mode = [ "n" "v" "i" ];
|
||||
inherit action key;
|
||||
})
|
||||
{
|
||||
# copy, cut, paste
|
||||
# TODO: why does pasting work but not copying in visual mode???
|
||||
"<CS-c>" = "\\\"+y";
|
||||
"<CS-x>" = "\\\"+c";
|
||||
"<CS-v>" = "\\\"+p";
|
||||
|
||||
# saving
|
||||
"<C-s>" = "<cmd>w<CR>";
|
||||
};
|
||||
in
|
||||
normalVisual ++ vni;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue