diff --git a/.gitignore b/.gitignore index 3bec00f5..961e88ca 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,5 @@ spell/ # You likely want to comment this, since it's recommended to track lazy-lock.json in version # control, see https://lazy.folke.io/usage/lockfile # For kickstart, it makes sense to leave it ignored. -lazy-lock.json .DS_Store diff --git a/init.lua b/init.lua index ed50b69d..46ddc244 100644 --- a/init.lua +++ b/init.lua @@ -1,97 +1,14 @@ ---[[ - -===================================================================== -==================== READ THIS BEFORE CONTINUING ==================== -===================================================================== -======== .-----. ======== -======== .----------------------. | === | ======== -======== |.-""""""""""""""""""-.| |-----| ======== -======== || || | === | ======== -======== || KICKSTART.NVIM || |-----| ======== -======== || || | === | ======== -======== || || |-----| ======== -======== ||:Tutor || |:::::| ======== -======== |'-..................-'| |____o| ======== -======== `"")----------------(""` ___________ ======== -======== /::::::::::| |::::::::::\ \ no mouse \ ======== -======== /:::========| |==hjkl==:::\ \ required \ ======== -======== '""""""""""""' '""""""""""""' '""""""""""' ======== -======== ======== -===================================================================== -===================================================================== - -What is Kickstart? - - Kickstart.nvim is *not* a distribution. - - Kickstart.nvim is a starting point 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 can start exploring, configuring and tinkering to - make Neovim your own! That might mean leaving Kickstart just the way it is for a while - or immediately breaking it into modular pieces. It's up to you! - - If you don't know anything about Lua, I recommend taking some time to read through - a guide. One possible example which will only take 10-15 minutes: - - https://learnxinyminutes.com/docs/lua/ - - After understanding a bit more about Lua, you can use `:help lua-guide` as a - reference for how Neovim integrates Lua. - - :help lua-guide - - (or HTML version): https://neovim.io/doc/user/lua-guide.html - -Kickstart Guide: - - TODO: The very first thing you should do is to run the command `:Tutor` in Neovim. - - If you don't know what this means, type the following: - - - - : - - Tutor - - - - (If you already know the Neovim basics, you can skip this step.) - - Once you've completed that, you can continue working through **AND READING** the rest - of the kickstart init.lua. - - Next, run AND READ `:help`. - This will open up a help window with some basic information - about reading, navigating and searching the builtin help documentation. - - This should be the first place you go to look when you're stuck or confused - with something. It's one of my favorite Neovim features. - - MOST IMPORTANTLY, we provide a keymap "sh" to [s]earch the [h]elp documentation, - which is very useful when you're not exactly sure of what you're looking for. - - I have left several `:help X` comments throughout the init.lua - These are hints about where to find more information about the relevant settings, - plugins or Neovim features used in Kickstart. - - NOTE: Look for lines like this - - Throughout the file. These are for you, the reader, to help you 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 Neovim config. - -If you experience any errors while trying to install kickstart, run `:checkhealth` for more info. - -I hope you enjoy your Neovim journey, -- TJ - -P.S. You can delete this when you're done too. It's your config now! :) ---]] +-- Thanks TJ :) -- Set as the leader key -- See `:help mapleader` -- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' +vim.opt.guicursor = '' -- 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.o` @@ -100,9 +17,7 @@ vim.g.have_nerd_font = false -- Make line numbers default vim.o.number = true --- You can also add relative line numbers, to help with jumping. --- Experiment for yourself to see if you like it! --- vim.o.relativenumber = true +vim.o.relativenumber = true -- Enable mouse mode, can be useful for resizing splits for example! vim.o.mouse = 'a' @@ -114,13 +29,35 @@ vim.o.showmode = false -- Schedule the setting after `UiEnter` because it can increase startup-time. -- Remove this option if you want your OS clipboard to remain independent. -- See `:help 'clipboard'` -vim.schedule(function() vim.o.clipboard = 'unnamedplus' end) +-- vim.schedule(function() vim.o.clipboard = 'unnamedplus' end) +vim.keymap.set('n', 'y', '"+y') +vim.keymap.set('v', 'y', '"+y') +vim.keymap.set('n', 'yap', '"+yap') +vim.keymap.set('v', 'yap', '"+yap') +vim.keymap.set('n', 'p', '"+p') + +-- Navigating highlighted text after vap or v-j or k +vim.keymap.set('v', '', ":m '>+1gv=gv") +vim.keymap.set('v', '', ":m '<-2gv=gv") +vim.keymap.set('v', '', 'bd', vim.cmd.bdelete) + +-- go to project view +vim.keymap.set('n', 'pv', vim.cmd.Ex) -- Enable break indent vim.o.breakindent = true +vim.keymap.set('v', '', '>gv') + +-- Enable break indent +-- vim.o.breakindent = true -- Enable undo/redo changes even after closing and reopening a file vim.o.undofile = true +vim.opt.swapfile = false +vim.opt.undodir = os.getenv 'HOME' .. '/.vim/undodir' -- Case-insensitive searching UNLESS \C or one or more capital letters in the search term vim.o.ignorecase = true @@ -129,6 +66,11 @@ vim.o.smartcase = true -- Keep signcolumn on by default vim.o.signcolumn = 'yes' +-- color column +vim.opt.colorcolumn = '100' + +-- most disgusting keymap to quit +vim.keymap.set('n', 'qq', vim.cmd.q) -- Decrease update time vim.o.updatetime = 250 @@ -150,6 +92,11 @@ vim.o.splitbelow = true vim.o.list = true vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' } +vim.opt.tabstop = 4 +vim.opt.softtabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.expandtab = false + -- Preview substitutions live, as you type! vim.o.inccommand = 'split' @@ -167,6 +114,9 @@ vim.o.confirm = true -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` +-- making jj to act like Esc +vim.keymap.set('i', 'jj', '') + -- Clear highlights on search when pressing in normal mode -- See `:help hlsearch` vim.keymap.set('n', '', 'nohlsearch') @@ -303,27 +253,28 @@ require('lazy').setup({ -- Then, because we use the `opts` key (recommended), the configuration runs -- after the plugin has been loaded as `require(MODULE).setup(opts)`. - { -- Useful plugin to show you pending keybinds. - 'folke/which-key.nvim', - event = 'VimEnter', - ---@module 'which-key' - ---@type wk.Opts - ---@diagnostic disable-next-line: missing-fields - opts = { - -- delay between pressing a key and opening which-key (milliseconds) - delay = 0, - icons = { mappings = vim.g.have_nerd_font }, - - -- Document existing key chains - spec = { - { 's', group = '[S]earch', mode = { 'n', 'v' } }, - { 't', group = '[T]oggle' }, - { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, -- Enable gitsigns recommended keymaps first - { 'gr', group = 'LSP Actions', mode = { 'n' } }, - }, - }, - }, - + -- I'd intentionally hide which key... might see its use later + -- { -- Useful plugin to show you pending keybinds. + -- 'folke/which-key.nvim', + -- event = 'VimEnter', + -- ---@module 'which-key' + -- ---@type wk.Opts + -- ---@diagnostic disable-next-line: missing-fields + -- opts = { + -- -- delay between pressing a key and opening which-key (milliseconds) + -- delay = 0, + -- icons = { mappings = vim.g.have_nerd_font }, + -- + -- -- Document existing key chains + -- spec = { + -- { 's', group = '[S]earch', mode = { 'n', 'v' } }, + -- { 't', group = '[T]oggle' }, + -- { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, -- Enable gitsigns recommended keymaps first + -- { 'gr', group = 'LSP Actions', mode = { 'n' } }, + -- }, + -- }, + -- }, + -- -- NOTE: Plugins can specify dependencies. -- -- The dependencies are proper plugin specifications as well - anything @@ -360,7 +311,7 @@ require('lazy').setup({ { 'nvim-telescope/telescope-ui-select.nvim' }, -- Useful for getting pretty icons, but requires a Nerd Font. - { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, + { 'nvim-tree/nvim-web-devicons', disabled = vim.g.have_nerd_font }, }, config = function() -- Telescope is a fuzzy finder that comes with a lot of different things that @@ -589,9 +540,9 @@ require('lazy').setup({ -- code, if the language server you are using supports them -- -- This may be unwanted, since they displace some of your code - if client and client:supports_method('textDocument/inlayHint', event.buf) then - map('th', function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) end, '[T]oggle Inlay [H]ints') - end + -- if client and client:supports_method('textDocument/inlayHint', event.buf) then + -- map('th', function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) end, '[T]oggle Inlay [H]ints') + -- end end, }) @@ -600,9 +551,9 @@ require('lazy').setup({ -- See `:help lsp-config` for information about keys and how to configure ---@type table local servers = { - -- clangd = {}, + clangd = {}, -- gopls = {}, - -- pyright = {}, + pyright = {}, -- rust_analyzer = {}, -- -- Some languages (like typescript) have entire language plugins that can be useful: @@ -811,6 +762,7 @@ require('lazy').setup({ styles = { comments = { italic = false }, -- Disable italics in comments }, + transparent = true, } -- Load the colorscheme here. @@ -854,7 +806,7 @@ require('lazy').setup({ -- and try some other statusline plugin local statusline = require 'mini.statusline' -- set use_icons to true if you have a Nerd Font - statusline.setup { use_icons = vim.g.have_nerd_font } + statusline.setup { use_icons = false } -- You can configure sections in the statusline by overriding their -- default behavior. For example, here we set the section for @@ -920,7 +872,7 @@ require('lazy').setup({ -- This is the easiest way to modularize your config. -- -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - -- { import = 'custom.plugins' }, + { import = 'custom.plugins' }, -- -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` -- Or use telescope! diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 00000000..2cbc48e5 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,27 @@ +{ + "LuaSnip": { "branch": "master", "commit": "5a1e39223db9a0498024a77b8441169d260c8c25" }, + "blink.cmp": { "branch": "main", "commit": "4b18c32adef2898f95cdef6192cbd5796c1a332d" }, + "conform.nvim": { "branch": "master", "commit": "086a40dc7ed8242c03be9f47fbcee68699cc2395" }, + "fidget.nvim": { "branch": "main", "commit": "7fa433a83118a70fe24c1ce88d5f0bd3453c0970" }, + "gitsigns.nvim": { "branch": "main", "commit": "7c4faa3540d0781a28588cafbd4dd187a28ac6e3" }, + "guess-indent.nvim": { "branch": "main", "commit": "84a4987ff36798c2fc1169cbaff67960aed9776f" }, + "hardtime.nvim": { "branch": "main", "commit": "b4e431934af1fe224a3a801f632c008278cb7628" }, + "harpoon": { "branch": "master", "commit": "1bc17e3e42ea3c46b33c0bbad6a880792692a1b3" }, + "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "a676ab7282da8d651e175118bcf54483ca11e46d" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "443f1ef8b5e6bf47045cb2217b6f748a223cf7dc" }, + "mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" }, + "mini.nvim": { "branch": "main", "commit": "9990c41f10f54f29a888d13024c9f765037bde23" }, + "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, + "nvim-lspconfig": { "branch": "master", "commit": "883c6495b53fccbd35d0938aac8bdf72f6d499c0" }, + "nvim-treesitter": { "branch": "main", "commit": "493890b87a81dfe6a7e577dbc364ae33fa482da9" }, + "nvim-web-devicons": { "branch": "master", "commit": "d7462543c9e366c0d196c7f67a945eaaf5d99414" }, + "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" }, + "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, + "telescope.nvim": { "branch": "master", "commit": "5255aa27c422de944791318024167ad5d40aad20" }, + "todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" }, + "tokyonight.nvim": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" }, + "undotree": { "branch": "main", "commit": "0e6d41d55ad147407e4ba00a292973de8db0b836" }, + "vim-fugitive": { "branch": "master", "commit": "3b753cf8c6a4dcde6edee8827d464ba9b8c4a6f0" } +} diff --git a/lua/custom/plugins/fugitive.lua b/lua/custom/plugins/fugitive.lua new file mode 100644 index 00000000..4f162827 --- /dev/null +++ b/lua/custom/plugins/fugitive.lua @@ -0,0 +1,4 @@ +return { + 'tpope/vim-fugitive', + config = function() vim.keymap.set('n', 'gs', vim.cmd.Git, { desc = 'fugitive git status' }) end, +} diff --git a/lua/custom/plugins/hardtime.lua b/lua/custom/plugins/hardtime.lua new file mode 100644 index 00000000..27ef2745 --- /dev/null +++ b/lua/custom/plugins/hardtime.lua @@ -0,0 +1,18 @@ +return { + 'm4xshen/hardtime.nvim', + dependencies = { 'MunifTanjim/nui.nvim', 'nvim-lua/plenary.nvim' }, + opts = { + -- Set to false if you want to keep using your mouse while learning + disable_mouse = true, + + -- After 3 repeated presses of a key, it will block you for 1 second + max_time = 1000, + max_count = 3, + + -- This will give you hints like "Use 5j instead of jjjjj" + hint = true, + + -- You can disable it for specific filetypes like the Lazy dashboard + disabled_filetypes = { 'qf', 'netrw', 'NvimTree', 'lazy', 'mason' }, + }, +} diff --git a/lua/custom/plugins/harpoon.lua b/lua/custom/plugins/harpoon.lua new file mode 100644 index 00000000..445127c1 --- /dev/null +++ b/lua/custom/plugins/harpoon.lua @@ -0,0 +1,19 @@ +return { + 'ThePrimeagen/harpoon', + -- No branch needed; defaults to master (Harpoon 1) + dependencies = { 'nvim-lua/plenary.nvim' }, + config = function() + local mark = require 'harpoon.mark' + local ui = require 'harpoon.ui' + + -- Keymaps for Harpoon 1 + vim.keymap.set('n', 'h', mark.add_file) + vim.keymap.set('n', 'H', ui.toggle_quick_menu) + + -- Quick Jumps + vim.keymap.set('n', '1', function() ui.nav_file(1) end) + vim.keymap.set('n', '2', function() ui.nav_file(2) end) + vim.keymap.set('n', '3', function() ui.nav_file(3) end) + -- Add more as needed + end, +} diff --git a/lua/custom/plugins/undotree.lua b/lua/custom/plugins/undotree.lua new file mode 100644 index 00000000..76c162a4 --- /dev/null +++ b/lua/custom/plugins/undotree.lua @@ -0,0 +1,9 @@ +return { + 'jiaoshijie/undotree', + opts = { + -- your options + }, + keys = { -- load the plugin only when using it's keybinding: + { 'u', "lua require('undotree').toggle()" }, + }, +}