Skip to content

Commit 802b138

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 83f0158 + ea4335f commit 802b138

File tree

3 files changed

+86
-66
lines changed

3 files changed

+86
-66
lines changed

README.md

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@ If you are experiencing issues, please make sure you have the latest versions.
2121

2222
### Install External Dependencies
2323

24-
> **NOTE**
24+
> **NOTE**
2525
> [Backup](#FAQ) your previous configuration (if any exists)
2626
2727
External Requirements:
2828
- Basic utils: `git`, `make`, `unzip`, C Compiler (`gcc`)
2929
- [ripgrep](https://github.com/BurntSushi/ripgrep#installation)
30+
- A [Nerd Font](https://www.nerdfonts.com/): optional, provides various icons
31+
- if you have it set `vim.g.have_nerd_font` in `init.lua` to true
3032
- Language Setup:
3133
- If want to write Typescript, you need `npm`
3234
- If want to write Golang, you will need `go`
@@ -60,13 +62,13 @@ git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HO
6062
If you're using `cmd.exe`:
6163

6264
```
63-
git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\Local\nvim\
65+
git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\Local\nvim\
6466
```
6567

6668
If you're using `powershell.exe`
6769

6870
```
69-
git clone https://github.com/nvim-lua/kickstart.nvim.git $env:USERPROFILE\AppData\Local\nvim\
71+
git clone https://github.com/nvim-lua/kickstart.nvim.git $env:USERPROFILE\AppData\Local\nvim\
7072
```
7173

7274
</details>
@@ -87,17 +89,15 @@ information about extending and exploring Neovim.
8789

8890
### Getting Started
8991

90-
See [Effective Neovim: Instant IDE](https://youtu.be/stqUbv-5u2s), covering the
91-
previous version. Note: The install via init.lua is outdated, please follow the
92-
install instructions in this file instead. An updated video is coming soon.
92+
[The Only Video You Need to Get Started with Neovim](https://youtu.be/m8C0Cq9Uv9o)
9393

9494
### Recommended Steps
9595

9696
[Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) this repo
97-
(so that you have your own copy that you can modify) and then installing you
98-
can install to your machine using the methods above.
97+
(so that you have your own copy that you can modify) and then install. You
98+
can install it on your machine using the methods above.
9999

100-
> **NOTE**
100+
> **NOTE**
101101
> Your fork's url will be something like this: `https://github.com/<your_github_username>/kickstart.nvim.git`
102102
103103
#### Examples of adding popularly requested plugins
@@ -135,13 +135,12 @@ return {
135135
<details>
136136
<summary>Adding a file tree plugin</summary>
137137

138-
This will install the tree plugin and add the command `:Neotree` for you. You can explore the documentation at [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim) for more information.
138+
This will install the tree plugin and add the command `:Neotree` for you. For more information, see the documentation at [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim).
139139

140140
In the file: `lua/custom/plugins/filetree.lua`, add:
141141

142142
```lua
143-
-- Unless you are still migrating, remove the deprecated commands from v1.x
144-
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
143+
-- File: lua/custom/plugins/filetree.lua
145144

146145
return {
147146
"nvim-neo-tree/neo-tree.nvim",
@@ -162,10 +161,10 @@ return {
162161
### FAQ
163162

164163
* What should I do if I already have a pre-existing neovim configuration?
165-
* You should back it up, then delete all files associated with it.
164+
* You should back it up and then delete all associated files.
166165
* This includes your existing init.lua and the neovim files in `~/.local` which can be deleted with `rm -rf ~/.local/share/nvim/`
167166
* Can I keep my existing configuration in parallel to kickstart?
168-
* Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME` to maintain multiple configurations. For example you can install the kickstart configuration in `~/.config/nvim-kickstart` and create an alias:
167+
* Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME` to maintain multiple configurations. For example, you can install the kickstart configuration in `~/.config/nvim-kickstart` and create an alias:
169168
```
170169
alias nvim-kickstart='NVIM_APPNAME="nvim-kickstart" nvim'
171170
```
@@ -174,9 +173,9 @@ return {
174173
* See [lazy.nvim uninstall](https://github.com/folke/lazy.nvim#-uninstalling) information
175174
* Why is the kickstart `init.lua` a single file? Wouldn't it make sense to split it into multiple files?
176175
* The main purpose of kickstart is to serve as a teaching tool and a reference
177-
configuration that someone can easily `git clone` as a basis for their own.
176+
configuration that someone can easily use to `git clone` as a basis for their own.
178177
As you progress in learning Neovim and Lua, you might consider splitting `init.lua`
179-
into smaller parts. A fork of kickstart that does this while maintaining the exact
178+
into smaller parts. A fork of kickstart that does this while maintaining the
180179
same functionality is available here:
181180
* [kickstart-modular.nvim](https://github.com/dam9000/kickstart-modular.nvim)
182181
* Discussions on this topic can be found here:
@@ -185,19 +184,19 @@ return {
185184
186185
### Windows Installation
187186
188-
Installation may require installing build tools, and updating the run command for `telescope-fzf-native`
187+
Installation may require installing build tools and updating the run command for `telescope-fzf-native`
189188
190189
See `telescope-fzf-native` documentation for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation)
191190
192191
This requires:
193192
194-
- Install CMake, and the Microsoft C++ Build Tools on Windows
193+
- Install CMake and the Microsoft C++ Build Tools on Windows
195194
196195
```lua
197196
{'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' }
198197
```
199198

200-
Alternatively one can install gcc and make which don't require changing the config,
199+
Alternatively, one can install gcc and make which don't require changing the config,
201200
the easiest way is to use choco:
202201

203202
1. install [chocolatey](https://chocolatey.org/install)
@@ -208,11 +207,9 @@ winget install --accept-source-agreements chocolatey.chocolatey
208207
```
209208

210209
2. install all requirements using choco, exit previous cmd and
211-
open a new one so that choco path is set, run in cmd as **admin**:
210+
open a new one so that choco path is set, and run in cmd as **admin**:
212211
```
213212
choco install -y neovim git ripgrep wget fd unzip gzip mingw make
214213
```
215214

216-
Then continue with the [Install Kickstart](#Install-Kickstart) step.
217-
218-
215+
Then, continue with the [Install Kickstart](#Install-Kickstart) step.

init.lua

Lines changed: 62 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ P.S. You can delete this when you're done too. It's your config now! :)
9090
vim.g.mapleader = ' '
9191
vim.g.maplocalleader = ' '
9292

93+
-- Set to true if you have a Nerd Font installed
94+
vim.g.have_nerd_font = false
95+
9396
-- [[ Setting options ]]
9497
-- See `:help vim.opt`
9598
-- NOTE: You can change these options as you wish!
@@ -127,6 +130,9 @@ vim.opt.signcolumn = 'yes'
127130

128131
-- Decrease update time
129132
vim.opt.updatetime = 250
133+
134+
-- Decrease mapped sequence wait time
135+
-- Displays which-key popup sooner
130136
vim.opt.timeoutlen = 300
131137

132138
-- Configure how new splits should be opened
@@ -218,7 +224,7 @@ vim.opt.rtp:prepend(lazypath)
218224
-- :Lazy update
219225
--
220226
-- NOTE: Here is where you install your plugins.
221-
require('lazy').setup {
227+
require('lazy').setup({
222228
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
223229
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
224230

@@ -312,10 +318,8 @@ require('lazy').setup {
312318
},
313319
{ 'nvim-telescope/telescope-ui-select.nvim' },
314320

315-
-- Useful for getting pretty icons, but requires special font.
316-
-- If you already have a Nerd Font, or terminal set up with fallback fonts
317-
-- you can enable this
318-
-- { 'nvim-tree/nvim-web-devicons' }
321+
-- Useful for getting pretty icons, but requires a Nerd Font.
322+
{ 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
319323
},
320324
config = function()
321325
-- Telescope is a fuzzy finder that comes with a lot of different things that
@@ -409,6 +413,10 @@ require('lazy').setup {
409413
-- Useful status updates for LSP.
410414
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
411415
{ 'j-hui/fidget.nvim', opts = {} },
416+
417+
-- `neodev` configures Lua LSP for your Neovim config, runtime and plugins
418+
-- used for completion, annotations and signatures of Neovim apis
419+
{ 'folke/neodev.nvim', opts = {} },
412420
},
413421
config = function()
414422
-- Brief Aside: **What is LSP?**
@@ -455,7 +463,7 @@ require('lazy').setup {
455463

456464
-- Jump to the definition of the word under your cursor.
457465
-- This is where a variable was first declared, or where a function is defined, etc.
458-
-- To jump back, press <C-T>.
466+
-- To jump back, press <C-t>.
459467
map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
460468

461469
-- Find references for the word under your cursor.
@@ -550,18 +558,6 @@ require('lazy').setup {
550558
-- capabilities = {},
551559
settings = {
552560
Lua = {
553-
runtime = { version = 'LuaJIT' },
554-
workspace = {
555-
checkThirdParty = false,
556-
-- Tells lua_ls where to find all the Lua files that you have loaded
557-
-- for your neovim configuration.
558-
library = {
559-
'${3rd}/luv/library',
560-
unpack(vim.api.nvim_get_runtime_file('', true)),
561-
},
562-
-- If lua_ls is really slow on your computer, you can try this instead:
563-
-- library = { vim.env.VIMRUNTIME },
564-
},
565561
completion = {
566562
callSnippet = 'Replace',
567563
},
@@ -607,10 +603,16 @@ require('lazy').setup {
607603
'stevearc/conform.nvim',
608604
opts = {
609605
notify_on_error = false,
610-
format_on_save = {
611-
timeout_ms = 500,
612-
lsp_fallback = true,
613-
},
606+
format_on_save = function(bufnr)
607+
-- Disable "format_on_save lsp_fallback" for languages that don't
608+
-- have a well standardized coding style. You can add additional
609+
-- languages here or re-enable it for the disabled ones.
610+
local disable_filetypes = { c = true, cpp = true }
611+
return {
612+
timeout_ms = 500,
613+
lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
614+
}
615+
end,
614616
formatters_by_ft = {
615617
lua = { 'stylua' },
616618
-- Conform can also run multiple formatters sequentially
@@ -639,6 +641,17 @@ require('lazy').setup {
639641
end
640642
return 'make install_jsregexp'
641643
end)(),
644+
dependencies = {
645+
-- `friendly-snippets` contains a variety of premade snippets.
646+
-- See the README about individual language/framework/plugin snippets:
647+
-- https://github.com/rafamadriz/friendly-snippets
648+
-- {
649+
-- 'rafamadriz/friendly-snippets',
650+
-- config = function()
651+
-- require('luasnip.loaders.from_vscode').lazy_load()
652+
-- end,
653+
-- },
654+
},
642655
},
643656
'saadparwaiz1/cmp_luasnip',
644657

@@ -647,12 +660,6 @@ require('lazy').setup {
647660
-- into multiple repos for maintenance purposes.
648661
'hrsh7th/cmp-nvim-lsp',
649662
'hrsh7th/cmp-path',
650-
651-
-- If you want to add a bunch of pre-configured snippets,
652-
-- you can use this plugin to help you. It even has snippets
653-
-- for various frameworks/libraries/etc. but you will have to
654-
-- set up the ones that are useful for you.
655-
-- 'rafamadriz/friendly-snippets',
656663
},
657664
config = function()
658665
-- See `:help cmp`
@@ -678,6 +685,10 @@ require('lazy').setup {
678685
-- Select the [p]revious item
679686
['<C-p>'] = cmp.mapping.select_prev_item(),
680687

688+
-- scroll the documentation window [b]ack / [f]orward
689+
['<C-b>'] = cmp.mapping.scroll_docs(-4),
690+
['<C-f>'] = cmp.mapping.scroll_docs(4),
691+
681692
-- Accept ([y]es) the completion.
682693
-- This will auto-import if your LSP supports it.
683694
-- This will expand snippets if the LSP sent a snippet.
@@ -706,6 +717,9 @@ require('lazy').setup {
706717
luasnip.jump(-1)
707718
end
708719
end, { 'i', 's' }),
720+
721+
-- For more advanced luasnip keymaps (e.g. selecting choice nodes, expansion) see:
722+
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
709723
},
710724
sources = {
711725
{ name = 'nvim_lsp' },
@@ -759,14 +773,15 @@ require('lazy').setup {
759773
-- You could remove this setup call if you don't like it,
760774
-- and try some other statusline plugin
761775
local statusline = require 'mini.statusline'
762-
statusline.setup()
776+
-- set use_icons to true if you have a Nerd Font
777+
statusline.setup { use_icons = vim.g.have_nerd_font }
763778

764779
-- You can configure sections in the statusline by overriding their
765-
-- default behavior. For example, here we disable the section for
766-
-- cursor information because line numbers are already enabled
780+
-- default behavior. For example, here we set the section for
781+
-- cursor location to LINE:COLUMN
767782
---@diagnostic disable-next-line: duplicate-set-field
768783
statusline.section_location = function()
769-
return ''
784+
return '%2l:%-2v'
770785
end
771786

772787
-- ... and there is more!
@@ -777,17 +792,24 @@ require('lazy').setup {
777792
{ -- Highlight, edit, and navigate code
778793
'nvim-treesitter/nvim-treesitter',
779794
build = ':TSUpdate',
780-
config = function()
795+
opts = {
796+
ensure_installed = { 'bash', 'c', 'html', 'lua', 'markdown', 'vim', 'vimdoc' },
797+
-- Autoinstall languages that are not installed
798+
auto_install = true,
799+
highlight = {
800+
enable = true,
801+
-- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules.
802+
-- If you are experiencing weird indenting issues, add the language to
803+
-- the list of additional_vim_regex_highlighting and disabled languages for indent.
804+
additional_vim_regex_highlighting = { 'ruby' },
805+
},
806+
indent = { enable = true, disable = { 'ruby' } },
807+
},
808+
config = function(_, opts)
781809
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
782810

783811
---@diagnostic disable-next-line: missing-fields
784-
require('nvim-treesitter.configs').setup {
785-
ensure_installed = { 'bash', 'c', 'html', 'lua', 'markdown', 'vim', 'vimdoc' },
786-
-- Autoinstall languages that are not installed
787-
auto_install = true,
788-
highlight = { enable = true },
789-
indent = { enable = true },
790-
}
812+
require('nvim-treesitter.configs').setup(opts)
791813

792814
-- There are additional nvim-treesitter modules that you can use to interact
793815
-- with nvim-treesitter. You should go explore a few and see what interests you:

lua/kickstart/health.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@
66
--]]
77

88
local check_version = function()
9+
local verstr = string.format('%s.%s.%s', vim.version().major, vim.version().minor, vim.version().patch)
910
if not vim.version.cmp then
10-
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", tostring(vim.version())))
11+
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
1112
return
1213
end
1314

1415
if vim.version.cmp(vim.version(), { 0, 9, 4 }) >= 0 then
15-
vim.health.ok(string.format("Neovim version is: '%s'", tostring(vim.version())))
16+
vim.health.ok(string.format("Neovim version is: '%s'", verstr))
1617
else
17-
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", tostring(vim.version())))
18+
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
1819
end
1920
end
2021

0 commit comments

Comments
 (0)