statusline
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
|
||||
"LuaSnip": { "branch": "master", "commit": "33b06d72d220aa56a7ce80a0dd6f06c70cd82b9d" },
|
||||
"SchemaStore.nvim": { "branch": "main", "commit": "bb03860b59f17dfada46d6d9563c48b7b12fecaf" },
|
||||
"SchemaStore.nvim": { "branch": "main", "commit": "55d2ae33ce57de9fcd0cc3c8ee2f225ddbf2cd6a" },
|
||||
"catpuccin": { "branch": "main", "commit": "faf15ab0201b564b6368ffa47b56feefc92ce3f4" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" },
|
||||
@@ -14,14 +14,14 @@
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "259357fa4097e232730341fa60988087d189193a" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "7e6c863bc7563efbdd757a310d17ebc95166cef3" },
|
||||
"lspkind.nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "8e46de9241d3997927af12196bd8faa0ed08c29a" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "2daa8921b7afdcfa47419a21ea343c3df6d74fa0" },
|
||||
"mason-nvim-dap.nvim": { "branch": "main", "commit": "8b9363d83b5d779813cdd2819b8308651cec2a09" },
|
||||
"mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" },
|
||||
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
|
||||
"mini.nvim": { "branch": "main", "commit": "7ebfab26d77a4b9b05aaae565907e7fa4b2ee154" },
|
||||
"mini.nvim": { "branch": "main", "commit": "4228f166ee9db3e910eea1915e2d3683028add47" },
|
||||
"neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "98e8b9d593a5547c126a39212d6f5e954a2d85dd" },
|
||||
"nvim-dap": { "branch": "master", "commit": "7e48a80551e0b8fd7e34436d74243de7ae1ec397" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "b555203ce4bd7ff6192e759af3362f9d217e8c89" },
|
||||
"nvim-dap": { "branch": "master", "commit": "a6070b4e9e9a8ff1bc513c3748eff27080b0f44a" },
|
||||
"nvim-dap-go": { "branch": "main", "commit": "6aa88167ea1224bcef578e8c7160fe8afbb44848" },
|
||||
"nvim-dap-python": { "branch": "master", "commit": "34282820bb713b9a5fdb120ae8dd85c2b3f49b51" },
|
||||
"nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" },
|
||||
@@ -30,10 +30,9 @@
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "040001d85e9190a904d0e35ef5774633e14d8475" },
|
||||
"nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" },
|
||||
"nvim-tmux-navigation": { "branch": "main", "commit": "4898c98702954439233fdaf764c39636681e2861" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "fa915a30c5cdf1d18129e9ef6ac2ee0fa799904f" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "2405274937718d520a40e03df92030dca6b4f0fd" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "ad8f0a472148c3e0ae9851e26a722ee4e29b1595" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "0eb18da56e2ba6ba24de7130a12bcc4e31ad11cb" },
|
||||
"oil.nvim": { "branch": "master", "commit": "dba037598843973b8c54bc5ce0318db4a0da439d" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "dae2eac9d91464448b584c7949a31df8faefec56" },
|
||||
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
|
||||
|
||||
@@ -19,11 +19,74 @@ return {
|
||||
local statusline = require "mini.statusline"
|
||||
statusline.setup { use_icons = vim.g.have_nerd_font }
|
||||
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
statusline.active = function()
|
||||
local mode, mode_hl = statusline.section_mode { trunc_width = 120 }
|
||||
local git = statusline.section_git()
|
||||
local diagnostics = statusline.section_diagnostics { trunc_width = 75 }
|
||||
local filename = statusline.section_filename { trunc_width = 140 }
|
||||
local fileinfo = statusline.section_fileinfo()
|
||||
local location = statusline.section_location()
|
||||
|
||||
return statusline.combine_groups {
|
||||
{ hl = mode_hl, strings = { mode } },
|
||||
{ hl = "MiniStatuslineDevinfo", strings = { git, diagnostics } },
|
||||
"%<",
|
||||
{ hl = "MiniStatuslineFilename", strings = { filename } },
|
||||
"%=",
|
||||
{ hl = "MiniStatuslineFileinfo", strings = { fileinfo } },
|
||||
{ hl = mode_hl, strings = { location } },
|
||||
}
|
||||
end
|
||||
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
statusline.section_diagnostics = function()
|
||||
local buffer_diagnostics = {
|
||||
errors = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.ERROR }),
|
||||
warnings = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.WARN }),
|
||||
info = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.INFO }),
|
||||
hints = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.HINT }),
|
||||
}
|
||||
|
||||
local diagnostics = {}
|
||||
if buffer_diagnostics.errors > 0 then
|
||||
table.insert(diagnostics, string.format(":%d", buffer_diagnostics.errors))
|
||||
end
|
||||
if buffer_diagnostics.warnings > 0 then
|
||||
table.insert(diagnostics, string.format(":%d", buffer_diagnostics.warnings))
|
||||
end
|
||||
if buffer_diagnostics.info > 0 then
|
||||
table.insert(diagnostics, string.format(":%d", buffer_diagnostics.info))
|
||||
end
|
||||
if buffer_diagnostics.hints > 0 then
|
||||
table.insert(diagnostics, string.format(":%d", buffer_diagnostics.hints))
|
||||
end
|
||||
return table.concat(diagnostics, " ")
|
||||
end
|
||||
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
statusline.section_fileinfo = function()
|
||||
local fname = vim.fn.expand "%:t"
|
||||
if fname == "" then
|
||||
fname = "[No Name]"
|
||||
end
|
||||
local readonly = vim.bo.readonly and "🔒" or ""
|
||||
local modified = vim.bo.modified and "[+]" or ""
|
||||
return string.format(" %s%s%s ", fname, readonly, modified)
|
||||
end
|
||||
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
statusline.section_git = function()
|
||||
local head = vim.b.gitsigns_head
|
||||
if not head or head == "" then
|
||||
return ""
|
||||
end
|
||||
return string.format(" %s", head)
|
||||
end
|
||||
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
statusline.section_location = function()
|
||||
return "%2l:%-2v"
|
||||
end
|
||||
|
||||
-- Check out: https://github.com/echasnovski/mini.nvim
|
||||
end,
|
||||
}
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
return {
|
||||
"stevearc/oil.nvim",
|
||||
opts = {},
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
config = function()
|
||||
require("oil").setup {
|
||||
default_file_explorer = true,
|
||||
delete_to_trash = true,
|
||||
skip_confirm_for_simple_edits = true,
|
||||
view_options = {
|
||||
show_hidden = true,
|
||||
natural_order = true,
|
||||
is_always_hidden = function(name, _)
|
||||
return name == ".." or name == ".git"
|
||||
end,
|
||||
},
|
||||
float = {
|
||||
padding = 2,
|
||||
max_width = 90,
|
||||
max_height = 0,
|
||||
},
|
||||
win_options = {
|
||||
wrap = true,
|
||||
winblend = 0,
|
||||
},
|
||||
keymaps = {
|
||||
["<C-h>"] = false,
|
||||
["q"] = "actions.close",
|
||||
},
|
||||
}
|
||||
|
||||
vim.keymap.set("n", "<space>n", "<CMD>Oil<CR>", { desc = "open parent directory" })
|
||||
end,
|
||||
}
|
||||
@@ -21,7 +21,7 @@ set("n", "<C-d>", "<C-d>zz")
|
||||
set("n", "<C-u>", "<C-u>zz")
|
||||
|
||||
-- Navigate with Netrw
|
||||
-- set("n", "<leader>n", vim.cmd.Ex, { desc = "Open [N]etrw" })
|
||||
set("n", "<leader>n", vim.cmd.Ex, { desc = "Open [N]etrw" })
|
||||
|
||||
-- Prime said this is greatest remap ever
|
||||
set("x", "<leader>p", [["_dP]])
|
||||
|
||||
Reference in New Issue
Block a user