1
0
Fork 0

cleanup, add bufferline sort keymaps

This commit is contained in:
Luca Bilke 2024-06-03 10:55:43 +02:00
parent 394bbde19d
commit eaca87a7de
7 changed files with 16 additions and 53 deletions

View File

@ -1,15 +0,0 @@
{
"neodev": {
"library": {
"enabled": true,
"plugins": true
}
},
"neoconf": {
"plugins": {
"lua_ls": {
"enabled": true
}
}
}
}

View File

@ -1,8 +1,3 @@
_G.Config = require("config")
_G.Lib = require("lib")
-- NOTE: lazy.nvim setup
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then if not (vim.uv or vim.loop).fs_stat(lazypath) then
@ -19,17 +14,13 @@ vim.opt.rtp:prepend(vim.env.LAZY or lazypath)
require("lazy").setup({ require("lazy").setup({
spec = { spec = {
{ { "LazyVim/LazyVim", import = "lazyvim.plugins" },
"LazyVim/LazyVim",
import = "lazyvim.plugins",
},
{ import = "lazyvim.plugins.extras.coding.copilot" }, { import = "lazyvim.plugins.extras.coding.copilot" },
{ import = "lazyvim.plugins.extras.coding.mini-surround" }, { import = "lazyvim.plugins.extras.coding.mini-surround" },
{ import = "lazyvim.plugins.extras.dap.core" }, { import = "lazyvim.plugins.extras.dap.core" },
{ import = "lazyvim.plugins.extras.editor.aerial" }, { import = "lazyvim.plugins.extras.editor.aerial" },
{ import = "lazyvim.plugins.extras.editor.leap" }, { import = "lazyvim.plugins.extras.editor.leap" },
{ import = "lazyvim.plugins.extras.test.core" }, { import = "lazyvim.plugins.extras.test.core" },
-- { import = "lazyvim.plugins.extras.ui.edgy" },
{ import = "lazyvim.plugins.extras.ui.mini-indentscope" }, { import = "lazyvim.plugins.extras.ui.mini-indentscope" },
{ import = "lazyvim.plugins.extras.lang.ansible" }, { import = "lazyvim.plugins.extras.lang.ansible" },
{ import = "lazyvim.plugins.extras.lang.docker" }, { import = "lazyvim.plugins.extras.lang.docker" },
@ -63,8 +54,6 @@ require("lazy").setup({
}, },
}) })
-- NOTE: Autocmds
for _, autocmd in ipairs({ for _, autocmd in ipairs({
{ -- Automatically change line numeration { -- Automatically change line numeration
{ "BufEnter", "FocusGained", "InsertLeave", "WinEnter" }, { "BufEnter", "FocusGained", "InsertLeave", "WinEnter" },

View File

@ -1,17 +0,0 @@
---@class config
---@field ui config.ui
---@field language config.language
---@field shortcuts config.shortcuts
---@field secrets? config.secrets
local M = {}
setmetatable(M, {
__index = function(_, k)
local ok, mod = pcall(require, "config." .. k)
if ok then
return mod
end
end,
})
return M

View File

@ -1,5 +1,4 @@
-- NOTE: Managed by shortcuts script -- NOTE: Managed by shortcuts script
---@class config.shortcuts
return { return {
gh = "/home/luca", gh = "/home/luca",
gch = "/home/luca/.cache", gch = "/home/luca/.cache",

View File

@ -1,8 +1,7 @@
local M = {} local M = {}
---@return table<string, function>
function M.generate_shortcut_maps() function M.generate_shortcut_maps()
local shortcuts = Config.shortcuts local shortcuts = require("config.shortcuts")
local fs = require("neo-tree.sources.filesystem") local fs = require("neo-tree.sources.filesystem")
local maps = {} local maps = {}
for map, path in pairs(shortcuts) do for map, path in pairs(shortcuts) do
@ -13,8 +12,6 @@ function M.generate_shortcut_maps()
return maps return maps
end end
---@param key string
---@return string?
function M.get_secret(key) function M.get_secret(key)
local ok, keys = pcall(require, "config.secrets") local ok, keys = pcall(require, "config.secrets")
if ok then if ok then

View File

@ -21,6 +21,16 @@ return {
}, },
}, },
}, },
{
"akinsho/bufferline.nvim",
keys = {
{ "<leader>bs", desc = "Sort Bufferline" },
{ "<leader>bsd", "<Cmd>BufferLineSortByDirectory<CR>", desc = "By Directory" },
{ "<leader>bse", "<Cmd>BufferLineSortByExtension<CR>", desc = "By Extension" },
{ "<leader>bsr", "<Cmd>BufferLineSortByRelativeDirectory<CR>", desc = "By Relative Directory" },
{ "<leader>bst", "<Cmd>BufferLineSortByTabs<CR>", desc = "By Tabs" },
},
},
{ {
"ggandor/flit.nvim", "ggandor/flit.nvim",
enabled = false, enabled = false,
@ -115,7 +125,7 @@ return {
}, },
}, },
config = function(_, opts) config = function(_, opts)
local key = Lib.get_secret("openai") local key = require("lib").get_secret("openai")
if key then if key then
require("chatgpt.api").OPENAI_API_KEY = key require("chatgpt.api").OPENAI_API_KEY = key
require("chatgpt.api").AUTHORIZATION_HEADER = "Authorization: Bearer " .. key require("chatgpt.api").AUTHORIZATION_HEADER = "Authorization: Bearer " .. key
@ -260,7 +270,7 @@ return {
opts = { opts = {
filesystem = { filesystem = {
window = { window = {
mappings = Lib.generate_shortcut_maps(), mappings = require("lib").generate_shortcut_maps(),
}, },
}, },
}, },

View File

@ -28,8 +28,8 @@ return {
{ {
"nvimdev/dashboard-nvim", "nvimdev/dashboard-nvim",
opts = function(_, opts) opts = function(_, opts)
local center = Config.ui.buttons local center = require("config.ui").buttons
local banners = Config.ui.banners local banners = require("config.ui").banners
for _, button in ipairs(center) do for _, button in ipairs(center) do
button.desc = button.desc .. string.rep(" ", 43 - #button.desc) button.desc = button.desc .. string.rep(" ", 43 - #button.desc)
button.key_format = " %s" button.key_format = " %s"