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"
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({
spec = {
{
"LazyVim/LazyVim",
import = "lazyvim.plugins",
},
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
{ import = "lazyvim.plugins.extras.coding.copilot" },
{ import = "lazyvim.plugins.extras.coding.mini-surround" },
{ import = "lazyvim.plugins.extras.dap.core" },
{ import = "lazyvim.plugins.extras.editor.aerial" },
{ import = "lazyvim.plugins.extras.editor.leap" },
{ import = "lazyvim.plugins.extras.test.core" },
-- { import = "lazyvim.plugins.extras.ui.edgy" },
{ import = "lazyvim.plugins.extras.ui.mini-indentscope" },
{ import = "lazyvim.plugins.extras.lang.ansible" },
{ import = "lazyvim.plugins.extras.lang.docker" },
@ -63,8 +54,6 @@ require("lazy").setup({
},
})
-- NOTE: Autocmds
for _, autocmd in ipairs({
{ -- Automatically change line numeration
{ "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
---@class config.shortcuts
return {
gh = "/home/luca",
gch = "/home/luca/.cache",

View File

@ -1,8 +1,7 @@
local M = {}
---@return table<string, function>
function M.generate_shortcut_maps()
local shortcuts = Config.shortcuts
local shortcuts = require("config.shortcuts")
local fs = require("neo-tree.sources.filesystem")
local maps = {}
for map, path in pairs(shortcuts) do
@ -13,8 +12,6 @@ function M.generate_shortcut_maps()
return maps
end
---@param key string
---@return string?
function M.get_secret(key)
local ok, keys = pcall(require, "config.secrets")
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",
enabled = false,
@ -115,7 +125,7 @@ return {
},
},
config = function(_, opts)
local key = Lib.get_secret("openai")
local key = require("lib").get_secret("openai")
if key then
require("chatgpt.api").OPENAI_API_KEY = key
require("chatgpt.api").AUTHORIZATION_HEADER = "Authorization: Bearer " .. key
@ -260,7 +270,7 @@ return {
opts = {
filesystem = {
window = {
mappings = Lib.generate_shortcut_maps(),
mappings = require("lib").generate_shortcut_maps(),
},
},
},

View File

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