|
| 1 | +--[[ |
| 2 | +
|
| 3 | +===================================================================== |
| 4 | +==================== READ THIS BEFORE CONTINUING ==================== |
| 5 | +===================================================================== |
| 6 | +======== .-----. ======== |
| 7 | +======== .----------------------. | === | ======== |
| 8 | +======== |.-""""""""""""""""""-.| |-----| ======== |
| 9 | +======== || || | === | ======== |
| 10 | +======== || KICKSTART.NVIM || |-----| ======== |
| 11 | +======== || || | === | ======== |
| 12 | +======== || || |-----| ======== |
| 13 | +======== ||:Tutor || |:::::| ======== |
| 14 | +======== |'-..................-'| |____o| ======== |
| 15 | +======== `"")----------------(""` ___________ ======== |
| 16 | +======== /::::::::::| |::::::::::\ \ no mouse \ ======== |
| 17 | +======== /:::========| |==hjkl==:::\ \ required \ ======== |
| 18 | +======== '""""""""""""' '""""""""""""' '""""""""""' ======== |
| 19 | +======== ======== |
| 20 | +===================================================================== |
| 21 | +===================================================================== |
| 22 | +
|
| 23 | +What is Kickstart? |
| 24 | +
|
| 25 | + Kickstart.nvim is *not* a distribution. |
| 26 | +
|
| 27 | + Kickstart.nvim is a starting point for your own configuration. |
| 28 | + The goal is that you can read every line of code, top-to-bottom, understand |
| 29 | + what your configuration is doing, and modify it to suit your needs. |
| 30 | +
|
| 31 | + Once you've done that, you can start exploring, configuring and tinkering to |
| 32 | + make Neovim your own! That might mean leaving Kickstart just the way it is for a while |
| 33 | + or immediately breaking it into modular pieces. It's up to you! |
| 34 | +
|
| 35 | + If you don't know anything about Lua, I recommend taking some time to read through |
| 36 | + a guide. One possible example which will only take 10-15 minutes: |
| 37 | + - https://learnxinyminutes.com/docs/lua/ |
| 38 | +
|
| 39 | + After understanding a bit more about Lua, you can use `:help lua-guide` as a |
| 40 | + reference for how Neovim integrates Lua. |
| 41 | + - :help lua-guide |
| 42 | + - (or HTML version): https://neovim.io/doc/user/lua-guide.html |
| 43 | +
|
| 44 | +Kickstart Guide: |
| 45 | +
|
| 46 | + TODO: The very first thing you should do is to run the command `:Tutor` in Neovim. |
| 47 | +
|
| 48 | + If you don't know what this means, type the following: |
| 49 | + - <escape key> |
| 50 | + - : |
| 51 | + - Tutor |
| 52 | + - <enter key> |
| 53 | +
|
| 54 | + (If you already know the Neovim basics, you can skip this step.) |
| 55 | +
|
| 56 | + Once you've completed that, you can continue working through **AND READING** the rest |
| 57 | + of the kickstart init.lua. |
| 58 | +
|
| 59 | + Next, run AND READ `:help`. |
| 60 | + This will open up a help window with some basic information |
| 61 | + about reading, navigating and searching the builtin help documentation. |
| 62 | +
|
| 63 | + This should be the first place you go to look when you're stuck or confused |
| 64 | + with something. It's one of my favorite Neovim features. |
| 65 | +
|
| 66 | + MOST IMPORTANTLY, we provide a keymap "<space>sh" to [s]earch the [h]elp documentation, |
| 67 | + which is very useful when you're not exactly sure of what you're looking for. |
| 68 | +
|
| 69 | + I have left several `:help X` comments throughout the init.lua |
| 70 | + These are hints about where to find more information about the relevant settings, |
| 71 | + plugins or Neovim features used in Kickstart. |
| 72 | +
|
| 73 | + NOTE: Look for lines like this |
| 74 | +
|
| 75 | + Throughout the file. These are for you, the reader, to help you understand what is happening. |
| 76 | + Feel free to delete them once you know what you're doing, but they should serve as a guide |
| 77 | + for when you are first encountering a few different constructs in your Neovim config. |
| 78 | +
|
| 79 | +If you experience any errors while trying to install kickstart, run `:checkhealth` for more info. |
| 80 | +
|
| 81 | +I hope you enjoy your Neovim journey, |
| 82 | +- TJ |
| 83 | +
|
| 84 | +P.S. You can delete this when you're done too. It's your config now! :) |
| 85 | +--]] |
| 86 | +---@diagnostic disable: undefined-global, vim |
| 87 | + |
| 88 | +-- Set <space> as the leader key |
| 89 | +-- See `:help mapleader` |
| 90 | +-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) |
| 91 | +vim.g.mapleader = ' ' |
| 92 | +vim.g.maplocalleader = ' ' |
| 93 | + |
| 94 | +-- Set to true if you have a Nerd Font installed and selected in the terminal |
| 95 | +vim.g.have_nerd_font = false |
| 96 | + |
| 97 | +-- [[ Setting options ]] |
| 98 | +-- See `:help vim.o` |
| 99 | +-- NOTE: You can change these options as you wish! |
| 100 | +-- For more options, you can see `:help option-list` |
| 101 | + |
| 102 | +-- Make line numbers default |
| 103 | +vim.o.number = true |
| 104 | +-- You can also add relative line numbers, to help with jumping. |
| 105 | +-- Experiment for yourself to see if you like it! |
| 106 | +-- vim.o.relativenumber = true |
| 107 | + |
| 108 | +-- Enable mouse mode, can be useful for resizing splits for example! |
| 109 | +vim.o.mouse = 'a' |
| 110 | + |
| 111 | +-- Don't show the mode, since it's already in the status line |
| 112 | +vim.o.showmode = false |
| 113 | + |
| 114 | +-- Sync clipboard between OS and Neovim. |
| 115 | +-- Schedule the setting after `UiEnter` because it can increase startup-time. |
| 116 | +-- Remove this option if you want your OS clipboard to remain independent. |
| 117 | +-- See `:help 'clipboard'` |
| 118 | +vim.schedule(function() |
| 119 | + vim.o.clipboard = 'unnamedplus' |
| 120 | +end) |
| 121 | + |
| 122 | +-- Enable break indent |
| 123 | +vim.o.breakindent = true |
| 124 | + |
| 125 | +-- Save undo history |
| 126 | +vim.o.undofile = true |
| 127 | + |
| 128 | +-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term |
| 129 | +vim.o.ignorecase = true |
| 130 | +vim.o.smartcase = true |
| 131 | + |
| 132 | +-- Keep signcolumn on by default |
| 133 | +vim.o.signcolumn = 'yes' |
| 134 | + |
| 135 | +-- Decrease update time |
| 136 | +vim.o.updatetime = 250 |
| 137 | + |
| 138 | +-- Decrease mapped sequence wait time |
| 139 | +vim.o.timeoutlen = 300 |
| 140 | + |
| 141 | +-- Configure how new splits should be opened |
| 142 | +vim.o.splitright = true |
| 143 | +vim.o.splitbelow = true |
| 144 | + |
| 145 | +-- Sets how neovim will display certain whitespace characters in the editor. |
| 146 | +-- See `:help 'list'` |
| 147 | +-- and `:help 'listchars'` |
| 148 | +-- |
| 149 | +-- Notice listchars is set using `vim.opt` instead of `vim.o`. |
| 150 | +-- It is very similar to `vim.o` but offers an interface for conveniently interacting with tables. |
| 151 | +-- See `:help lua-options` |
| 152 | +-- and `:help lua-options-guide` |
| 153 | +vim.o.list = true |
| 154 | +vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' } |
| 155 | + |
| 156 | +-- Preview substitutions live, as you type! |
| 157 | +vim.o.inccommand = 'split' |
| 158 | + |
| 159 | +-- Show which line your cursor is on |
| 160 | +vim.o.cursorline = true |
| 161 | + |
| 162 | +-- Minimal number of screen lines to keep above and below the cursor. |
| 163 | +vim.o.scrolloff = 10 |
| 164 | + |
| 165 | +-- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`), |
| 166 | +-- instead raise a dialog asking if you wish to save the current file(s) |
| 167 | +-- See `:help 'confirm'` |
| 168 | +vim.o.confirm = true |
| 169 | + |
| 170 | +-- [[ Basic Keymaps ]] |
| 171 | +-- See `:help vim.keymap.set()` |
| 172 | + |
| 173 | +-- Clear highlights on search when pressing <Esc> in normal mode |
| 174 | +-- See `:help hlsearch` |
| 175 | +vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>') |
| 176 | + |
| 177 | +-- Diagnostic keymaps |
| 178 | +vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) |
| 179 | + |
| 180 | +-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier |
| 181 | +-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which |
| 182 | +-- is not what someone will guess without a bit more experience. |
| 183 | +-- |
| 184 | +-- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping |
| 185 | +-- or just use <C-\><C-n> to exit terminal mode |
| 186 | +vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' }) |
| 187 | + |
| 188 | +-- TIP: Disable arrow keys in normal mode |
| 189 | +-- vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>') |
| 190 | +-- vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>') |
| 191 | +-- vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>') |
| 192 | +-- vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>') |
| 193 | + |
| 194 | +-- Keybinds to make split navigation easier. |
| 195 | +-- Use CTRL+<hjkl> to switch between windows |
| 196 | +-- |
| 197 | +-- See `:help wincmd` for a list of all window commands |
| 198 | +vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' }) |
| 199 | +vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' }) |
| 200 | +vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' }) |
| 201 | +vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' }) |
| 202 | + |
| 203 | +-- NOTE: Some terminals have colliding keymaps or are not able to send distinct keycodes |
| 204 | +-- vim.keymap.set("n", "<C-S-h>", "<C-w>H", { desc = "Move window to the left" }) |
| 205 | +-- vim.keymap.set("n", "<C-S-l>", "<C-w>L", { desc = "Move window to the right" }) |
| 206 | +-- vim.keymap.set("n", "<C-S-j>", "<C-w>J", { desc = "Move window to the lower" }) |
| 207 | +-- vim.keymap.set("n", "<C-S-k>", "<C-w>K", { desc = "Move window to the upper" }) |
| 208 | + |
| 209 | +-- [[ Basic Autocommands ]] |
| 210 | +-- See `:help lua-guide-autocommands` |
| 211 | + |
| 212 | +-- Highlight when yanking (copying) text |
| 213 | +-- Try it with `yap` in normal mode |
| 214 | +-- See `:help vim.hl.on_yank()` |
| 215 | +vim.api.nvim_create_autocmd('TextYankPost', { |
| 216 | + desc = 'Highlight when yanking (copying) text', |
| 217 | + group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }), |
| 218 | + callback = function() |
| 219 | + vim.hl.on_yank() |
| 220 | + end, |
| 221 | +}) |
| 222 | + |
| 223 | +-- [[ Install `lazy.nvim` plugin manager ]] |
| 224 | +-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info |
| 225 | +local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' |
| 226 | +if not (vim.uv or vim.loop).fs_stat(lazypath) then |
| 227 | + local lazyrepo = 'https://github.com/folke/lazy.nvim.git' |
| 228 | + local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath } |
| 229 | + if vim.v.shell_error ~= 0 then |
| 230 | + error('Error cloning lazy.nvim:\n' .. out) |
| 231 | + end |
| 232 | +end |
| 233 | + |
| 234 | +---@type vim.Option |
| 235 | +local rtp = vim.opt.rtp |
| 236 | +rtp:prepend(lazypath) |
| 237 | + |
| 238 | +-- [[ Configure and install plugins ]] |
| 239 | +-- |
| 240 | +-- To check the current status of your plugins, run |
| 241 | +-- :Lazy |
| 242 | +-- |
| 243 | +-- You can press `?` in this menu for help. Use `:q` to close the window |
| 244 | +-- |
| 245 | +-- To update plugins you can run |
| 246 | +-- :Lazy update |
| 247 | +-- |
| 248 | +-- NOTE: Here is where you install your plugins. |
| 249 | +require('lazy').setup({ |
| 250 | + |
| 251 | + import { 'modules.utils' }, |
| 252 | + |
| 253 | + import { 'modules.uxui.gitsigns'}, |
| 254 | + |
| 255 | + import { 'modules.uxui.whichkey' }, |
| 256 | + |
| 257 | + import { 'modules.finder.telescope' }, |
| 258 | + |
| 259 | + import { 'modules.lsp ' }, |
| 260 | + |
| 261 | + import { 'modules.formatter.conform' }, |
| 262 | + |
| 263 | + import { 'modules.completions.blink' }, |
| 264 | + |
| 265 | + import { 'modules.theme' }, |
| 266 | + |
| 267 | + import { 'modules.util.mini' }, |
| 268 | + |
| 269 | + -- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the |
| 270 | + -- init.lua. If you want these files, they are in the repository, so you can just download them and |
| 271 | + -- place them in the correct locations. |
| 272 | + |
| 273 | + -- NOTE: Next step on your Neovim journey: Add/Configure additional plugins for Kickstart |
| 274 | + -- |
| 275 | + -- Here are some example plugins that I've included in the Kickstart repository. |
| 276 | + -- Uncomment any of the lines below to enable them (you will need to restart nvim). |
| 277 | + -- |
| 278 | + -- require 'kickstart.plugins.debug', |
| 279 | + -- require 'kickstart.plugins.indent_line', |
| 280 | + -- require 'kickstart.plugins.lint', |
| 281 | + -- require 'kickstart.plugins.autopairs', |
| 282 | + -- require 'kickstart.plugins.neo-tree', |
| 283 | + -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps |
| 284 | + |
| 285 | + -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` |
| 286 | + -- This is the easiest way to modularize your config. |
| 287 | + -- |
| 288 | + -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. |
| 289 | + -- { import = 'custom.plugins' }, |
| 290 | + -- |
| 291 | + -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` |
| 292 | + -- Or use telescope! |
| 293 | + -- In normal mode type `<space>sh` then write `lazy.nvim-plugin` |
| 294 | + -- you can continue same window with `<space>sr` which resumes last telescope search |
| 295 | +}, { |
| 296 | + ui = { |
| 297 | + -- If you are using a Nerd Font: set icons to an empty table which will use the |
| 298 | + -- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table |
| 299 | + icons = vim.g.have_nerd_font and {} or { |
| 300 | + cmd = '⌘', |
| 301 | + config = '🛠', |
| 302 | + event = '📅', |
| 303 | + ft = '📂', |
| 304 | + init = '⚙', |
| 305 | + keys = '🗝', |
| 306 | + plugin = '🔌', |
| 307 | + runtime = '💻', |
| 308 | + require = '🌙', |
| 309 | + source = '📄', |
| 310 | + start = '🚀', |
| 311 | + task = '📌', |
| 312 | + lazy = '💤 ', |
| 313 | + }, |
| 314 | + }, |
| 315 | +}) |
| 316 | + |
| 317 | +-- The line beneath this is called `modeline`. See `:help modeline` |
| 318 | +-- vim: ts=2 sts=2 sw=2 et |
0 commit comments