Compare commits
2 Commits
1441e90711
...
8ad3a834ce
Author | SHA1 | Date | |
---|---|---|---|
8ad3a834ce | |||
db5a3f56b4 |
71
nix/cpptools.nix
Normal file
71
nix/cpptools.nix
Normal file
@ -0,0 +1,71 @@
|
||||
{ stdenv, lib
|
||||
, system ? builtins.currentSystem
|
||||
, fetchurl
|
||||
, unzip
|
||||
, libz
|
||||
, libcxx
|
||||
, lttng-ust_2_12
|
||||
, autoPatchelfHook
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "cpptools";
|
||||
version = "1.21.6";
|
||||
|
||||
# Get the current system architecture
|
||||
# arch = builtins.currentSystem;
|
||||
|
||||
linux-x64 = "https://github.com/microsoft/vscode-cpptools/releases/download/v${version}/cpptools-linux-x64.vsix";
|
||||
linux-arm64 = "https://github.com/microsoft/vscode-cpptools/releases/download/v${version}/cpptools-linux-arm64.vsix";
|
||||
darwin-x64 = "https://github.com/microsoft/vscode-cpptools/releases/download/v${version}/cpptools-macos-x64.vsix";
|
||||
darwin-arm64 = "https://github.com/microsoft/vscode-cpptools/releases/download/v${version}/cpptools-macos-arm64.vsix";
|
||||
|
||||
|
||||
src = fetchurl {
|
||||
url = lib.getAttr system {
|
||||
x86_64-linux = "https://github.com/microsoft/vscode-cpptools/releases/download/v${version}/cpptools-linux-x64.vsix";
|
||||
aarch64-linux = "https://github.com/microsoft/vscode-cpptools/releases/download/v${version}/cpptools-linux-arm64.vsix";
|
||||
aarch64-darwin = "https://github.com/microsoft/vscode-cpptools/releases/download/v${version}/cpptools-macos-arm64.vsix";
|
||||
x86_64-darwin = "https://github.com/microsoft/vscode-cpptools/releases/download/v${version}/cpptools-macos-x64.vsix";
|
||||
};
|
||||
hash = lib.getAttr system {
|
||||
x86_64-linux = "sha256-q6SDImUppICJopOi+HiIUMg7Ue1Qu0A41uewNxRdzeA=";
|
||||
aarch64-linux = "sha256-/Zci8P5RAK26FASHpQnIYR5fvSF9lgTTrgVAT33Wfwc=";
|
||||
x86_64-darwin = "sha256-P2LacAaCRXnsGUQOLuIyvfgxweeVHsDFTrAEuN/lBIQ=";
|
||||
aarch64-darwin = "sha256-P2LacAaCRXnsGUQOLuIyvfgxweeVHsDFTrAEuN/lBIQ=";
|
||||
};
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
autoPatchelfHook
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
unzip
|
||||
libz
|
||||
libcxx
|
||||
lttng-ust_2_12
|
||||
];
|
||||
|
||||
unpackPhase = ''
|
||||
unzip $src
|
||||
'';
|
||||
|
||||
sourceRoot = ".";
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir -p $out/bin
|
||||
mkdir -p $out/opt
|
||||
cp -r extension/debugAdapters/* $out/opt
|
||||
install -m755 -D extension/debugAdapters/bin/OpenDebugAD7 $out/opt/bin/OpenDebugAD7
|
||||
ln -s $out/opt/bin/OpenDebugAD7 $out/bin/OpenDebugAD7
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://github.com/microsoft/vscode-cpptools";
|
||||
description = "Official repository for the Microsoft C/C++ extension for VS Code. ";
|
||||
platforms = platforms.linux;
|
||||
};
|
||||
}
|
@ -120,6 +120,7 @@ with final.pkgs.lib; let
|
||||
# language servers, etc.
|
||||
asm-lsp # Assembly language server
|
||||
clang-tools # C/C++ language server
|
||||
(callPackage ./cpptools.nix {}) # C/C++ debugger from VSCode | https://github.com/microsoft/vscode-cpptools
|
||||
nodePackages.bash-language-server # Bash language server
|
||||
lua-language-server
|
||||
nil # nix LSP
|
||||
|
@ -35,20 +35,16 @@ dap.adapters.gdb = {
|
||||
args = { "-i", "dap" }
|
||||
}
|
||||
|
||||
dap.adapters.cppdbg = {
|
||||
id = 'cppdbg',
|
||||
type = 'executable',
|
||||
command = 'OpenDebugAD7',
|
||||
}
|
||||
|
||||
dap.configurations.c = {
|
||||
-- {
|
||||
-- name = "Launch",
|
||||
-- type = "gdb",
|
||||
-- request = "launch",
|
||||
-- program = function()
|
||||
-- return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
|
||||
-- end,
|
||||
-- cwd = "${workspaceFolder}",
|
||||
-- stopAtBeginningOfMainSubprogram = false,
|
||||
-- },
|
||||
{
|
||||
name = "Launch an executable",
|
||||
type = "gdb",
|
||||
type = "cppdbg",
|
||||
request = "launch",
|
||||
cwd = "${workspaceFolder}",
|
||||
program = function()
|
||||
@ -70,6 +66,6 @@ dap.configurations.c = {
|
||||
:find()
|
||||
end)
|
||||
end,
|
||||
stopAtBeginningOfMainSubprogram = false,
|
||||
stopAtBeginningOfMainSubprogram = true,
|
||||
},
|
||||
}
|
||||
|
@ -21,20 +21,20 @@ require('which-key').add({
|
||||
{ ']b', "<Cmd>BufferLineCycleNext<Cr>", desc = 'next [b]uffer' },
|
||||
{ '[B', vim.cmd.bfirst, desc = 'first [B]uffer' },
|
||||
{ ']B', vim.cmd.blast, desc = 'last [B]uffer' },
|
||||
{ '<space>tn', vim.cmd.tabnew, desc = '[t]ab: [n]ew' },
|
||||
{ '<leader>tn', vim.cmd.tabnew, desc = '[t]ab: [n]ew' },
|
||||
{ '<leader>tq', "<Cmd>bd<Cr>", desc = '[t]ab: [q]uit/close' },
|
||||
{ '<leader>c', "<Cmd>bd<Cr>", desc = '[c]lose tab' },
|
||||
|
||||
-- Window resizing
|
||||
{ "<C-Up>", "<Cmd>resize +2<CR>", desc = "resize split up" },
|
||||
{ "<C-Down>", "<Cmd>resize -2<CR>", desc = "resize split down" },
|
||||
{ "<C-Left>", "<Cmd>vertical resize -2<CR>", desc = "resize split left" },
|
||||
{ "<C-Right>", "<Cmd>vertical resize +2<CR>", desc = "resize split right" },
|
||||
{ "<C-Up>", "<Cmd>resize -2<CR>", desc = "resize split up" },
|
||||
{ "<C-Down>", "<Cmd>resize +2<CR>", desc = "resize split down" },
|
||||
{ "<C-Left>", "<Cmd>vertical resize +2<CR>", desc = "resize split left" },
|
||||
{ "<C-Right>", "<Cmd>vertical resize -2<CR>", desc = "resize split right" },
|
||||
|
||||
-- ToggleTerm
|
||||
{ "<Leader>Tf", "<Cmd>ToggleTerm direction=float<CR>", desc = "[T]oggleTerm [f]loat" },
|
||||
{ "<Leader>Th", "<Cmd>ToggleTerm size=10 direction=horizontal<CR>", desc = "[T]oggleTerm [h]orizontal split" },
|
||||
{ "<Leader>Tv", "<Cmd>ToggleTerm size=80 direction=vertical<CR>", desc = "[T]oggleTerm [v]ertical split" },
|
||||
{ "<leader>Tf", "<Cmd>ToggleTerm direction=float<CR>", desc = "[T]oggleterm [f]loat" },
|
||||
{ "<leader>Th", "<Cmd>ToggleTerm size=10 direction=horizontal<CR>", desc = "[T]oggleterm [h]orizontal split" },
|
||||
{ "<leader>Tv", "<Cmd>ToggleTerm size=80 direction=vertical<CR>", desc = "[T]oggleterm [v]ertical split" },
|
||||
{ "<F7>", '<Cmd>execute v:count . "ToggleTerm"<CR>', desc = "Toggle terminal" },
|
||||
{ mode = "t", "<F7>", "<Cmd>ToggleTerm<CR>", desc = "Toggle terminal" },
|
||||
{ mode = "i", "<F7>", "<Esc><Cmd>ToggleTerm<CR>", desc = "Toggle terminal" },
|
||||
@ -159,7 +159,7 @@ end, { expr = true, desc = "expand to current buffer's directory" })
|
||||
|
||||
local severity = diagnostic.severity
|
||||
|
||||
keymap.set('n', '<space>le', function()
|
||||
keymap.set('n', '<leader>le', function()
|
||||
local _, winid = diagnostic.open_float(nil, { scope = 'line' })
|
||||
if not winid then
|
||||
vim.notify('no diagnostics found', vim.log.levels.INFO)
|
||||
|
Loading…
x
Reference in New Issue
Block a user