From 746be1e73cf242f17c82b331c53b678f08b05d54 Mon Sep 17 00:00:00 2001 From: Joao P Dubas Date: Thu, 9 May 2024 00:15:44 +0000 Subject: [PATCH] feat(nvim): upgrade to latest commit (#48) Also, use `gitsigns` shortcuts delivered in `kickstart` repo. Reviewed-on: https://gitea.dubas.dev/joao.dubas/ide/pulls/48 Co-authored-by: Joao P Dubas Co-committed-by: Joao P Dubas --- Dockerfile | 2 +- config/nvim/lua/custom/plugins/init.lua | 65 ------------------------- patch/kickstart.nvim/updates.patch | 31 ++++++------ 3 files changed, 15 insertions(+), 83 deletions(-) diff --git a/Dockerfile b/Dockerfile index e9e0fab..d247aeb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -180,7 +180,7 @@ COPY ./patch/kickstart.nvim/updates.patch /tmp COPY ./config/nvim/lua/custom/plugins/init.lua /tmp RUN git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME}"/nvim \ && cd ${XDG_CONFIG_HOME}/nvim \ - && git reset --hard c4363e4ad8aa3269a581d89b1e11403dd89df291 \ + && git reset --hard b9bd02d55b77293291a38fac9abe46acad9ab91d \ && git apply /tmp/updates.patch \ && cp /tmp/init.lua ${XDG_CONFIG_HOME}/nvim/lua/custom/plugins \ && nvim --headless "+Lazy! sync" +qa diff --git a/config/nvim/lua/custom/plugins/init.lua b/config/nvim/lua/custom/plugins/init.lua index d38d34e..73ef897 100644 --- a/config/nvim/lua/custom/plugins/init.lua +++ b/config/nvim/lua/custom/plugins/init.lua @@ -3,71 +3,6 @@ -- -- See the kickstart.nvim README for more information return { - { - 'lewis6991/gitsigns.nvim', - opts = { - on_attach = function(bufnr) - local gs = package.loaded.gitsigns - - local function map(mode, l, r, opts) - opts = opts or {} - opts.buffer = bufnr - vim.keymap.set(mode, l, r, opts) - end - - -- Navigation - map({ 'n', 'v' }, ']c', function() - if vim.wo.diff then - return ']c' - end - vim.schedule(function() - gs.next_hunk() - end) - return '' - end, { expr = true, desc = 'Jump to next hunk' }) - - map({ 'n', 'v' }, '[c', function() - if vim.wo.diff then - return '[c' - end - vim.schedule(function() - gs.prev_hunk() - end) - return '' - end, { expr = true, desc = 'Jump to previous hunk' }) - - -- Actions - -- visual mode - map('v', 'hs', function() - gs.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } - end, { desc = 'stage git hunk' }) - map('v', 'hr', function() - gs.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } - end, { desc = 'reset git hunk' }) - -- normal mode - map('n', 'hs', gs.stage_hunk, { desc = 'git stage hunk' }) - map('n', 'hr', gs.reset_hunk, { desc = 'git reset hunk' }) - map('n', 'hS', gs.stage_buffer, { desc = 'git Stage buffer' }) - map('n', 'hu', gs.undo_stage_hunk, { desc = 'undo stage hunk' }) - map('n', 'hR', gs.reset_buffer, { desc = 'git Reset buffer' }) - map('n', 'hp', gs.preview_hunk, { desc = 'preview git hunk' }) - map('n', 'hb', function() - gs.blame_line { full = false } - end, { desc = 'git blame line' }) - map('n', 'hd', gs.diffthis, { desc = 'git diff against index' }) - map('n', 'hD', function() - gs.diffthis '~' - end, { desc = 'git diff against last commit' }) - - -- Toggles - map('n', 'tb', gs.toggle_current_line_blame, { desc = 'toggle git blame line' }) - map('n', 'td', gs.toggle_deleted, { desc = 'toggle git show deleted' }) - - -- Text object - map({ 'o', 'x' }, 'ih', ':Gitsigns select_hunk', { desc = 'select git hunk' }) - end, - }, - }, { 'joaodubas/gitlinker.nvim', config = function() diff --git a/patch/kickstart.nvim/updates.patch b/patch/kickstart.nvim/updates.patch index 7db8054..d5f4279 100644 --- a/patch/kickstart.nvim/updates.patch +++ b/patch/kickstart.nvim/updates.patch @@ -1,11 +1,11 @@ diff --git a/init.lua b/init.lua -index 496f45b..c667dc3 100644 +index 88658ef..d9e96ee 100644 --- a/init.lua +++ b/init.lua @@ -91,7 +91,7 @@ vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' - -- Set to true if you have a Nerd Font installed + -- 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 @@ -39,15 +39,7 @@ index 496f45b..c667dc3 100644 -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` -@@ -283,6 +291,7 @@ require('lazy').setup({ - require('which-key').register { - ['c'] = { name = '[C]ode', _ = 'which_key_ignore' }, - ['d'] = { name = '[D]ocument', _ = 'which_key_ignore' }, -+ ['h'] = { name = 'Git [h]unk', _ = 'which_key_ignore' }, - ['r'] = { name = '[R]ename', _ = 'which_key_ignore' }, - ['s'] = { name = '[S]earch', _ = 'which_key_ignore' }, - ['w'] = { name = '[W]orkspace', _ = 'which_key_ignore' }, -@@ -551,6 +560,18 @@ require('lazy').setup({ +@@ -578,6 +586,18 @@ require('lazy').setup({ -- tsserver = {}, -- @@ -66,7 +58,7 @@ index 496f45b..c667dc3 100644 lua_ls = { -- cmd = {...}, -- filetypes = { ...}, -@@ -565,6 +586,10 @@ require('lazy').setup({ +@@ -592,6 +612,10 @@ require('lazy').setup({ }, }, }, @@ -77,7 +69,7 @@ index 496f45b..c667dc3 100644 } -- Ensure the servers and tools above are installed -@@ -591,6 +616,33 @@ require('lazy').setup({ +@@ -618,6 +642,33 @@ require('lazy').setup({ -- by the server configuration above. Useful when disabling -- certain features of an LSP (for example, turning off formatting for tsserver) server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) @@ -111,15 +103,16 @@ index 496f45b..c667dc3 100644 require('lspconfig')[server_name].setup(server) end, }, -@@ -802,7 +854,37 @@ require('lazy').setup({ +@@ -835,7 +886,38 @@ require('lazy').setup({ 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', opts = { -- ensure_installed = { 'bash', 'c', 'html', 'lua', 'luadoc', 'markdown', 'vim', 'vimdoc' }, +- ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'vim', 'vimdoc' }, + ensure_installed = { + 'bash', + 'c', + 'css', ++ 'diff', + 'dockerfile', + 'eex', + 'elixir', @@ -150,16 +143,20 @@ index 496f45b..c667dc3 100644 -- Autoinstall languages that are not installed auto_install = true, highlight = { -@@ -839,7 +921,7 @@ require('lazy').setup({ +@@ -874,18 +956,18 @@ require('lazy').setup({ -- 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.indent_line', -- require 'kickstart.plugins.lint', + -- require 'kickstart.plugins.autopairs', + -- require 'kickstart.plugins.neo-tree', +- -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps ++ require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -@@ -847,7 +929,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. -- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins`