Skip to content

Commit 929f5f7

Browse files
authored
Merge branch 'master' into my-config
2 parents 5b1484b + db4867a commit 929f5f7

File tree

7 files changed

+203
-82
lines changed

7 files changed

+203
-82
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ assignees: ''
99

1010
<!-- Any bug report not following this template will be immediately closed. Thanks -->
1111

12+
## Before Reporting an Issue
13+
- I have read the kickstart.nvim README.md.
14+
- I have read the appropiate plugin's documentation.
15+
- I have searched that this issue has not been reported before.
16+
17+
- [ ] **By checking this, I confirm that the above steps are completed. I understand leaving this unchecked will result in this report being closed immediately.**
18+
1219
## Describe the bug
1320
<!-- A clear and concise description of what the bug is. -->
1421

@@ -18,8 +25,8 @@ assignees: ''
1825

1926
## Desktop
2027
<!-- please complete the following information. -->
21-
- OS:
22-
- Terminal:
28+
- OS:
29+
- Terminal:
2330

2431
## Neovim Version
2532
<!-- Output of running `:version` from inside of neovim. -->

README.md

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ If you are experiencing issues, please make sure you have the latest versions.
2424
External Requirements:
2525
- Basic utils: `git`, `make`, `unzip`, C Compiler (`gcc`)
2626
- [ripgrep](https://github.com/BurntSushi/ripgrep#installation)
27-
- Clipboard tool (xclip/xsel/win32yank or other depending on platform)
27+
- Clipboard tool (xclip/xsel/win32yank or other depending on the platform)
2828
- A [Nerd Font](https://www.nerdfonts.com/): optional, provides various icons
2929
- if you have it set `vim.g.have_nerd_font` in `init.lua` to true
3030
- Language Setup:
31-
- If want to write Typescript, you need `npm`
32-
- If want to write Golang, you will need `go`
31+
- If you want to write Typescript, you need `npm`
32+
- If you want to write Golang, you will need `go`
3333
- etc.
3434

3535
> **NOTE**
@@ -56,9 +56,13 @@ so that you have your own copy that you can modify, then install by cloning the
5656
fork to your machine using one of the commands below, depending on your OS.
5757

5858
> **NOTE**
59-
> Your fork's url will be something like this:
59+
> Your fork's URL will be something like this:
6060
> `https://github.com/<your_github_username>/kickstart.nvim.git`
6161
62+
You likely want to remove `lazy-lock.json` from your fork's `.gitignore` file
63+
too - it's ignored in the kickstart repo to make maintenance easier, but it's
64+
[recommended to track it in version control](https://lazy.folke.io/usage/lockfile).
65+
6266
#### Clone kickstart.nvim
6367
> **NOTE**
6468
> If following the recommended step above (i.e., forking the repo), replace
@@ -77,13 +81,13 @@ git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HO
7781
If you're using `cmd.exe`:
7882

7983
```
80-
git clone https://github.com/nvim-lua/kickstart.nvim.git %localappdata%\nvim\
84+
git clone https://github.com/nvim-lua/kickstart.nvim.git "%localappdata%\nvim"
8185
```
8286

8387
If you're using `powershell.exe`
8488

8589
```
86-
git clone https://github.com/nvim-lua/kickstart.nvim.git $env:LOCALAPPDATA\nvim\
90+
git clone https://github.com/nvim-lua/kickstart.nvim.git "${env:LOCALAPPDATA}\nvim"
8791
```
8892

8993
</details>
@@ -97,22 +101,27 @@ nvim
97101
```
98102

99103
That's it! Lazy will install all the plugins you have. Use `:Lazy` to view
100-
current plugin status. Hit `q` to close the window.
104+
the current plugin status. Hit `q` to close the window.
105+
106+
#### Read The Friendly Documentation
101107

102108
Read through the `init.lua` file in your configuration folder for more
103109
information about extending and exploring Neovim. That also includes
104110
examples of adding popularly requested plugins.
105111

112+
> [!NOTE]
113+
> For more information about a particular plugin check its repository's documentation.
114+
106115

107116
### Getting Started
108117

109118
[The Only Video You Need to Get Started with Neovim](https://youtu.be/m8C0Cq9Uv9o)
110119

111120
### FAQ
112121

113-
* What should I do if I already have a pre-existing neovim configuration?
122+
* What should I do if I already have a pre-existing Neovim configuration?
114123
* You should back it up and then delete all associated files.
115-
* This includes your existing init.lua and the neovim files in `~/.local`
124+
* This includes your existing init.lua and the Neovim files in `~/.local`
116125
which can be deleted with `rm -rf ~/.local/share/nvim/`
117126
* Can I keep my existing configuration in parallel to kickstart?
118127
* Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME`
@@ -126,12 +135,12 @@ examples of adding popularly requested plugins.
126135
`~/.local/share/nvim-kickstart`. You can apply this approach to any Neovim
127136
distribution that you would like to try out.
128137
* What if I want to "uninstall" this configuration:
129-
* See [lazy.nvim uninstall](https://github.com/folke/lazy.nvim#-uninstalling) information
138+
* See [lazy.nvim uninstall](https://lazy.folke.io/usage#-uninstalling) information
130139
* Why is the kickstart `init.lua` a single file? Wouldn't it make sense to split it into multiple files?
131140
* The main purpose of kickstart is to serve as a teaching tool and a reference
132141
configuration that someone can easily use to `git clone` as a basis for their own.
133142
As you progress in learning Neovim and Lua, you might consider splitting `init.lua`
134-
into smaller parts. A fork of kickstart that does this while maintaining the
143+
into smaller parts. A fork of kickstart that does this while maintaining the
135144
same functionality is available here:
136145
* [kickstart-modular.nvim](https://github.com/dam9000/kickstart-modular.nvim)
137146
* Discussions on this topic can be found here:
@@ -170,7 +179,7 @@ run in cmd as **admin**:
170179
winget install --accept-source-agreements chocolatey.chocolatey
171180
```
172181

173-
2. install all requirements using choco, exit previous cmd and
182+
2. install all requirements using choco, exit the previous cmd and
174183
open a new one so that choco path is set, and run in cmd as **admin**:
175184
```
176185
choco install -y neovim git ripgrep wget fd unzip gzip mingw make

init.lua

Lines changed: 99 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ vim.opt.signcolumn = 'yes'
141141
vim.opt.updatetime = 250
142142

143143
-- Decrease mapped sequence wait time
144-
-- Displays which-key popup sooner
145144
vim.opt.timeoutlen = 300
146145

147146
-- Configure how new splits should be opened
@@ -213,7 +212,7 @@ vim.api.nvim_create_autocmd('TextYankPost', {
213212
-- [[ Install `lazy.nvim` plugin manager ]]
214213
-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
215214
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
216-
if not vim.uv.fs_stat(lazypath) then
215+
if not (vim.uv or vim.loop).fs_stat(lazypath) then
217216
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
218217
local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
219218
if vim.v.shell_error ~= 0 then
@@ -273,27 +272,64 @@ require('lazy').setup({
273272
-- which loads which-key before all the UI elements are loaded. Events can be
274273
-- normal autocommands events (`:help autocmd-events`).
275274
--
276-
-- Then, because we use the `config` key, the configuration only runs
277-
-- after the plugin has been loaded:
278-
-- config = function() ... end
275+
-- Then, because we use the `opts` key (recommended), the configuration runs
276+
-- after the plugin has been loaded as `require(MODULE).setup(opts)`.
279277

280278
{ -- Useful plugin to show you pending keybinds.
281279
'folke/which-key.nvim',
282280
event = 'VimEnter', -- Sets the loading event to 'VimEnter'
283-
config = function() -- This is the function that runs, AFTER loading
284-
require('which-key').setup()
281+
opts = {
282+
-- delay between pressing a key and opening which-key (milliseconds)
283+
-- this setting is independent of vim.opt.timeoutlen
284+
delay = 0,
285+
icons = {
286+
-- set icon mappings to true if you have a Nerd Font
287+
mappings = vim.g.have_nerd_font,
288+
-- If you are using a Nerd Font: set icons.keys to an empty table which will use the
289+
-- default which-key.nvim defined Nerd Font icons, otherwise define a string table
290+
keys = vim.g.have_nerd_font and {} or {
291+
Up = '<Up> ',
292+
Down = '<Down> ',
293+
Left = '<Left> ',
294+
Right = '<Right> ',
295+
C = '<C-…> ',
296+
M = '<M-…> ',
297+
D = '<D-…> ',
298+
S = '<S-…> ',
299+
CR = '<CR> ',
300+
Esc = '<Esc> ',
301+
ScrollWheelDown = '<ScrollWheelDown> ',
302+
ScrollWheelUp = '<ScrollWheelUp> ',
303+
NL = '<NL> ',
304+
BS = '<BS> ',
305+
Space = '<Space> ',
306+
Tab = '<Tab> ',
307+
F1 = '<F1>',
308+
F2 = '<F2>',
309+
F3 = '<F3>',
310+
F4 = '<F4>',
311+
F5 = '<F5>',
312+
F6 = '<F6>',
313+
F7 = '<F7>',
314+
F8 = '<F8>',
315+
F9 = '<F9>',
316+
F10 = '<F10>',
317+
F11 = '<F11>',
318+
F12 = '<F12>',
319+
},
320+
},
285321

286322
-- Document existing key chains
287-
require('which-key').add {
288-
{ '<leader>c', group = '[C]ode' },
323+
spec = {
324+
{ '<leader>c', group = '[C]ode', mode = { 'n', 'x' } },
289325
{ '<leader>d', group = '[D]ocument' },
290326
{ '<leader>r', group = '[R]ename' },
291327
{ '<leader>s', group = '[S]earch' },
292328
{ '<leader>w', group = '[W]orkspace' },
293329
{ '<leader>t', group = '[T]oggle' },
294330
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
295-
}
296-
end,
331+
},
332+
},
297333
},
298334

299335
-- NOTE: Plugins can specify dependencies.
@@ -427,7 +463,9 @@ require('lazy').setup({
427463
'neovim/nvim-lspconfig',
428464
dependencies = {
429465
-- Automatically install LSPs and related tools to stdpath for Neovim
430-
{ 'williamboman/mason.nvim', config = true }, -- NOTE: Must be loaded before dependants
466+
-- Mason must be loaded before its dependents so we need to set it up here.
467+
-- NOTE: `opts = {}` is the same as calling `require('mason').setup({})`
468+
{ 'williamboman/mason.nvim', opts = {} },
431469
'williamboman/mason-lspconfig.nvim',
432470
'WhoIsSethDaniel/mason-tool-installer.nvim',
433471

@@ -476,8 +514,9 @@ require('lazy').setup({
476514
--
477515
-- In this case, we create a function that lets us more easily define mappings specific
478516
-- for LSP related items. It sets the mode, buffer and description for us each time.
479-
local map = function(keys, func, desc)
480-
vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
517+
local map = function(keys, func, desc, mode)
518+
mode = mode or 'n'
519+
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
481520
end
482521

483522
-- Jump to the definition of the word under your cursor.
@@ -511,7 +550,7 @@ require('lazy').setup({
511550

512551
-- Execute a code action, usually your cursor needs to be on top of an error
513552
-- or a suggestion from your LSP for this to activate.
514-
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
553+
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' })
515554

516555
-- WARN: This is not Goto Definition, this is Goto Declaration.
517556
-- For example, in C this would take you to the header.
@@ -558,6 +597,16 @@ require('lazy').setup({
558597
end,
559598
})
560599

600+
-- Change diagnostic symbols in the sign column (gutter)
601+
-- if vim.g.have_nerd_font then
602+
-- local signs = { ERROR = '', WARN = '', INFO = '', HINT = '' }
603+
-- local diagnostic_signs = {}
604+
-- for type, icon in pairs(signs) do
605+
-- diagnostic_signs[vim.diagnostic.severity[type]] = icon
606+
-- end
607+
-- vim.diagnostic.config { signs = { text = diagnostic_signs } }
608+
-- end
609+
561610
-- LSP servers and clients are able to communicate to each other what features they support.
562611
-- By default, Neovim doesn't support everything that is in the LSP specification.
563612
-- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities.
@@ -586,13 +635,13 @@ require('lazy').setup({
586635
-- Some languages (like typescript) have entire language plugins that can be useful:
587636
-- https://github.com/pmizio/typescript-tools.nvim
588637
--
589-
-- But for many setups, the LSP (`tsserver`) will work just fine
590-
-- tsserver = {},
638+
-- But for many setups, the LSP (`ts_ls`) will work just fine
639+
-- ts_ls = {},
591640
--
592641

593642
lua_ls = {
594-
-- cmd = {...},
595-
-- filetypes = { ...},
643+
-- cmd = { ... },
644+
-- filetypes = { ... },
596645
-- capabilities = {},
597646
settings = {
598647
Lua = {
@@ -607,13 +656,16 @@ require('lazy').setup({
607656
}
608657

609658
-- Ensure the servers and tools above are installed
610-
-- To check the current status of installed tools and/or manually install
611-
-- other tools, you can run
659+
--
660+
-- To check the current status of installed tools and/or manually install
661+
-- other tools, you can run
612662
-- :Mason
613663
--
614-
-- You can press `g?` for help in this menu.
615-
require('mason').setup()
616-
664+
-- You can press `g?` for help in this menu.
665+
--
666+
-- `mason` had to be setup earlier: to configure its options see the
667+
-- `dependencies` table for `nvim-lspconfig` above.
668+
--
617669
-- You can add other tools here that you want Mason to install
618670
-- for you, so that they are available from within Neovim.
619671
local ensure_installed = vim.tbl_keys(servers or {})
@@ -628,7 +680,7 @@ require('lazy').setup({
628680
local server = servers[server_name] or {}
629681
-- This handles overriding only values explicitly passed
630682
-- by the server configuration above. Useful when disabling
631-
-- certain features of an LSP (for example, turning off formatting for tsserver)
683+
-- certain features of an LSP (for example, turning off formatting for ts_ls)
632684
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
633685
require('lspconfig')[server_name].setup(server)
634686
end,
@@ -645,7 +697,7 @@ require('lazy').setup({
645697
{
646698
'<leader>f',
647699
function()
648-
require('conform').format { async = true, lsp_fallback = true }
700+
require('conform').format { async = true, lsp_format = 'fallback' }
649701
end,
650702
mode = '',
651703
desc = '[F]ormat buffer',
@@ -658,9 +710,15 @@ require('lazy').setup({
658710
-- have a well standardized coding style. You can add additional
659711
-- languages here or re-enable it for the disabled ones.
660712
local disable_filetypes = { c = true, cpp = true }
713+
local lsp_format_opt
714+
if disable_filetypes[vim.bo[bufnr].filetype] then
715+
lsp_format_opt = 'never'
716+
else
717+
lsp_format_opt = 'fallback'
718+
end
661719
return {
662720
timeout_ms = 500,
663-
lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
721+
lsp_format = lsp_format_opt,
664722
}
665723
end,
666724
formatters_by_ft = {
@@ -852,6 +910,8 @@ require('lazy').setup({
852910
{ -- Highlight, edit, and navigate code
853911
'nvim-treesitter/nvim-treesitter',
854912
build = ':TSUpdate',
913+
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
914+
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
855915
opts = {
856916
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
857917
-- Autoinstall languages that are not installed
@@ -865,22 +925,15 @@ require('lazy').setup({
865925
},
866926
indent = { enable = true, disable = { 'ruby' } },
867927
},
868-
config = function(_, opts)
869-
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
870-
871-
---@diagnostic disable-next-line: missing-fields
872-
require('nvim-treesitter.configs').setup(opts)
873-
874-
-- There are additional nvim-treesitter modules that you can use to interact
875-
-- with nvim-treesitter. You should go explore a few and see what interests you:
876-
--
877-
-- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
878-
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
879-
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
880-
end,
928+
-- There are additional nvim-treesitter modules that you can use to interact
929+
-- with nvim-treesitter. You should go explore a few and see what interests you:
930+
--
931+
-- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
932+
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
933+
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
881934
},
882935

883-
-- The following two comments only work if you have downloaded the kickstart repo, not just copy pasted the
936+
-- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the
884937
-- init.lua. If you want these files, they are in the repository, so you can just download them and
885938
-- place them in the correct locations.
886939

@@ -900,8 +953,12 @@ require('lazy').setup({
900953
-- This is the easiest way to modularize your config.
901954
--
902955
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
903-
-- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins`
904956
{ import = 'custom.plugins' },
957+
--
958+
-- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
959+
-- Or use telescope!
960+
-- In normal mode type `<space>sh` then write `lazy.nvim-plugin`
961+
-- you can continue same window with `<space>sr` which resumes last telescope search
905962
}, {
906963
ui = {
907964
-- If you are using a Nerd Font: set icons to an empty table which will use the

0 commit comments

Comments
 (0)