Skip to content

Commit ab7f52b

Browse files
committed
Merged from remote/origin
2 parents 156064e + 72369e3 commit ab7f52b

File tree

8 files changed

+233
-122
lines changed

8 files changed

+233
-122
lines changed

README.md

Lines changed: 28 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ 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)
2728
- A [Nerd Font](https://www.nerdfonts.com/): optional, provides various icons
2829
- if you have it set `vim.g.have_nerd_font` in `init.lua` to true
2930
- Language Setup:
@@ -45,8 +46,8 @@ Neovim's configurations are located under the following paths, depending on your
4546
| OS | PATH |
4647
| :- | :--- |
4748
| Linux, MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` |
48-
| Windows (cmd)| `%userprofile%\AppData\Local\nvim\` |
49-
| Windows (powershell)| `$env:USERPROFILE\AppData\Local\nvim\` |
49+
| Windows (cmd)| `%localappdata%\nvim\` |
50+
| Windows (powershell)| `$env:LOCALAPPDATA\nvim\` |
5051

5152
#### Recommended Step
5253

@@ -76,13 +77,13 @@ git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HO
7677
If you're using `cmd.exe`:
7778

7879
```
79-
git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\Local\nvim\
80+
git clone https://github.com/nvim-lua/kickstart.nvim.git %localappdata%\nvim\
8081
```
8182

8283
If you're using `powershell.exe`
8384

8485
```
85-
git clone https://github.com/nvim-lua/kickstart.nvim.git $env:USERPROFILE\AppData\Local\nvim\
86+
git clone https://github.com/nvim-lua/kickstart.nvim.git $env:LOCALAPPDATA\nvim\
8687
```
8788

8889
</details>
@@ -99,71 +100,10 @@ That's it! Lazy will install all the plugins you have. Use `:Lazy` to view
99100
current plugin status. Hit `q` to close the window.
100101

101102
Read through the `init.lua` file in your configuration folder for more
102-
information about extending and exploring Neovim.
103+
information about extending and exploring Neovim. That also includes
104+
examples of adding popularly requested plugins.
103105

104106

105-
#### Examples of adding popularly requested plugins
106-
107-
NOTE: You'll need to uncomment the line in the init.lua that turns on loading custom plugins.
108-
109-
<details>
110-
<summary>Adding autopairs</summary>
111-
112-
This will automatically install [windwp/nvim-autopairs](https://github.com/windwp/nvim-autopairs)
113-
and enable it on startup. For more information, see documentation for
114-
[lazy.nvim](https://github.com/folke/lazy.nvim).
115-
116-
In the file: `lua/custom/plugins/autopairs.lua`, add:
117-
118-
```lua
119-
-- File: lua/custom/plugins/autopairs.lua
120-
121-
return {
122-
"windwp/nvim-autopairs",
123-
-- Optional dependency
124-
dependencies = { 'hrsh7th/nvim-cmp' },
125-
config = function()
126-
require("nvim-autopairs").setup {}
127-
-- If you want to automatically add `(` after selecting a function or method
128-
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
129-
local cmp = require('cmp')
130-
cmp.event:on(
131-
'confirm_done',
132-
cmp_autopairs.on_confirm_done()
133-
)
134-
end,
135-
}
136-
```
137-
138-
</details>
139-
<details>
140-
<summary>Adding a file tree plugin</summary>
141-
142-
This will install the tree plugin and add the command `:Neotree` for you.
143-
For more information, see the documentation at
144-
[neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim).
145-
146-
In the file: `lua/custom/plugins/filetree.lua`, add:
147-
148-
```lua
149-
-- File: lua/custom/plugins/filetree.lua
150-
151-
return {
152-
"nvim-neo-tree/neo-tree.nvim",
153-
version = "*",
154-
dependencies = {
155-
"nvim-lua/plenary.nvim",
156-
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
157-
"MunifTanjim/nui.nvim",
158-
},
159-
config = function ()
160-
require('neo-tree').setup {}
161-
end,
162-
}
163-
```
164-
165-
</details>
166-
167107
### Getting Started
168108

169109
[The Only Video You Need to Get Started with Neovim](https://youtu.be/m8C0Cq9Uv9o)
@@ -243,7 +183,7 @@ wsl --install
243183
wsl
244184
sudo add-apt-repository ppa:neovim-ppa/unstable -y
245185
sudo apt update
246-
sudo apt install make gcc ripgrep unzip neovim
186+
sudo apt install make gcc ripgrep unzip git xclip neovim
247187
```
248188
</details>
249189

@@ -253,23 +193,37 @@ sudo apt install make gcc ripgrep unzip neovim
253193
```
254194
sudo add-apt-repository ppa:neovim-ppa/unstable -y
255195
sudo apt update
256-
sudo apt install make gcc ripgrep unzip git neovim
196+
sudo apt install make gcc ripgrep unzip git xclip neovim
257197
```
258198
</details>
259199
<details><summary>Debian Install Steps</summary>
260200

261201
```
262202
sudo apt update
263-
sudo apt install make gcc ripgrep unzip git
264-
echo "deb https://deb.debian.org/debian unstable main" | sudo tee -a /etc/apt/sources.list
265-
sudo apt update
266-
sudo apt install -t unstable neovim
203+
sudo apt install make gcc ripgrep unzip git xclip curl
204+
205+
# Now we install nvim
206+
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz
207+
sudo rm -rf /opt/nvim-linux64
208+
sudo mkdir -p /opt/nvim-linux64
209+
sudo chmod a+rX /opt/nvim-linux64
210+
sudo tar -C /opt -xzf nvim-linux64.tar.gz
211+
212+
# make it available in /usr/local/bin, distro installs to /usr/bin
213+
sudo ln -sf /opt/nvim-linux64/bin/nvim /usr/local/bin/
267214
```
268215
</details>
269216
<details><summary>Fedora Install Steps</summary>
270217

271218
```
272-
sudo dnf install -y gcc make git ripgrep fd-find neovim
219+
sudo dnf install -y gcc make git ripgrep fd-find unzip neovim
220+
```
221+
</details>
222+
223+
<details><summary>Arch Install Steps</summary>
224+
225+
```
226+
sudo pacman -S --noconfirm --needed gcc make git ripgrep fd unzip neovim
273227
```
274228
</details>
275229

init.lua

Lines changed: 69 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ 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
93+
-- Set to true if you have a Nerd Font installed and selected in the terminal
9494
vim.g.have_nerd_font = false
9595

9696
-- [[ Setting options ]]
@@ -162,9 +162,6 @@ vim.opt.hlsearch = true
162162
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
163163

164164
-- Diagnostic keymaps
165-
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' })
166-
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' })
167-
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' })
168165
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
169166

170167
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
@@ -207,9 +204,12 @@ vim.api.nvim_create_autocmd('TextYankPost', {
207204
-- [[ Install `lazy.nvim` plugin manager ]]
208205
-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
209206
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
210-
if not vim.loop.fs_stat(lazypath) then
207+
if not vim.uv.fs_stat(lazypath) then
211208
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
212-
vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
209+
local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
210+
if vim.v.shell_error ~= 0 then
211+
error('Error cloning lazy.nvim:\n' .. out)
212+
end
213213
end ---@diagnostic disable-next-line: undefined-field
214214
vim.opt.rtp:prepend(lazypath)
215215

@@ -234,11 +234,6 @@ require('lazy').setup({
234234
--
235235
-- Use `opts = {}` to force a plugin to be loaded.
236236
--
237-
-- This is equivalent to:
238-
-- require('Comment').setup({})
239-
240-
-- "gc" to comment visual regions/lines
241-
{ 'numToStr/Comment.nvim', opts = {} },
242237

243238
-- Here is a more advanced example where we pass configuration
244239
-- options to `gitsigns.nvim`. This is equivalent to the following Lua:
@@ -280,12 +275,14 @@ require('lazy').setup({
280275
require('which-key').setup()
281276

282277
-- Document existing key chains
283-
require('which-key').register {
284-
['<leader>c'] = { name = '[C]ode', _ = 'which_key_ignore' },
285-
['<leader>d'] = { name = '[D]ocument', _ = 'which_key_ignore' },
286-
['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
287-
['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' },
288-
['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
278+
require('which-key').add {
279+
{ '<leader>c', group = '[C]ode' },
280+
{ '<leader>d', group = '[D]ocument' },
281+
{ '<leader>r', group = '[R]ename' },
282+
{ '<leader>s', group = '[S]earch' },
283+
{ '<leader>w', group = '[W]orkspace' },
284+
{ '<leader>t', group = '[T]oggle' },
285+
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
289286
}
290287
end,
291288
},
@@ -406,17 +403,27 @@ require('lazy').setup({
406403
'neovim/nvim-lspconfig',
407404
dependencies = {
408405
-- Automatically install LSPs and related tools to stdpath for Neovim
409-
'williamboman/mason.nvim',
406+
{ 'williamboman/mason.nvim', config = true }, -- NOTE: Must be loaded before dependants
410407
'williamboman/mason-lspconfig.nvim',
411408
'WhoIsSethDaniel/mason-tool-installer.nvim',
412409

413410
-- Useful status updates for LSP.
414411
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
415412
{ 'j-hui/fidget.nvim', opts = {} },
416413

417-
-- `neodev` configures Lua LSP for your Neovim config, runtime and plugins
414+
-- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
418415
-- used for completion, annotations and signatures of Neovim apis
419-
{ 'folke/neodev.nvim', opts = {} },
416+
{
417+
'folke/lazydev.nvim',
418+
ft = 'lua',
419+
opts = {
420+
library = {
421+
-- Load luvit types when the `vim.uv` word is found
422+
{ path = 'luvit-meta/library', words = { 'vim%.uv' } },
423+
},
424+
},
425+
},
426+
{ 'Bilal2453/luvit-meta', lazy = true },
420427
},
421428
config = function()
422429
-- Brief aside: **What is LSP?**
@@ -493,10 +500,6 @@ require('lazy').setup({
493500
-- or a suggestion from your LSP for this to activate.
494501
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
495502

496-
-- Opens a popup that displays documentation about the word under your cursor
497-
-- See `:help K` for why this keymap.
498-
map('K', vim.lsp.buf.hover, 'Hover Documentation')
499-
500503
-- WARN: This is not Goto Definition, this is Goto Declaration.
501504
-- For example, in C this would take you to the header.
502505
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
@@ -507,16 +510,37 @@ require('lazy').setup({
507510
--
508511
-- When you move your cursor, the highlights will be cleared (the second autocommand).
509512
local client = vim.lsp.get_client_by_id(event.data.client_id)
510-
if client and client.server_capabilities.documentHighlightProvider then
513+
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then
514+
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })
511515
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
512516
buffer = event.buf,
517+
group = highlight_augroup,
513518
callback = vim.lsp.buf.document_highlight,
514519
})
515520

516521
vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
517522
buffer = event.buf,
523+
group = highlight_augroup,
518524
callback = vim.lsp.buf.clear_references,
519525
})
526+
527+
vim.api.nvim_create_autocmd('LspDetach', {
528+
group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }),
529+
callback = function(event2)
530+
vim.lsp.buf.clear_references()
531+
vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf }
532+
end,
533+
})
534+
end
535+
536+
-- The following code creates a keymap to toggle inlay hints in your
537+
-- code, if the language server you are using supports them
538+
--
539+
-- This may be unwanted, since they displace some of your code
540+
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then
541+
map('<leader>th', function()
542+
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
543+
end, '[T]oggle Inlay [H]ints')
520544
end
521545
end,
522546
})
@@ -600,7 +624,8 @@ require('lazy').setup({
600624

601625
{ -- Autoformat
602626
'stevearc/conform.nvim',
603-
lazy = false,
627+
event = { 'BufWritePre' },
628+
cmd = { 'ConformInfo' },
604629
keys = {
605630
{
606631
'<leader>f',
@@ -704,6 +729,12 @@ require('lazy').setup({
704729
-- This will expand snippets if the LSP sent a snippet.
705730
['<C-y>'] = cmp.mapping.confirm { select = true },
706731

732+
-- If you prefer more traditional completion keymaps,
733+
-- you can uncomment the following lines
734+
--['<CR>'] = cmp.mapping.confirm { select = true },
735+
--['<Tab>'] = cmp.mapping.select_next_item(),
736+
--['<S-Tab>'] = cmp.mapping.select_prev_item(),
737+
707738
-- Manually trigger a completion from nvim-cmp.
708739
-- Generally you don't need this, because nvim-cmp will display
709740
-- completions whenever it has completion options available.
@@ -732,6 +763,11 @@ require('lazy').setup({
732763
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
733764
},
734765
sources = {
766+
{
767+
name = 'lazydev',
768+
-- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
769+
group_index = 0,
770+
},
735771
{ name = 'nvim_lsp' },
736772
{ name = 'luasnip' },
737773
{ name = 'path' },
@@ -768,7 +804,7 @@ require('lazy').setup({
768804
--
769805
-- Examples:
770806
-- - va) - [V]isually select [A]round [)]paren
771-
-- - yinq - [Y]ank [I]nside [N]ext [']quote
807+
-- - yinq - [Y]ank [I]nside [N]ext [Q]uote
772808
-- - ci' - [C]hange [I]nside [']quote
773809
require('mini.ai').setup { n_lines = 500 }
774810

@@ -802,8 +838,7 @@ require('lazy').setup({
802838
'nvim-treesitter/nvim-treesitter',
803839
build = ':TSUpdate',
804840
opts = {
805-
ensure_installed = { 'bash', 'c', 'html', 'lua', 'luadoc', 'markdown', 'vim', 'vimdoc', 'c_sharp', 'java' },
806-
-- Autoinstall languages that are not installed
841+
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc', 'c_sharp', 'java' },
807842
auto_install = true,
808843
highlight = {
809844
enable = true,
@@ -817,6 +852,8 @@ require('lazy').setup({
817852
config = function(_, opts)
818853
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
819854

855+
-- Prefer git instead of curl in order to improve connectivity in some environments
856+
require('nvim-treesitter.install').prefer_git = true
820857
---@diagnostic disable-next-line: missing-fields
821858
require('nvim-treesitter.configs').setup(opts)
822859

@@ -841,6 +878,9 @@ require('lazy').setup({
841878
-- require 'kickstart.plugins.debug',
842879
-- require 'kickstart.plugins.indent_line',
843880
-- require 'kickstart.plugins.lint',
881+
-- require 'kickstart.plugins.autopairs',
882+
-- require 'kickstart.plugins.neo-tree',
883+
-- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
844884

845885
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
846886
-- This is the easiest way to modularize your config.

lua/kickstart/health.lua

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

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

15-
if vim.version.cmp(vim.version(), { 0, 9, 4 }) >= 0 then
15+
if vim.version.ge(vim.version(), '0.10-dev') then
1616
vim.health.ok(string.format("Neovim version is: '%s'", verstr))
1717
else
1818
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))

0 commit comments

Comments
 (0)