Compare commits

..

No commits in common. "b97d011b55b62bea646d3cdd4cb600e3e1079b0d" and "4a47c79be242872a3b8071a6b98e6210d8c63b66" have entirely different histories.

5 changed files with 142 additions and 190 deletions

View File

@ -0,0 +1,21 @@
-- Author : swytch
-- Created : Sunday Jan. 29, 2023 00:20:31 CET
-- License : GPLv3
-- Description : Mini.comment plugin config file
return {
"echasnovski/mini.comment",
version = "*",
opts = {
mappings = {
comment = "<leader>c",
comment_line = "<leader><Space>",
text_object = "gc",
},
},
config = function(_, opts)
require("mini.comment").setup(opts)
end,
}

View File

@ -1,44 +0,0 @@
-- Author : swytch
-- Created : Sunday Jan. 29, 2023 00:20:31 CET
-- License : GPLv3
-- Description : Mini.comment plugin config file
return {
{
"echasnovski/mini.comment",
version = "*",
opts = {
mappings = {
comment = "<leader>c",
comment_line = "<leader><Space>",
text_object = "gc",
},
},
config = function(_, opts)
require("mini.comment").setup(opts)
end
},
{
"echasnovski/mini.pairs",
version = "*",
config = function() require("mini.pairs").setup() end,
},
{
"echasnovski/mini.indentscope",
version = "*",
opts = function()
local plugin = require("mini.indentscope")
return {
draw = {
animation = plugin.gen_animation.none()
}
}
end,
config = function(_, opts)
require("mini.indentscope").setup(opts)
end,
}
}

View File

@ -9,7 +9,7 @@ _G.lsp_root_dir = vim.fn.stdpath("data") .. "/mason/bin"
local servers = {
"clangd",
"rust_analyzer",
"lua_ls",
"sumneko_lua",
"texlab",
}

View File

@ -12,7 +12,7 @@ local function gen_section(hl_string, items)
out = out .. " " .. item
end
end
if out ~= "" then
if out ~="" then
return hl_string .. out .. " "
else
return out
@ -98,29 +98,6 @@ local function get_mode_color(m)
return color[m]
end
-- from https://github.com/nvim-lualine/lualine.nvim/blob/master/lua/lualine/components/filename.lua
local function shorten_path(path, max_len)
local sep = '/'
local len = #path
if len <= max_len then
return path
end
local segments = vim.split(path, sep)
for idx = 1, #segments - 1 do
if len <= max_len then
break
end
local segment = segments[idx]
local shortened = segment:sub(1, vim.startswith(segment, '.') and 2 or 1)
segments[idx] = shortened
len = len - (#segment - #shortened)
end
return table.concat(segments, sep)
end
-- from https://github.com/nvim-lua/lsp-status.nvim/blob/master/lua/lsp-status/diagnostics.lua
local function get_lsp_diagnostics()
local result = {}
@ -144,34 +121,32 @@ local function get_lsp_diagnostics()
end
local function process_diagnostics(prefix, n, hl)
if n > 0 then
if n > 0 then
return hl .. prefix .. n
else
else
return ""
end
end
end
local function spell_check()
if vim.wo.spell then
if vim.wo.spell then
local lang = vim.o.spelllang
return "[SPELL=" .. lang .. "]"
else
else
return ""
end
end
end
local function statusline_focused()
local file = vim.fn.expand("%:p:~")
local diagnostics = get_lsp_diagnostics()
local mode = vim.fn.mode()
local mg = get_mode(mode)
local accent_color = get_mode_color(mg)
local winwidth = vim.fn.winwidth(0)
local diagnostics = get_lsp_diagnostics()
local mode = vim.fn.mode()
local mg = get_mode(mode)
local accent_color = get_mode_color(mg)
local left = table.concat {
gen_section(accent_color, { get_mode_display_name(mg) }),
gen_section("%#Middle#", { shorten_path(file, winwidth / 3) }),
gen_section("%#Bottom#", { "%m", "%r" }),
local left = table.concat {
gen_section(accent_color, {get_mode_display_name(mg)}),
gen_section("%#Middle#", {"%f"}),
gen_section("%#Bottom#", {"%m", "%r"}),
gen_section(
"%#Alert#",
{
@ -192,8 +167,8 @@ local function statusline_focused()
)
}
)
}
local right = table.concat {
}
local right = table.concat {
gen_section(
"%#Bottom#",
{
@ -201,25 +176,25 @@ local function statusline_focused()
vim.bo.filetype
}
),
gen_section("%#Middle#", { "%03.p%%" }),
gen_section("%#Top#", { "-%03.c-" })
}
gen_section("%#Middle#", {"%03.p%%"}),
gen_section("%#Top#", {"-%03.c-"})
}
return table.concat {
return table.concat {
left,
"%#Statusline#",
"%=",
right
}
}
end
local function statusline_not_focused()
return table.concat {
gen_section("%#StatuslineNF#", { "%f", "%m" }),
gen_section("%#StatuslineNF#", {"%f", "%m"}),
"%=",
gen_section("%#StatuslineNF#", { "%03.p%%" }),
gen_section("%#StatuslineNF#", { "-%03.c-" })
gen_section("%#StatuslineNF#", {"%03.p%%"}),
gen_section("%#StatuslineNF#", {"-%03.c-"})
}
end