From 0693fcf41d7f43a465b5bab557add09e14395cdc Mon Sep 17 00:00:00 2001 From: arnold-lei Date: Sun, 24 Sep 2023 23:14:26 -0600 Subject: [PATCH] configuring my own kickstart --- init.lua | 63 +++++++++-------------------------------- lua/arnoldlei/remap.lua | 49 ++++++++++++++++++++++++++++++++ lua/arnoldlei/set.lua | 27 ++++++++++++++++++ lua/plugins/harpoon.lua | 15 ++++++++++ 4 files changed, 104 insertions(+), 50 deletions(-) create mode 100644 lua/arnoldlei/remap.lua create mode 100644 lua/arnoldlei/set.lua create mode 100644 lua/plugins/harpoon.lua diff --git a/init.lua b/init.lua index 2d31b44b..03e1b9cf 100644 --- a/init.lua +++ b/init.lua @@ -1,48 +1,9 @@ ---[[ - -===================================================================== -==================== READ THIS BEFORE CONTINUING ==================== -===================================================================== - -Kickstart.nvim is *not* a distribution. - -Kickstart.nvim is a template for your own configuration. - The goal is that you can read every line of code, top-to-bottom, understand - what your configuration is doing, and modify it to suit your needs. - - Once you've done that, you should start exploring, configuring and tinkering to - explore Neovim! - - If you don't know anything about Lua, I recommend taking some time to read through - a guide. One possible example: - - https://learnxinyminutes.com/docs/lua/ - - - And then you can explore or search through `:help lua-guide` - - https://neovim.io/doc/user/lua-guide.html - - -Kickstart Guide: - -I have left several `:help X` comments throughout the init.lua -You should run that command and read that help section for more information. - -In addition, I have some `NOTE:` items throughout the file. -These are for you, the reader to help understand what is happening. Feel free to delete -them once you know what you're doing, but they should serve as a guide for when you -are first encountering a few different constructs in your nvim config. - -I hope you enjoy your Neovim journey, -- TJ - -P.S. You can delete this when you're done too. It's your config now :) ---]] -- Set as the leader key -- See `:help mapleader` -- NOTE: Must happen before plugins are required (otherwise wrong leader will be used) vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' - +vim.keymap.set("n", "gs", vim.cmd.Git) -- Install package manager -- https://github.com/folke/lazy.nvim -- `:help lazy.nvim.txt` for more info @@ -66,9 +27,9 @@ vim.opt.rtp:prepend(lazypath) -- as they will be available in your neovim runtime. require('lazy').setup({ -- NOTE: First, some plugins that don't require any configuration - + {import = "plugins"}, -- Git related plugins - 'tpope/vim-fugitive', + "tpope/vim-fugitive", 'tpope/vim-rhubarb', -- Detect tabstop and shiftwidth automatically @@ -143,14 +104,14 @@ require('lazy').setup({ }, { - -- Theme inspired by Atom - 'navarasu/onedark.nvim', - priority = 1000, + "folke/tokyonight.nvim", + lazy = false, -- make sure we load this during startup if it is your main colorscheme + priority = 1000, -- make sure to load this before all the other start plugins config = function() - vim.cmd.colorscheme 'onedark' + -- load the colorscheme here + vim.cmd([[colorscheme tokyonight]]) end, }, - { -- Set lualine as statusline 'nvim-lualine/lualine.nvim', @@ -313,10 +274,10 @@ vim.keymap.set('n', '/', function() }) end, { desc = '[/] Fuzzily search in current buffer' }) -vim.keymap.set('n', 'gf', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' }) -vim.keymap.set('n', 'sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' }) +vim.keymap.set('n', '', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' }) +vim.keymap.set('n', '', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' }) vim.keymap.set('n', 'sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' }) -vim.keymap.set('n', 'sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' }) +vim.keymap.set('n', '', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' }) vim.keymap.set('n', 'sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) vim.keymap.set('n', 'sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' }) vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = '[S]earch [R]resume' }) @@ -537,3 +498,5 @@ cmp.setup { -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et +require('arnoldlei.set') +require('arnoldlei.remap') diff --git a/lua/arnoldlei/remap.lua b/lua/arnoldlei/remap.lua new file mode 100644 index 00000000..753b7481 --- /dev/null +++ b/lua/arnoldlei/remap.lua @@ -0,0 +1,49 @@ +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") + +vim.keymap.set("n", "vwm", function() + require("vim-with-me").StartVimWithMe() +end) +vim.keymap.set("n", "svwm", function() + require("vim-with-me").StopVimWithMe() +end) + +-- greatest remap ever +vim.keymap.set("x", "p", [["_dP]]) + +-- next greatest remap ever : asbjornHaland +vim.keymap.set({"n", "v"}, "y", [["+y]]) +vim.keymap.set("n", "Y", [["+Y]]) + +vim.keymap.set({"n", "v"}, "d", [["_d]]) + +-- This is going to get me cancelled +vim.keymap.set("i", "", "") + +vim.keymap.set("n", "Q", "") +vim.keymap.set("n", "", "silent !tmux neww tmux-sessionizer") +vim.keymap.set("n", "f", vim.lsp.buf.format) + +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", "s", [[:%s/\<\>//gI]]) +vim.keymap.set("n", "x", "!chmod +x %", { silent = true }) + +vim.keymap.set("n", "vpp", "e ~/.dotfiles/nvim/.config/nvim/lua/theprimeagen/packer.lua"); +vim.keymap.set("n", "mr", "CellularAutomaton make_it_rain"); + +vim.keymap.set("n", "", function() + vim.cmd("so") +end) diff --git a/lua/arnoldlei/set.lua b/lua/arnoldlei/set.lua new file mode 100644 index 00000000..45aa63b6 --- /dev/null +++ b/lua/arnoldlei/set.lua @@ -0,0 +1,27 @@ +vim.opt.nu = true +vim.opt.relativenumber = true + +vim.opt.tabstop = 2 +vim.opt.softtabstop = 2 +vim.opt.shiftwidth = 2 +vim.opt.expandtab = true + +vim.opt.smartindent = true + +vim.opt.wrap = false + +vim.opt.swapfile = false +vim.opt.backup = false +vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir" +vim.opt.undofile = true + +-- vim.opt.hlsearch = false +-- vim.opt.incsearch = true + +vim.opt.termguicolors = true + +vim.opt.scrolloff = 8 +vim.opt.signcolumn = "yes" +vim.opt.isfname:append("@-@") + +vim.opt.colorcolumn = "80" diff --git a/lua/plugins/harpoon.lua b/lua/plugins/harpoon.lua new file mode 100644 index 00000000..8590d617 --- /dev/null +++ b/lua/plugins/harpoon.lua @@ -0,0 +1,15 @@ +return { + "ThePrimeagen/harpoon", + lazy = false, + dependencies = { + "nvim-lua/plenary.nvim", + }, + config = true, + keys = { + { "a", "lua require('harpoon.mark').add_file()", desc = "Mark file with harpoon" }, + { "hn", "lua require('harpoon.ui').nav_next()", desc = "Go to next harpoon mark" }, + { "hp", "lua require('harpoon.ui').nav_prev()", desc = "Go to previous harpoon mark" }, + { "", "lua require('harpoon.ui').toggle_quick_menu()", desc = "Show harpoon marks" }, + }, +} +