From 92553d0cc38e82109648e80e1e0600aa2729135b Mon Sep 17 00:00:00 2001 From: Robert Morrison Date: Sat, 28 Sep 2024 18:15:16 +0100 Subject: [PATCH] stuff --- lazy-lock.json | 86 +++++++++--------- lua/plugins/configs/UI/whichkey.lua | 14 +-- lua/plugins/configs/completion/cmp.lua | 5 +- lua/plugins/configs/lsp/config.lua | 2 +- lua/plugins/configs/lsp/neodev.lua | 12 --- lua/plugins/configs/treesitter/init.lua | 4 +- lua/plugins/specs/LSP.lua | 20 ++--- lua/plugins/specs/UI.lua | 2 +- lua/plugins/specs/debug.lua | 110 ++++++++++++++++++++++++ lua/sherlock5512/colourSwitch.lua | 1 + luasnip/markdown.lua | 32 +++++++ 11 files changed, 209 insertions(+), 79 deletions(-) create mode 100644 lua/plugins/specs/debug.lua create mode 100644 luasnip/markdown.lua diff --git a/lazy-lock.json b/lazy-lock.json index bbb7ec6..9094f70 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,51 +1,55 @@ { - "LuaSnip": { "branch": "master", "commit": "f3b3d3446bcbfa62d638b1903ff00a78b2b730a1" }, - "bufferline.nvim": { "branch": "main", "commit": "b15c6daf5a64426c69732b31a951f4e438cb6590" }, + "LuaSnip": { "branch": "master", "commit": "e808bee352d1a6fcf902ca1a71cee76e60e24071" }, + "bufferline.nvim": { "branch": "main", "commit": "0b2fd861eee7595015b6561dade52fb060be10c4" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, - "cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" }, + "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, "cmp-conjure": { "branch": "master", "commit": "8c9a88efedc0e5bf3165baa6af8a407afe29daf6" }, - "cmp-emoji": { "branch": "main", "commit": "19075c36d5820253d32e2478b6aaf3734aeaafa0" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, + "cmp-emoji": { "branch": "main", "commit": "e8398e2adf512a03bb4e1728ca017ffeac670a9f" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, - "conjure": { "branch": "master", "commit": "f50d4db821489f66ff93afe58155eef42c273a5d" }, - "friendly-snippets": { "branch": "main", "commit": "5cc1f45c6aac699ad008fb85f6ae03236062667d" }, - "gentoo-syntax": { "branch": "master", "commit": "382826e8b6fa99a700df9ae23f1fa0f9bff1c53c" }, - "gruvbox": { "branch": "main", "commit": "6e4027ae957cddf7b193adfaec4a8f9e03b4555f" }, - "indent-blankline.nvim": { "branch": "master", "commit": "821a7acd88587d966f7e464b0b3031dfe7f5680c" }, - "knap": { "branch": "main", "commit": "503010f541696e99ed5c62f658620e546cebf8b0" }, - "lazy.nvim": { "branch": "main", "commit": "aedcd79811d491b60d0a6577a9c1701063c2a609" }, - "lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" }, - "lspsaga.nvim": { "branch": "main", "commit": "db74412e0282505ea1e63a42060728fb74c1968e" }, + "conjure": { "branch": "master", "commit": "6d2bc7f7b24c2c43d54f263bee7b9b08aef5d1a1" }, + "friendly-snippets": { "branch": "main", "commit": "00ba9dd3df89509f95437b8d595553707c46d5ea" }, + "gentoo-syntax": { "branch": "master", "commit": "2bbb23d32d0546e78e7ecc3b310951b86c781780" }, + "gruvbox": { "branch": "main", "commit": "7a1b23e4edf73a39642e77508ee6b9cbb8c60f9e" }, + "indent-blankline.nvim": { "branch": "master", "commit": "18603eb949eba08300799f64027af11ef922283f" }, + "knap": { "branch": "main", "commit": "0040760bb504a713ea5988c7c490a15faf477c57" }, + "lazy.nvim": { "branch": "main", "commit": "460e1cd8f24e364d54543a4b0e83f6f4ec1f65fb" }, + "lazydev.nvim": { "branch": "main", "commit": "491452cf1ca6f029e90ad0d0368848fac717c6d2" }, + "lspkind.nvim": { "branch": "master", "commit": "cff4ae321a91ee3473a92ea1a8c637e3a9510aec" }, + "lspsaga.nvim": { "branch": "main", "commit": "e64351d0e6335eadf089aa2b9f17221e54ca10a4" }, "lualine-spell-status": { "branch": "main", "commit": "aa81c2c9a71e3ed3552c6cd75e150414ff9ac664" }, - "lualine.nvim": { "branch": "master", "commit": "7d131a8d3ba5016229e8a1d08bf8782acea98852" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "fe4cce44dec93c69be17dad79b21de867dde118a" }, - "mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" }, - "neo-tree.nvim": { "branch": "main", "commit": "f3941c57ec85d7bdb44fa53fd858fd80f159018f" }, - "neodev.nvim": { "branch": "main", "commit": "de3685b8c1cd439dd96b7958793f6f381f98652d" }, - "nerdcommenter": { "branch": "master", "commit": "e361a44230860d616f799a337bc58f5218ab6e9c" }, - "noice.nvim": { "branch": "main", "commit": "bf67d70bd7265d075191e7812d8eb42b9791f737" }, - "nui.nvim": { "branch": "main", "commit": "af7dfee12fbf51d12cfc6ee386fa54f7a5a573c8" }, - "nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" }, - "nvim-lspconfig": { "branch": "master", "commit": "d1bab4cf4b69e49d6058028fd933d8ef5e74e680" }, - "nvim-notify": { "branch": "master", "commit": "7138c86b28de61b6866c8cae60289136f0d539fa" }, - "nvim-treesitter": { "branch": "master", "commit": "581e87ba4e509a50689fcdd538e5f9388845eb78" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "dd0b2036c3a27cb6e6486f8bd24188c6ca43af0b" }, - "nvim-web-devicons": { "branch": "master", "commit": "7f30f2da3c3641841ceb0e2c150281f624445e8f" }, - "plenary.nvim": { "branch": "master", "commit": "4f71c0c4a196ceb656c824a70792f3df3ce6bb6d" }, + "lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "25c11854aa25558ee6c03432edfa0df0217324be" }, + "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, + "neo-tree.nvim": { "branch": "main", "commit": "a77af2e764c5ed4038d27d1c463fa49cd4794e07" }, + "nerdcommenter": { "branch": "master", "commit": "3f860f2d981547c18f2c9599e3c358ea488c3be4" }, + "noice.nvim": { "branch": "main", "commit": "c1ba80ccf6b3bd8c7fc88fe2e61085131d44ad65" }, + "nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" }, + "nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" }, + "nvim-dap": { "branch": "master", "commit": "90616ae6ae40053103dc66872886fc26b94c70c8" }, + "nvim-dap-ui": { "branch": "master", "commit": "1c351e4e417d4691da12948b6ecf966936a56d28" }, + "nvim-dap-virtual-text": { "branch": "master", "commit": "3497eb39bf413a57ab5b7e7e2e192683e462148c" }, + "nvim-lspconfig": { "branch": "master", "commit": "dd329912c8d446240584a2dbcd3802af3a19105a" }, + "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, + "nvim-notify": { "branch": "master", "commit": "fbef5d32be8466dd76544a257d3f3dce20082a07" }, + "nvim-treesitter": { "branch": "master", "commit": "6511cd984ab4b21e28f83af488f38dc89c3b0586" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "bf8d2ad35d1d1a687eae6c065c3d524f7ab61b23" }, + "nvim-web-devicons": { "branch": "master", "commit": "26220156aafb198b2de6a4cf80c1b120a3768da0" }, + "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, "popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" }, "project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" }, - "rainbow-delimiters.nvim": { "branch": "master", "commit": "586f44d21ef687a4d41b5b24c1566d686ae84250" }, - "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, + "rainbow-delimiters.nvim": { "branch": "master", "commit": "5f73b24aeb94f5274c218955573153c69ce4d1ee" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" }, "telescope-media-files.nvim": { "branch": "master", "commit": "0826c7a730bc4d36068f7c85cf4c5b3fd9fb570a" }, - "telescope.nvim": { "branch": "master", "commit": "45d61cc8da213e4052cf698653692b6a4c961760" }, - "tidy.nvim": { "branch": "main", "commit": "2a23ba8cd39d3570595ba4e6890f8de4cd8116fd" }, - "todo-comments.nvim": { "branch": "main", "commit": "833d8dd8b07eeda37a09e99460f72a02616935cb" }, - "trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" }, - "twilight.nvim": { "branch": "main", "commit": "8b7b50c0cb2dc781b2f4262a5ddd57571556d1e4" }, + "telescope.nvim": { "branch": "master", "commit": "b324469959908c1c7434eb65d80e87895e6828f7" }, + "tidy.nvim": { "branch": "main", "commit": "58fcc63de53840fa78946e4161e8883e67213f92" }, + "todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" }, + "trouble.nvim": { "branch": "main", "commit": "6efc446226679fda0547c0fd6a7892fd5f5b15d8" }, + "twilight.nvim": { "branch": "main", "commit": "1584c0b0a979b71fd86b18d302ba84e9aba85b1b" }, "vim-dispatch-neovim": { "branch": "master", "commit": "c8c4e21a95c25032a041002f9bf6e45a75a73021" }, - "vim-jack-in": { "branch": "master", "commit": "4cefab20f02c44249499f43200442a3176315acd" }, - "vimwiki": { "branch": "dev", "commit": "fde35bb87e45abe930eebef5ab99a16289e53789" }, - "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" }, - "zen-mode.nvim": { "branch": "main", "commit": "78557d972b4bfbb7488e17b5703d25164ae64e6a" } -} \ No newline at end of file + "vim-jack-in": { "branch": "master", "commit": "7fed7961a8b59265dc34c27c4cdbc410b3c25a73" }, + "vimwiki": { "branch": "dev", "commit": "705ad1e0dded0e3b7ff5fac78547ab67c9d39bdf" }, + "which-key.nvim": { "branch": "main", "commit": "fb070344402cfc662299d9914f5546d840a22126" }, + "zen-mode.nvim": { "branch": "main", "commit": "29b292bdc58b76a6c8f294c961a8bf92c5a6ebd6" } +} diff --git a/lua/plugins/configs/UI/whichkey.lua b/lua/plugins/configs/UI/whichkey.lua index 55a37fc..c125bf2 100644 --- a/lua/plugins/configs/UI/whichkey.lua +++ b/lua/plugins/configs/UI/whichkey.lua @@ -25,9 +25,8 @@ M.config = { group = '󰋃', }, - window = { + win = { border = 'single', - position = 'bottom', }, -- ignore_missing = true, disable = { @@ -36,11 +35,12 @@ M.config = { } M.default_bindings = { - ['w'] = { name = '+vimwiki' }, - ['l'] = { name = '+LSP' }, - ['c'] = { name = '+NerdComment' }, - ['f'] = { name = '+File' }, - ['t'] = { name = '+telescope' }, + { 'c', group = 'NerdComment' }, + { 'f', group = 'File' }, + { 'l', group = 'LSP' }, + { 't', group = 'telescope' }, + { 'ts', group = 'tresitter' }, + { 'w', group = 'vimwiki' }, } return M diff --git a/lua/plugins/configs/completion/cmp.lua b/lua/plugins/configs/completion/cmp.lua index ffb8bc1..38a3f4d 100644 --- a/lua/plugins/configs/completion/cmp.lua +++ b/lua/plugins/configs/completion/cmp.lua @@ -66,12 +66,13 @@ M.cmp = { [''] = cmp.mapping.abort(), }, sources = cmp.config.sources { - { name = 'emoji', priority = 10000 }, { name = 'nvim_lsp' }, { name = 'luasnip' }, - { name = 'buffer', keyword_length = 5 }, + { name = 'lazydev', group_index = 0 }, { name = 'path' }, + { name = 'buffer', keyword_length = 5 }, { name = 'conjure' }, + { name = 'emoji', priority = -20 }, }, formatting = { format = lspkind.cmp_format { diff --git a/lua/plugins/configs/lsp/config.lua b/lua/plugins/configs/lsp/config.lua index d163464..a0176a2 100644 --- a/lua/plugins/configs/lsp/config.lua +++ b/lua/plugins/configs/lsp/config.lua @@ -8,7 +8,7 @@ M.on_attach = function() local client = vim.lsp.get_client_by_id(args.data.client_id) if client == nil then return end if client.server_capabilities.inlayHintProvider then - vim.lsp.inlay_hint.enable(bufnr, true) + vim.lsp.inlay_hint.enable(true, nil, bufnr) end if client.server_capabilities.documentFormattingProvider then diff --git a/lua/plugins/configs/lsp/neodev.lua b/lua/plugins/configs/lsp/neodev.lua index d3e5ed7..e69de29 100644 --- a/lua/plugins/configs/lsp/neodev.lua +++ b/lua/plugins/configs/lsp/neodev.lua @@ -1,12 +0,0 @@ -return function(opts) - local status, neodev = pcall(require, 'neodev') - if not status then return false end - - neodev.setup { - library = { - plugins = opts.plugins, - runtime = opts.runtime, - types = opts.types, - }, - } -end diff --git a/lua/plugins/configs/treesitter/init.lua b/lua/plugins/configs/treesitter/init.lua index 0dc6279..720e3e2 100644 --- a/lua/plugins/configs/treesitter/init.lua +++ b/lua/plugins/configs/treesitter/init.lua @@ -107,8 +107,8 @@ return { floating_preview_opts = {}, peek_definition_code = { - ['df'] = { query = '@function.outer', desc = 'Peek function definition' }, - ['dF'] = { query = '@class.outer', desc = 'Peek class definition' }, + ['tsdf'] = { query = '@function.outer', desc = 'Peek function definition' }, + ['tsdF'] = { query = '@class.outer', desc = 'Peek class definition' }, }, }, }, diff --git a/lua/plugins/specs/LSP.lua b/lua/plugins/specs/LSP.lua index a75a5f1..74a9a46 100644 --- a/lua/plugins/specs/LSP.lua +++ b/lua/plugins/specs/LSP.lua @@ -58,6 +58,9 @@ return { texlab = {}, cssls = {}, clangd = {}, + vala_ls = {}, + perlpls = {}, + ts_ls = {}, }, setup = {}, } @@ -72,22 +75,13 @@ return { end, dependencies = { 'mason-lspconfig.nvim', - 'neodev.nvim', }, }, - { -- neodev - 'folke/neodev.nvim', - opts = { - enabled = true, - plugins = true, - runtime = true, - types = true, - pathStrict = true, - }, - config = function(_, opts) - require('plugins.configs.lsp.neodev')(opts) - end, + { -- lazydev + 'folke/lazydev.nvim', + ft = 'lua', + opts = {}, }, { -- lspsaga diff --git a/lua/plugins/specs/UI.lua b/lua/plugins/specs/UI.lua index 93dfb52..d62ade0 100644 --- a/lua/plugins/specs/UI.lua +++ b/lua/plugins/specs/UI.lua @@ -79,7 +79,7 @@ return { end, config = function(_, opts) require('which-key').setup(opts.config) - require('which-key').register(opts.default_bindings) + require('which-key').add(opts.default_bindings) end, event = 'VeryLazy', }, diff --git a/lua/plugins/specs/debug.lua b/lua/plugins/specs/debug.lua new file mode 100644 index 0000000..6f1e191 --- /dev/null +++ b/lua/plugins/specs/debug.lua @@ -0,0 +1,110 @@ +return { + { -- nvim-dap + 'mfussenegger/nvim-dap', + + config = function(_, _) + local dap = require('dap') + + dap.adapters.coreclr = { + type = 'executable', + command = vim.fn.exepath('netcoredbg'), + args = { '--interpreter=vscode' }, + } + + vim.g.dotnet_build_project = function() + local default_path = vim.fn.getcwd() .. '/' + if vim.g['dotnet_last_proj_path'] ~= nil then + default_path = vim.g['dotnet_last_proj_path'] + end + local path = vim.fn.input('Path to your *proj file', default_path, 'file') + vim.g['dotnet_last_proj_path'] = path + local cmd = 'dotnet build -c Debug ' .. path .. ' > /dev/null' + print('') + print('Cmd to execute: ' .. cmd) + local f = os.execute(cmd) + if f == 0 then + print('\nBuild: ✔️ ') + else + print('\nBuild: ❌ (code: ' .. f .. ')') + end + end + + vim.g.dotnet_get_dll_path = function() + local request = function() + return vim.fn.input('Path to dll', vim.fn.getcwd() .. '/bin/Debug/', 'file') + end + + if vim.g['dotnet_last_dll_path'] == nil then + vim.g['dotnet_last_dll_path'] = request() + else + if + vim.fn.confirm( + 'Do you want to change the path to dll?\n' + .. vim.g['dotnet_last_dll_path'], + '&yes\n&no', + 2 + ) == 1 + then + vim.g['dotnet_last_dll_path'] = request() + end + end + + return vim.g['dotnet_last_dll_path'] + end + + local config = { + { + type = 'coreclr', + name = 'launch - netcoredbg', + request = 'launch', + program = function() + return coroutine.create(function(dap_prg_crt) + if vim.fn.confirm('Should I recompile first?', '&yes\n&no', 2) == 1 then + vim.g.dotnet_build_project() + end + local dll = vim.g.dotnet_get_dll_path() + coroutine.resume(dap_prg_crt, dll) + end) + end, + args = function() + return coroutine.create(function(dap_arg_crt) + vim.ui.input({ prompt = 'Args >' }, function(choice) + choice = choice or nil + local arg = vim.split(choice, ' ') + coroutine.resume(dap_arg_crt, arg) + end) + end) + end, + }, + } + + dap.configurations.cs = config + dap.configurations.fsharp = config + end, + }, + { -- nvim-dap-virtual-text + 'theHamsta/nvim-dap-virtual-text', + dependencies = { + 'mfussenegger/nvim-dap', + 'nvim-treesitter/nvim-treesitter', + }, + }, + { -- nvim-dap-ui + 'rcarriga/nvim-dap-ui', + dependencies = { + 'mfussenegger/nvim-dap', + 'theHamsta/nvim-dap-virtual-text', + 'nvim-neotest/nvim-nio', + }, + opts = {}, + keys = { + { + 'dt', + function() + require('dapui').toggle() + end, + desc = 'open dapui', + }, + }, + }, +} diff --git a/lua/sherlock5512/colourSwitch.lua b/lua/sherlock5512/colourSwitch.lua index 9e05e2b..78c9d19 100644 --- a/lua/sherlock5512/colourSwitch.lua +++ b/lua/sherlock5512/colourSwitch.lua @@ -16,6 +16,7 @@ if vim.fn.executable('theme.sh') and vim.fn.exists('~/.config/.theme_history') t local lightThemes = vim.fn.systemlist('theme.sh --light -l') if vim.tbl_contains(lightThemes, currentTheme) then + print('setting light because theme ' .. currentTheme) vim.o.background = 'light' else vim.o.background = 'dark' diff --git a/luasnip/markdown.lua b/luasnip/markdown.lua new file mode 100644 index 0000000..67359ab --- /dev/null +++ b/luasnip/markdown.lua @@ -0,0 +1,32 @@ +-- Snippets for markdown + +local ls = require('luasnip') +local s = ls.snippet +local t = ls.text_node +local i = ls.insert_node + +return { + -- Snippet for making yaml frontmatter + s({ trig = 'yamlfrontmatter', dscr = 'YAML frontmatter block' }, { + t { '---', '' }, + t { 'author: "' }, + i(1), + t { '"', '' }, + t { 'title: "' }, + i(2), + t { '"', '' }, + t { 'date: ' }, + i(3), + t { '', '' }, + t { 'description: "' }, + i(4), + t { '"', '' }, + t { 'keywords: [' }, + i(5), + t { ']', '' }, + t { 'lang: "' }, + i(6, 'en-gb'), + t { '"', '' }, + t { '---', '' }, + }), +}