Compare commits
7 Commits
4a47c79be2
...
b97d011b55
Author | SHA1 | Date | |
---|---|---|---|
b97d011b55 | |||
786d119e5c | |||
b8ef05167f | |||
475ed9bb31 | |||
306a6ef1da | |||
9aed284dbe | |||
3892bc9389 |
@ -1,21 +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,
|
||||
}
|
44
.config/nvim/lua/plugin/editor.lua
Normal file
44
.config/nvim/lua/plugin/editor.lua
Normal file
@ -0,0 +1,44 @@
|
||||
-- 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,
|
||||
|
||||
}
|
||||
}
|
@ -9,7 +9,7 @@ _G.lsp_root_dir = vim.fn.stdpath("data") .. "/mason/bin"
|
||||
local servers = {
|
||||
"clangd",
|
||||
"rust_analyzer",
|
||||
"sumneko_lua",
|
||||
"lua_ls",
|
||||
"texlab",
|
||||
}
|
||||
|
||||
|
@ -98,6 +98,29 @@ 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 = {}
|
||||
@ -138,14 +161,16 @@ 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 left = table.concat {
|
||||
gen_section(accent_color, { get_mode_display_name(mg) }),
|
||||
gen_section("%#Middle#", {"%f"}),
|
||||
gen_section("%#Middle#", { shorten_path(file, winwidth / 3) }),
|
||||
gen_section("%#Bottom#", { "%m", "%r" }),
|
||||
gen_section(
|
||||
"%#Alert#",
|
||||
|
Reference in New Issue
Block a user