summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pkgs/custom-neovim/config/lua/keymaps.lua9
-rw-r--r--pkgs/custom-neovim/config/lua/lsp.lua11
-rw-r--r--pkgs/custom-neovim/config/lua/plugins/git.lua12
-rw-r--r--pkgs/custom-neovim/config/lua/plugins/mini-statusline.lua142
4 files changed, 162 insertions, 12 deletions
diff --git a/pkgs/custom-neovim/config/lua/keymaps.lua b/pkgs/custom-neovim/config/lua/keymaps.lua
index 2ae207e..92dfd46 100644
--- a/pkgs/custom-neovim/config/lua/keymaps.lua
+++ b/pkgs/custom-neovim/config/lua/keymaps.lua
@@ -16,6 +16,15 @@ mapkey("n", "<leader>b", "Open buffer picker", ":Pick buffers<cr>", "mini.pick")
-- File manager
mapkey("n", "<leader>e", "Open file manager", ":lua MiniFiles.open()<cr>", "mini.files")
+-- Git
+mapkey("n", "<leader>g", "Manage git", "")
+mapkey("n", "<leader>gg", "Open neogit", ":Neogit<cr>", "neogit")
+mapkey("n", "<leader>ga", "Git add", ":Git add %:p<cr>", "mini-git")
+mapkey("n", "<leader>gr", "Git rm", ":Git rm %:p<cr>", "mini-git")
+mapkey("n", "<leader>gc", "Git commit", ":Git commit<cr>", "mini-git")
+mapkey("n", "<leader>gp", "Git pull", ":Git pull<cr>", "mini-git")
+mapkey("n", "<leader>gP", "Git push", ":Git push<cr>", "mini-git")
+
-- Really delete
mapkey({"n", "v"}, "<leader>d", "Really delete", [["_d]])
mapkey({"n", "v"}, "<leader>x", "Really delete character", [["_x]])
diff --git a/pkgs/custom-neovim/config/lua/lsp.lua b/pkgs/custom-neovim/config/lua/lsp.lua
index 5744280..68a4d3d 100644
--- a/pkgs/custom-neovim/config/lua/lsp.lua
+++ b/pkgs/custom-neovim/config/lua/lsp.lua
@@ -1,3 +1,6 @@
+-- LSP Configs
+-- Get more from https://github.com/neovim/nvim-lspconfig/tree/master/lsp
+
-- Lua LS
vim.lsp.config("lua_ls", {
cmd = { 'lua-language-server' },
@@ -15,6 +18,14 @@ vim.lsp.config("lua_ls", {
})
vim.lsp.enable("lua_ls")
+-- Marksman LS
+vim.lsp.config("marksman", {
+ cmd = {"marksman", "server"},
+ filetypes = {"markdown", "markdown.mdx"},
+ root_markers = {".marksman.toml", ".git"},
+})
+vim.lsp.enable("marksman")
+
-- LSP Autocommands
-- Disable semantic tokens to stop weird highlighting.
diff --git a/pkgs/custom-neovim/config/lua/plugins/git.lua b/pkgs/custom-neovim/config/lua/plugins/git.lua
index ce60214..d5ce713 100644
--- a/pkgs/custom-neovim/config/lua/plugins/git.lua
+++ b/pkgs/custom-neovim/config/lua/plugins/git.lua
@@ -1,6 +1,6 @@
return {
{
- "mini.git",
+ "mini-git", -- fsr this is named mini-git?
lazy = false,
cmd = "Git",
after = function()
@@ -20,7 +20,15 @@ return {
cmd = "Neogit",
after = function()
vim.cmd.packadd("plenary.nvim")
- require("neogit").setup()
+ require("neogit").setup {
+ kind = "floating",
+ mappings = {
+ status = {
+ ["<esc>"] = "Close",
+ ["<space>"] = "Toggle",
+ },
+ },
+ }
end
},
}
diff --git a/pkgs/custom-neovim/config/lua/plugins/mini-statusline.lua b/pkgs/custom-neovim/config/lua/plugins/mini-statusline.lua
index 36e268d..9018175 100644
--- a/pkgs/custom-neovim/config/lua/plugins/mini-statusline.lua
+++ b/pkgs/custom-neovim/config/lua/plugins/mini-statusline.lua
@@ -2,27 +2,149 @@ return {
"mini.statusline",
lazy = false,
after = function()
- require("mini.statusline").setup {
+ MiniStatusline = require("mini.statusline")
+
+ local hi_pattern = '%%#%s#%s%%*'
+
+ local custom_sections = {
+
+ git = function(args)
+ if MiniStatusline.is_truncated(args.trunc_width) then return '' end
+
+ local summary = vim.b.minigit_summary and vim.b.minigit_summary.head_name or nil
+ if summary == nil then return '' end
+
+ local use_icons = MiniStatusline.config.use_icons
+ local icon = args.icon or (use_icons and ' ' or 'Git: ')
+ return " " .. icon .. (summary == '' and '-' or summary)
+ end,
+
+ diff = function(args)
+ if MiniStatusline.is_truncated(args.trunc_width) then return '' end
+
+ if not vim.b.minidiff_summary then
+ return ''
+ end
+
+ if not vim.b.minidiff_summary.add then
+ return ''
+ end
+
+ if not vim.b.minidiff_summary.change then
+ return ''
+ end
+
+ if not vim.b.minidiff_summary.delete then
+ return ''
+ end
+
+ local use_icons = MiniStatusline.config.use_icons
+
+ local status = {}
+
+ local add_icon = use_icons and " " or "+"
+ local change_icon = use_icons and " " or "~"
+ local delete_icon = use_icons and " " or "-"
+
+ local summary = vim.b.minidiff_summary
+
+ if summary.add > 0 then
+ table.insert(status, hi_pattern:format("Added", ("%s%s"):format(add_icon, summary.add)))
+ end
+
+ if summary.change > 0 then
+ table.insert(status, hi_pattern:format("Changed", ("%s%s"):format(change_icon, summary.change)))
+ end
+
+ if summary.delete > 0 then
+ table.insert(status, hi_pattern:format("Removed", ("%s%s"):format(delete_icon, summary.delete)))
+ end
+
+ summary = table.concat(status, " ")
+
+ if summary == "" then return "" end
+
+ local icon = args.icon or (use_icons and '' or 'Diff: ')
+ return " " .. icon .. (summary == '' and '-' or summary)
+ end,
+
+ diagnostics = function(args)
+ if MiniStatusline.is_truncated(args.trunc_width) then return '' end
+
+ local use_icons = MiniStatusline.config.use_icons
+
+ local diagnostics = {}
+
+ local error_icon = use_icons and " " or "E"
+ local warning_icon = use_icons and " " or "W"
+ local info_icon = use_icons and " " or "I"
+ local hint_icon = use_icons and " " or "H"
+
+ local errors = #vim.diagnostic.get(0, { severity = 1 })
+
+ if errors > 0 then
+ table.insert(diagnostics, hi_pattern:format("DiagnosticSignError", ("%s%s"):format(error_icon, errors)))
+ end
+
+ local warnings = #vim.diagnostic.get(0, { severity = 2 })
+
+ if warnings > 0 then
+ table.insert(diagnostics, hi_pattern:format("DiagnosticSignWarn", ("%s%s"):format(warning_icon, warnings)))
+ end
+
+ local infos = #vim.diagnostic.get(0, { severity = 3 })
+
+ if infos > 0 then
+ table.insert(diagnostics, hi_pattern:format("DiagnosticSignInfo", ("%s%s"):format(info_icon, infos)))
+ end
+
+ local hints = #vim.diagnostic.get(0, { severity = 4 })
+
+ if hints > 0 then
+ table.insert(diagnostics, hi_pattern:format("DiagnosticSignHint", ("%s%s"):format(hint_icon, hints)))
+ end
+
+ vim.defer_fn(vim.cmd.redrawstatus, 500)
+
+ -- Don't show diagnostics in insert mode.
+ if MiniStatusline.section_mode({}):find "Insert" then
+ return ""
+ end
+
+ local icon = args.icon or (use_icons and '' or 'Diag: ')
+
+ local status = table.concat(diagnostics, " ")
+
+ if status == "" then return "" end
+
+ return " " .. icon .. status
+ end,
+
+ location = function()
+ return '%2l:%-2c'
+ end
+
+ }
+
+ MiniStatusline.setup {
content = {
active = function()
local mode, mode_hl = MiniStatusline.section_mode({ trunc_width = 120 })
- local git = MiniStatusline.section_git({ trunc_width = 40 })
- local diff = MiniStatusline.section_diff({ trunc_width = 75 })
- local diagnostics = MiniStatusline.section_diagnostics({ trunc_width = 75 })
- local lsp = MiniStatusline.section_lsp({ trunc_width = 75 })
+ local git = custom_sections.git({ trunc_width = 40 })
+ local diff = custom_sections.diff({ trunc_width = 75 })
+ local diagnostics = custom_sections.diagnostics({ trunc_width = 75 })
local filename = MiniStatusline.section_filename({ trunc_width = 140 })
local fileinfo = MiniStatusline.section_fileinfo({ trunc_width = 120 })
- local location = MiniStatusline.section_location({ trunc_width = 75 })
- local search = MiniStatusline.section_searchcount({ trunc_width = 75 })
+ local location = custom_sections.location()
return MiniStatusline.combine_groups({
{ hl = mode_hl, strings = { mode } },
- { hl = 'MiniStatuslineDevinfo', strings = { git, diff, diagnostics, lsp } },
+ { hl = 'MiniStatuslineFilename', strings = { git, diff, diagnostics } },
'%<', -- Mark general truncate point
{ hl = 'MiniStatuslineFilename', strings = { filename } },
'%=', -- End left alignment
- { hl = 'MiniStatuslineFileinfo', strings = { fileinfo } },
- { hl = mode_hl, strings = { search, location } },
+ { hl = 'MiniStatuslineFilename', strings = { fileinfo } },
+ { hl = mode_hl, strings = { location } },
})
end
},