From 11863aa710ab0626eb76648d101854a481664a34 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Mon, 24 Jun 2024 16:45:18 +0800 Subject: Update --- vim/lua/chadrc.lua | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 vim/lua/chadrc.lua (limited to 'vim/lua/chadrc.lua') diff --git a/vim/lua/chadrc.lua b/vim/lua/chadrc.lua new file mode 100644 index 0000000..aa0d78c --- /dev/null +++ b/vim/lua/chadrc.lua @@ -0,0 +1,47 @@ +-- This file needs to have same structure as nvconfig.lua +-- https://github.com/NvChad/NvChad/blob/v2.5/lua/nvconfig.lua + +---@type ChadrcConfig +local M = {} + +M.ui = { + theme = "onedark", + + -- hl_override = { + -- Comment = { italic = true }, + -- ["@comment"] = { italic = true }, + -- }, + tabufline = { + enabled = true, + }, +} + +-- For tabufline +if M.ui.tabufline.enabled then + vim.keymap.set("n", "", function() + local bufnrs = vim.tbl_filter(function(b) + if 1 ~= vim.fn.buflisted(b) then + return false + else + return true + end + end, vim.api.nvim_list_bufs()) + if #bufnrs == 1 then + vim.cmd("silent quit!") + else + require("nvchad.tabufline").close_buffer() + end + end, { desc = "buffer close" }) + for i = 1, 9, 1 do + vim.keymap.set("n", string.format("", i), function() + vim.api.nvim_set_current_buf(vim.t.bufs[i]) + end) + end + vim.keymap.set("n", "", function() require("nvchad.tabufline").move_buf(-1) end) + vim.keymap.set("n", "", function() require("nvchad.tabufline").move_buf(1) end) + vim.keymap.set("n", "", function() vim.cmd("tabprevious") end) + vim.keymap.set("n", "", function() vim.cmd("tabnext") end) +end + + +return M -- cgit v1.2.3-70-g09d2