Skip to content

Commit 324ebcb

Browse files
committed
Merge branch 'nvim-lua-master'
2 parents fd7228b + 0e471d5 commit 324ebcb

File tree

6 files changed

+49
-33
lines changed

6 files changed

+49
-33
lines changed

README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ External Requirements:
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**
@@ -46,8 +46,8 @@ Neovim's configurations are located under the following paths, depending on your
4646
| OS | PATH |
4747
| :- | :--- |
4848
| Linux, MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` |
49-
| Windows (cmd)| `%userprofile%\AppData\Local\nvim\` |
50-
| Windows (powershell)| `$env:USERPROFILE\AppData\Local\nvim\` |
49+
| Windows (cmd)| `%localappdata%\nvim\` |
50+
| Windows (powershell)| `$env:LOCALAPPDATA\nvim\` |
5151

5252
#### Recommended Step
5353

@@ -59,6 +59,10 @@ fork to your machine using one of the commands below, depending on your OS.
5959
> 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+
[recommmended 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 %userprofile%\AppData\Local\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:USERPROFILE\AppData\Local\nvim\
90+
git clone https://github.com/nvim-lua/kickstart.nvim.git "${env:LOCALAPPDATA}\nvim"
8791
```
8892

8993
</details>
@@ -126,7 +130,7 @@ examples of adding popularly requested plugins.
126130
`~/.local/share/nvim-kickstart`. You can apply this approach to any Neovim
127131
distribution that you would like to try out.
128132
* What if I want to "uninstall" this configuration:
129-
* See [lazy.nvim uninstall](https://github.com/folke/lazy.nvim#-uninstalling) information
133+
* See [lazy.nvim uninstall](https://lazy.folke.io/usage#-uninstalling) information
130134
* Why is the kickstart `init.lua` a single file? Wouldn't it make sense to split it into multiple files?
131135
* The main purpose of kickstart is to serve as a teaching tool and a reference
132136
configuration that someone can easily use to `git clone` as a basis for their own.

init.lua

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,12 @@ vim.opt.mouse = 'a'
2626
vim.opt.showmode = false
2727

2828
-- Sync clipboard between OS and Neovim.
29+
-- Schedule the setting after `UiEnter` because it can increase startup-time.
2930
-- Remove this option if you want your OS clipboard to remain independent.
3031
-- See `:help 'clipboard'`
31-
vim.opt.clipboard = 'unnamedplus'
32+
vim.schedule(function()
33+
vim.opt.clipboard = 'unnamedplus'
34+
end)
3235

3336
-- Enable break indent
3437
vim.opt.breakindent = true
@@ -72,14 +75,11 @@ vim.opt.scrolloff = 10
7275
-- [[ Basic Keymaps ]]
7376
-- See `:help vim.keymap.set()`
7477

75-
-- Set highlight on search, but clear on pressing <Esc> in normal mode
76-
vim.opt.hlsearch = true
78+
-- Clear highlights on search when pressing <Esc> in normal mode
79+
-- See `:help hlsearch`
7780
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
7881

7982
-- Diagnostic keymaps
80-
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' })
81-
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' })
82-
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' })
8383
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
8484

8585
-- Keybinds to make split navigation easier.
@@ -115,9 +115,12 @@ vim.api.nvim_create_autocmd('TextYankPost', {
115115
-- [[ Install `lazy.nvim` plugin manager ]]
116116
-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
117117
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
118-
if not vim.loop.fs_stat(lazypath) then
118+
if not (vim.uv or vim.loop).fs_stat(lazypath) then
119119
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
120-
vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
120+
local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
121+
if vim.v.shell_error ~= 0 then
122+
error('Error cloning lazy.nvim:\n' .. out)
123+
end
121124
end ---@diagnostic disable-next-line: undefined-field
122125
vim.opt.rtp:prepend(lazypath)
123126

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))

lua/kickstart/plugins/debug.lua

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,28 @@ return {
2424
-- Add your own debuggers here
2525
'leoluz/nvim-dap-go',
2626
},
27+
keys = function(_, keys)
28+
local dap = require 'dap'
29+
local dapui = require 'dapui'
30+
return {
31+
-- Basic debugging keymaps, feel free to change to your liking!
32+
{ '<F5>', dap.continue, desc = 'Debug: Start/Continue' },
33+
{ '<F1>', dap.step_into, desc = 'Debug: Step Into' },
34+
{ '<F2>', dap.step_over, desc = 'Debug: Step Over' },
35+
{ '<F3>', dap.step_out, desc = 'Debug: Step Out' },
36+
{ '<leader>b', dap.toggle_breakpoint, desc = 'Debug: Toggle Breakpoint' },
37+
{
38+
'<leader>B',
39+
function()
40+
dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ')
41+
end,
42+
desc = 'Debug: Set Breakpoint',
43+
},
44+
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
45+
{ '<F7>', dapui.toggle, desc = 'Debug: See last session result.' },
46+
unpack(keys),
47+
}
48+
end,
2749
config = function()
2850
local dap = require 'dap'
2951
local dapui = require 'dapui'
@@ -45,16 +67,6 @@ return {
4567
},
4668
}
4769

48-
-- Basic debugging keymaps, feel free to change to your liking!
49-
vim.keymap.set('n', '<F5>', dap.continue, { desc = 'Debug: Start/Continue' })
50-
vim.keymap.set('n', '<F1>', dap.step_into, { desc = 'Debug: Step Into' })
51-
vim.keymap.set('n', '<F2>', dap.step_over, { desc = 'Debug: Step Over' })
52-
vim.keymap.set('n', '<F3>', dap.step_out, { desc = 'Debug: Step Out' })
53-
vim.keymap.set('n', '<leader>b', dap.toggle_breakpoint, { desc = 'Debug: Toggle Breakpoint' })
54-
vim.keymap.set('n', '<leader>B', function()
55-
dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ')
56-
end, { desc = 'Debug: Set Breakpoint' })
57-
5870
-- Dap UI setup
5971
-- For more information, see |:help nvim-dap-ui|
6072
dapui.setup {
@@ -77,9 +89,6 @@ return {
7789
},
7890
}
7991

80-
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
81-
vim.keymap.set('n', '<F7>', dapui.toggle, { desc = 'Debug: See last session result.' })
82-
8392
dap.listeners.after.event_initialized['dapui_config'] = dapui.open
8493
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
8594
dap.listeners.before.event_exited['dapui_config'] = dapui.close

lua/kickstart/plugins/lint.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ return {
4747
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
4848
group = lint_augroup,
4949
callback = function()
50-
require('lint').try_lint()
50+
lint.try_lint()
5151
end,
5252
})
5353
end,

lua/kickstart/plugins/neo-tree.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ return {
1111
},
1212
cmd = 'Neotree',
1313
keys = {
14-
{ '\\', ':Neotree reveal<CR>', { desc = 'NeoTree reveal' } },
14+
{ '\\', ':Neotree reveal<CR>', desc = 'NeoTree reveal', silent = true },
1515
},
1616
opts = {
1717
filesystem = {

0 commit comments

Comments
 (0)