mirror of
https://github.com/dam9000/kickstart-modular.nvim.git
synced 2026-05-14 08:23:48 +00:00
Refactor and update some of the comments
This commit is contained in:
parent
4b065ad2f7
commit
cd7adee3ce
69
init.lua
69
init.lua
@ -94,7 +94,7 @@ vim.g.maplocalleader = ' '
|
|||||||
vim.g.have_nerd_font = false
|
vim.g.have_nerd_font = false
|
||||||
|
|
||||||
-- [[ Setting options ]]
|
-- [[ Setting options ]]
|
||||||
-- See `:help vim.o`
|
-- See `:help vim.o`
|
||||||
-- NOTE: You can change these options as you wish!
|
-- NOTE: You can change these options as you wish!
|
||||||
-- For more options, you can see `:help option-list`
|
-- For more options, you can see `:help option-list`
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ vim.o.confirm = true
|
|||||||
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
||||||
|
|
||||||
-- Diagnostic Config & Keymaps
|
-- Diagnostic Config & Keymaps
|
||||||
-- See :help vim.diagnostic.Opts
|
-- See `:help vim.diagnostic.Opts`
|
||||||
vim.diagnostic.config {
|
vim.diagnostic.config {
|
||||||
update_in_insert = false,
|
update_in_insert = false,
|
||||||
severity_sort = true,
|
severity_sort = true,
|
||||||
@ -272,8 +272,9 @@ require('lazy').setup({
|
|||||||
-- Here is a more advanced example where we pass configuration
|
-- Here is a more advanced example where we pass configuration
|
||||||
-- options to `gitsigns.nvim`.
|
-- options to `gitsigns.nvim`.
|
||||||
--
|
--
|
||||||
-- See `:help gitsigns` to understand what the configuration keys do
|
-- See `:help gitsigns` to understand what each configuration keys does.
|
||||||
{ -- Adds git related signs to the gutter, as well as utilities for managing changes
|
-- Adds git related signs to the gutter, as well as utilities for managing changes
|
||||||
|
{
|
||||||
'lewis6991/gitsigns.nvim',
|
'lewis6991/gitsigns.nvim',
|
||||||
---@module 'gitsigns'
|
---@module 'gitsigns'
|
||||||
---@type Gitsigns.Config
|
---@type Gitsigns.Config
|
||||||
@ -302,15 +303,16 @@ require('lazy').setup({
|
|||||||
--
|
--
|
||||||
-- Then, because we use the `opts` key (recommended), the configuration runs
|
-- Then, because we use the `opts` key (recommended), the configuration runs
|
||||||
-- after the plugin has been loaded as `require(MODULE).setup(opts)`.
|
-- after the plugin has been loaded as `require(MODULE).setup(opts)`.
|
||||||
|
--
|
||||||
{ -- Useful plugin to show you pending keybinds.
|
-- Useful plugin to show you pending keybinds.
|
||||||
|
{
|
||||||
'folke/which-key.nvim',
|
'folke/which-key.nvim',
|
||||||
event = 'VimEnter',
|
event = 'VimEnter',
|
||||||
---@module 'which-key'
|
---@module 'which-key'
|
||||||
---@type wk.Opts
|
---@type wk.Opts
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@diagnostic disable-next-line: missing-fields
|
||||||
opts = {
|
opts = {
|
||||||
-- delay between pressing a key and opening which-key (milliseconds)
|
-- Delay between pressing a key and opening which-key (milliseconds)
|
||||||
delay = 0,
|
delay = 0,
|
||||||
icons = { mappings = vim.g.have_nerd_font },
|
icons = { mappings = vim.g.have_nerd_font },
|
||||||
|
|
||||||
@ -330,8 +332,9 @@ require('lazy').setup({
|
|||||||
-- you do for a plugin at the top level, you can do for a dependency.
|
-- 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
|
-- Use the `dependencies` key to specify the dependencies of a particular plugin
|
||||||
|
--
|
||||||
{ -- Fuzzy Finder (files, lsp, etc)
|
-- Fuzzy Finder (files, lsp, etc)
|
||||||
|
{
|
||||||
'nvim-telescope/telescope.nvim',
|
'nvim-telescope/telescope.nvim',
|
||||||
-- By default, Telescope is included and acts as your picker for everything.
|
-- By default, Telescope is included and acts as your picker for everything.
|
||||||
|
|
||||||
@ -346,7 +349,8 @@ require('lazy').setup({
|
|||||||
event = 'VimEnter',
|
event = 'VimEnter',
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'nvim-lua/plenary.nvim',
|
'nvim-lua/plenary.nvim',
|
||||||
{ -- If encountering errors, see telescope-fzf-native README for installation instructions
|
-- If encountering errors, see telescope-fzf-native README for installation instructions
|
||||||
|
{
|
||||||
'nvim-telescope/telescope-fzf-native.nvim',
|
'nvim-telescope/telescope-fzf-native.nvim',
|
||||||
|
|
||||||
-- `build` is used to run some command when the plugin is installed/updated.
|
-- `build` is used to run some command when the plugin is installed/updated.
|
||||||
@ -417,8 +421,8 @@ require('lazy').setup({
|
|||||||
vim.keymap.set('n', '<leader>sc', builtin.commands, { desc = '[S]earch [C]ommands' })
|
vim.keymap.set('n', '<leader>sc', builtin.commands, { desc = '[S]earch [C]ommands' })
|
||||||
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
|
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
|
||||||
|
|
||||||
-- This runs on LSP attach per buffer (see main LSP attach function in 'neovim/nvim-lspconfig' config for more info,
|
-- Add Telescope-based LSP pickers when an LSP attaches to a buffer.
|
||||||
-- it is better explained there). This allows easily switching between pickers if you prefer using something else!
|
-- If you later switch picker plugins, this is where to update these mappings.
|
||||||
vim.api.nvim_create_autocmd('LspAttach', {
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
group = vim.api.nvim_create_augroup('telescope-lsp-attach', { clear = true }),
|
group = vim.api.nvim_create_augroup('telescope-lsp-attach', { clear = true }),
|
||||||
callback = function(event)
|
callback = function(event)
|
||||||
@ -669,7 +673,8 @@ require('lazy').setup({
|
|||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{ -- Autoformat
|
-- Autoformat
|
||||||
|
{
|
||||||
'stevearc/conform.nvim',
|
'stevearc/conform.nvim',
|
||||||
event = { 'BufWritePre' },
|
event = { 'BufWritePre' },
|
||||||
cmd = { 'ConformInfo' },
|
cmd = { 'ConformInfo' },
|
||||||
@ -712,7 +717,8 @@ require('lazy').setup({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
{ -- Autocompletion
|
-- Autocompletion
|
||||||
|
{
|
||||||
'saghen/blink.cmp',
|
'saghen/blink.cmp',
|
||||||
event = 'VimEnter',
|
event = 'VimEnter',
|
||||||
version = '1.*',
|
version = '1.*',
|
||||||
@ -766,7 +772,7 @@ require('lazy').setup({
|
|||||||
-- <c-e>: Hide menu
|
-- <c-e>: Hide menu
|
||||||
-- <c-k>: Toggle signature help
|
-- <c-k>: Toggle signature help
|
||||||
--
|
--
|
||||||
-- See :h blink-cmp-config-keymap for defining your own keymap
|
-- See `:help blink-cmp-config-keymap` for defining your own keymap
|
||||||
preset = 'default',
|
preset = 'default',
|
||||||
|
|
||||||
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
|
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
|
||||||
@ -797,7 +803,7 @@ require('lazy').setup({
|
|||||||
-- By default, we use the Lua implementation instead, but you may enable
|
-- By default, we use the Lua implementation instead, but you may enable
|
||||||
-- the rust implementation via `'prefer_rust_with_warning'`
|
-- the rust implementation via `'prefer_rust_with_warning'`
|
||||||
--
|
--
|
||||||
-- See :h blink-cmp-config-fuzzy for more information
|
-- See `:help blink-cmp-config-fuzzy` for more information
|
||||||
fuzzy = { implementation = 'lua' },
|
fuzzy = { implementation = 'lua' },
|
||||||
|
|
||||||
-- Shows a signature help window while you type arguments for a function
|
-- Shows a signature help window while you type arguments for a function
|
||||||
@ -805,7 +811,8 @@ require('lazy').setup({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
{ -- You can easily change to a different colorscheme.
|
{
|
||||||
|
-- You can easily change to a different colorscheme.
|
||||||
-- Change the name of the colorscheme plugin below, and then
|
-- Change the name of the colorscheme plugin below, and then
|
||||||
-- change the command in the config to whatever the name of that colorscheme is.
|
-- change the command in the config to whatever the name of that colorscheme is.
|
||||||
--
|
--
|
||||||
@ -838,7 +845,8 @@ require('lazy').setup({
|
|||||||
opts = { signs = false },
|
opts = { signs = false },
|
||||||
},
|
},
|
||||||
|
|
||||||
{ -- Collection of various small independent plugins/modules
|
-- Collection of various small independent plugins/modules
|
||||||
|
{
|
||||||
'nvim-mini/mini.nvim',
|
'nvim-mini/mini.nvim',
|
||||||
config = function()
|
config = function()
|
||||||
-- Better Around/Inside textobjects
|
-- Better Around/Inside textobjects
|
||||||
@ -867,7 +875,7 @@ require('lazy').setup({
|
|||||||
-- You could remove this setup call if you don't like it,
|
-- You could remove this setup call if you don't like it,
|
||||||
-- and try some other statusline plugin
|
-- and try some other statusline plugin
|
||||||
local statusline = require 'mini.statusline'
|
local statusline = require 'mini.statusline'
|
||||||
-- set use_icons to true if you have a Nerd Font
|
-- Set `use_icons` to true if you have a Nerd Font
|
||||||
statusline.setup { use_icons = vim.g.have_nerd_font }
|
statusline.setup { use_icons = vim.g.have_nerd_font }
|
||||||
|
|
||||||
-- You can configure sections in the statusline by overriding their
|
-- You can configure sections in the statusline by overriding their
|
||||||
@ -881,35 +889,36 @@ require('lazy').setup({
|
|||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{ -- Highlight, edit, and navigate code
|
-- Used to highlight, edit, and navigate code
|
||||||
|
{
|
||||||
'nvim-treesitter/nvim-treesitter',
|
'nvim-treesitter/nvim-treesitter',
|
||||||
lazy = false,
|
lazy = false,
|
||||||
build = ':TSUpdate',
|
build = ':TSUpdate',
|
||||||
branch = 'main',
|
branch = 'main',
|
||||||
-- [[ Configure Treesitter ]] See `:help nvim-treesitter-intro`
|
-- [[ Configure Treesitter ]] See `:help nvim-treesitter-intro`
|
||||||
config = function()
|
config = function()
|
||||||
-- ensure basic parser are installed
|
-- Ensure basic parsers are installed
|
||||||
local parsers = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }
|
local parsers = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }
|
||||||
require('nvim-treesitter').install(parsers)
|
require('nvim-treesitter').install(parsers)
|
||||||
|
|
||||||
---@param buf integer
|
---@param buf integer
|
||||||
---@param language string
|
---@param language string
|
||||||
local function treesitter_try_attach(buf, language)
|
local function treesitter_try_attach(buf, language)
|
||||||
-- check if parser exists and load it
|
-- Check if a parser exists and load it
|
||||||
if not vim.treesitter.language.add(language) then return end
|
if not vim.treesitter.language.add(language) then return end
|
||||||
-- enables syntax highlighting and other treesitter features
|
-- Enable syntax highlighting and other treesitter features
|
||||||
vim.treesitter.start(buf, language)
|
vim.treesitter.start(buf, language)
|
||||||
|
|
||||||
-- enables treesitter based folds
|
-- Enable treesitter based folds
|
||||||
-- for more info on folds see `:help folds`
|
-- For more info on folds see `:help folds`
|
||||||
-- vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
|
-- vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
|
||||||
-- vim.wo.foldmethod = 'expr'
|
-- vim.wo.foldmethod = 'expr'
|
||||||
|
|
||||||
-- check if treesitter indentation is available for this language, and if so enable it
|
-- Check if treesitter indentation is available for this language, and if so enable it
|
||||||
-- in case there is no indent query, the indentexpr will fallback to the vim's built in one
|
-- in case there is no indent query, the indentexpr will fallback to the vim's built in one
|
||||||
local has_indent_query = vim.treesitter.query.get(language, 'indents') ~= nil
|
local has_indent_query = vim.treesitter.query.get(language, 'indents') ~= nil
|
||||||
|
|
||||||
-- enables treesitter based indentation
|
-- Enable treesitter based indentation
|
||||||
if has_indent_query then vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" end
|
if has_indent_query then vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -924,13 +933,13 @@ require('lazy').setup({
|
|||||||
local installed_parsers = require('nvim-treesitter').get_installed 'parsers'
|
local installed_parsers = require('nvim-treesitter').get_installed 'parsers'
|
||||||
|
|
||||||
if vim.tbl_contains(installed_parsers, language) then
|
if vim.tbl_contains(installed_parsers, language) then
|
||||||
-- enable the parser if it is installed
|
-- Enable the parser if it is already installed
|
||||||
treesitter_try_attach(buf, language)
|
treesitter_try_attach(buf, language)
|
||||||
elseif vim.tbl_contains(available_parsers, language) then
|
elseif vim.tbl_contains(available_parsers, language) then
|
||||||
-- if a parser is available in `nvim-treesitter` auto install it, and enable it after the installation is done
|
-- If a parser is available in `nvim-treesitter`, auto-install it and enable it after the installation is done
|
||||||
require('nvim-treesitter').install(language):await(function() treesitter_try_attach(buf, language) end)
|
require('nvim-treesitter').install(language):await(function() treesitter_try_attach(buf, language) end)
|
||||||
else
|
else
|
||||||
-- try to enable treesitter features in case the parser exists but is not available from `nvim-treesitter`
|
-- Try to enable treesitter features in case the parser exists but is not available from `nvim-treesitter`
|
||||||
treesitter_try_attach(buf, language)
|
treesitter_try_attach(buf, language)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user