Skip to content

Commit 52b838a

Browse files
Merge branch 'nvim-lua:master' into master
2 parents 24dc6f8 + d452633 commit 52b838a

File tree

2 files changed

+58
-21
lines changed

2 files changed

+58
-21
lines changed

README.md

Lines changed: 6 additions & 2 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**
@@ -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

init.lua

Lines changed: 52 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ vim.api.nvim_create_autocmd('TextYankPost', {
207207
-- [[ Install `lazy.nvim` plugin manager ]]
208208
-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
209209
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
210-
if not vim.uv.fs_stat(lazypath) then
210+
if not (vim.uv or vim.loop).fs_stat(lazypath) then
211211
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
212212
local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
213213
if vim.v.shell_error ~= 0 then
@@ -275,11 +275,48 @@ require('lazy').setup({
275275
'folke/which-key.nvim',
276276
event = 'VimEnter', -- Sets the loading event to 'VimEnter'
277277
config = function() -- This is the function that runs, AFTER loading
278-
require('which-key').setup()
278+
require('which-key').setup {
279+
icons = {
280+
-- set icon mappings to true if you have a Nerd Font
281+
mappings = vim.g.have_nerd_font,
282+
-- If you are using a Nerd Font: set icons.keys to an empty table which will use the
283+
-- default whick-key.nvim defined Nerd Font icons, otherwise define a string table
284+
keys = vim.g.have_nerd_font and {} or {
285+
Up = '<Up> ',
286+
Down = '<Down> ',
287+
Left = '<Left> ',
288+
Right = '<Right> ',
289+
C = '<C-…> ',
290+
M = '<M-…> ',
291+
D = '<D-…> ',
292+
S = '<S-…> ',
293+
CR = '<CR> ',
294+
Esc = '<Esc> ',
295+
ScrollWheelDown = '<ScrollWheelDown> ',
296+
ScrollWheelUp = '<ScrollWheelUp> ',
297+
NL = '<NL> ',
298+
BS = '<BS> ',
299+
Space = '<Space> ',
300+
Tab = '<Tab> ',
301+
F1 = '<F1>',
302+
F2 = '<F2>',
303+
F3 = '<F3>',
304+
F4 = '<F4>',
305+
F5 = '<F5>',
306+
F6 = '<F6>',
307+
F7 = '<F7>',
308+
F8 = '<F8>',
309+
F9 = '<F9>',
310+
F10 = '<F10>',
311+
F11 = '<F11>',
312+
F12 = '<F12>',
313+
},
314+
},
315+
}
279316

280317
-- Document existing key chains
281318
require('which-key').add {
282-
{ '<leader>c', group = '[C]ode' },
319+
{ '<leader>c', group = '[C]ode', mode = { 'n', 'x' } },
283320
{ '<leader>d', group = '[D]ocument' },
284321
{ '<leader>r', group = '[R]ename' },
285322
{ '<leader>s', group = '[S]earch' },
@@ -470,8 +507,9 @@ require('lazy').setup({
470507
--
471508
-- In this case, we create a function that lets us more easily define mappings specific
472509
-- for LSP related items. It sets the mode, buffer and description for us each time.
473-
local map = function(keys, func, desc)
474-
vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
510+
local map = function(keys, func, desc, mode)
511+
mode = mode or 'n'
512+
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
475513
end
476514

477515
-- Jump to the definition of the word under your cursor.
@@ -505,7 +543,7 @@ require('lazy').setup({
505543

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

510548
-- WARN: This is not Goto Definition, this is Goto Declaration.
511549
-- For example, in C this would take you to the header.
@@ -843,6 +881,8 @@ require('lazy').setup({
843881
{ -- Highlight, edit, and navigate code
844882
'nvim-treesitter/nvim-treesitter',
845883
build = ':TSUpdate',
884+
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
885+
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
846886
opts = {
847887
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
848888
-- Autoinstall languages that are not installed
@@ -856,19 +896,12 @@ require('lazy').setup({
856896
},
857897
indent = { enable = true, disable = { 'ruby' } },
858898
},
859-
config = function(_, opts)
860-
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
861-
862-
---@diagnostic disable-next-line: missing-fields
863-
require('nvim-treesitter.configs').setup(opts)
864-
865-
-- There are additional nvim-treesitter modules that you can use to interact
866-
-- with nvim-treesitter. You should go explore a few and see what interests you:
867-
--
868-
-- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
869-
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
870-
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
871-
end,
899+
-- There are additional nvim-treesitter modules that you can use to interact
900+
-- with nvim-treesitter. You should go explore a few and see what interests you:
901+
--
902+
-- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
903+
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
904+
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
872905
},
873906

874907
-- The following two comments only work if you have downloaded the kickstart repo, not just copy pasted the

0 commit comments

Comments
 (0)