From ca4efc72a6ac338b410eccbd41d23a60e1f36fc8 Mon Sep 17 00:00:00 2001 From: Jakub Kluwa Date: Sun, 5 Oct 2025 21:31:11 +0200 Subject: [PATCH 1/4] c++ configs --- init.lua | 45 ++++++++++++++++----------- lua/custom/configs/none-ls.lua | 24 ++++++++++++++ lua/custom/keymaps.lua | 12 +++++++ lua/custom/plugins/init.lua | 57 +++++++++++++++++++++++++++++++--- 4 files changed, 115 insertions(+), 23 deletions(-) create mode 100644 lua/custom/configs/none-ls.lua create mode 100644 lua/custom/keymaps.lua diff --git a/init.lua b/init.lua index 776c6873ff6..e7dba33e5f7 100644 --- a/init.lua +++ b/init.lua @@ -70,7 +70,6 @@ Kickstart Guide: These are hints about where to find more information about the relevant settings, plugins or Neovim features used in Kickstart. - NOTE: Look for lines like this Throughout the file. These are for you, the reader, to help you understand what is happening. Feel free to delete them once you know what you're doing, but they should serve as a guide @@ -86,17 +85,16 @@ P.S. You can delete this when you're done too. It's your config now! :) -- Set as the leader key -- See `:help mapleader` --- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' -- Set to true if you have a Nerd Font installed and selected in the terminal -vim.g.have_nerd_font = false +vim.g.have_nerd_font = true -- [[ Setting options ]] -- See `:help vim.opt` --- NOTE: You can change these options as you wish! --- For more options, you can see `:help option-list` +-- You can change these options as you wish! +-- For more options, you can see `:help option-list` -- Make line numbers default vim.opt.number = true @@ -180,10 +178,10 @@ vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagn vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) -- TIP: Disable arrow keys in normal mode --- vim.keymap.set('n', '', 'echo "Use h to move!!"') --- vim.keymap.set('n', '', 'echo "Use l to move!!"') --- vim.keymap.set('n', '', 'echo "Use k to move!!"') --- vim.keymap.set('n', '', 'echo "Use j to move!!"') +vim.keymap.set('n', '', 'echo "Use h to move!!"') +vim.keymap.set('n', '', 'echo "Use l to move!!"') +vim.keymap.set('n', '', 'echo "Use k to move!!"') +vim.keymap.set('n', '', 'echo "Use j to move!!"') -- Keybinds to make split navigation easier. -- Use CTRL+ to switch between windows @@ -453,6 +451,13 @@ require('lazy').setup({ end, { desc = '[S]earch [N]eovim files' }) end, }, + { + 'nvimtools/none-ls.nvim', + event = 'VeryLazy', + opts = function() + return require 'custom.configs.none-ls' + end, + }, -- LSP Plugins { @@ -517,7 +522,7 @@ require('lazy').setup({ vim.api.nvim_create_autocmd('LspAttach', { group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }), callback = function(event) - -- NOTE: Remember that Lua is a real programming language, and as such it is possible + -- Remember that Lua is a real programming language, and as such it is possible -- to define small helper and utility functions so you don't have to repeat yourself. -- -- In this case, we create a function that lets us more easily define mappings specific @@ -665,7 +670,7 @@ require('lazy').setup({ local servers = { -- clangd = {}, -- gopls = {}, - -- pyright = {}, + pyright = {}, -- rust_analyzer = {}, -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs -- @@ -708,6 +713,8 @@ require('lazy').setup({ local ensure_installed = vim.tbl_keys(servers or {}) vim.list_extend(ensure_installed, { 'stylua', -- Used to format Lua code + 'clangd', + 'clang-format', }) require('mason-tool-installer').setup { ensure_installed = ensure_installed } @@ -873,20 +880,22 @@ require('lazy').setup({ -- change the command in the config to whatever the name of that colorscheme is. -- -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`. - 'folke/tokyonight.nvim', + 'catppuccin/nvim', + name = 'catppuccin', priority = 1000, -- Make sure to load this before all the other start plugins. config = function() ---@diagnostic disable-next-line: missing-fields - require('tokyonight').setup { + require('catppuccin').setup { + flavour = 'mocha', styles = { - comments = { italic = false }, -- Disable italics in comments + comments = { 'italic' }, }, } -- Load the colorscheme here. -- Like many other themes, this one has different styles, and you could load -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. - vim.cmd.colorscheme 'tokyonight-night' + vim.cmd.colorscheme 'catppuccin' end, }, @@ -965,8 +974,8 @@ require('lazy').setup({ -- Here are some example plugins that I've included in the Kickstart repository. -- Uncomment any of the lines below to enable them (you will need to restart nvim). -- - -- require 'kickstart.plugins.debug', - -- require 'kickstart.plugins.indent_line', + require 'kickstart.plugins.debug', + require 'kickstart.plugins.indent_line', -- require 'kickstart.plugins.lint', -- require 'kickstart.plugins.autopairs', -- require 'kickstart.plugins.neo-tree', @@ -976,7 +985,7 @@ require('lazy').setup({ -- This is the easiest way to modularize your config. -- -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - -- { import = 'custom.plugins' }, + { import = 'custom.plugins' }, -- -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` -- Or use telescope! diff --git a/lua/custom/configs/none-ls.lua b/lua/custom/configs/none-ls.lua new file mode 100644 index 00000000000..83f0becaf2f --- /dev/null +++ b/lua/custom/configs/none-ls.lua @@ -0,0 +1,24 @@ +local augroup = vim.api.nvim_create_augroup('LspFormatting', {}) +local none_ls = require 'null-ls' + +local opts = { + sources = { + none_ls.builtins.formatting.clang_format, + }, + on_attach = function(client, bufnr) + if client.supports_method 'textDocument/formatting' then + vim.api.nvim_clear_autocmds { + group = augroup, + buffer = bufnr, + } + vim.api.nvim_create_autocmd('BufWritePre', { + group = augroup, + buffer = bufnr, + callback = function() + vim.lsp.buf.format { bufnr = bufnr } + end, + }) + end + end, +} +return opts diff --git a/lua/custom/keymaps.lua b/lua/custom/keymaps.lua new file mode 100644 index 00000000000..86e78d66ef8 --- /dev/null +++ b/lua/custom/keymaps.lua @@ -0,0 +1,12 @@ +local dap = require 'dap' +local dapui = require 'dapui' + +vim.keymap.set('n', '', dap.continue, { desc = 'Start/Continue debug' }) +vim.keymap.set('n', '', dap.step_over, { desc = 'Step over' }) +vim.keymap.set('n', '', dap.step_into, { desc = 'Step into' }) +vim.keymap.set('n', '', dap.step_out, { desc = 'Step out' }) +vim.keymap.set('n', 'b', dap.toggle_breakpoint, { desc = 'Toggle breakpoint' }) +vim.keymap.set('n', 'B', function() + dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ') +end, { desc = 'Set conditional breakpoint' }) +vim.keymap.set('n', 'du', dapui.toggle, { desc = 'Toggle DAP UI' }) diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index be0eb9d8d7a..740f0c8fff8 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -1,5 +1,52 @@ --- You can add your own plugins here or in other files in this directory! --- I promise not to create any merge conflicts in this directory :) --- --- See the kickstart.nvim README for more information -return {} +return { + -- Debug Adapter Protocol + { + 'mfussenegger/nvim-dap', + dependencies = { + 'rcarriga/nvim-dap-ui', + 'theHamsta/nvim-dap-virtual-text', + 'nvim-telescope/telescope-dap.nvim', + }, + config = function() + local dap = require 'dap' + local dapui = require 'dapui' + + require('nvim-dap-virtual-text').setup() + dapui.setup() + + 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 + + -- C++ Debug Adapter (lldb) + dap.adapters.lldb = { + type = 'executable', + command = '/usr/bin/lldb-dap', -- or 'lldb-dap' if available + name = 'lldb', + } + + dap.configurations.cpp = { + { + name = 'Launch file', + type = 'lldb', + request = 'launch', + program = function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + end, + cwd = '${workspaceFolder}', + stopOnEntry = false, + args = {}, + }, + } + + dap.configurations.c = dap.configurations.cpp + dap.configurations.rust = dap.configurations.cpp + end, + }, +} From 3399fad748dd8ba3a052f0fc627a00dd32ed88d4 Mon Sep 17 00:00:00 2001 From: Jakub Kluwa Date: Mon, 6 Oct 2025 22:08:06 +0200 Subject: [PATCH 2/4] c++ debbuging --- init.lua | 1 + lua/custom/plugins/init.lua | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index e7dba33e5f7..211b28ac33e 100644 --- a/init.lua +++ b/init.lua @@ -715,6 +715,7 @@ require('lazy').setup({ 'stylua', -- Used to format Lua code 'clangd', 'clang-format', + 'codelldb', }) require('mason-tool-installer').setup { ensure_installed = ensure_installed } diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 740f0c8fff8..329ffc46aac 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -13,7 +13,12 @@ return { require('nvim-dap-virtual-text').setup() dapui.setup() - + dap.listeners.before.attach.dapui_config = function() + dapui.open() + end + dap.listeners.before.launch.dapui_config = function() + dapui.open() + end dap.listeners.after.event_initialized['dapui_config'] = function() dapui.open() end From 81505dbd9295dcfa6a3aa51166250c2df50d8257 Mon Sep 17 00:00:00 2001 From: Jakub Kluwa Date: Wed, 8 Oct 2025 23:08:12 +0200 Subject: [PATCH 3/4] make file config --- init.lua | 4 +++- lua/custom/keymaps.lua | 11 ----------- lua/custom/plugins/init.lua | 15 +++++++++++++-- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/init.lua b/init.lua index 211b28ac33e..9c7cbb5bfe6 100644 --- a/init.lua +++ b/init.lua @@ -100,7 +100,7 @@ vim.g.have_nerd_font = true vim.opt.number = true -- You can also add relative line numbers, to help with jumping. -- Experiment for yourself to see if you like it! --- vim.opt.relativenumber = true +vim.opt.relativenumber = true -- Enable mouse mode, can be useful for resizing splits for example! vim.opt.mouse = 'a' @@ -192,6 +192,8 @@ vim.keymap.set('n', '', '', { desc = 'Move focus to the right win vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) +vim.keymap.set('n', 'm', ':make', { noremap = true, silent = true, desc = 'Run make' }) + -- NOTE: Some terminals have colliding keymaps or are not able to send distinct keycodes -- vim.keymap.set("n", "", "H", { desc = "Move window to the left" }) -- vim.keymap.set("n", "", "L", { desc = "Move window to the right" }) diff --git a/lua/custom/keymaps.lua b/lua/custom/keymaps.lua index 86e78d66ef8..8b137891791 100644 --- a/lua/custom/keymaps.lua +++ b/lua/custom/keymaps.lua @@ -1,12 +1 @@ -local dap = require 'dap' -local dapui = require 'dapui' -vim.keymap.set('n', '', dap.continue, { desc = 'Start/Continue debug' }) -vim.keymap.set('n', '', dap.step_over, { desc = 'Step over' }) -vim.keymap.set('n', '', dap.step_into, { desc = 'Step into' }) -vim.keymap.set('n', '', dap.step_out, { desc = 'Step out' }) -vim.keymap.set('n', 'b', dap.toggle_breakpoint, { desc = 'Toggle breakpoint' }) -vim.keymap.set('n', 'B', function() - dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ') -end, { desc = 'Set conditional breakpoint' }) -vim.keymap.set('n', 'du', dapui.toggle, { desc = 'Toggle DAP UI' }) diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 329ffc46aac..7872cf321b0 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -38,11 +38,22 @@ return { dap.configurations.cpp = { { - name = 'Launch file', + name = 'Launch C++ program (with make)', type = 'lldb', request = 'launch', program = function() - return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + local result = vim.fn.system 'make' + + -- Print make output (optional) + print(result) + + if vim.v.shell_error ~= 0 then + error '❌ Build failed! Check your Makefile.' + else + print '✅ Build successful!' + end + + return vim.fn.getcwd() .. '/main' end, cwd = '${workspaceFolder}', stopOnEntry = false, From 6fe0af5b061ed44fa0065f29eebe2ea184f9ae98 Mon Sep 17 00:00:00 2001 From: jkluwa Date: Thu, 18 Jun 2026 00:54:42 +0200 Subject: [PATCH 4/4] add oil.nvim --- init.lua | 11 ++++++ lua/custom/plugins/init.lua | 1 + lua/custom/plugins/lazygit.lua | 10 ++++++ lua/custom/plugins/oil.lua | 61 ++++++++++++++++++++++++++++++++++ 4 files changed, 83 insertions(+) create mode 100644 lua/custom/plugins/lazygit.lua create mode 100644 lua/custom/plugins/oil.lua diff --git a/init.lua b/init.lua index 9c7cbb5bfe6..b025fcf5f20 100644 --- a/init.lua +++ b/init.lua @@ -673,6 +673,7 @@ require('lazy').setup({ -- clangd = {}, -- gopls = {}, pyright = {}, + -- rust_analyzer = {}, -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs -- @@ -1018,3 +1019,13 @@ require('lazy').setup({ -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et +vim.api.nvim_create_autocmd('FileType', { + pattern = 'cs', + callback = function() + vim.lsp.start { + name = 'csharp_ls', + cmd = { 'csharp-ls' }, + root_dir = vim.fs.root(0, { '.sln', '.git' }), + } + end, +}) diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 7872cf321b0..dfc36266043 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -57,6 +57,7 @@ return { end, cwd = '${workspaceFolder}', stopOnEntry = false, + console = 'internalTerminal', args = {}, }, } diff --git a/lua/custom/plugins/lazygit.lua b/lua/custom/plugins/lazygit.lua new file mode 100644 index 00000000000..b2610b00fa7 --- /dev/null +++ b/lua/custom/plugins/lazygit.lua @@ -0,0 +1,10 @@ +return { + 'kdheepak/lazygit.nvim', + dependencies = { + 'nvim-lua/plenary.nvim', + }, + -- Lazy-loading: wtyczka ładuje się dopiero, gdy wciśniesz skrót + keys = { + { 'gg', 'LazyGit', desc = 'Otwórz [G]it [G]UI (LazyGit)' }, + }, +} diff --git a/lua/custom/plugins/oil.lua b/lua/custom/plugins/oil.lua new file mode 100644 index 00000000000..a1ce951f911 --- /dev/null +++ b/lua/custom/plugins/oil.lua @@ -0,0 +1,61 @@ +return { + 'stevearc/oil.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + config = function() + require('oil').setup { + -- Podstawowa konfiguracja + default_file_explorer = true, -- Zastępuje domyślnego Netrw (wbudowany explorer w Vima) + + -- Wygląd i kolumny + columns = { + 'icon', + -- "permissions", + -- "size", + -- "mtime", + }, + + -- Zachowanie buforów + buf_options = { + buflisted = false, + bufhidden = 'hide', + }, + + -- Ukrywanie plików .gitignore + view_options = { + show_hidden = false, -- domyślnie nie pokazuj ukrytych plików (użyj g. aby przełączyć) + is_hidden_file = function(name, bufnr) + return vim.startswith(name, '.') + end, + is_always_hidden = function(name, bufnr) + return name == '..' + end, + }, + + -- Mapowania klawiszy wewnątrz Oil + keymaps = { + ['g?'] = 'actions.show_help', + [''] = 'actions.select', + [''] = 'actions.select_vsplit', -- Otwórz w podziale pionowym + [''] = 'actions.select_split', -- Otwórz w podziale poziomym + [''] = 'actions.select_tab', -- Otwórz w nowej karcie + [''] = 'actions.preview', -- Podgląd + [''] = 'actions.close', -- Zamknij + [''] = 'actions.refresh', -- Odśwież + ['-'] = 'actions.parent', -- Przejdź katalog wyżej + ['_'] = 'actions.open_cwd', -- Otwórz aktualny katalog roboczy + ['`'] = 'actions.cd', -- Zmień aktualny katalog roboczy (CWD) + ['~'] = 'actions.tcd', -- Zmień CWD tylko dla aktualnej karty + ['gs'] = 'actions.change_sort', -- Zmień sortowanie + ['gx'] = 'actions.open_external', -- Otwórz w zewnętrznym programie (np. obrazek w przeglądarce) + ['g.'] = 'actions.toggle_hidden', -- Przełącz ukryte pliki + ['g\\'] = 'actions.toggle_trash', -- Pokaż kosz + }, + + -- Gdzie używać kosza zamiast trwałego usunięcia (wymaga programu 'trash' w systemie) + use_default_keymaps = true, + } + + -- Mapowanie do otwierania Oil z dowolnego miejsca + vim.keymap.set('n', '-', 'Oil', { desc = 'Otwórz folder nadrzędny (Oil)' }) + end, +}