Skip to content

Commit d4bf13c

Browse files
committed
Tidy the comments
1 parent c049375 commit d4bf13c

1 file changed

Lines changed: 27 additions & 26 deletions

File tree

init.lua

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ I hope you enjoy your Neovim journey,
8484
P.S. You can delete this when you're done too. It's your config now! :)
8585
--]]
8686

87-
-- Enables faster startup time by caching your compiled Lua modules.
87+
-- Enable faster startup by caching compiled Lua modules
8888
vim.loader.enable()
8989

9090
-- Set <space> as the leader key
@@ -175,7 +175,7 @@ vim.o.confirm = true
175175
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
176176

177177
-- Diagnostic Config & Keymaps
178-
-- See :help vim.diagnostic.Opts
178+
-- See `:help vim.diagnostic.Opts`
179179
vim.diagnostic.config {
180180
update_in_insert = false,
181181
severity_sort = true,
@@ -254,8 +254,10 @@ local function run_build(name, cmd, cwd)
254254
end
255255
end
256256

257-
-- This autocommand runs after a plugin is installed or updated and runs the appropriate build command for that plugin if necessary.
258-
-- See `:help vim.pack-events`
257+
-- This autocommand runs after a plugin is installed or updated and
258+
-- runs the appropriate build command for that plugin if necessary.
259+
--
260+
-- See `:help vim.pack-events`
259261
vim.api.nvim_create_autocmd('PackChanged', {
260262
callback = function(ev)
261263
local name = ev.data.spec.name
@@ -284,7 +286,7 @@ local gh = function(repo) return 'https://github.com/' .. repo end
284286

285287
---@type (string|vim.pack.Spec)[]
286288
local plugins = {
287-
-- You can specify plugins using just a git URL. It will use the default branch (usually `main` or `master`)
289+
-- You can specify plugins with a git URL. `vim.pack` then uses the default branch (usually `main` or `master`)
288290
gh 'NMAC427/guess-indent.nvim',
289291
gh 'lewis6991/gitsigns.nvim',
290292
gh 'folke/which-key.nvim',
@@ -297,14 +299,14 @@ local plugins = {
297299
gh 'WhoIsSethDaniel/mason-tool-installer.nvim',
298300
gh 'j-hui/fidget.nvim',
299301
gh 'stevearc/conform.nvim',
300-
-- You can also specify plugin using a version range for its git tag.
302+
-- You can also specify plugins with a version range for semver git tags
301303
-- See `:help vim.version.range()` for more info
302304
{ src = gh 'saghen/blink.cmp', version = vim.version.range '1.*' },
303305
{ src = gh 'L3MON4D3/LuaSnip', version = vim.version.range '2.*' },
304306
gh 'folke/tokyonight.nvim',
305307
gh 'folke/todo-comments.nvim',
306308
gh 'nvim-mini/mini.nvim',
307-
-- It is also possible to specify a branch or a specific commit to checkout
309+
-- You can also specify a branch or a specific commit
308310
{ src = gh 'nvim-treesitter/nvim-treesitter', version = 'main' },
309311
}
310312

@@ -313,7 +315,7 @@ if vim.fn.executable 'make' == 1 then table.insert(plugins, gh 'nvim-telescope/t
313315
-- Useful for getting pretty icons, but requires a Nerd Font.
314316
if vim.g.have_nerd_font then table.insert(plugins, gh 'nvim-tree/nvim-web-devicons') end
315317

316-
-- NOTE: Here is where the plugins are actually installed.
318+
-- NOTE: Here is where the plugins are actually installed and added to the path
317319
vim.pack.add(plugins)
318320

319321
-- [[ Configure plugins ]]
@@ -323,10 +325,9 @@ vim.pack.add(plugins)
323325
-- which will automatically detect and set your indentation settings based on the current file.
324326
require('guess-indent').setup {}
325327

326-
-- Here is a more advanced example where we pass configuration
327-
-- options to `gitsigns.nvim`.
328+
-- Here is a more advanced example that passes configuration options to `gitsigns.nvim`
328329
--
329-
-- See `:help gitsigns` to understand what the configuration keys do
330+
-- See `:help gitsigns` to understand what each configuration key does.
330331
-- Adds git related signs to the gutter, as well as utilities for managing changes
331332
require('gitsigns').setup {
332333
signs = {
@@ -340,7 +341,7 @@ require('gitsigns').setup {
340341

341342
-- Useful plugin to show you pending keybinds.
342343
require('which-key').setup {
343-
-- delay between pressing a key and opening which-key (milliseconds)
344+
-- Delay between pressing a key and opening which-key (milliseconds)
344345
delay = 0,
345346
icons = { mappings = vim.g.have_nerd_font },
346347
-- Document existing key chains
@@ -410,8 +411,8 @@ vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Fi
410411
vim.keymap.set('n', '<leader>sc', builtin.commands, { desc = '[S]earch [C]ommands' })
411412
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
412413

413-
-- This runs on LSP attach per buffer (see main LSP attach function in 'neovim/nvim-lspconfig' config for more info,
414-
-- it is better explained there). This allows easily switching between pickers if you prefer using something else!
414+
-- Add Telescope-based LSP pickers when an LSP attaches to a buffer.
415+
-- If you later switch picker plugins, this is where to update these mappings.
415416
vim.api.nvim_create_autocmd('LspAttach', {
416417
group = vim.api.nvim_create_augroup('telescope-lsp-attach', { clear = true }),
417418
callback = function(event)
@@ -739,7 +740,7 @@ require('blink.cmp').setup {
739740
-- By default, we use the Lua implementation instead, but you may enable
740741
-- the rust implementation via `'prefer_rust_with_warning'`
741742
--
742-
-- See :h blink-cmp-config-fuzzy for more information
743+
-- See `:help blink-cmp-config-fuzzy` for more information
743744
fuzzy = { implementation = 'lua' },
744745

745746
-- Shows a signature help window while you type arguments for a function
@@ -795,7 +796,7 @@ require('mini.surround').setup()
795796
-- You could remove this setup call if you don't like it,
796797
-- and try some other statusline plugin
797798
local statusline = require 'mini.statusline'
798-
-- set use_icons to true if you have a Nerd Font
799+
-- Set `use_icons` to true if you have a Nerd Font
799800
statusline.setup { use_icons = vim.g.have_nerd_font }
800801

801802
-- You can configure sections in the statusline by overriding their
@@ -812,28 +813,28 @@ statusline.section_location = function() return '%2l:%-2v' end
812813
--
813814
-- See `:help nvim-treesitter-intro`
814815

815-
-- ensure basic parsers are installed
816+
-- Ensure basic parsers are installed
816817
local parsers = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }
817818
require('nvim-treesitter').install(parsers)
818819

819820
---@param buf integer
820821
---@param language string
821822
local function treesitter_try_attach(buf, language)
822-
-- check if parser exists and load it
823+
-- Check if a parser exists and load it
823824
if not vim.treesitter.language.add(language) then return end
824-
-- enables syntax highlighting and other treesitter features
825+
-- Enable syntax highlighting and other treesitter features
825826
vim.treesitter.start(buf, language)
826827

827-
-- enables treesitter based folds
828-
-- for more info on folds see `:help folds`
828+
-- Enable treesitter based folds
829+
-- For more info on folds see `:help folds`
829830
-- vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
830831
-- vim.wo.foldmethod = 'expr'
831832

832-
-- check if treesitter indentation is available for this language, and if so enable it
833+
-- Check if treesitter indentation is available for this language, and if so enable it
833834
-- in case there is no indent query, the indentexpr will fallback to the vim's built in one
834835
local has_indent_query = vim.treesitter.query.get(language, 'indents') ~= nil
835836

836-
-- enables treesitter based indentation
837+
-- Enable treesitter based indentation
837838
if has_indent_query then vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" end
838839
end
839840

@@ -848,13 +849,13 @@ vim.api.nvim_create_autocmd('FileType', {
848849
local installed_parsers = require('nvim-treesitter').get_installed 'parsers'
849850

850851
if vim.tbl_contains(installed_parsers, language) then
851-
-- enable the parser if it is installed
852+
-- Enable the parser if it is already installed
852853
treesitter_try_attach(buf, language)
853854
elseif vim.tbl_contains(available_parsers, language) then
854-
-- if a parser is available in `nvim-treesitter` auto install it, and enable it after the installation is done
855+
-- If a parser is available in `nvim-treesitter`, auto-install it and enable it after the installation is done
855856
require('nvim-treesitter').install(language):await(function() treesitter_try_attach(buf, language) end)
856857
else
857-
-- try to enable treesitter features in case the parser exists but is not available from `nvim-treesitter`
858+
-- Try to enable treesitter features in case the parser exists but is not available from `nvim-treesitter`
858859
treesitter_try_attach(buf, language)
859860
end
860861
end,

0 commit comments

Comments
 (0)