nvim: add neogit
This commit is contained in:
parent
fc0a456426
commit
b361c7529f
|
@ -1,27 +1,5 @@
|
||||||
-- Is new loader available?
|
local ok, err = pcall(require, 'main')
|
||||||
if vim.loader then
|
|
||||||
vim.loader.enable()
|
if not ok then
|
||||||
end
|
print('Error: ' .. err)
|
||||||
|
|
||||||
-- Setup default options
|
|
||||||
require 'config.options'
|
|
||||||
require 'config.keymaps'
|
|
||||||
require 'config.autocmd'
|
|
||||||
|
|
||||||
-- Are we inside Neovide?
|
|
||||||
if vim.g.neovide then
|
|
||||||
require 'config.neovide'
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Try load package manager
|
|
||||||
local ok, err = pcall(function()
|
|
||||||
require 'config.manager'
|
|
||||||
end)
|
|
||||||
|
|
||||||
if not ok and err then
|
|
||||||
vim.cmd 'colorscheme slate'
|
|
||||||
|
|
||||||
vim.schedule(function()
|
|
||||||
vim.notify(err, vim.log.levels.ERROR)
|
|
||||||
end)
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,26 +7,27 @@
|
||||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||||
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
|
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
|
||||||
"diffview.nvim": { "branch": "main", "commit": "3dc498c9777fe79156f3d32dddd483b8b3dbd95f" },
|
"diffview.nvim": { "branch": "main", "commit": "3dc498c9777fe79156f3d32dddd483b8b3dbd95f" },
|
||||||
"gitsigns.nvim": { "branch": "main", "commit": "c5ff7628e19a47ec14d3657294cc074ecae27b99" },
|
"gitsigns.nvim": { "branch": "main", "commit": "0a2a93f687ec051292943a4d139366332ac93688" },
|
||||||
"haskell-tools.nvim": { "branch": "master", "commit": "2faa2c879c82652f1df3974c185901cf93c6367c" },
|
"haskell-tools.nvim": { "branch": "master", "commit": "2faa2c879c82652f1df3974c185901cf93c6367c" },
|
||||||
"kanagawa.nvim": { "branch": "master", "commit": "c19b9023842697ec92caf72cd3599f7dd7be4456" },
|
"kanagawa.nvim": { "branch": "master", "commit": "c19b9023842697ec92caf72cd3599f7dd7be4456" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "28126922c9b54e35a192ac415788f202c3944c9f" },
|
"lazy.nvim": { "branch": "main", "commit": "aedcd79811d491b60d0a6577a9c1701063c2a609" },
|
||||||
"lualine.nvim": { "branch": "master", "commit": "566b7036f717f3d676362742630518a47f132fff" },
|
"lualine.nvim": { "branch": "master", "commit": "7d131a8d3ba5016229e8a1d08bf8782acea98852" },
|
||||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "3ba1b92b771f33256b4969d696b82c8ae7075364" },
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "b9084b1f42f790d6230dc66dbcb6bcc35b148552" },
|
||||||
"mason-nvim-dap.nvim": { "branch": "main", "commit": "3614a39aae98ccd34124b072939d6283853b3dd2" },
|
"mason-nvim-dap.nvim": { "branch": "main", "commit": "3614a39aae98ccd34124b072939d6283853b3dd2" },
|
||||||
"mason.nvim": { "branch": "main", "commit": "9c9416817c9f4e6f333c749327a1ed5355cfab61" },
|
"mason.nvim": { "branch": "main", "commit": "9c9416817c9f4e6f333c749327a1ed5355cfab61" },
|
||||||
"neo-tree.nvim": { "branch": "v3.x", "commit": "2f2d08894bbc679d4d181604c16bb7079f646384" },
|
"neo-tree.nvim": { "branch": "v3.x", "commit": "2f2d08894bbc679d4d181604c16bb7079f646384" },
|
||||||
"neodev.nvim": { "branch": "main", "commit": "5bbbeda6a9c672f314c95ca47a8b495cf6de17f9" },
|
"neodev.nvim": { "branch": "main", "commit": "3408a4daeca5ff8f41cb2c668b6d8fcc665f793a" },
|
||||||
|
"neogit": { "branch": "master", "commit": "ce0c369ccdba3f644a3b28f4c053421f435352c9" },
|
||||||
"nui.nvim": { "branch": "main", "commit": "35da9ca1de0fc4dda96c2e214d93d363c145f418" },
|
"nui.nvim": { "branch": "main", "commit": "35da9ca1de0fc4dda96c2e214d93d363c145f418" },
|
||||||
"nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" },
|
"nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" },
|
||||||
"nvim-dap": { "branch": "master", "commit": "9adbfdca13afbe646d09a8d7a86d5d031fb9c5a5" },
|
"nvim-dap": { "branch": "master", "commit": "9adbfdca13afbe646d09a8d7a86d5d031fb9c5a5" },
|
||||||
"nvim-dap-ui": { "branch": "master", "commit": "d845ebd798ad1cf30aa4abd4c4eff795cdcfdd4f" },
|
"nvim-dap-ui": { "branch": "master", "commit": "d845ebd798ad1cf30aa4abd4c4eff795cdcfdd4f" },
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "8917d2c830e04bf944a699b8c41f097621283828" },
|
"nvim-lspconfig": { "branch": "master", "commit": "8917d2c830e04bf944a699b8c41f097621283828" },
|
||||||
"nvim-notify": { "branch": "master", "commit": "80b67b265530632505193553d05127ae7fe09ddd" },
|
"nvim-notify": { "branch": "master", "commit": "80b67b265530632505193553d05127ae7fe09ddd" },
|
||||||
"nvim-treesitter": { "branch": "master", "commit": "cd4e0909948eb33d3959e133c16f837e4db122c6" },
|
"nvim-treesitter": { "branch": "master", "commit": "ce4adf11cfe36fc5b0e5bcdce0c7c6e8fbc9798a" },
|
||||||
"nvim-web-devicons": { "branch": "master", "commit": "140edfcf25093e8b321d13e154cbce89ee868ca0" },
|
"nvim-web-devicons": { "branch": "master", "commit": "b427ac5f9dff494f839e81441fb3f04a58cbcfbc" },
|
||||||
"plenary.nvim": { "branch": "master", "commit": "663246936325062427597964d81d30eaa42ab1e4" },
|
"plenary.nvim": { "branch": "master", "commit": "663246936325062427597964d81d30eaa42ab1e4" },
|
||||||
"rustaceanvim": { "branch": "master", "commit": "a095a1f9397310d108ead239edc068b2624695b6" },
|
"rustaceanvim": { "branch": "master", "commit": "bc8c4b8f7606d5b7c067cd8369e25c1a7ff77bd0" },
|
||||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" },
|
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" },
|
||||||
"telescope.nvim": { "branch": "0.1.x", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" },
|
"telescope.nvim": { "branch": "0.1.x", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" },
|
||||||
"which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" }
|
"which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" }
|
||||||
|
|
|
@ -1,40 +1,3 @@
|
||||||
local M = {}
|
return {
|
||||||
|
keymap = require 'config.helpers.keymap',
|
||||||
|
}
|
||||||
local defaults = { noremap = true, silent = true }
|
|
||||||
|
|
||||||
---@class KeymapOpts
|
|
||||||
---@field [1]? string Shorthand description
|
|
||||||
---@field desc? string Description
|
|
||||||
---@field [2]? number|boolean Shorthand buffer
|
|
||||||
---@field buffer? number|boolean Buffer
|
|
||||||
|
|
||||||
---Wrapper around `vim.keymap.set`
|
|
||||||
---@param modes string|string[]
|
|
||||||
function M.keymap(modes)
|
|
||||||
---@param lhs string
|
|
||||||
return function(lhs)
|
|
||||||
---@param rhs string|function
|
|
||||||
return function(rhs)
|
|
||||||
---@param opts string|KeymapOpts
|
|
||||||
return function(opts)
|
|
||||||
-- Either 'string' or 'table'
|
|
||||||
local type = type(opts)
|
|
||||||
---@type table
|
|
||||||
local options
|
|
||||||
if type == 'string' then
|
|
||||||
options = vim.tbl_extend('force', defaults, {desc=opts})
|
|
||||||
elseif type == 'table' then
|
|
||||||
opts.desc = opts[1] or opts.desc
|
|
||||||
opts.buffer = opts[2] or opts.buffer
|
|
||||||
opts[1], opts[2] = nil, nil
|
|
||||||
options = vim.tbl_extend('force', defaults, opts)
|
|
||||||
end
|
|
||||||
vim.keymap.set(modes, lhs, rhs, options)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
return M
|
|
||||||
|
|
35
nvim/lua/config/helpers/keymap.lua
Normal file
35
nvim/lua/config/helpers/keymap.lua
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
local defaults = { noremap = true, silent = true }
|
||||||
|
|
||||||
|
---@class KeymapOpts
|
||||||
|
---@field [1]? string Shorthand description
|
||||||
|
---@field desc? string Description
|
||||||
|
---@field [2]? number|boolean Shorthand buffer
|
||||||
|
---@field buffer? number|boolean Buffer
|
||||||
|
|
||||||
|
---Wrapper around `vim.keymap.set`
|
||||||
|
---@param modes string|string[]
|
||||||
|
return function(modes)
|
||||||
|
---@param lhs string
|
||||||
|
return function(lhs)
|
||||||
|
---@param rhs string|function
|
||||||
|
return function(rhs)
|
||||||
|
---@param opts string|KeymapOpts
|
||||||
|
return function(opts)
|
||||||
|
local kind = type(opts) ---@cast kind 'string'|'table'
|
||||||
|
---@type table
|
||||||
|
local options
|
||||||
|
|
||||||
|
if kind == 'string' then
|
||||||
|
options = vim.tbl_extend('force', defaults, {desc=opts})
|
||||||
|
else
|
||||||
|
opts.desc = opts[1] or opts.desc
|
||||||
|
opts.buffer = opts[2] or opts.buffer
|
||||||
|
opts[1], opts[2] = nil, nil
|
||||||
|
options = vim.tbl_extend('force', defaults, opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.keymap.set(modes, lhs, rhs, options)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,7 +1,7 @@
|
||||||
local H = require 'config.helpers'
|
local map = require 'config.helpers.keymap'
|
||||||
local n = H.keymap 'n'
|
local n = map 'n'
|
||||||
local t = H.keymap 't'
|
local t = map 't'
|
||||||
local nv = H.keymap {'n', 'v'}
|
local nv = map {'n', 'v'}
|
||||||
|
|
||||||
|
|
||||||
n '<leader>mn' ':Explore ~/.config/nvim/<cr>' 'Meta: open Neovim config'
|
n '<leader>mn' ':Explore ~/.config/nvim/<cr>' 'Meta: open Neovim config'
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
local is, when = require 'config.compose' ()
|
local is, when = require 'config.compose' ()
|
||||||
local H = require 'config.helpers'
|
local map = require 'config.helpers.keymap'
|
||||||
local n = H.keymap 'n'
|
local n = map 'n'
|
||||||
|
|
||||||
|
|
||||||
---@type LazySpec
|
---@type LazySpec
|
||||||
|
@ -63,13 +63,13 @@ return {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
n '<leader>ff' (builtin.find_files) 'Telescope: find files'
|
n '<leader>ff' (builtin.find_files) 'Telescope: files'
|
||||||
n '<leader>fb' (builtin.buffers) 'Telescope: find buffers'
|
n '<leader>fb' (builtin.buffers) 'Telescope: buffers'
|
||||||
n '<leader>fg' (builtin.live_grep) 'Telescope: grep content'
|
n '<leader>fg' (builtin.live_grep) 'Telescope: grep'
|
||||||
n '<leader>fh' (builtin.help_tags) 'Telescope: search docs'
|
n '<leader>fh' (builtin.help_tags) 'Telescope: docs'
|
||||||
|
|
||||||
if is 'standalone' then
|
if is 'standalone' then
|
||||||
n '<leader>fn' (ext.notify.notify) 'Telescope: find notifications'
|
n '<leader>fn' (ext.notify.notify) 'Telescope: notifications'
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
@ -88,7 +88,7 @@ return {
|
||||||
ignore_install = {},
|
ignore_install = {},
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
-- neovim
|
-- neovim
|
||||||
'vimdoc', 'lua', 'query',
|
'vimdoc', 'lua', 'query', 'luadoc',
|
||||||
-- data
|
-- data
|
||||||
'json', 'xml', 'yaml', 'toml',
|
'json', 'xml', 'yaml', 'toml',
|
||||||
-- markdown
|
-- markdown
|
||||||
|
@ -131,11 +131,57 @@ return {
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Git signs
|
-- Git - file hunks
|
||||||
{
|
{
|
||||||
'lewis6991/gitsigns.nvim',
|
'lewis6991/gitsigns.nvim',
|
||||||
enabled = is 'standalone',
|
enabled = is 'standalone',
|
||||||
config = true,
|
config = function()
|
||||||
|
local gs = require 'gitsigns'
|
||||||
|
|
||||||
|
gs.setup {
|
||||||
|
on_attach = function()
|
||||||
|
n '<Leader>hp' (gs.preview_hunk) 'Hunk: preview'
|
||||||
|
n '<Leader>hs' (gs.stage_hunk) 'Hunk: stage'
|
||||||
|
n '<Leader>hu' (gs.undo_stage_hunk) 'Hunk: unstage'
|
||||||
|
n '<Leader>hr' (gs.reset_hunk) 'Hunk: reset'
|
||||||
|
n '<leader>hS' (gs.stage_buffer) 'Hunk: buffer stage'
|
||||||
|
n '<leader>hR' (gs.reset_buffer) 'Hunk: buffer reset'
|
||||||
|
n '<leader>hd' (gs.toggle_deleted) 'Hunk: show deleted'
|
||||||
|
end
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Git - project diff
|
||||||
|
{
|
||||||
|
'sindrets/diffview.nvim',
|
||||||
|
enabled = is 'standalone',
|
||||||
|
dependencies = {
|
||||||
|
'nvim-lua/plenary.nvim',
|
||||||
|
'nvim-tree/nvim-web-devicons',
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
n '<Leader>gd' ':DiffviewOpen<CR>' 'Git: Diff'
|
||||||
|
n '<Leader>gc' ':DiffviewClose<CR>' 'Git: Close'
|
||||||
|
n '<Leader>gh' ':DiffviewFileHistory<CR>' 'Git: History'
|
||||||
|
end
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Git: ops
|
||||||
|
{
|
||||||
|
'NeogitOrg/neogit',
|
||||||
|
dependencies = {
|
||||||
|
'nvim-lua/plenary.nvim',
|
||||||
|
'sindrets/diffview.nvim',
|
||||||
|
'nvim-telescope/telescope.nvim'
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local neogit = require 'neogit'
|
||||||
|
|
||||||
|
n '<Leader>gn' (neogit.open) 'Git: Neogit'
|
||||||
|
|
||||||
|
neogit.setup({})
|
||||||
|
end
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Comments
|
-- Comments
|
||||||
|
@ -177,16 +223,6 @@ return {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Git diffviewer
|
|
||||||
{
|
|
||||||
'sindrets/diffview.nvim',
|
|
||||||
enabled = is 'standalone',
|
|
||||||
dependencies = {
|
|
||||||
'nvim-lua/plenary.nvim',
|
|
||||||
'nvim-tree/nvim-web-devicons',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Snippet engine
|
-- Snippet engine
|
||||||
{
|
{
|
||||||
'L3MON4D3/LuaSnip',
|
'L3MON4D3/LuaSnip',
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
local H = require 'config.helpers'
|
local map = require 'config.helpers.keymap'
|
||||||
local n = H.keymap 'n'
|
local n = map 'n'
|
||||||
|
|
||||||
|
|
||||||
---@param buffer number
|
---@param buffer number
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
local H = require 'config.helpers'
|
local map = require 'config.helpers.keymap'
|
||||||
local n = H.keymap 'n'
|
local n = map 'n'
|
||||||
|
|
||||||
|
|
||||||
vim.g.rustaceanvim = function()
|
vim.g.rustaceanvim = function()
|
||||||
|
|
20
nvim/lua/main.lua
Normal file
20
nvim/lua/main.lua
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
-- Setup default options
|
||||||
|
require 'config.options'
|
||||||
|
require 'config.keymaps'
|
||||||
|
require 'config.autocmd'
|
||||||
|
|
||||||
|
-- Are we inside Neovide?
|
||||||
|
if vim.g.neovide then
|
||||||
|
require 'config.neovide'
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Try load package manager
|
||||||
|
local ok, err = pcall(require, 'config.manager')
|
||||||
|
|
||||||
|
if not ok then
|
||||||
|
vim.cmd 'colorscheme slate'
|
||||||
|
|
||||||
|
vim.schedule(function()
|
||||||
|
vim.notify(err, vim.log.levels.ERROR)
|
||||||
|
end)
|
||||||
|
end
|
Loading…
Reference in a new issue