From c2a70edc95a284a4e782fb46a8fb04e17683acd0 Mon Sep 17 00:00:00 2001 From: Tovi Jaeschke-Rogers Date: Wed, 27 Sep 2023 15:33:21 +0930 Subject: [PATCH] Update nvim stuffs --- .config/nvim/lazy-lock.json | 7 +-- .config/nvim/lua/tovi/plugins/gitsigns.lua | 49 +++++++++++++++++-- .config/nvim/lua/tovi/plugins/lsp/null-ls.lua | 36 +++++++------- .config/nvim/lua/tovi/plugins/neotest.lua | 2 +- .config/nvim/lua/tovi/plugins/nvim-cmp.lua | 15 ++++-- 5 files changed, 79 insertions(+), 30 deletions(-) diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index 9481d3a..a1bb0a9 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -1,7 +1,7 @@ { "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, - "LuaSnip": { "branch": "master", "commit": "c5fb16a934892086d4ba01bac48b77c65435025e" }, + "LuaSnip": { "branch": "master", "commit": "1fd22fa96c11573248f9fdd09f25e724c7bb3dd4" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, @@ -11,7 +11,7 @@ "dressing.nvim": { "branch": "master", "commit": "c1e1d5fa44fe08811b6ef4aadac2b50e602f9504" }, "friendly-snippets": { "branch": "main", "commit": "ebf6d6e83494cdd88a54a429340256f4dbb6a052" }, "fugitive-gitlab.vim": { "branch": "master", "commit": "55fed481c0309b3405dd3d72921d687bf36873a8" }, - "gitsigns.nvim": { "branch": "main", "commit": "9bec6e1ef5542e33974e5b4f982c8c063b981974" }, + "gitsigns.nvim": { "branch": "main", "commit": "bdeba1cec3faddd89146690c10b9a87949c0ee66" }, "go.nvim": { "branch": "master", "commit": "019936780060efc64c0f22a47afd08fbbe82e026" }, "guihua.lua": { "branch": "master", "commit": "5ad8dba19ce9b9fd8965598984dfdc9c119f97e4" }, "harpoon": { "branch": "master", "commit": "21f4c47c6803d64ddb934a5b314dcb1b8e7365dc" }, @@ -33,7 +33,7 @@ "nvim-lsp-file-operations": { "branch": "master", "commit": "2abe934ab00a18932f55edfd881555934622fe36" }, "nvim-lspconfig": { "branch": "master", "commit": "ede4114e1fd41acb121c70a27e1b026ac68c42d6" }, "nvim-tree.lua": { "branch": "master", "commit": "07eb5b4059aa0a6366c46d5546ff6239dfdc1f03" }, - "nvim-treesitter": { "branch": "master", "commit": "af6b3ecea9b3cff18b9244027e23e7f2c34ebdd5" }, + "nvim-treesitter": { "branch": "master", "commit": "0960322686bfa38afd4f1e0b9660473cf77e24b6" }, "nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" }, "nvim-web-devicons": { "branch": "master", "commit": "480a756df82a0c231622c9bf2173bb6634713716" }, "plenary.nvim": { "branch": "master", "commit": "9ce85b0f7dcfe5358c0be937ad23e456907d410b" }, @@ -41,5 +41,6 @@ "telescope.nvim": { "branch": "0.1.x", "commit": "54930e1abfc94409e1bb9266e752ef8379008592" }, "undotree": { "branch": "master", "commit": "0e11ba7325efbbb3f3bebe06213afa3e7ec75131" }, "vim-fugitive": { "branch": "master", "commit": "99db68d9b3304580bd383da7aaee05c7a954a344" }, + "vim-repeat": { "branch": "master", "commit": "24afe922e6a05891756ecf331f39a1f6743d3d5a" }, "which-key.nvim": { "branch": "main", "commit": "7ccf476ebe0445a741b64e36c78a682c1c6118b7" } } \ No newline at end of file diff --git a/.config/nvim/lua/tovi/plugins/gitsigns.lua b/.config/nvim/lua/tovi/plugins/gitsigns.lua index a3576c8..8867575 100644 --- a/.config/nvim/lua/tovi/plugins/gitsigns.lua +++ b/.config/nvim/lua/tovi/plugins/gitsigns.lua @@ -1,5 +1,48 @@ return { - "lewis6991/gitsigns.nvim", - event = { "BufReadPre", "BufNewFile" }, - config = true, + "lewis6991/gitsigns.nvim", + event = { "BufReadPre", "BufNewFile" }, + config = function () + require('gitsigns').setup { + signs = { + add = {hl = 'GitSignsAdd' , text = '│', numhl='GitSignsAddNr' , linehl='GitSignsAddLn'}, + change = {hl = 'GitSignsChange', text = '│', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, + delete = {hl = 'GitSignsDelete', text = '_', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, + topdelete = {hl = 'GitSignsDelete', text = '‾', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, + changedelete = {hl = 'GitSignsChange', text = '~', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, + }, + + signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` + numhl = false, -- Toggle with `:Gitsigns toggle_numhl` + linehl = false, -- Toggle with `:Gitsigns toggle_linehl` + word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` + watch_gitdir = { + interval = 1000, + follow_files = true + }, + attach_to_untracked = true, + current_line_blame = true, -- Toggle with `:Gitsigns toggle_current_line_blame` + current_line_blame_opts = { + virt_text = true, + virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align' + delay = 0, + ignore_whitespace = false, + }, + current_line_blame_formatter = ', - ', + sign_priority = 6, + update_debounce = 100, + status_formatter = nil, -- Use default + max_file_length = 40000, -- Disable if file is longer than this (in lines) + preview_config = { + -- Options passed to nvim_open_win + border = 'single', + style = 'minimal', + relative = 'cursor', + row = 0, + col = 1 + }, + yadm = { + enable = false + }, + } + end } diff --git a/.config/nvim/lua/tovi/plugins/lsp/null-ls.lua b/.config/nvim/lua/tovi/plugins/lsp/null-ls.lua index fad7d4c..a3b32fd 100644 --- a/.config/nvim/lua/tovi/plugins/lsp/null-ls.lua +++ b/.config/nvim/lua/tovi/plugins/lsp/null-ls.lua @@ -33,24 +33,24 @@ return { }), }, -- configure format on save - on_attach = function(current_client, bufnr) - if current_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({ - filter = function(client) - -- only use null-ls for formatting instead of lsp server - return client.name == "null-ls" - end, - bufnr = bufnr, - }) - end, - }) - end - end, + -- on_attach = function(current_client, bufnr) + -- if current_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({ + -- filter = function(client) + -- -- only use null-ls for formatting instead of lsp server + -- return client.name == "null-ls" + -- end, + -- bufnr = bufnr, + -- }) + -- end, + -- }) + -- end + -- end, }) end, } diff --git a/.config/nvim/lua/tovi/plugins/neotest.lua b/.config/nvim/lua/tovi/plugins/neotest.lua index 2f7b03c..19d283b 100644 --- a/.config/nvim/lua/tovi/plugins/neotest.lua +++ b/.config/nvim/lua/tovi/plugins/neotest.lua @@ -41,7 +41,7 @@ return { adapters = { require("neotest-phpunit")({ root_files = { "phpunit.xml", "composer.json" }, - phpunit_cmd = { "docker-compose", "exec", "fpm", "./vendor/bin/phpunit" }, + phpunit_cmd = { "docker", "compose", "exec", "fpm", "./vendor/bin/phpunit" }, filter_dirs = { "vendor" }, mapped_docker_dir = "/var/www", append_to_cwd = "/api", diff --git a/.config/nvim/lua/tovi/plugins/nvim-cmp.lua b/.config/nvim/lua/tovi/plugins/nvim-cmp.lua index 74f7600..c724b4e 100644 --- a/.config/nvim/lua/tovi/plugins/nvim-cmp.lua +++ b/.config/nvim/lua/tovi/plugins/nvim-cmp.lua @@ -19,11 +19,16 @@ return { -- loads vscode style snippets from installed plugins (e.g. friendly-snippets) require("luasnip.loaders.from_vscode").lazy_load() - local has_words_before = function() - local line, col = vim.api.nvim_win_get_cursor(0) - ---@diagnostic disable-next-line: param-type-mismatch - return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil - end + -- local has_words_before = function() + -- local line, col = vim.api.nvim_win_get_cursor(0) + -- ---@diagnostic disable-next-line: param-type-mismatch + -- return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil + -- end + + local has_words_before = function() + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match "%s" == nil + end cmp.setup({ completion = {