diff --git a/nix/users/base/neovim/core/keymaps.lua b/nix/users/base/neovim/core/keymaps.lua new file mode 100644 index 0000000..068d759 --- /dev/null +++ b/nix/users/base/neovim/core/keymaps.lua @@ -0,0 +1,93 @@ +local opts = { noremap = true, silent = true } +local map = vim.keymap.set + +--Leader Key +map("", "", "", opts) +vim.g.mapleader = " " +vim.g.maplocalleader = " " + +---------- Normal Mode ---------- + +--Window Resize +map("n", "", ":vertical resize +2", opts) +map("n", "", ":resize +2", opts) +map("n", "", ":resize -2", opts) +map("n", "", ":vertical resize -2", opts) + +---------- Insert Mode ---------- + +--jj gang rise up +map("i", "jj", "", opts) + +---------- Visual Mode ----------- + +--Move Selections +map("v", "", "< gv", opts) +map("v", "", ":m '>+1gv=gv", opts) +map("v", "", ":m '<-2gv=gv", opts) +map("v", "", "> gv", opts) + +---------- Terminal Mode ---------- + +--Escape Terminal +map('t', 'jj', [[]], opts) +map('t', '', [[]], opts) +map('t', '', [[]], opts) + +--------- Custom Functions ---------- + +--Edit Nvim +map("n", "en", ":lua edit_nvim()", opts) + +---------- Plugins ---------------- + +--Fugative +map("n", "ga", ":G add", opts) +map("n", "gs", ":G status", opts) +map("n", "gb", ":G branch", opts) +map("n", "gm", ":G merge", opts) +map("n", "gpl", ":G pull", opts) +map("n", "gplo", ":G pull origin", opts) +map("n", "gps", ":G push", opts) +map("n", "gpso", ":G push origin", opts) +map("n", "gc", ":G commit", opts) +map("n", "gcm", ":G commit -m", opts) +map("n", "gch", ":G checkout", opts) +map("n", "gchb", ":G checkout -b", opts) +map("n", "gcoe", ":G config user.email", opts) +map("n", "gcon", ":G config user.name", opts) + +--Nvim Tree +map("n", "dt", ":NvimTreeToggle", opts) + +--Transparency +map("n", "tt", ":TransparentToggle", opts) + +--Telescope +map('n', 'ff', ":Telescope find_files", opts) +map('n', 'fw', ":Telescope live_grep", opts) +map('n', 'fgc', ":Telescope git_commits", opts) +map('n', 'fgs', ":Telescope git_stash", opts) +map('n', 'fgb', ":Telescope git_branches", opts) +map('n', 'fv', ":Telescope treesitter", opts) +map('n', 'fs', ":Telescope spell_suggest", opts) +map('n', 'fc', ":Telescope colorscheme", opts) + +--BufferLine +map("n", "1", ":BufferLineGoToBuffer 1", opts) +map("n", "2", ":BufferLineGoToBuffer 2", opts) +map("n", "3", ":BufferLineGoToBuffer 3", opts) +map("n", "4", ":BufferLineGoToBuffer 4", opts) +map("n", "5", ":BufferLineGoToBuffer 5", opts) +map("n", "6", ":BufferLineGoToBuffer 6", opts) +map("n", "7", ":BufferLineGoToBuffer 7", opts) +map("n", "8", ":BufferLineGoToBuffer 8", opts) +map("n", "9", ":BufferLineGoToBuffer 9", opts) + +map("n", "h", ":BufferLineCyclePrev", opts) +map("n", "l", ":BufferLineCycleNext", opts) + +map("n", "", ":BufferLineMovePrev", opts) +map("n", "", ":BufferLineMoveNext", opts) + +map("n", "qq", ":bdelete", opts) -- Close current buffer \ No newline at end of file diff --git a/nix/users/base/neovim/default.nix b/nix/users/base/neovim/default.nix index d50d0f8..ddec7d7 100644 --- a/nix/users/base/neovim/default.nix +++ b/nix/users/base/neovim/default.nix @@ -169,6 +169,7 @@ extraLuaConfig = '' ${builtins.readFile ./core/colors.lua} + ${builtins.readFile ./core/keymaps.lua} ${builtins.readFile ./core/options.lua} '';