commit 33e218e068b9b2dd9e43876658789f1aaa13a126
parent efbcb7cf1868201de63f6fc5b8413af3238ae2f4
Author: Thomas Vigouroux <thomas.vigouroux@protonmail.com>
Date: Fri, 22 Jul 2022 08:12:31 +0200
Integrate with lazygit instead of neogit
Diffstat:
5 files changed, 45 insertions(+), 24 deletions(-)
diff --git a/after/plugin/mappings.vim b/after/plugin/mappings.vim
@@ -1,4 +1,4 @@
-" Last Change: 2022 Jul 05
+" Last Change: 2022 Jul 21
vnoremap <silent> < <gv
vnoremap <silent> > >gv
@@ -36,5 +36,3 @@ nnoremap gp :silent %!prettier --stdin-filepath % --trailing-comma all --single-
nnoremap <Leader>zs <cmd>1Zest search<CR>
nnoremap <Leader>zc <cmd>Zest create<CR>
-
-nnoremap <Leader>g <cmd>Neogit<CR>
diff --git a/lua/completree-config.lua b/lua/completree-config.lua
@@ -59,6 +59,7 @@ comp.setup {
nix = lsp_completion,
tex = lsp_completion,
haskell = lsp_completion,
+ go = lsp_completion,
-- For git commit and text only do luasnip
NeogitCommitMessage = cdef.luasnip,
diff --git a/lua/lsp_config.lua b/lua/lsp_config.lua
@@ -211,6 +211,7 @@ local lsps = {
pylsp = default_config,
rnix = default_config,
vimls = default_config,
+ gopls = default_config,
-- Special cases
rust_analyzer = {
diff --git a/lua/neogit-config.lua b/lua/neogit-config.lua
@@ -1,5 +1,4 @@
-local gitsigns = require'gitsigns'
-local neogit = require'neogit'
+local gitsigns = require 'gitsigns'
gitsigns.setup {
current_line_blame = true,
@@ -7,25 +6,48 @@ gitsigns.setup {
delay = 1000,
},
on_attach = function(bufnr)
- vim.api.nvim_buf_set_keymap(bufnr, 'n', '<C-S>', ':Gitsigns stage_hunk<CR>', { silent = true})
- vim.api.nvim_buf_set_keymap(bufnr, 'v', '<C-S>', ':Gitsigns stage_hunk<CR>', { silent = true})
+ vim.api.nvim_buf_set_keymap(bufnr, 'n', '<C-S>', ':Gitsigns stage_hunk<CR>', { silent = true })
+ vim.api.nvim_buf_set_keymap(bufnr, 'v', '<C-S>', ':Gitsigns stage_hunk<CR>', { silent = true })
end
}
-neogit.setup {
- disable_commit_confirmation = true,
- commit_popup = {
- kind = 'floating',
- },
- sections = {
- untracked = {
- folded = true,
- },
- recent = {
- folded = false,
- }
- }
-}
+do -- Terminal mode configuration
+ local cfg_template = [[
+git:
+ paging:
+ colorArg: always
+ pager: delta --dark --paging=never
+promptToReturnFromSubprocess: false
+os:
+ editCommand: 'nvim'
+ editCommandTemplate: '{{editor}} --server "%s" --remote {{filename}}'
+ openCommand: 'nvim --server "%s" --remote {{filename}}'
+ ]]
+ local lg_config_path = "/tmp/nvim.lg.config"
+
+ local cfg = io.open(lg_config_path, "w")
+ if cfg then
+ cfg:write(string.format(cfg_template, vim.v.servername, vim.v.servername))
+ else
+ error("Could not open config file")
+ end
+ local function open_lz()
+ vim.cmd.terminal { "lazygit", "--use-config-file", lg_config_path }
+ vim.opt_local.number = false
+ vim.opt_local.relativenumber = false
+
+ vim.api.nvim_create_autocmd("TermClose", {
+ buffer = vim.api.nvim_get_current_buf(),
+ callback = function(opts)
+ if vim.v.event.status == 0 then
+ vim.api.nvim_buf_delete(opts.buf, { force = true })
+ gitsigns.refresh()
+ end
+ end
+ })
+
+ vim.cmd.startinsert()
+ end
-vim.keymap.set('n', '<Leader>c', function() neogit.open{ 'commit' } end)
-vim.keymap.set('n', '<Leader>p', function() neogit.open{ 'push' } end)
+ vim.keymap.set('n', '<Leader>g', open_lz)
+end
diff --git a/lua/plugins.lua b/lua/plugins.lua
@@ -69,7 +69,6 @@ return packer.startup(function(use)
require'colorizer'.setup()
end}
use 'lewis6991/impatient.nvim'
- use { 'TimUntersberger/neogit', requires = {'nvim-lua/plenary.nvim' } }
-- Git because git
use { 'lewis6991/gitsigns.nvim', requires = { 'nvim-lua/plenary.nvim' } }