diff --git a/init.lua b/init.lua index 6eaac498..57378c93 100644 --- a/init.lua +++ b/init.lua @@ -13,6 +13,16 @@ vim.g.have_nerd_font = true vim.opt.shiftwidth = 4 vim.opt.tabstop = 4 +vim.g.mapleader = ' ' +vim.g.maplocalleader = ' ' + +vim.g.have_nerd_font = true + +-- tabs appear as 4 spaces +vim.opt.tabstop = 4 +vim.opt.shiftwidth = 4 + +-- Make line numbers default vim.opt.number = true vim.opt.relativenumber = true vim.opt.mouse = 'a' @@ -392,6 +402,16 @@ require('lazy').setup({ end, }) + -- Change diagnostic symbols in the sign column (gutter) + -- if vim.g.have_nerd_font then + -- local signs = { ERROR = '', WARN = '', INFO = '', HINT = '' } + -- local diagnostic_signs = {} + -- for type, icon in pairs(signs) do + -- diagnostic_signs[vim.diagnostic.severity[type]] = icon + -- end + -- vim.diagnostic.config { signs = { text = diagnostic_signs } } + -- end + -- LSP servers and clients are able to communicate to each other what features they support. -- By default, Neovim doesn't support everything that is in the LSP specification. -- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities. @@ -410,8 +430,8 @@ require('lazy').setup({ -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ local servers = { -- clangd = {}, - -- gopls = {}, - -- pyright = {}, + gopls = {}, + pyright = {}, -- rust_analyzer = {}, -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs -- @@ -451,6 +471,7 @@ require('lazy').setup({ local ensure_installed = vim.tbl_keys(servers or {}) vim.list_extend(ensure_installed, { 'stylua', -- Used to format Lua code + 'ruff', -- Used to lint and format Python code }) require('mason-tool-installer').setup { ensure_installed = ensure_installed } @@ -712,7 +733,7 @@ require('lazy').setup({ -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects }, - -- The following two comments only work if you have downloaded the kickstart repo, not just copy pasted the + -- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the -- init.lua. If you want these files, they are in the repository, so you can just download them and -- place them in the correct locations. @@ -721,7 +742,7 @@ 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.debug', -- require 'kickstart.plugins.indent_line', -- require 'kickstart.plugins.lint', -- require 'kickstart.plugins.autopairs', @@ -732,8 +753,12 @@ 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. - -- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins` -- { import = 'custom.plugins' }, + -- + -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` + -- Or use telescope! + -- In normal mode type `sh` then write `lazy.nvim-plugin` + -- you can continue same window with `sr` which resumes last telescope search }, { ui = { -- If you are using a Nerd Font: set icons to an empty table which will use the diff --git a/install-deps.sh b/install-deps.sh new file mode 100644 index 00000000..e69de29b diff --git a/lazy-lock.json b/lazy-lock.json index 94ab5b7e..f9a51ee2 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -4,17 +4,23 @@ "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, "conform.nvim": { "branch": "master", "commit": "70019124aa4f2e6838be9fbd2007f6d13b27a96d" }, + "debugpy": { "branch": "main", "commit": "02723de14048aaa414cd4be01268b0a0f4c786ad" }, "fidget.nvim": { "branch": "main", "commit": "a0abbf18084b77d28bc70e24752e4f4fd54aea17" }, "gitsigns.nvim": { "branch": "main", "commit": "2eaa30537365f6889c850bd46ef6f18ddf8fac70" }, "lazy.nvim": { "branch": "main", "commit": "d8f26efd456190241afd1b0f5235fe6fdba13d4a" }, "lazydev.nvim": { "branch": "main", "commit": "8620f82ee3f59ff2187647167b6b47387a13a018" }, "luvit-meta": { "branch": "main", "commit": "55709f183b0742a7e4f47688c284f81148ad4dc0" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "97d9f1d3ad205dece6bcafd1d71cf1507608f3c7" }, + "mason-nvim-dap.nvim": { "branch": "main", "commit": "8b9363d83b5d779813cdd2819b8308651cec2a09" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, "mini.nvim": { "branch": "main", "commit": "bac6c8bb77fe0a872719ea43c39e35c7c695f05e" }, "nvim-cmp": { "branch": "main", "commit": "8c82d0bd31299dbff7f8e780f5e06d2283de9678" }, + "nvim-dap": { "branch": "master", "commit": "99807078c5089ed30e0547aa4b52c5867933f426" }, + "nvim-dap-go": { "branch": "main", "commit": "6aa88167ea1224bcef578e8c7160fe8afbb44848" }, + "nvim-dap-ui": { "branch": "master", "commit": "e94d98649dccb6a3884b66aabc2e07beb279e535" }, "nvim-lspconfig": { "branch": "master", "commit": "88157521e890fe7fdf18bee22438875edd6300a6" }, + "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, "nvim-treesitter": { "branch": "master", "commit": "8ca76960ae75e0a3bb231402558eb50e79433161" }, "nvim-web-devicons": { "branch": "master", "commit": "5740b7382429d20b6ed0bbdb0694185af9507d44" }, "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index 196f2c6d..7c16e820 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -23,29 +23,61 @@ return { -- Add your own debuggers here 'leoluz/nvim-dap-go', + 'microsoft/debugpy', + }, + keys = { + -- Basic debugging keymaps, feel free to change to your liking! + { + '', + function() + require('dap').continue() + end, + desc = 'Debug: Start/Continue', + }, + { + '', + function() + require('dap').step_into() + end, + desc = 'Debug: Step Into', + }, + { + '', + function() + require('dap').step_over() + end, + desc = 'Debug: Step Over', + }, + { + '', + function() + require('dap').step_out() + end, + desc = 'Debug: Step Out', + }, + { + 'b', + function() + require('dap').toggle_breakpoint() + end, + desc = 'Debug: Toggle Breakpoint', + }, + { + 'B', + function() + require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ') + end, + desc = 'Debug: Set Breakpoint', + }, + -- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception. + { + '', + function() + require('dapui').toggle() + end, + desc = 'Debug: See last session result.', + }, }, - keys = function(_, keys) - local dap = require 'dap' - local dapui = require 'dapui' - return { - -- Basic debugging keymaps, feel free to change to your liking! - { '', dap.continue, desc = 'Debug: Start/Continue' }, - { '', dap.step_into, desc = 'Debug: Step Into' }, - { '', dap.step_over, desc = 'Debug: Step Over' }, - { '', dap.step_out, desc = 'Debug: Step Out' }, - { 'b', dap.toggle_breakpoint, desc = 'Debug: Toggle Breakpoint' }, - { - 'B', - function() - dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ') - end, - desc = 'Debug: Set Breakpoint', - }, - -- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception. - { '', dapui.toggle, desc = 'Debug: See last session result.' }, - unpack(keys), - } - end, config = function() local dap = require 'dap' local dapui = require 'dapui' @@ -89,6 +121,18 @@ return { }, } + -- Change breakpoint icons + -- vim.api.nvim_set_hl(0, 'DapBreak', { fg = '#e51400' }) + -- vim.api.nvim_set_hl(0, 'DapStop', { fg = '#ffcc00' }) + -- local breakpoint_icons = vim.g.have_nerd_font + -- and { Breakpoint = '', BreakpointCondition = '', BreakpointRejected = '', LogPoint = '', Stopped = '' } + -- or { Breakpoint = '●', BreakpointCondition = '⊜', BreakpointRejected = '⊘', LogPoint = '◆', Stopped = '⭔' } + -- for type, icon in pairs(breakpoint_icons) do + -- local tp = 'Dap' .. type + -- local hl = (type == 'Stopped') and 'DapStop' or 'DapBreak' + -- vim.fn.sign_define(tp, { text = icon, texthl = hl, numhl = hl }) + -- end + dap.listeners.after.event_initialized['dapui_config'] = dapui.open dap.listeners.before.event_terminated['dapui_config'] = dapui.close dap.listeners.before.event_exited['dapui_config'] = dapui.close diff --git a/lua/kickstart/plugins/lint.lua b/lua/kickstart/plugins/lint.lua index ca9bc237..907c6bf3 100644 --- a/lua/kickstart/plugins/lint.lua +++ b/lua/kickstart/plugins/lint.lua @@ -47,7 +47,12 @@ return { vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, { group = lint_augroup, callback = function() - lint.try_lint() + -- Only run the linter in buffers that you can modify in order to + -- avoid superfluous noise, notably within the handy LSP pop-ups that + -- describe the hovered symbol using Markdown. + if vim.opt_local.modifiable:get() then + lint.try_lint() + end end, }) end,