|
|
|
@ -1,97 +1,13 @@
|
|
|
|
|
--[[
|
|
|
|
|
|
|
|
|
|
=====================================================================
|
|
|
|
|
==================== 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:
|
|
|
|
|
- <escape key>
|
|
|
|
|
- :
|
|
|
|
|
- Tutor
|
|
|
|
|
- <enter key>
|
|
|
|
|
|
|
|
|
|
(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 "<space>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! :)
|
|
|
|
|
--]]
|
|
|
|
|
|
|
|
|
|
-- Set <space> 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.termguicolors = true
|
|
|
|
|
|
|
|
|
|
-- 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.opt`
|
|
|
|
@ -100,9 +16,12 @@ vim.g.have_nerd_font = false
|
|
|
|
|
|
|
|
|
|
-- Make line numbers default
|
|
|
|
|
vim.opt.number = true
|
|
|
|
|
-- You can also add relative line numbers, to help with jumping.
|
|
|
|
|
-- Experiment for yourself to see if you like it!
|
|
|
|
|
-- vim.opt.relativenumber = true
|
|
|
|
|
vim.opt.relativenumber = true
|
|
|
|
|
|
|
|
|
|
vim.opt.tabstop = 2
|
|
|
|
|
vim.opt.softtabstop = 2
|
|
|
|
|
vim.opt.shiftwidth = 2
|
|
|
|
|
vim.expandtab = true
|
|
|
|
|
|
|
|
|
|
-- Enable mouse mode, can be useful for resizing splits for example!
|
|
|
|
|
vim.opt.mouse = 'a'
|
|
|
|
@ -110,10 +29,6 @@ vim.opt.mouse = 'a'
|
|
|
|
|
-- Don't show the mode, since it's already in the status line
|
|
|
|
|
vim.opt.showmode = false
|
|
|
|
|
|
|
|
|
|
-- Sync clipboard between OS and Neovim.
|
|
|
|
|
-- 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.opt.clipboard = 'unnamedplus'
|
|
|
|
|
end)
|
|
|
|
@ -166,20 +81,15 @@ vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
|
|
|
|
-- Diagnostic keymaps
|
|
|
|
|
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
|
|
|
|
|
|
|
|
|
|
-- Explorer shortcut
|
|
|
|
|
vim.keymap.set('n', '<leader>e', '<cmd>Ex<CR>', { desc = 'Return to [E]xplorer' })
|
|
|
|
|
|
|
|
|
|
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
|
|
|
|
|
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
|
|
|
|
|
-- is not what someone will guess without a bit more experience.
|
|
|
|
|
--
|
|
|
|
|
-- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping
|
|
|
|
|
-- or just use <C-\><C-n> to exit terminal mode
|
|
|
|
|
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
|
|
|
|
|
|
|
|
|
|
-- TIP: Disable arrow keys in normal mode
|
|
|
|
|
-- vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
|
|
|
|
|
-- vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
|
|
|
|
|
-- vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
|
|
|
|
|
-- vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
|
|
|
|
|
|
|
|
|
|
vim.keymap.set('t', '<Leader><Esc>', '<C-\\><C-n>', { noremap = true })
|
|
|
|
|
-- Keybinds to make split navigation easier.
|
|
|
|
|
-- Use CTRL+<hjkl> to switch between windows
|
|
|
|
|
--
|
|
|
|
@ -230,28 +140,6 @@ require('lazy').setup({
|
|
|
|
|
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
|
|
|
|
|
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
|
|
|
|
|
|
|
|
|
|
-- NOTE: Plugins can also be added by using a table,
|
|
|
|
|
-- with the first argument being the link and the following
|
|
|
|
|
-- keys can be used to configure plugin behavior/loading/etc.
|
|
|
|
|
--
|
|
|
|
|
-- Use `opts = {}` to automatically pass options to a plugin's `setup()` function, forcing the plugin to be loaded.
|
|
|
|
|
--
|
|
|
|
|
|
|
|
|
|
-- Alternatively, use `config = function() ... end` for full control over the configuration.
|
|
|
|
|
-- If you prefer to call `setup` explicitly, use:
|
|
|
|
|
-- {
|
|
|
|
|
-- 'lewis6991/gitsigns.nvim',
|
|
|
|
|
-- config = function()
|
|
|
|
|
-- require('gitsigns').setup({
|
|
|
|
|
-- -- Your gitsigns configuration here
|
|
|
|
|
-- })
|
|
|
|
|
-- end,
|
|
|
|
|
-- }
|
|
|
|
|
--
|
|
|
|
|
-- Here is a more advanced example where we pass configuration
|
|
|
|
|
-- options to `gitsigns.nvim`.
|
|
|
|
|
--
|
|
|
|
|
-- See `:help gitsigns` to understand what the configuration keys do
|
|
|
|
|
{ -- Adds git related signs to the gutter, as well as utilities for managing changes
|
|
|
|
|
'lewis6991/gitsigns.nvim',
|
|
|
|
|
opts = {
|
|
|
|
@ -265,20 +153,6 @@ require('lazy').setup({
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
-- NOTE: Plugins can also be configured to run Lua code when they are loaded.
|
|
|
|
|
--
|
|
|
|
|
-- This is often very useful to both group configuration, as well as handle
|
|
|
|
|
-- lazy loading plugins that don't need to be loaded immediately at startup.
|
|
|
|
|
--
|
|
|
|
|
-- For example, in the following configuration, we use:
|
|
|
|
|
-- event = 'VimEnter'
|
|
|
|
|
--
|
|
|
|
|
-- which loads which-key before all the UI elements are loaded. Events can be
|
|
|
|
|
-- normal autocommands events (`:help autocmd-events`).
|
|
|
|
|
--
|
|
|
|
|
-- 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', -- Sets the loading event to 'VimEnter'
|
|
|
|
@ -336,13 +210,6 @@ require('lazy').setup({
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
-- NOTE: Plugins can specify dependencies.
|
|
|
|
|
--
|
|
|
|
|
-- The dependencies are proper plugin specifications as well - anything
|
|
|
|
|
-- you do for a plugin at the top level, you can do for a dependency.
|
|
|
|
|
--
|
|
|
|
|
-- Use the `dependencies` key to specify the dependencies of a particular plugin
|
|
|
|
|
|
|
|
|
|
{ -- Fuzzy Finder (files, lsp, etc)
|
|
|
|
|
'nvim-telescope/telescope.nvim',
|
|
|
|
|
event = 'VimEnter',
|
|
|
|
@ -368,37 +235,7 @@ require('lazy').setup({
|
|
|
|
|
{ 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
|
|
|
|
|
},
|
|
|
|
|
config = function()
|
|
|
|
|
-- Telescope is a fuzzy finder that comes with a lot of different things that
|
|
|
|
|
-- it can fuzzy find! It's more than just a "file finder", it can search
|
|
|
|
|
-- many different aspects of Neovim, your workspace, LSP, and more!
|
|
|
|
|
--
|
|
|
|
|
-- The easiest way to use Telescope, is to start by doing something like:
|
|
|
|
|
-- :Telescope help_tags
|
|
|
|
|
--
|
|
|
|
|
-- After running this command, a window will open up and you're able to
|
|
|
|
|
-- type in the prompt window. You'll see a list of `help_tags` options and
|
|
|
|
|
-- a corresponding preview of the help.
|
|
|
|
|
--
|
|
|
|
|
-- Two important keymaps to use while in Telescope are:
|
|
|
|
|
-- - Insert mode: <c-/>
|
|
|
|
|
-- - Normal mode: ?
|
|
|
|
|
--
|
|
|
|
|
-- This opens a window that shows you all of the keymaps for the current
|
|
|
|
|
-- Telescope picker. This is really useful to discover what Telescope can
|
|
|
|
|
-- do as well as how to actually do it!
|
|
|
|
|
|
|
|
|
|
-- [[ Configure Telescope ]]
|
|
|
|
|
-- See `:help telescope` and `:help telescope.setup()`
|
|
|
|
|
require('telescope').setup {
|
|
|
|
|
-- You can put your default mappings / updates / etc. in here
|
|
|
|
|
-- All the info you're looking for is in `:help telescope.setup()`
|
|
|
|
|
--
|
|
|
|
|
-- defaults = {
|
|
|
|
|
-- mappings = {
|
|
|
|
|
-- i = { ['<c-enter>'] = 'to_fuzzy_refine' },
|
|
|
|
|
-- },
|
|
|
|
|
-- },
|
|
|
|
|
-- pickers = {}
|
|
|
|
|
extensions = {
|
|
|
|
|
['ui-select'] = {
|
|
|
|
|
require('telescope.themes').get_dropdown(),
|
|
|
|
@ -465,9 +302,6 @@ require('lazy').setup({
|
|
|
|
|
-- Main LSP Configuration
|
|
|
|
|
'neovim/nvim-lspconfig',
|
|
|
|
|
dependencies = {
|
|
|
|
|
-- Automatically install LSPs and related tools to stdpath for Neovim
|
|
|
|
|
-- Mason must be loaded before its dependents so we need to set it up here.
|
|
|
|
|
-- NOTE: `opts = {}` is the same as calling `require('mason').setup({})`
|
|
|
|
|
{ 'williamboman/mason.nvim', opts = {} },
|
|
|
|
|
'williamboman/mason-lspconfig.nvim',
|
|
|
|
|
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
|
|
|
@ -479,43 +313,9 @@ require('lazy').setup({
|
|
|
|
|
'hrsh7th/cmp-nvim-lsp',
|
|
|
|
|
},
|
|
|
|
|
config = function()
|
|
|
|
|
-- Brief aside: **What is LSP?**
|
|
|
|
|
--
|
|
|
|
|
-- LSP is an initialism you've probably heard, but might not understand what it is.
|
|
|
|
|
--
|
|
|
|
|
-- LSP stands for Language Server Protocol. It's a protocol that helps editors
|
|
|
|
|
-- and language tooling communicate in a standardized fashion.
|
|
|
|
|
--
|
|
|
|
|
-- In general, you have a "server" which is some tool built to understand a particular
|
|
|
|
|
-- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc.). These Language Servers
|
|
|
|
|
-- (sometimes called LSP servers, but that's kind of like ATM Machine) are standalone
|
|
|
|
|
-- processes that communicate with some "client" - in this case, Neovim!
|
|
|
|
|
--
|
|
|
|
|
-- LSP provides Neovim with features like:
|
|
|
|
|
-- - Go to definition
|
|
|
|
|
-- - Find references
|
|
|
|
|
-- - Autocompletion
|
|
|
|
|
-- - Symbol Search
|
|
|
|
|
-- - and more!
|
|
|
|
|
--
|
|
|
|
|
-- Thus, Language Servers are external tools that must be installed separately from
|
|
|
|
|
-- Neovim. This is where `mason` and related plugins come into play.
|
|
|
|
|
--
|
|
|
|
|
-- If you're wondering about lsp vs treesitter, you can check out the wonderfully
|
|
|
|
|
-- and elegantly composed help section, `:help lsp-vs-treesitter`
|
|
|
|
|
|
|
|
|
|
-- This function gets run when an LSP attaches to a particular buffer.
|
|
|
|
|
-- That is to say, every time a new file is opened that is associated with
|
|
|
|
|
-- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this
|
|
|
|
|
-- function will be executed to configure the current buffer
|
|
|
|
|
vim.api.nvim_create_autocmd('LspAttach', {
|
|
|
|
|
group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }),
|
|
|
|
|
callback = function(event)
|
|
|
|
|
-- NOTE: Remember that Lua is a real programming language, and as such it is possible
|
|
|
|
|
-- to define small helper and utility functions so you don't have to repeat yourself.
|
|
|
|
|
--
|
|
|
|
|
-- In this case, we create a function that lets us more easily define mappings specific
|
|
|
|
|
-- for LSP related items. It sets the mode, buffer and description for us each time.
|
|
|
|
|
local map = function(keys, func, desc, mode)
|
|
|
|
|
mode = mode or 'n'
|
|
|
|
|
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
|
|
|
|
@ -599,75 +399,22 @@ require('lazy').setup({
|
|
|
|
|
end,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
-- Change diagnostic symbols in the sign column (gutter)
|
|
|
|
|
-- if vim.g.have_nerd_font then
|
|
|
|
|
-- local signs = { ERROR = '', WARN = '', INFO = '', HINT = '' }
|
|
|
|
|
-- local diagnostic_signs = {}
|
|
|
|
|
-- for type, icon in pairs(signs) do
|
|
|
|
|
-- diagnostic_signs[vim.diagnostic.severity[type]] = icon
|
|
|
|
|
-- end
|
|
|
|
|
-- vim.diagnostic.config { signs = { text = diagnostic_signs } }
|
|
|
|
|
-- end
|
|
|
|
|
|
|
|
|
|
-- LSP servers and clients are able to communicate to each other what features they support.
|
|
|
|
|
-- By default, Neovim doesn't support everything that is in the LSP specification.
|
|
|
|
|
-- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities.
|
|
|
|
|
-- So, we create new capabilities with nvim cmp, and then broadcast that to the servers.
|
|
|
|
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
|
|
|
|
capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities())
|
|
|
|
|
|
|
|
|
|
-- Enable the following language servers
|
|
|
|
|
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
|
|
|
|
|
--
|
|
|
|
|
-- Add any additional override configuration in the following tables. Available keys are:
|
|
|
|
|
-- - cmd (table): Override the default command used to start the server
|
|
|
|
|
-- - filetypes (table): Override the default list of associated filetypes for the server
|
|
|
|
|
-- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features.
|
|
|
|
|
-- - settings (table): Override the default settings passed when initializing the server.
|
|
|
|
|
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
|
|
|
|
|
local servers = {
|
|
|
|
|
-- clangd = {},
|
|
|
|
|
-- gopls = {},
|
|
|
|
|
-- pyright = {},
|
|
|
|
|
-- rust_analyzer = {},
|
|
|
|
|
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
|
|
|
|
|
--
|
|
|
|
|
-- Some languages (like typescript) have entire language plugins that can be useful:
|
|
|
|
|
-- https://github.com/pmizio/typescript-tools.nvim
|
|
|
|
|
--
|
|
|
|
|
-- But for many setups, the LSP (`ts_ls`) will work just fine
|
|
|
|
|
-- ts_ls = {},
|
|
|
|
|
--
|
|
|
|
|
|
|
|
|
|
lua_ls = {
|
|
|
|
|
-- cmd = { ... },
|
|
|
|
|
-- filetypes = { ... },
|
|
|
|
|
-- capabilities = {},
|
|
|
|
|
settings = {
|
|
|
|
|
Lua = {
|
|
|
|
|
completion = {
|
|
|
|
|
callSnippet = 'Replace',
|
|
|
|
|
},
|
|
|
|
|
-- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
|
|
|
|
|
-- diagnostics = { disable = { 'missing-fields' } },
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
clangd = {},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-- Ensure the servers and tools above are installed
|
|
|
|
|
--
|
|
|
|
|
-- To check the current status of installed tools and/or manually install
|
|
|
|
|
-- other tools, you can run
|
|
|
|
|
-- :Mason
|
|
|
|
|
--
|
|
|
|
|
-- You can press `g?` for help in this menu.
|
|
|
|
|
--
|
|
|
|
|
-- `mason` had to be setup earlier: to configure its options see the
|
|
|
|
|
-- `dependencies` table for `nvim-lspconfig` above.
|
|
|
|
|
--
|
|
|
|
|
-- You can add other tools here that you want Mason to install
|
|
|
|
|
-- for you, so that they are available from within Neovim.
|
|
|
|
|
local ensure_installed = vim.tbl_keys(servers or {})
|
|
|
|
|
vim.list_extend(ensure_installed, {
|
|
|
|
|
'stylua', -- Used to format Lua code
|
|
|
|
@ -678,9 +425,6 @@ require('lazy').setup({
|
|
|
|
|
handlers = {
|
|
|
|
|
function(server_name)
|
|
|
|
|
local server = servers[server_name] or {}
|
|
|
|
|
-- This handles overriding only values explicitly passed
|
|
|
|
|
-- by the server configuration above. Useful when disabling
|
|
|
|
|
-- certain features of an LSP (for example, turning off formatting for ts_ls)
|
|
|
|
|
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
|
|
|
|
|
require('lspconfig')[server_name].setup(server)
|
|
|
|
|
end,
|
|
|
|
@ -706,9 +450,6 @@ require('lazy').setup({
|
|
|
|
|
opts = {
|
|
|
|
|
notify_on_error = false,
|
|
|
|
|
format_on_save = function(bufnr)
|
|
|
|
|
-- Disable "format_on_save lsp_fallback" for languages that don't
|
|
|
|
|
-- have a well standardized coding style. You can add additional
|
|
|
|
|
-- languages here or re-enable it for the disabled ones.
|
|
|
|
|
local disable_filetypes = { c = true, cpp = true }
|
|
|
|
|
local lsp_format_opt
|
|
|
|
|
if disable_filetypes[vim.bo[bufnr].filetype] then
|
|
|
|
@ -723,11 +464,6 @@ require('lazy').setup({
|
|
|
|
|
end,
|
|
|
|
|
formatters_by_ft = {
|
|
|
|
|
lua = { 'stylua' },
|
|
|
|
|
-- Conform can also run multiple formatters sequentially
|
|
|
|
|
-- python = { "isort", "black" },
|
|
|
|
|
--
|
|
|
|
|
-- You can use 'stop_after_first' to run the first available formatter from the list
|
|
|
|
|
-- javascript = { "prettierd", "prettier", stop_after_first = true },
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
@ -740,33 +476,21 @@ require('lazy').setup({
|
|
|
|
|
{
|
|
|
|
|
'L3MON4D3/LuaSnip',
|
|
|
|
|
build = (function()
|
|
|
|
|
-- Build Step is needed for regex support in snippets.
|
|
|
|
|
-- This step is not supported in many windows environments.
|
|
|
|
|
-- Remove the below condition to re-enable on windows.
|
|
|
|
|
if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
return 'make install_jsregexp'
|
|
|
|
|
end)(),
|
|
|
|
|
dependencies = {
|
|
|
|
|
-- `friendly-snippets` contains a variety of premade snippets.
|
|
|
|
|
-- See the README about individual language/framework/plugin snippets:
|
|
|
|
|
-- https://github.com/rafamadriz/friendly-snippets
|
|
|
|
|
-- {
|
|
|
|
|
-- 'rafamadriz/friendly-snippets',
|
|
|
|
|
-- config = function()
|
|
|
|
|
-- require('luasnip.loaders.from_vscode').lazy_load()
|
|
|
|
|
-- end,
|
|
|
|
|
-- },
|
|
|
|
|
},
|
|
|
|
|
dependencies = {},
|
|
|
|
|
},
|
|
|
|
|
'saadparwaiz1/cmp_luasnip',
|
|
|
|
|
|
|
|
|
|
-- Adds other completion capabilities.
|
|
|
|
|
-- nvim-cmp does not ship with all sources by default. They are split
|
|
|
|
|
-- into multiple repos for maintenance purposes.
|
|
|
|
|
'hrsh7th/cmp-nvim-lsp',
|
|
|
|
|
'hrsh7th/cmp-path',
|
|
|
|
|
'hrsh7th/cmp-cmdline',
|
|
|
|
|
|
|
|
|
|
'hrsh7th/cmp-vsnip',
|
|
|
|
|
'hrsh7th/vim-vsnip',
|
|
|
|
|
},
|
|
|
|
|
config = function()
|
|
|
|
|
-- See `:help cmp`
|
|
|
|
@ -782,10 +506,6 @@ require('lazy').setup({
|
|
|
|
|
},
|
|
|
|
|
completion = { completeopt = 'menu,menuone,noinsert' },
|
|
|
|
|
|
|
|
|
|
-- For an understanding of why these mappings were
|
|
|
|
|
-- chosen, you will need to read `:help ins-completion`
|
|
|
|
|
--
|
|
|
|
|
-- No, but seriously. Please read `:help ins-completion`, it is really good!
|
|
|
|
|
mapping = cmp.mapping.preset.insert {
|
|
|
|
|
-- Select the [n]ext item
|
|
|
|
|
['<C-n>'] = cmp.mapping.select_next_item(),
|
|
|
|
@ -797,29 +517,10 @@ require('lazy').setup({
|
|
|
|
|
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
|
|
|
|
|
|
|
|
|
-- Accept ([y]es) the completion.
|
|
|
|
|
-- This will auto-import if your LSP supports it.
|
|
|
|
|
-- This will expand snippets if the LSP sent a snippet.
|
|
|
|
|
['<C-y>'] = cmp.mapping.confirm { select = true },
|
|
|
|
|
|
|
|
|
|
-- If you prefer more traditional completion keymaps,
|
|
|
|
|
-- you can uncomment the following lines
|
|
|
|
|
--['<CR>'] = cmp.mapping.confirm { select = true },
|
|
|
|
|
--['<Tab>'] = cmp.mapping.select_next_item(),
|
|
|
|
|
--['<S-Tab>'] = cmp.mapping.select_prev_item(),
|
|
|
|
|
|
|
|
|
|
-- Manually trigger a completion from nvim-cmp.
|
|
|
|
|
-- Generally you don't need this, because nvim-cmp will display
|
|
|
|
|
-- completions whenever it has completion options available.
|
|
|
|
|
['<C-Space>'] = cmp.mapping.complete {},
|
|
|
|
|
|
|
|
|
|
-- Think of <c-l> as moving to the right of your snippet expansion.
|
|
|
|
|
-- So if you have a snippet that's like:
|
|
|
|
|
-- function $name($args)
|
|
|
|
|
-- $body
|
|
|
|
|
-- end
|
|
|
|
|
--
|
|
|
|
|
-- <c-l> will move you to the right of each of the expansion locations.
|
|
|
|
|
-- <c-h> is similar, except moving you backwards.
|
|
|
|
|
['<C-l>'] = cmp.mapping(function()
|
|
|
|
|
if luasnip.expand_or_locally_jumpable() then
|
|
|
|
|
luasnip.expand_or_jump()
|
|
|
|
@ -830,14 +531,10 @@ require('lazy').setup({
|
|
|
|
|
luasnip.jump(-1)
|
|
|
|
|
end
|
|
|
|
|
end, { 'i', 's' }),
|
|
|
|
|
|
|
|
|
|
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
|
|
|
|
|
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
|
|
|
|
|
},
|
|
|
|
|
sources = {
|
|
|
|
|
{
|
|
|
|
|
name = 'lazydev',
|
|
|
|
|
-- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
|
|
|
|
|
group_index = 0,
|
|
|
|
|
},
|
|
|
|
|
{ name = 'nvim_lsp' },
|
|
|
|
@ -848,20 +545,12 @@ require('lazy').setup({
|
|
|
|
|
end,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ -- You can easily change to a different colorscheme.
|
|
|
|
|
-- Change the name of the colorscheme plugin below, and then
|
|
|
|
|
-- change the command in the config to whatever the name of that colorscheme is.
|
|
|
|
|
--
|
|
|
|
|
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
|
|
|
|
|
{
|
|
|
|
|
'folke/tokyonight.nvim',
|
|
|
|
|
priority = 1000, -- Make sure to load this before all the other start plugins.
|
|
|
|
|
init = function()
|
|
|
|
|
-- Load the colorscheme here.
|
|
|
|
|
-- Like many other themes, this one has different styles, and you could load
|
|
|
|
|
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
|
|
|
|
|
vim.cmd.colorscheme 'tokyonight-night'
|
|
|
|
|
|
|
|
|
|
-- You can configure highlights by doing something like:
|
|
|
|
|
vim.cmd.hi 'Comment gui=none'
|
|
|
|
|
end,
|
|
|
|
|
},
|
|
|
|
@ -872,38 +561,16 @@ require('lazy').setup({
|
|
|
|
|
{ -- Collection of various small independent plugins/modules
|
|
|
|
|
'echasnovski/mini.nvim',
|
|
|
|
|
config = function()
|
|
|
|
|
-- Better Around/Inside textobjects
|
|
|
|
|
--
|
|
|
|
|
-- Examples:
|
|
|
|
|
-- - va) - [V]isually select [A]round [)]paren
|
|
|
|
|
-- - yinq - [Y]ank [I]nside [N]ext [Q]uote
|
|
|
|
|
-- - ci' - [C]hange [I]nside [']quote
|
|
|
|
|
require('mini.ai').setup { n_lines = 500 }
|
|
|
|
|
|
|
|
|
|
-- Add/delete/replace surroundings (brackets, quotes, etc.)
|
|
|
|
|
--
|
|
|
|
|
-- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren
|
|
|
|
|
-- - sd' - [S]urround [D]elete [']quotes
|
|
|
|
|
-- - sr)' - [S]urround [R]eplace [)] [']
|
|
|
|
|
require('mini.surround').setup()
|
|
|
|
|
|
|
|
|
|
-- Simple and easy statusline.
|
|
|
|
|
-- You could remove this setup call if you don't like it,
|
|
|
|
|
-- 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 }
|
|
|
|
|
|
|
|
|
|
-- You can configure sections in the statusline by overriding their
|
|
|
|
|
-- default behavior. For example, here we set the section for
|
|
|
|
|
-- cursor location to LINE:COLUMN
|
|
|
|
|
---@diagnostic disable-next-line: duplicate-set-field
|
|
|
|
|
statusline.section_location = function()
|
|
|
|
|
return '%2l:%-2v'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- ... and there is more!
|
|
|
|
|
-- Check out: https://github.com/echasnovski/mini.nvim
|
|
|
|
|
end,
|
|
|
|
|
},
|
|
|
|
|
{ -- Highlight, edit, and navigate code
|
|
|
|
@ -917,51 +584,22 @@ require('lazy').setup({
|
|
|
|
|
auto_install = true,
|
|
|
|
|
highlight = {
|
|
|
|
|
enable = true,
|
|
|
|
|
-- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules.
|
|
|
|
|
-- If you are experiencing weird indenting issues, add the language to
|
|
|
|
|
-- the list of additional_vim_regex_highlighting and disabled languages for indent.
|
|
|
|
|
additional_vim_regex_highlighting = { 'ruby' },
|
|
|
|
|
},
|
|
|
|
|
indent = { enable = true, disable = { 'ruby' } },
|
|
|
|
|
},
|
|
|
|
|
-- There are additional nvim-treesitter modules that you can use to interact
|
|
|
|
|
-- with nvim-treesitter. You should go explore a few and see what interests you:
|
|
|
|
|
--
|
|
|
|
|
-- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
|
|
|
|
|
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
|
|
|
|
|
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
-- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the
|
|
|
|
|
-- init.lua. If you want these files, they are in the repository, so you can just download them and
|
|
|
|
|
-- place them in the correct locations.
|
|
|
|
|
require 'kickstart.plugins.debug',
|
|
|
|
|
require 'kickstart.plugins.indent_line',
|
|
|
|
|
require 'kickstart.plugins.lint',
|
|
|
|
|
require 'kickstart.plugins.autopairs',
|
|
|
|
|
require 'kickstart.plugins.neo-tree',
|
|
|
|
|
require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
|
|
|
|
|
|
|
|
|
|
-- NOTE: Next step on your Neovim journey: Add/Configure additional plugins for Kickstart
|
|
|
|
|
--
|
|
|
|
|
-- Here are some example plugins that I've included in the Kickstart repository.
|
|
|
|
|
-- Uncomment any of the lines below to enable them (you will need to restart nvim).
|
|
|
|
|
--
|
|
|
|
|
-- require 'kickstart.plugins.debug',
|
|
|
|
|
-- require 'kickstart.plugins.indent_line',
|
|
|
|
|
-- require 'kickstart.plugins.lint',
|
|
|
|
|
-- require 'kickstart.plugins.autopairs',
|
|
|
|
|
-- require 'kickstart.plugins.neo-tree',
|
|
|
|
|
-- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
|
|
|
|
|
|
|
|
|
|
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
|
|
|
|
|
-- 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' },
|
|
|
|
|
--
|
|
|
|
|
-- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
|
|
|
|
|
-- Or use telescope!
|
|
|
|
|
-- In normal mode type `<space>sh` then write `lazy.nvim-plugin`
|
|
|
|
|
-- you can continue same window with `<space>sr` which resumes last telescope search
|
|
|
|
|
{ import = 'custom.plugins' },
|
|
|
|
|
}, {
|
|
|
|
|
ui = {
|
|
|
|
|
-- If you are using a Nerd Font: set icons to an empty table which will use the
|
|
|
|
|
-- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table
|
|
|
|
|
icons = vim.g.have_nerd_font and {} or {
|
|
|
|
|
cmd = '⌘',
|
|
|
|
|
config = '🛠',
|
|
|
|
@ -979,6 +617,3 @@ require('lazy').setup({
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
-- The line beneath this is called `modeline`. See `:help modeline`
|
|
|
|
|
-- vim: ts=2 sts=2 sw=2 et
|
|
|
|
|