From dcda42d32e4c61e475f4169368fd6d1719493614 Mon Sep 17 00:00:00 2001 From: Daniel Weber Date: Thu, 19 Dec 2024 22:34:53 -0500 Subject: [PATCH] Major nvim changes, Colorscheme and dap mostly --- after/plugin/color_scheme.lua | 130 +++++++++-------- after/plugin/dap.lua | 134 ++++++++++++++++++ after/plugin/{undotree.lua => one_liners.lua} | 3 + after/plugin/treescript.lua | 6 +- lua/pippy/lazy.lua | 31 ++-- 5 files changed, 235 insertions(+), 69 deletions(-) create mode 100644 after/plugin/dap.lua rename after/plugin/{undotree.lua => one_liners.lua} (60%) diff --git a/after/plugin/color_scheme.lua b/after/plugin/color_scheme.lua index 2217ff6..ba278aa 100644 --- a/after/plugin/color_scheme.lua +++ b/after/plugin/color_scheme.lua @@ -1,65 +1,83 @@ -- My initial attempt to trying to use catppuccin...may revisit later so keeping it --- require("catppuccin").setup({ --- flavour = "mocha", -- latte, frappe, macchiato, mocha --- background = { -- :h background --- light = "latte", --- dark = "mocha", --- }, --- transparent_background = false, -- disables setting the background color. --- show_end_of_buffer = false, -- shows the '~' characters after the end of buffers --- term_colors = false, -- sets terminal colors (e.g. `g:terminal_color_0`) --- dim_inactive = { --- enabled = false, -- dims the background color of inactive window --- shade = "dark", --- percentage = 0.15, -- percentage of the shade to apply to the inactive window --- }, --- no_italic = false, -- Force no italic --- no_bold = false, -- Force no bold --- no_underline = false, -- Force no underline --- styles = { -- Handles the styles of general hi groups (see `:h highlight-args`): --- comments = { "italic" }, -- Change the style of comments --- conditionals = { "italic" }, --- loops = {}, --- functions = {}, --- keywords = {}, --- strings = {}, --- variables = {}, --- numbers = {}, --- booleans = {}, --- properties = {}, --- types = {}, --- operators = {}, --- }, --- color_overrides = {}, --- custom_highlights = {}, --- integrations = { --- cmp = true, --- gitsigns = true, --- nvimtree = true, --- treesitter = true, --- notify = false, --- mini = { --- enabled = true, --- indentscope_color = "", --- }, --- -- For more plugins integrations please scroll down (https://github.com/catppuccin/nvim#integrations) --- }, --- }) --- --- -- setup must be called before loading +require("catppuccin").setup({ + flavour = "mocha", -- latte, frappe, macchiato, mocha + background = { -- :h background + light = "latte", + dark = "mocha", + }, + transparent_background = false, -- disables setting the background color. + show_end_of_buffer = false, -- shows the '~' characters after the end of buffers + term_colors = false, -- sets terminal colors (e.g. `g:terminal_color_0`) + dim_inactive = { + enabled = true, -- dims the background color of inactive window + shade = "light", + percentage = 0.15, -- percentage of the shade to apply to the inactive window + }, + no_italic = false, -- Force no italic + no_bold = false, -- Force no bold + no_underline = false, -- Force no underline + styles = { -- Handles the styles of general hi groups (see `:h highlight-args`): + comments = { "italic" }, -- Change the style of comments + conditionals = { "italic" }, + loops = {}, + functions = {}, + keywords = {}, + strings = {}, + variables = {}, + numbers = {}, + booleans = {}, + properties = {}, + types = {}, + operators = {}, + }, + color_overrides = { + mocha = { + base = "#000000", + mantle = "#000000", + crust = "#000000", + }, + }, + custom_highlights = { + -- ["@keyword"] = {fg = '${green}'}, + -- ["@string"] = {fg = '#ff9900'}, + -- ["@function"] = {fg = '#00ccff', italic=true, underline=true}, + -- ["@function.builtin"] = {fg = '#0059ff'}, + -- ["@variable"] = {fg = '#00FF88'}, + }, + integrations = { + cmp = true, + gitsigns = true, + nvimtree = true, + neotree = true, + treesitter = true, + notify = false, + mini = { + enabled = true, + indentscope_color = "", + }, + -- For more plugins integrations please scroll down (https://github.com/catppuccin/nvim#integrations) + }, +}) + +-- setup must be called before loading -- vim.cmd.colorscheme "catppuccin" -require('onedark').setup { - style = 'deep', - colors = { - green = '#00ffaa', -- redefine an existing color - }, +require('onedarkpro').setup { + -- colors = { + -- green = '#00ffaa', -- redefine an existing color + -- }, highlights = { - ["@keyword"] = {fg = '$green'}, + SpellBad = { sp = "${red}", undercurl = true }, + SpellCap = { sp = "${red}", undercurl = true }, + SpellRare = { sp = "${red}", undercurl = true }, + SpellLocal = { sp = "${red}", undercurl = true }, + ["@keyword"] = {fg = '${green}'}, ["@string"] = {fg = '#ff9900'}, - ["@function"] = {fg = '#00ccff', sp = '$cyan', fmt = 'underline,italic'}, + ["@function"] = {fg = '#00ccff', italic=true, underline=true}, ["@function.builtin"] = {fg = '#0059ff'}, ["@variable"] = {fg = '#00FF88'}, } } -require('onedark').load() + +-- vim.cmd("colorscheme onedark_dark") +vim.cmd("colorscheme wildcharm") diff --git a/after/plugin/dap.lua b/after/plugin/dap.lua new file mode 100644 index 0000000..ea086ea --- /dev/null +++ b/after/plugin/dap.lua @@ -0,0 +1,134 @@ +-- local dap = require('dap') +-- dap.adapters.python = function(cb, config) +-- if config.request == 'attach' then +-- ---@diagnostic disable-next-line: undefined-field +-- local port = (config.connect or config).port +-- ---@diagnostic disable-next-line: undefined-field +-- local host = (config.connect or config).host or '127.0.0.1' +-- cb({ +-- type = 'server', +-- port = assert(port, '`connect.port` is required for a python `attach` configuration'), +-- host = host, +-- options = { +-- source_filetype = 'python', +-- }, +-- }) +-- else +-- cb({ +-- type = 'executable', +-- command = 'path/to/virtualenvs/debugpy/bin/python', +-- args = { '-m', 'debugpy.adapter' }, +-- options = { +-- source_filetype = 'python', +-- }, +-- }) +-- end +-- end +local dap = require("dap") +dap.adapters.lldb = { + type = "executable", + command = "lldb-dap", + name = 'lldb', + -- args = { "--interpreter=dap", "--eval-command", "set print pretty on" } +} + +dap.adapters.python = function(cb, config) + if config.request == 'attach' then + ---@diagnostic disable-next-line: undefined-field + local port = (config.connect or config).port + ---@diagnostic disable-next-line: undefined-field + local host = (config.connect or config).host or '127.0.0.1' + cb({ + type = 'server', + port = assert(port, '`connect.port` is required for a python `attach` configuration'), + host = host, + options = { + source_filetype = 'python', + }, + }) + else + cb({ + type = 'executable', + command = './venv/bin/python', + args = { '-m', 'debugpy.adapter' }, + options = { + source_filetype = 'python', + }, + }) + end +end + + +dap.configurations.python = { + { + -- The first three options are required by nvim-dap + type = 'python'; -- the type here established the link to the adapter definition: `dap.adapters.python` + request = 'launch'; + name = "Launch file"; + + -- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options + + program = "${file}"; -- This configuration will launch the current file if used. + pythonPath = function() + -- debugpy supports launching an application with a different interpreter then the one used to launch debugpy itself. + -- The code below looks for a `venv` or `.venv` folder in the current directly and uses the python within. + -- You could adapt this - to for example use the `VIRTUAL_ENV` environment variable. + local cwd = vim.fn.getcwd() + if vim.fn.executable(cwd .. '/venv/bin/python') == 1 then + return cwd .. '/venv/bin/python' + elseif vim.fn.executable(cwd .. '/.venv/bin/python') == 1 then + return cwd .. '/.venv/bin/python' + else + return '/usr/bin/python' + end + end; + }, +} + +dap.configurations.cpp = { + { + name = 'Launch', + type = 'lldb', + request = 'launch', + program = function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + end, + cwd = '${workspaceFolder}', + stopOnEntry = true, + args = {}, + }, +} +require("nvim-dap-virtual-text").setup() +local dap = require("dap") + +dap.configurations.c = dap.configurations.cpp +dap.configurations.rust = dap.configurations.cpp + +require("dapui").setup() + +local dapui = require("dapui") +dap.listeners.before.attach.dapui_config = function() + dapui.open() +end +dap.listeners.before.launch.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 + + + +vim.keymap.set("n", "tb", "DapToggleBreakpoint",{ desc = '[t]oggle [b]reakpoint' }) +vim.keymap.set("n", "dn", "DapNew",{ desc = '[d]ebugger [n]ew' }) +vim.keymap.set("n", "", "DapContinue",{ desc = 'continuej:Da' }) +vim.keymap.set("n", "", "DapStepInto",{ desc = 'step into' }) +vim.keymap.set("n", "", "DapStepOver",{ desc = 'step over' }) +vim.keymap.set("n", "", "DapStepOut",{ desc = 'step out' }) +-- vim.keymap.set("n", "", "DapStepOut",{ desc = 'step out' }) +vim.keymap.set("n", "", "DapDisconnect",{ desc = 'disconnect' }) + + diff --git a/after/plugin/undotree.lua b/after/plugin/one_liners.lua similarity index 60% rename from after/plugin/undotree.lua rename to after/plugin/one_liners.lua index 26a24c7..99e9645 100644 --- a/after/plugin/undotree.lua +++ b/after/plugin/one_liners.lua @@ -1 +1,4 @@ +vim.cmd("set termguicolors") +require('colorizer').setup() + vim.keymap.set("n", "tu", vim.cmd.UndotreeToggle, { desc = 'Toggle undo tree' }) diff --git a/after/plugin/treescript.lua b/after/plugin/treescript.lua index d1138e0..83bc89b 100644 --- a/after/plugin/treescript.lua +++ b/after/plugin/treescript.lua @@ -1,6 +1,7 @@ require('nvim-treesitter.configs').setup({ + modules = {}, -- A list of parser names, or "all" (the five listed parsers should always be installed) - ensure_installed = { "c", "cpp", "cuda", "lua", "python", "vim", "vimdoc", "query", "javascript" }, + ensure_installed = { "bash", "c", "cpp", "cuda", "lua", "python", "vim", "vimdoc", "query", "javascript" }, -- Install parsers synchronously (only applied to `ensure_installed`) sync_install = false, @@ -11,6 +12,7 @@ require('nvim-treesitter.configs').setup({ ---- If you need to change the installation directory of the parsers (see -> Advanced Setup) -- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")! + ignore_install = {}, highlight = { enable = true, @@ -34,4 +36,4 @@ require('nvim-treesitter.configs').setup({ -- Adding spell check to other treesitter query groups. Only comments are spell checked by default -- vim.treesitter.query.set("python", "highlights", "(string) @string @spell") -vim.treesitter.query.set("lua", "highlights", "(string) @string @spell") +-- vim.treesitter.query.set("lua", "highlights", "(string) @string @spell") diff --git a/lua/pippy/lazy.lua b/lua/pippy/lazy.lua index 3baec4c..e5006ca 100644 --- a/lua/pippy/lazy.lua +++ b/lua/pippy/lazy.lua @@ -12,9 +12,9 @@ end vim.opt.rtp:prepend(lazypath) require("lazy").setup({ - "folke/which-key.nvim", + {"folke/which-key.nvim"}, {"nvim-treesitter/nvim-treesitter", build = ':TSUpdate'}, - "nvim-treesitter/playground", + {"nvim-treesitter/playground"}, { "nvim-neo-tree/neo-tree.nvim", branch = "v3.x", @@ -24,16 +24,25 @@ require("lazy").setup({ "MunifTanjim/nui.nvim", } }, - "navarasu/onedark.nvim", - "mbbill/undotree", - "tpope/vim-fugitive", + + { "catppuccin/nvim", name = "catppuccin", priority = 1000 }, + { "olimorris/onedarkpro.nvim", priority = 1000}, -- Ensure it loads first + {'norcalli/nvim-colorizer.lua'}, + { + "rcarriga/nvim-dap-ui", + dependencies = { + "mfussenegger/nvim-dap", + "nvim-neotest/nvim-nio", + "theHamsta/nvim-dap-virtual-text", + }, + }, + {"mbbill/undotree"}, + {"tpope/vim-fugitive"}, { 'nvim-lualine/lualine.nvim', requires = { 'nvim-tree/nvim-web-devicons', opt = true } }, { 'nvim-telescope/telescope.nvim', - tag = '0.1.3', - dependencies = { - 'nvim-lua/plenary.nvim' - }, + tag = '0.1.8', + dependencies = { 'nvim-lua/plenary.nvim' }, }, {"danymat/neogen", dependencies = "nvim-treesitter/nvim-treesitter", config = true}, {'williamboman/mason.nvim'}, @@ -46,8 +55,8 @@ require("lazy").setup({ 'saadparwaiz1/cmp_luasnip', }}, {'windwp/nvim-autopairs', event = "InsertEnter", config = true}, - 'm4xshen/autoclose.nvim', - 'lewis6991/gitsigns.nvim', + {'m4xshen/autoclose.nvim'}, + {'lewis6991/gitsigns.nvim'}, {'xiyaowong/transparent.nvim'}, { 'numToStr/Comment.nvim', opts = {} }, { 'mg979/vim-visual-multi' },