From b1bbff8470706b11301745e8c7ace0badbd7ef16 Mon Sep 17 00:00:00 2001 From: Exo Mercado Date: Sat, 24 Aug 2024 01:08:56 +0800 Subject: [PATCH] add personalize mappings and plugins --- init.lua | 57 +++++++++++++++++++++++++--------- lua/custom/plugins/copilot.lua | 9 ++++++ lua/custom/plugins/harpoon.lua | 16 ++++++++++ 3 files changed, 67 insertions(+), 15 deletions(-) create mode 100644 lua/custom/plugins/copilot.lua create mode 100644 lua/custom/plugins/harpoon.lua diff --git a/init.lua b/init.lua index 41b5a97b..625c7875 100644 --- a/init.lua +++ b/init.lua @@ -91,7 +91,7 @@ vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' -- Set to true if you have a Nerd Font installed and selected in the terminal -vim.g.have_nerd_font = false +vim.g.have_nerd_font = true -- [[ Setting options ]] -- See `:help vim.opt` @@ -102,7 +102,7 @@ vim.g.have_nerd_font = false vim.opt.number = true -- You can also add relative line numbers, to help with jumping. -- Experiment for yourself to see if you like it! --- vim.opt.relativenumber = true +vim.opt.relativenumber = true -- Enable mouse mode, can be useful for resizing splits for example! vim.opt.mouse = 'a' @@ -176,19 +176,44 @@ vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagn vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) -- TIP: Disable arrow keys in normal mode --- vim.keymap.set('n', '', 'echo "Use h to move!!"') --- vim.keymap.set('n', '', 'echo "Use l to move!!"') --- vim.keymap.set('n', '', 'echo "Use k to move!!"') --- vim.keymap.set('n', '', 'echo "Use j to move!!"') +vim.keymap.set('n', '', 'echo "Use h to move!!"') +vim.keymap.set('n', '', 'echo "Use l to move!!"') +vim.keymap.set('n', '', 'echo "Use k to move!!"') +vim.keymap.set('n', '', 'echo "Use j to move!!"') + + +vim.g.mapleader = ' ' +vim.keymap.set('n', 'pv', vim.cmd.Ex) + +vim.keymap.set('v', 'J', ":m '>+1gv=gv") +vim.keymap.set('v', 'K', ":m '<-2gv=gv") + +vim.keymap.set('n', 'J', 'mzJ`z') +vim.keymap.set('n', '', 'zz') +vim.keymap.set('n', '', 'zz') +vim.keymap.set('n', 'n', 'nzzzv') +vim.keymap.set('n', 'N', 'Nzzzv') +-- greatest remap ever +vim.keymap.set('x', 'p', [["_dP]]) + +vim.keymap.set('n', 'Q', '') +vim.keymap.set('n', 'f', 'FormatWrite') + +vim.keymap.set('n', '', 'cnextzz') +vim.keymap.set('n', '', 'cprevzz') +vim.keymap.set('n', 'k', 'lnextzz') +vim.keymap.set('n', 'j', 'lprevzz') + +vim.keymap.set('n', 'x', '!chmod +x %', { silent = true }) -- Keybinds to make split navigation easier. -- Use CTRL+ to switch between windows -- -- See `:help wincmd` for a list of all window commands -vim.keymap.set('n', '', '', { desc = 'Move focus to the left window' }) -vim.keymap.set('n', '', '', { desc = 'Move focus to the right window' }) -vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) -vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) +-- vim.keymap.set('n', '', '', { desc = 'Move focus to the left window' }) +-- vim.keymap.set('n', '', '', { desc = 'Move focus to the right window' }) +-- vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) +-- vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) -- [[ Basic Autocommands ]] -- See `:help lua-guide-autocommands` @@ -912,11 +937,13 @@ require('lazy').setup({ -- Here are some example plugins that I've included in the Kickstart repository. -- Uncomment any of the lines below to enable them (you will need to restart nvim). -- - -- require 'kickstart.plugins.debug', - -- require 'kickstart.plugins.indent_line', - -- require 'kickstart.plugins.lint', - -- require 'kickstart.plugins.autopairs', - -- require 'kickstart.plugins.neo-tree', + require 'kickstart.plugins.debug', + require 'kickstart.plugins.indent_line', + require 'kickstart.plugins.lint', + require 'kickstart.plugins.autopairs', + require 'kickstart.plugins.neo-tree', + require 'custom.plugins.harpoon', + require 'custom.plugins.copilot', -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` diff --git a/lua/custom/plugins/copilot.lua b/lua/custom/plugins/copilot.lua new file mode 100644 index 00000000..ac8ff453 --- /dev/null +++ b/lua/custom/plugins/copilot.lua @@ -0,0 +1,9 @@ +-- You can add your own plugins here or in other files in this directory! +-- I promise not to create any merge conflicts in this directory :) +-- +-- See the kickstart.nvim README for more information +return { + 'github/copilot.vim', + config = function() + end, +} diff --git a/lua/custom/plugins/harpoon.lua b/lua/custom/plugins/harpoon.lua new file mode 100644 index 00000000..a6c4d458 --- /dev/null +++ b/lua/custom/plugins/harpoon.lua @@ -0,0 +1,16 @@ +-- You can add your own plugins here or in other files in this directory! +-- I promise not to create any merge conflicts in this directory :) +-- +-- See the kickstart.nvim README for more information +return { + 'theprimeagen/harpoon', + config = function() + require('harpoon').setup {} + + local mark = require 'harpoon.mark' + local ui = require 'harpoon.ui' + + vim.keymap.set('n', 'a', mark.add_file) + vim.keymap.set('n', '', ui.toggle_quick_menu) + end, +}