diff --git a/init.lua b/init.lua index 88f0800..2638ef5 100644 --- a/init.lua +++ b/init.lua @@ -1,6 +1,9 @@ -- enable read config from CWD vim.o.exrc = true +-- enable 24-bit color for nvim-notify +vim.o.termguicolors = true + -- Disable intro message on startup, or many other plugins will -- close this message on load, which may cause a flash of intro message. vim.opt.shortmess:append({ I = true }) @@ -23,20 +26,23 @@ vim.o.colorcolumn = "101" vim.g.mapleader = " " vim.g.maplocalleader = " " +vim.keymap.set("n", "\\\\", "split", { silent = true }) +vim.keymap.set("n", "||", "vsplit", { silent = true }) + vim.keymap.set("n", "\\q", "wincmd q", { silent = true }) -vim.keymap.set("n", "zh", "wincmd h", { silent = true }) -vim.keymap.set("n", "zj", "wincmd j", { silent = true }) -vim.keymap.set("n", "zk", "wincmd k", { silent = true }) -vim.keymap.set("n", "zl", "wincmd l", { silent = true }) +vim.keymap.set("n", "", "wincmd h", { silent = true }) +vim.keymap.set("n", "", "wincmd j", { silent = true }) +vim.keymap.set("n", "", "wincmd k", { silent = true }) +vim.keymap.set("n", "", "wincmd l", { silent = true }) -vim.keymap.set("n", "zch", "wincmd H", { silent = true }) -vim.keymap.set("n", "zcj", "wincmd J", { silent = true }) -vim.keymap.set("n", "zck", "wincmd K", { silent = true }) -vim.keymap.set("n", "zcl", "wincmd L", { silent = true }) +vim.keymap.set("n", "", "wincmd H", { silent = true }) +vim.keymap.set("n", "", "wincmd J", { silent = true }) +vim.keymap.set("n", "", "wincmd K", { silent = true }) +vim.keymap.set("n", "", "wincmd L", { silent = true }) -vim.keymap.set("n", "zn", "bnext", { silent = true }) -vim.keymap.set("n", "zp", "bprevious", { silent = true }) -vim.keymap.set("n", "zx", "bdelete", { silent = true }) +vim.keymap.set("n", "]b", "bnext", { silent = true }) +vim.keymap.set("n", "[b", "bprevious", { silent = true }) +vim.keymap.set("n", "c", "bdelete", { silent = true }) vim.keymap.set("n", "nh", "nohlsearch", { silent = true }) diff --git a/lua/plugins/10-editor.lua b/lua/plugins/10-editor.lua index 397b810..5ebd0a8 100644 --- a/lua/plugins/10-editor.lua +++ b/lua/plugins/10-editor.lua @@ -27,7 +27,7 @@ return { { "famiu/bufdelete.nvim", keys = { - { "zx", "Bdelete", mode = "n" }, + { "c", "Bdelete", mode = "n" }, }, }, { diff --git a/lua/plugins/13-lines.lua b/lua/plugins/13-lines.lua index f878d79..3165243 100644 --- a/lua/plugins/13-lines.lua +++ b/lua/plugins/13-lines.lua @@ -13,10 +13,10 @@ return { main = "bufferline", event = "VeryLazy", keys = { - { "zn", "BufferLineCycleNext" }, - { "zp", "BufferLineCyclePrev" }, - { "zcn", "BufferLineMoveNext" }, - { "zcp", "BufferLineMovePrev" }, + { "]b", "BufferLineCycleNext" }, + { "[b", "BufferLineCyclePrev" }, + { ">b", "BufferLineMoveNext" }, + { "BufferLineMovePrev" }, }, opts = { options = { diff --git a/lua/plugins/15-tree.lua b/lua/plugins/15-tree.lua deleted file mode 100644 index a5cb7b2..0000000 --- a/lua/plugins/15-tree.lua +++ /dev/null @@ -1,41 +0,0 @@ -return{ - { - "nvim-tree/nvim-tree.lua", - enabled = custom.full_feature, - dependencies = { - "nvim-tree/nvim-web-devicons" - }, - main = "nvim-tree", - event = "VeryLazy", - opts = { - filters = { - git_ignored = false, - }, - }, - keys = { - { "t", "NvimTreeFocus", mode = "n" }, - { "f", "NvimTreeFindFile", mode = "n" }, - }, - init = function(_) - vim.g.loaded_netrw = 1 - vim.g.loaded_netrwPlugin = 1 - - vim.api.nvim_create_autocmd("QuitPre", { - callback = function() - local invalid_win = {} - local wins = vim.api.nvim_list_wins() - for _, w in ipairs(wins) do - local bufname = vim.api.nvim_buf_get_name(vim.api.nvim_win_get_buf(w)) - if bufname:match("NvimTree_") ~= nil then - table.insert(invalid_win, w) - end - end - if #invalid_win == #wins - 1 then - -- Should quit, so we close all invalid windows. - for _, w in ipairs(invalid_win) do vim.api.nvim_win_close(w, true) end - end - end - }) - end, - }, -} diff --git a/lua/plugins/neo-tree.lua b/lua/plugins/neo-tree.lua new file mode 100644 index 0000000..a779fa8 --- /dev/null +++ b/lua/plugins/neo-tree.lua @@ -0,0 +1,49 @@ +return { + "nvim-neo-tree/neo-tree.nvim", + dependencies = { + { "nvim-lua/plenary.nvim", lazy = true }, + { "nvim-tree/nvim-web-devicons", lazy = true }, + { "MunifTanjim/nui.nvim", lazy = true }, + }, + cmd = "Neotree", + opts = function() + local git_available = vim.fn.executable("git") == 1 + local get_icon = require("nvim-web-devicons").get_icon + local opts = { + enable_git_status = git_available, + auto_clean_after_session_restore = true, + close_if_last_window = true, + sources = { "filesystem", "buffers", "git_status" }, + source_selector = { + winbar = true, + content_layout = "center", + sources = { + { source = "filesystem", display_name = " 󰉓 Files " }, + { source = "buffers", display_name = " 󰈚 Bufs " }, + { source = "git_status", display_name = " 󰊢 Git " }, + }, + }, + window = { + width = 30, + mappings = { + ["[b"] = "prev_source", + ["]b"] = "next_source", + } + }, + } + return opts + end, + keys = { + { "e", "Neotree toggle", desc = "Toggle explorer"}, + { + "o", + function() + if vim.bo.filetype == "neo-tree" then + vim.cmd.wincmd("p") + else + vim.cmd.Neotree("focus") + end + end, + desc = "Toggle explorer"}, + }, +} diff --git a/lua/plugins/notify.lua b/lua/plugins/notify.lua new file mode 100644 index 0000000..7a876fb --- /dev/null +++ b/lua/plugins/notify.lua @@ -0,0 +1,8 @@ +return { + "rcarriga/nvim-notify", + config = function(LazyPlugin, opts) + local notify = require("notify") + vim.notify = notify + notify.setup(opts) + end +} diff --git a/lua/plugins/smart-splits.lua b/lua/plugins/smart-splits.lua new file mode 100644 index 0000000..71089e6 --- /dev/null +++ b/lua/plugins/smart-splits.lua @@ -0,0 +1,15 @@ +return { + "mrjones2014/smart-splits.nvim", + event = "VeryLazy", + opts = { ignored_filetypes = { "nofile", "quickfix", "qf", "prompt" }, ignored_buftypes = { "nofile" } }, + keys = { + { "", function() require("smart-splits").move_cursor_left() end, desc = "Move to left split" }, + { "", function() require("smart-splits").move_cursor_down() end, desc = "Move to below split" }, + { "", function() require("smart-splits").move_cursor_up() end, desc = "Move to above split" }, + { "", function() require("smart-splits").move_cursor_right() end, desc = "Move to right split" }, + { "", function() require("smart-splits").resize_up() end, desc = "Resize split up" }, + { "", function() require("smart-splits").resize_down() end, desc = "Resize split down" }, + { "", function() require("smart-splits").resize_left() end, desc = "Resize split left" }, + { "", function() require("smart-splits").resize_right() end, desc = "Resize split right" }, + }, +}