Compare commits

...

3 Commits

Author SHA1 Message Date
mandlm 79d97d6b92
feat(neovim): setup rust debugging 2022-08-23 14:09:23 +02:00
mandlm b92082e9f7
feat(neovim): style completion windows 2022-08-23 08:03:33 +02:00
mandlm f09c1b0fb6
docs: protocol lenovo yoga 500 setup 2022-08-23 07:38:23 +02:00
5 changed files with 119 additions and 1 deletions

48
docs/yoga-setup-log.md Normal file
View File

@ -0,0 +1,48 @@
### Installer system
```bash
fdisk /dev/sda
> g
> n
> 1
> 2048
> +512M
> t
> 1
> n
> 2
> default
> default
> t
> 2
> 20
> w
mkfs.fat -F 32 -n boot /dev/sda1
cryptsetup -y -v luksFormat /dev/sda2
cryptsetup -v luksOpen /dev/sda2 nixos
pvcreate /dev/mapper/nixos
vgcreate vg /dev/mapper/nixos
lvcreate -L 8G -n swap vg
lvcreate -L 100G -n root vg
lvcreate -L 100G -n root vg
lvcreate -L 100%FREE -n home vg
mkswap -L swap /dev/vg/swap
mkfs.ext4 -L root /dev/vg/root
mkfs.ext4 -L home /dev/vg/home
mount /dev/disk/by-label/root /mnt/
mkdir -p /mnt/boot
mount /dev/disk/by-label/boot /mnt/boot/
swapon /dev/disk/by-label/swap
nixos-generate-config --root /mnt
nano /mnt/etc/nixos/configuration.nix
nixos-install
reboot
```

View File

@ -0,0 +1,34 @@
local dap, dapui = require("dap"), require("dapui")
dapui.setup()
vim.fn.sign_define("DapBreakpoint", { text = "🔴", texthl = "", linehl = "", numhl = "" })
-- debugging keymaps
vim.keymap.set("n", "<F5>", dap.continue, { noremap = true, silent = true })
vim.keymap.set("n", "<F9>", dap.toggle_breakpoint, { noremap = true, silent = true })
vim.keymap.set("n", "<F10>", dap.step_over, { noremap = true, silent = true })
vim.keymap.set("n", "<F11>", dap.step_into, { noremap = true, silent = true })
vim.keymap.set("n", "<S-F11>", dap.step_out, { noremap = true, silent = true })
vim.keymap.set("n", "<F23>", dap.step_out, { noremap = true, silent = true }) -- <Shift-F11> in kitty
vim.keymap.set("n", "<M-k>", dapui.eval, { noremap = true, silent = true })
-- trigger auto-completion in repl
vim.cmd([[
augroup TriggerDapReplAutoCompletion
autocmd!
autocmd FileType dap-repl lua require("dap.ext.autocompl").attach()
augroup END
]])
dap.listeners.after.event_initialized["dapui_config"] = function()
dapui.open()
end
dap.listeners.before.event_terminated["dapui_config"] = function()
dapui.close()
end
dap.listeners.before.event_exited["dapui_config"] = function()
dapui.close()
end

View File

@ -53,8 +53,13 @@ in
nodePackages.typescript nodePackages.typescript
nodePackages.dockerfile-language-server-nodejs nodePackages.dockerfile-language-server-nodejs
nodePackages.vscode-html-languageserver-bin nodePackages.vscode-html-languageserver-bin
lldb
vscode-extensions.vadimcn.vscode-lldb
]; ];
# symlink for a stable path
home.file.".vscode-extensions/vscode-lldb".source = pkgs.vscode-extensions.vadimcn.vscode-lldb;
programs = { programs = {
neovim = { neovim = {
enable = true; enable = true;
@ -115,6 +120,10 @@ in
lua-dev-nvim lua-dev-nvim
null-ls-nvim null-ls-nvim
lsp_lines-nvim lsp_lines-nvim
# debugging
nvim-dap
nvim-dap-ui
]; ];
extraConfig = '' extraConfig = ''
@ -146,6 +155,7 @@ in
vim.opt.background = '${theme}' vim.opt.background = '${theme}'
${builtins.readFile ./project-nvim.lua } ${builtins.readFile ./project-nvim.lua }
${builtins.readFile ./dap.lua }
EOF EOF
''; '';
}; };

View File

@ -73,6 +73,11 @@ for lsp, settings in pairs(servers) do
}) })
end end
-- setup rust tools
local codelldb_base_path = vim.env.HOME .. "/.vscode-extensions/vscode-lldb/share/vscode/extensions/vadimcn.vscode-lldb/"
local codelldb_bin_path = codelldb_base_path .. 'adapter/codelldb'
local codelldb_lib_path = codelldb_base_path .. 'lldb/lib/liblldb.so'
require("rust-tools").setup({ require("rust-tools").setup({
server = { server = {
on_attach = on_attach, on_attach = on_attach,
@ -89,6 +94,9 @@ require("rust-tools").setup({
}, },
capabilities = capabilities, capabilities = capabilities,
}, },
dap = {
adapter = require("rust-tools.dap").get_codelldb_adapter(codelldb_bin_path, codelldb_lib_path)
},
}) })
local luadev = require("lua-dev").setup({ local luadev = require("lua-dev").setup({

View File

@ -50,7 +50,25 @@ cmp.setup({
end end
end, { "i", "s" }), end, { "i", "s" }),
}), }),
experimental = { ghost_text = true } experimental = { ghost_text = true },
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
formatting = {
fields = { "menu", "abbr", "kind" },
format = function(entry, item)
local menu_icon = {
nvim_lsp = "λ",
luasnip = "",
buffer = "Ω",
path = "🖿",
}
item.menu = menu_icon[entry.source.name]
return item
end,
},
}) })
-- `/` cmdline setup. -- `/` cmdline setup.