From da112f882cb3a1792cf8eef1dbc3d23263708d0b Mon Sep 17 00:00:00 2001 From: EGRrqq <86194387+EGRrqq@users.noreply.github.com> Date: Mon, 18 Sep 2023 11:13:32 -0500 Subject: [PATCH] feat(cfg): first backup, need refactor - todo: -- move custom keybindings to a separate file -- move vimbegood to .lua/custom/init.lua -- uncomment custom plugins in init.lua --- init.lua | 48 +++++++++++++++++++++++++++++++--- lua/custom/plugins/harpoon.lua | 22 ++++++++++++++++ 2 files changed, 67 insertions(+), 3 deletions(-) create mode 100644 lua/custom/plugins/harpoon.lua diff --git a/init.lua b/init.lua index ea330eb1..9f0a6350 100644 --- a/init.lua +++ b/init.lua @@ -67,6 +67,9 @@ vim.opt.rtp:prepend(lazypath) require('lazy').setup({ -- NOTE: First, some plugins that don't require any configuration + -- vim motion study + 'ThePrimeagen/vim-be-good', + -- Git related plugins 'tpope/vim-fugitive', 'tpope/vim-rhubarb', @@ -147,6 +150,9 @@ require('lazy').setup({ 'navarasu/onedark.nvim', priority = 1000, config = function() + require('onedark').setup { + transparent = true + } vim.cmd.colorscheme 'onedark' end, }, @@ -221,7 +227,7 @@ require('lazy').setup({ -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. -- -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins - -- { import = 'custom.plugins' }, + { import = 'custom.plugins' }, }, {}) -- [[ Setting options ]] @@ -240,7 +246,7 @@ vim.o.mouse = 'a' -- Sync clipboard between OS and Neovim. -- Remove this option if you want your OS clipboard to remain independent. -- See `:help 'clipboard'` -vim.o.clipboard = 'unnamedplus' +-- vim.o.clipboard = 'unnamedplus' -- Enable break indent vim.o.breakindent = true @@ -303,7 +309,7 @@ require('telescope').setup { pcall(require('telescope').load_extension, 'fzf') -- See `:help telescope.builtin` -vim.keymap.set('n', '?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' }) +vim.keymap.set('n', '&', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' }) vim.keymap.set('n', '', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' }) vim.keymap.set('n', '/', function() -- You can pass additional configuration to telescope to change theme, layout, etc. @@ -537,3 +543,39 @@ cmp.setup { -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et + +-- custom +-- move back keymap +vim.keymap.set("n", "pv", vim.cmd.Ex) + +-- current line num +vim.opt.relativenumber = true + +-- fat cursor +vim.opt.guicursor = "" + +-- 4 tab indenting +vim.opt.tabstop = 4 +vim.opt.softtabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.expandtab = true + +-- move line up/down +vim.keymap.set("v", "J", ":m '>+1gv=gv") +vim.keymap.set("v", "K", ":m '<-2gv=gv") + +-- keep cursor in the middle +vim.keymap.set("n", "", "zz") +vim.keymap.set("n", "", "zz") +vim.keymap.set("n", "n", "nzzzv") +vim.keymap.set("n", "N", "Nzzzv") +vim.keymap.set("n", "", "cnextzz") +vim.keymap.set("n", "", "cprevzz") +vim.keymap.set("n", "k", "lnextzz") +vim.keymap.set("n", "j", "lprevzz") + +-- delete without buffer +vim.keymap.set("x", "p", [["_dP]]) + +-- replace current word +vim.keymap.set("n", "s", [[:%s/\<\>//gI]]) diff --git a/lua/custom/plugins/harpoon.lua b/lua/custom/plugins/harpoon.lua new file mode 100644 index 00000000..77c8b06d --- /dev/null +++ b/lua/custom/plugins/harpoon.lua @@ -0,0 +1,22 @@ +return { + 'ThePrimeagen/harpoon', + dependencies = { + "nvim-lua/plenary.nvim", + }, + + config = function() + require("harpoon").setup {} + + local mark = require("harpoon.mark") + local ui = require("harpoon.ui") + + vim.keymap.set("n", "", mark.add_file) + vim.keymap.set("n", "", ui.toggle_quick_menu) + + vim.keymap.set("n", "", function() ui.nav_file(1) end) + vim.keymap.set("n", "", function() ui.nav_file(2) end) + vim.keymap.set("n", "", function() ui.nav_file(3) end) + vim.keymap.set("n", "", function() ui.nav_file(4) end) + + end, +}