feat(nvim): upgrade to latest commit (#48)
Also, use `gitsigns` shortcuts delivered in `kickstart` repo. Reviewed-on: #48 Co-authored-by: Joao P Dubas <joao.dubas+gitea@gmail.com> Co-committed-by: Joao P Dubas <joao.dubas+gitea@gmail.com>
This commit is contained in:
parent
544fb06424
commit
746be1e73c
@ -180,7 +180,7 @@ COPY ./patch/kickstart.nvim/updates.patch /tmp
|
|||||||
COPY ./config/nvim/lua/custom/plugins/init.lua /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 \
|
RUN git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME}"/nvim \
|
||||||
&& cd ${XDG_CONFIG_HOME}/nvim \
|
&& cd ${XDG_CONFIG_HOME}/nvim \
|
||||||
&& git reset --hard c4363e4ad8aa3269a581d89b1e11403dd89df291 \
|
&& git reset --hard b9bd02d55b77293291a38fac9abe46acad9ab91d \
|
||||||
&& git apply /tmp/updates.patch \
|
&& git apply /tmp/updates.patch \
|
||||||
&& cp /tmp/init.lua ${XDG_CONFIG_HOME}/nvim/lua/custom/plugins \
|
&& cp /tmp/init.lua ${XDG_CONFIG_HOME}/nvim/lua/custom/plugins \
|
||||||
&& nvim --headless "+Lazy! sync" +qa
|
&& nvim --headless "+Lazy! sync" +qa
|
||||||
|
@ -3,71 +3,6 @@
|
|||||||
--
|
--
|
||||||
-- See the kickstart.nvim README for more information
|
-- See the kickstart.nvim README for more information
|
||||||
return {
|
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 '<Ignore>'
|
|
||||||
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 '<Ignore>'
|
|
||||||
end, { expr = true, desc = 'Jump to previous hunk' })
|
|
||||||
|
|
||||||
-- Actions
|
|
||||||
-- visual mode
|
|
||||||
map('v', '<leader>hs', function()
|
|
||||||
gs.stage_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
|
||||||
end, { desc = 'stage git hunk' })
|
|
||||||
map('v', '<leader>hr', function()
|
|
||||||
gs.reset_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
|
||||||
end, { desc = 'reset git hunk' })
|
|
||||||
-- normal mode
|
|
||||||
map('n', '<leader>hs', gs.stage_hunk, { desc = 'git stage hunk' })
|
|
||||||
map('n', '<leader>hr', gs.reset_hunk, { desc = 'git reset hunk' })
|
|
||||||
map('n', '<leader>hS', gs.stage_buffer, { desc = 'git Stage buffer' })
|
|
||||||
map('n', '<leader>hu', gs.undo_stage_hunk, { desc = 'undo stage hunk' })
|
|
||||||
map('n', '<leader>hR', gs.reset_buffer, { desc = 'git Reset buffer' })
|
|
||||||
map('n', '<leader>hp', gs.preview_hunk, { desc = 'preview git hunk' })
|
|
||||||
map('n', '<leader>hb', function()
|
|
||||||
gs.blame_line { full = false }
|
|
||||||
end, { desc = 'git blame line' })
|
|
||||||
map('n', '<leader>hd', gs.diffthis, { desc = 'git diff against index' })
|
|
||||||
map('n', '<leader>hD', function()
|
|
||||||
gs.diffthis '~'
|
|
||||||
end, { desc = 'git diff against last commit' })
|
|
||||||
|
|
||||||
-- Toggles
|
|
||||||
map('n', '<leader>tb', gs.toggle_current_line_blame, { desc = 'toggle git blame line' })
|
|
||||||
map('n', '<leader>td', gs.toggle_deleted, { desc = 'toggle git show deleted' })
|
|
||||||
|
|
||||||
-- Text object
|
|
||||||
map({ 'o', 'x' }, 'ih', ':<C-U>Gitsigns select_hunk<CR>', { desc = 'select git hunk' })
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
'joaodubas/gitlinker.nvim',
|
'joaodubas/gitlinker.nvim',
|
||||||
config = function()
|
config = function()
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
diff --git a/init.lua b/init.lua
|
diff --git a/init.lua b/init.lua
|
||||||
index 496f45b..c667dc3 100644
|
index 88658ef..d9e96ee 100644
|
||||||
--- a/init.lua
|
--- a/init.lua
|
||||||
+++ b/init.lua
|
+++ b/init.lua
|
||||||
@@ -91,7 +91,7 @@ vim.g.mapleader = ' '
|
@@ -91,7 +91,7 @@ vim.g.mapleader = ' '
|
||||||
vim.g.maplocalleader = ' '
|
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 = false
|
||||||
+vim.g.have_nerd_font = true
|
+vim.g.have_nerd_font = true
|
||||||
|
|
||||||
@ -39,15 +39,7 @@ index 496f45b..c667dc3 100644
|
|||||||
-- [[ Basic Keymaps ]]
|
-- [[ Basic Keymaps ]]
|
||||||
-- See `:help vim.keymap.set()`
|
-- See `:help vim.keymap.set()`
|
||||||
|
|
||||||
@@ -283,6 +291,7 @@ require('lazy').setup({
|
@@ -578,6 +586,18 @@ require('lazy').setup({
|
||||||
require('which-key').register {
|
|
||||||
['<leader>c'] = { name = '[C]ode', _ = 'which_key_ignore' },
|
|
||||||
['<leader>d'] = { name = '[D]ocument', _ = 'which_key_ignore' },
|
|
||||||
+ ['<leader>h'] = { name = 'Git [h]unk', _ = 'which_key_ignore' },
|
|
||||||
['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
|
|
||||||
['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' },
|
|
||||||
['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
|
|
||||||
@@ -551,6 +560,18 @@ require('lazy').setup({
|
|
||||||
-- tsserver = {},
|
-- tsserver = {},
|
||||||
--
|
--
|
||||||
|
|
||||||
@ -66,7 +58,7 @@ index 496f45b..c667dc3 100644
|
|||||||
lua_ls = {
|
lua_ls = {
|
||||||
-- cmd = {...},
|
-- cmd = {...},
|
||||||
-- filetypes = { ...},
|
-- 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
|
-- 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
|
-- by the server configuration above. Useful when disabling
|
||||||
-- certain features of an LSP (for example, turning off formatting for tsserver)
|
-- certain features of an LSP (for example, turning off formatting for tsserver)
|
||||||
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
|
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)
|
require('lspconfig')[server_name].setup(server)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
@@ -802,7 +854,37 @@ require('lazy').setup({
|
@@ -835,7 +886,38 @@ require('lazy').setup({
|
||||||
'nvim-treesitter/nvim-treesitter',
|
'nvim-treesitter/nvim-treesitter',
|
||||||
build = ':TSUpdate',
|
build = ':TSUpdate',
|
||||||
opts = {
|
opts = {
|
||||||
- ensure_installed = { 'bash', 'c', 'html', 'lua', 'luadoc', 'markdown', 'vim', 'vimdoc' },
|
- ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'vim', 'vimdoc' },
|
||||||
+ ensure_installed = {
|
+ ensure_installed = {
|
||||||
+ 'bash',
|
+ 'bash',
|
||||||
+ 'c',
|
+ 'c',
|
||||||
+ 'css',
|
+ 'css',
|
||||||
|
+ 'diff',
|
||||||
+ 'dockerfile',
|
+ 'dockerfile',
|
||||||
+ 'eex',
|
+ 'eex',
|
||||||
+ 'elixir',
|
+ 'elixir',
|
||||||
@ -150,16 +143,20 @@ index 496f45b..c667dc3 100644
|
|||||||
-- Autoinstall languages that are not installed
|
-- Autoinstall languages that are not installed
|
||||||
auto_install = true,
|
auto_install = true,
|
||||||
highlight = {
|
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).
|
-- 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.indent_line',
|
||||||
+ require 'kickstart.plugins.indent_line',
|
+ require 'kickstart.plugins.indent_line',
|
||||||
-- require 'kickstart.plugins.lint',
|
-- 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`
|
-- 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.
|
-- 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`
|
-- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user