--[[ ===================================================================== ==================== 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.cmd([[source ~/repos/nvim-kickstart/lua/custom/vimrc]]) vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' ---------- treesitter.start guard >------------------------------ -- Neovim's own bundled ftplugin/.lua calls vim.treesitter.start() -- unconditionally. When the system's bundled highlight queries are ahead of -- the currently available parser/grammar (a packaging/version skew, not a -- config issue), that call throws and takes down the whole FileType autocmd -- chain for the buffer (breaking omnifunc/foldexpr along with it). Guard it -- here, before any buffer can trigger it, so a mismatch just falls back to -- regex syntax highlighting instead of erroring. do local orig_start = vim.treesitter.start vim.treesitter.start = function(...) local ok, err = pcall(orig_start, ...) if not ok then vim.notify_once('treesitter.start failed, falling back to regex highlighting: ' .. tostring(err), vim.log.levels.WARN) end end end ---------- ', '', { silent = true }) -- Remap for dealing with word wrap vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) -- [[ Highlight on yank ]] -- See `:help vim.highlight.on_yank()` local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true }) vim.api.nvim_create_autocmd('TextYankPost', { callback = function() vim.highlight.on_yank() end, group = highlight_group, pattern = '*', }) -- [[ Configure Telescope ]] -- See `:help telescope` and `:help telescope.setup()` -- Enable telescope fzf native, if installed -- See `:help telescope.builtin` -- Diagnostic keymaps vim.keymap.set('n', '[d', function() vim.diagnostic.jump({ count = -1 }) end, { desc = 'Go to previous diagnostic message' }) vim.keymap.set('n', ']d', function() vim.diagnostic.jump({ count = 1 }) end, { desc = 'Go to next diagnostic message' }) vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' }) -- [[ Configure nvim-cmp ]] -- See `:help cmp` local luasnip = require 'luasnip' require('luasnip.loaders.from_vscode').lazy_load() luasnip.config.setup {} -- local nvim config (project level, debug mapping etc.) local local_config = vim.fn.getcwd() .. "/.nvim.lua" if vim.fn.filereadable(local_config) == 1 then dofile(local_config) end -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et -- options.lua sets vim.opt.termguicolors, which colorizer.lua (and others) need -- already set by the time they run their setup() calls, so it loads first require('custom.options') require('custom.catppuccin') require('custom.lua-line') require('custom.telescope') require('custom.lspconfig') require('custom.nvim-cmp') require('custom.toggleterm') require('custom.autopairs') require('custom.colorizer') require('custom.keymaps') require('custom.harpoon') require('custom.mason') require('custom.kulala') require('custom.rainbow') require('custom.none-ls') require('custom.gitsigns') require('custom.colortheme') -- bufferline derives its colors from the Normal highlight group at setup() -- time, so it must load after the colorscheme is applied above, or it -- captures the pre-colorscheme (solid) background instead of the final one. require('custom.bufferline')