diff --git a/lua/pcode/plugins/alpha.lua b/lua/pcode/plugins/alpha.lua index 29c32ee..af3f039 100644 --- a/lua/pcode/plugins/alpha.lua +++ b/lua/pcode/plugins/alpha.lua @@ -1,47 +1,47 @@ local M = { - "goolord/alpha-nvim", - event = "VimEnter", + "goolord/alpha-nvim", + event = "VimEnter", } M.opts = { - dash_model = { - [[ _ __ __ ]], - [[ ___ ___ (____ / /__ _______ ___/ ___ ]], - [[ / _ / _ \ / / _ \/ '_/ / __/ _ / _ / -_) ]], - [[ / .__\_____/ /\___/_/\_\ \__/\___\_,_/\__/ ]], - [[ /_/ |___/ ]], - }, + dash_model = { + [[ _ __ __ ]], + [[ ___ ___ (____ / /__ _______ ___/ ___ ]], + [[ / _ / _ \ / / _ \/ '_/ / __/ _ / _ / -_) ]], + [[ / .__\_____/ /\___/_/\_\ \__/\___\_,_/\__/ ]], + [[ /_/ |___/ ]], + }, } function M.config(_, opts) - local alpha = require("alpha") - local startify = require("alpha.themes.startify") - startify.section.header.val = pcode.dashboard or opts.dash_model - startify.section.top_buttons.val = { - startify.button("F", "󰈞 Find file", ":Telescope find_files "), - startify.button("e", " New file", ":ene startinsert "), - startify.button("p", "󰉋 Find project", ":Telescope projects "), - startify.button("r", "󰦛 Recently used files", ":Telescope oldfiles "), - startify.button("t", "󰊄 Find text", ":Telescope live_grep "), - startify.button("c", " Configuration", ":e $MYVIMRC "), - startify.button("L", "󰒲 Lazy", ":Lazy"), - startify.button("q", "󰅚 Quit", ":qa"), - } - -- disable MRU - startify.section.mru.val = { { type = "padding", val = 4 } } - -- disable MRU cwd - startify.section.mru_cwd.val = { { type = "padding", val = 0 } } - -- disable nvim_web_devicons - startify.nvim_web_devicons.enabled = false - startify.section.bottom_buttons.val = {} + local alpha = require("alpha") + local startify = require("alpha.themes.startify") + startify.section.header.val = pcode.dashboard or opts.dash_model + startify.section.top_buttons.val = { + startify.button("F", "󰈞 Find file", ":Telescope find_files "), + startify.button("e", " New file", ":ene startinsert "), + startify.button("p", "󰉋 Find project", ":Telescope projects "), + startify.button("r", "󰦛 Recently used files", ":Telescope oldfiles "), + startify.button("t", "󰊄 Find text", ":Telescope live_grep "), + startify.button("c", " Configuration", ":e $MYVIMRC "), + startify.button("l", "󰒲 Lazy", ":Lazy"), + startify.button("q", "󰅚 Quit", ":qa"), + } + -- disable MRU + startify.section.mru.val = { { type = "padding", val = 4 } } + -- disable MRU cwd + startify.section.mru_cwd.val = { { type = "padding", val = 0 } } + -- disable nvim_web_devicons + startify.nvim_web_devicons.enabled = false + startify.section.bottom_buttons.val = {} - vim.api.nvim_create_autocmd("User", { - pattern = "LazyVimStarted", - desc = "Add Alpha dashboard footer", - once = true, - callback = function() - local stats = require("lazy").stats() - local ms = math.floor(stats.startuptime * 100 + 0.5) / 100 + vim.api.nvim_create_autocmd("User", { + pattern = "LazyVimStarted", + desc = "Add Alpha dashboard footer", + once = true, + callback = function() + local stats = require("lazy").stats() + local ms = math.floor(stats.startuptime * 100 + 0.5) / 100 -- stylua: ignore startify.section.footer.val = { -- { @@ -59,24 +59,24 @@ function M.config(_, opts) -- val = {"───────────────────────────────────────────"}, -- }, } - pcall(vim.cmd.AlphaRedraw) - end, - }) + pcall(vim.cmd.AlphaRedraw) + end, + }) - vim.api.nvim_create_autocmd({ "User" }, { - pattern = { "AlphaReady" }, - callback = function() - vim.cmd([[ + vim.api.nvim_create_autocmd({ "User" }, { + pattern = { "AlphaReady" }, + callback = function() + vim.cmd([[ set laststatus=0 | autocmd BufUnload set laststatus=3 ]]) - end, - }) - -- ignore filetypes in MRU - local default_mru_ignore = {} - startify.mru_opts.ignore = function(path, ext) - return (string.find(path, "COMMIT_EDITMSG")) or (vim.tbl_contains(default_mru_ignore, ext)) - end - alpha.setup(startify.config) + end, + }) + -- ignore filetypes in MRU + local default_mru_ignore = {} + startify.mru_opts.ignore = function(path, ext) + return (string.find(path, "COMMIT_EDITMSG")) or (vim.tbl_contains(default_mru_ignore, ext)) + end + alpha.setup(startify.config) end return M diff --git a/lua/pcode/user/keymaps.lua b/lua/pcode/user/keymaps.lua index 716dfbf..39f8c5f 100644 --- a/lua/pcode/user/keymaps.lua +++ b/lua/pcode/user/keymaps.lua @@ -16,15 +16,17 @@ vim.g.maplocalleader = " " -- command mode = "c" for _, mode in ipairs({ "i", "v", "n", "x" }) do - -- duplicate line - keymap(mode, "", "t.", opts) - keymap(mode, "", "t -1", opts) - -- save file - keymap(mode, "", "silent! w", opts) + -- duplicate line + keymap(mode, "", "t.", opts) + keymap(mode, "", "t -1", opts) + -- save file + keymap(mode, "", "silent! w", opts) end + -- duplicate line visual block keymap("x", "", ":'<,'>t'>", opts) keymap("x", "", ":'<,'>t-1", opts) + -- move text up and down keymap("x", "", ":move '>+1gv-gv", opts) keymap("x", "", ":move '<-2gv-gv", opts) @@ -32,6 +34,7 @@ keymap("n", "", "m+", opts) keymap("i", "", "m+", opts) keymap("n", "", "m-2", opts) keymap("i", "", "m-2", opts) + -- create comment CTRL + / all mode keymap("v", "", "lua require('Comment.api').toggle.linewise(vim.fn.visualmode())", opts) keymap("v", "", "lua require('Comment.api').toggle.linewise(vim.fn.visualmode())", opts) @@ -45,3 +48,46 @@ keymap("n", "", "lua require('Comment.api').toggle.linewise.curre -- close windows keymap("n", "q", "q", opts) keymap("n", "f", "NvimTreeFindFileToggle", opts) + +-- window navigation +keymap("n", "", "h", opts) +keymap("n", "", "j", opts) +keymap("n", "", "k", opts) +keymap("n", "", "l", opts) +keymap("n", "", "gg0v$G", opts) +keymap("i", "", "gg0v$G", opts) +keymap("n", "", '"+y', opts) +keymap("v", "", '"+y', opts) +keymap("x", "", '"+y', opts) +keymap("n", "", '"+P', opts) +keymap("v", "", '"+P', opts) +keymap("i", "", "pa", opts) +keymap("x", "", '"+P', opts) +keymap("n", "", "undo", opts) +keymap("x", "", "undo", opts) +keymap("v", "", "undo", opts) +keymap("i", "", "undo", opts) + +-- Navigate buffers +keymap("n", "", ":bnext", opts) +keymap("n", "", ":bnext", opts) +keymap("n", "", ":bprevious", opts) +keymap("n", "", ":bprevious", opts) + +-- Reordering Bufferline +keymap("n", "", "BufferLineMovePrev", opts) +keymap("n", "", "BufferLineMoveNext", opts) + +-- Press jk fast to exit insert mode +keymap("i", "jk", "", opts) +keymap("i", "kj", "", opts) + +-- Stay in indent mode +keymap("v", "<", "", ">gv", opts) + +-- ALT + l to open terminal and run live-server +keymap("n", "", "terminal live-server", opts) + +-- close current buffer +keymap("n", "", "lua require('auto-bufferline.configs.utils').bufremove()", opts)