fix several of folke's comments
This commit is contained in:
parent
bdbe2f3ae2
commit
33469ef03d
3 changed files with 85 additions and 63 deletions
|
@ -11,6 +11,9 @@ A starting point for Neovim that is:
|
||||||
|
|
||||||
This repo is meant to be used as by **YOU** to begin your Neovim journey; remove the things you don't use and add what you miss.
|
This repo is meant to be used as by **YOU** to begin your Neovim journey; remove the things you don't use and add what you miss.
|
||||||
|
|
||||||
|
Distribution Alternatives:
|
||||||
|
- [LazyVim](https://www.lazyvim.org/): A delightful distribution maintained by @folke (the author of lazy.nvim, the package manager used here)
|
||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
|
|
||||||
Kickstart.nvim targets *only* the latest ['stable'](https://github.com/neovim/neovim/releases/tag/stable) and latest ['nightly'](https://github.com/neovim/neovim/releases/tag/nightly) of Neovim. If you are experiencing issues, please make sure you have the latest versions.
|
Kickstart.nvim targets *only* the latest ['stable'](https://github.com/neovim/neovim/releases/tag/stable) and latest ['nightly'](https://github.com/neovim/neovim/releases/tag/nightly) of Neovim. If you are experiencing issues, please make sure you have the latest versions.
|
||||||
|
@ -34,6 +37,7 @@ Additional system requirements:
|
||||||
* Then there are two primary configuration options available:
|
* Then there are two primary configuration options available:
|
||||||
* Include the `lua/kickstart/plugins/*` files in your configuration.
|
* Include the `lua/kickstart/plugins/*` files in your configuration.
|
||||||
* Add new configuration in `lua/custom/plugins/*` files, which will be auto sourced using `lazy.nvim`
|
* Add new configuration in `lua/custom/plugins/*` files, which will be auto sourced using `lazy.nvim`
|
||||||
|
* NOTE: To enable this, you need to uncomment `{ import = 'custom.plugins' }` in your `init.lua`
|
||||||
|
|
||||||
You can also merge updates/changes from the repo back into your fork, to keep up-to-date with any changes for the default configuration
|
You can also merge updates/changes from the repo back into your fork, to keep up-to-date with any changes for the default configuration
|
||||||
|
|
||||||
|
@ -62,7 +66,7 @@ In the file: `lua/custom/plugins/filetree.lua`, add:
|
||||||
```lua
|
```lua
|
||||||
return {
|
return {
|
||||||
"nvim-neo-tree/neo-tree.nvim",
|
"nvim-neo-tree/neo-tree.nvim",
|
||||||
branch = "v2.x",
|
version = "*",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"nvim-lua/plenary.nvim",
|
"nvim-lua/plenary.nvim",
|
||||||
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
|
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
|
||||||
|
|
92
init.lua
92
init.lua
|
@ -4,8 +4,26 @@
|
||||||
==================== READ THIS BEFORE CONTINUING ====================
|
==================== READ THIS BEFORE CONTINUING ====================
|
||||||
=====================================================================
|
=====================================================================
|
||||||
|
|
||||||
|
Kickstart.nvim is *not* a distribution.
|
||||||
|
|
||||||
|
Kickstart.nvim is a template for your own configuration.
|
||||||
|
The goal is that you can read every line of code, top-to-bottom, and understand
|
||||||
|
what your configuration is doing.
|
||||||
|
|
||||||
|
Once you've done that, you should start exploring, configuring and tinkering to
|
||||||
|
explore Neovim!
|
||||||
|
|
||||||
|
If you don't know anything about Lua, I recommend taking some time to read through
|
||||||
|
a guide. One possible example:
|
||||||
|
- https://learnxinyminutes.com/docs/lua/
|
||||||
|
|
||||||
|
And then you can explore or search through `:help lua-guide`
|
||||||
|
|
||||||
|
|
||||||
|
Kickstart Guide:
|
||||||
|
|
||||||
I have left several `:help X` comments throughout the init.lua
|
I have left several `:help X` comments throughout the init.lua
|
||||||
You should run that command and read the help for the section for more information.
|
You should run that command and read that help section for more information.
|
||||||
|
|
||||||
In addition, I have some `NOTE:` items throughout the file.
|
In addition, I have some `NOTE:` items throughout the file.
|
||||||
These are for you, the reader to help understand what is happening. Feel free to delete
|
These are for you, the reader to help understand what is happening. Feel free to delete
|
||||||
|
@ -16,7 +34,6 @@ I hope you enjoy your Neovim journey,
|
||||||
- TJ
|
- TJ
|
||||||
|
|
||||||
P.S. You can delete this when you're done too. It's your config now :)
|
P.S. You can delete this when you're done too. It's your config now :)
|
||||||
|
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
-- Set <space> as the leader key
|
-- Set <space> as the leader key
|
||||||
|
@ -65,12 +82,9 @@ require('lazy').setup({
|
||||||
'williamboman/mason.nvim',
|
'williamboman/mason.nvim',
|
||||||
'williamboman/mason-lspconfig.nvim',
|
'williamboman/mason-lspconfig.nvim',
|
||||||
|
|
||||||
{ -- Useful status updates for LSP
|
-- Useful status updates for LSP
|
||||||
'j-hui/fidget.nvim',
|
-- NOTE: `opt = {}` is the same as calling `require('fidget').setup({})`
|
||||||
config = function()
|
{ 'j-hui/fidget.nvim', opts = {} },
|
||||||
require('fidget').setup()
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Additional lua configuration, makes nvim stuff amazing!
|
-- Additional lua configuration, makes nvim stuff amazing!
|
||||||
'folke/neodev.nvim',
|
'folke/neodev.nvim',
|
||||||
|
@ -82,20 +96,12 @@ require('lazy').setup({
|
||||||
dependencies = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip' },
|
dependencies = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip' },
|
||||||
},
|
},
|
||||||
|
|
||||||
{ -- Useful plugin to show you pending keybinds.
|
-- Useful plugin to show you pending keybinds.
|
||||||
'folke/which-key.nvim',
|
{ 'folke/which-key.nvim', opt = {} },
|
||||||
config = function()
|
|
||||||
vim.o.timeout = true
|
|
||||||
vim.o.timeoutlen = 300
|
|
||||||
require('which-key').setup {}
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
{ -- Adds git releated signs to the gutter, as well as utilities for managing changes
|
{ -- Adds git releated signs to the gutter, as well as utilities for managing changes
|
||||||
'lewis6991/gitsigns.nvim',
|
'lewis6991/gitsigns.nvim',
|
||||||
config = function()
|
opt = {
|
||||||
-- See `:help gitsigns.txt`
|
-- See `:help gitsigns.txt`
|
||||||
require('gitsigns').setup {
|
|
||||||
signs = {
|
signs = {
|
||||||
add = { text = '+' },
|
add = { text = '+' },
|
||||||
change = { text = '~' },
|
change = { text = '~' },
|
||||||
|
@ -103,60 +109,53 @@ require('lazy').setup({
|
||||||
topdelete = { text = '‾' },
|
topdelete = { text = '‾' },
|
||||||
changedelete = { text = '~' },
|
changedelete = { text = '~' },
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
end,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
{ -- Theme inspired by Atom
|
{ -- Theme inspired by Atom
|
||||||
'navarasu/onedark.nvim',
|
'navarasu/onedark.nvim',
|
||||||
|
priority = 1000,
|
||||||
config = function()
|
config = function()
|
||||||
vim.cmd.colorscheme 'onedark'
|
vim.cmd.colorscheme 'onedark'
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{ -- Fancier statusline
|
{ -- Set lualine as statusline
|
||||||
'nvim-lualine/lualine.nvim',
|
'nvim-lualine/lualine.nvim',
|
||||||
config = function()
|
|
||||||
-- Set lualine as statusline
|
|
||||||
-- See `:help lualine.txt`
|
-- See `:help lualine.txt`
|
||||||
require('lualine').setup {
|
opt = {
|
||||||
options = {
|
options = {
|
||||||
icons_enabled = false,
|
icons_enabled = false,
|
||||||
theme = 'onedark',
|
theme = 'onedark',
|
||||||
component_separators = '|',
|
component_separators = '|',
|
||||||
section_separators = '',
|
section_separators = '',
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
end,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
{ -- Add indentation guides even on blank lines
|
{ -- Add indentation guides even on blank lines
|
||||||
'lukas-reineke/indent-blankline.nvim',
|
'lukas-reineke/indent-blankline.nvim',
|
||||||
config = function()
|
|
||||||
-- Enable `lukas-reineke/indent-blankline.nvim`
|
-- Enable `lukas-reineke/indent-blankline.nvim`
|
||||||
-- See `:help indent_blankline.txt`
|
-- See `:help indent_blankline.txt`
|
||||||
require('indent_blankline').setup {
|
opt = {
|
||||||
char = '┊',
|
char = '┊',
|
||||||
show_trailing_blankline_indent = false,
|
show_trailing_blankline_indent = false,
|
||||||
}
|
},
|
||||||
end,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
{ -- "gc" to comment visual regions/lines
|
-- "gc" to comment visual regions/lines
|
||||||
'numToStr/Comment.nvim',
|
{ 'numToStr/Comment.nvim', opt = {} },
|
||||||
config = function()
|
|
||||||
require('Comment').setup()
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Fuzzy Finder (files, lsp, etc)
|
-- Fuzzy Finder (files, lsp, etc)
|
||||||
{ 'nvim-telescope/telescope.nvim', branch = '0.1.x', dependencies = { 'nvim-lua/plenary.nvim' } },
|
{ 'nvim-telescope/telescope.nvim', version = '*', dependencies = { 'nvim-lua/plenary.nvim' } },
|
||||||
|
|
||||||
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
|
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
|
||||||
-- Only load if `make` is available. Make sure you have the system
|
-- Only load if `make` is available. Make sure you have the system
|
||||||
-- requirements installed.
|
-- requirements installed.
|
||||||
{
|
{
|
||||||
'nvim-telescope/telescope-fzf-native.nvim',
|
'nvim-telescope/telescope-fzf-native.nvim',
|
||||||
|
-- NOTE: If you are having trouble with this installation,
|
||||||
|
-- refer to the README for telescope-fzf-native for more instructions.
|
||||||
build = 'make',
|
build = 'make',
|
||||||
cond = function()
|
cond = function()
|
||||||
return vim.fn.executable 'make' == 1
|
return vim.fn.executable 'make' == 1
|
||||||
|
@ -174,12 +173,19 @@ require('lazy').setup({
|
||||||
},
|
},
|
||||||
|
|
||||||
-- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart
|
-- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart
|
||||||
|
-- These are some example plugins that I've included in the kickstart repository.
|
||||||
|
-- Uncomment any of the lines below to enable them.
|
||||||
-- require 'kickstart.plugins.autoformat',
|
-- require 'kickstart.plugins.autoformat',
|
||||||
-- require 'kickstart.plugins.debug',
|
-- require 'kickstart.plugins.debug',
|
||||||
|
|
||||||
-- NOTE: Add your own custom plugins to `lua/custom/plugins/*.lua`
|
-- NOTE: The import below automatically adds your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
|
||||||
-- There are examples in the README.md for kickstar.nvim
|
-- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping
|
||||||
|
-- up-to-date with whatever is in the kickstart repo.
|
||||||
|
--
|
||||||
-- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins
|
-- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins
|
||||||
|
--
|
||||||
|
-- An additional note is that if you only copied in the `init.lua`, you can just comment this line
|
||||||
|
-- to get rid of the warning telling you that there are not plugins in `lua/custom/plugins/`.
|
||||||
{ import = 'custom.plugins' },
|
{ import = 'custom.plugins' },
|
||||||
}, {})
|
}, {})
|
||||||
|
|
||||||
|
@ -205,9 +211,13 @@ vim.o.undofile = true
|
||||||
vim.o.ignorecase = true
|
vim.o.ignorecase = true
|
||||||
vim.o.smartcase = true
|
vim.o.smartcase = true
|
||||||
|
|
||||||
|
-- Keep signcolumn on by default
|
||||||
|
vim.wo.signcolumn = 'yes'
|
||||||
|
|
||||||
-- Decrease update time
|
-- Decrease update time
|
||||||
vim.o.updatetime = 250
|
vim.o.updatetime = 250
|
||||||
vim.wo.signcolumn = 'yes'
|
vim.o.timeout = true
|
||||||
|
vim.o.timeoutlen = 300
|
||||||
|
|
||||||
-- Set completeopt to have a better completion experience
|
-- Set completeopt to have a better completion experience
|
||||||
vim.o.completeopt = 'menuone,noselect'
|
vim.o.completeopt = 'menuone,noselect'
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'neovim/nvim-lspconfig',
|
'neovim/nvim-lspconfig',
|
||||||
|
|
||||||
config = function()
|
config = function()
|
||||||
-- Switch for controlling whether you want autoformatting.
|
-- Switch for controlling whether you want autoformatting.
|
||||||
-- Use :KickstartFormatToggle to toggle autoformatting on or off
|
-- Use :KickstartFormatToggle to toggle autoformatting on or off
|
||||||
|
@ -29,9 +28,11 @@ return {
|
||||||
return _augroups[client.id]
|
return _augroups[client.id]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Whenever an LSP attaches to a buffer, we will run this function.
|
||||||
|
--
|
||||||
|
-- See `:help LspAttach` for more information about this autocmd event.
|
||||||
vim.api.nvim_create_autocmd('LspAttach', {
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
group = vim.api.nvim_create_augroup('kickstart-lsp-attach-format', { clear = true }),
|
group = vim.api.nvim_create_augroup('kickstart-lsp-attach-format', { clear = true }),
|
||||||
|
|
||||||
-- This is where we attach the autoformatting for reasonable clients
|
-- This is where we attach the autoformatting for reasonable clients
|
||||||
callback = function(args)
|
callback = function(args)
|
||||||
local client_id = args.data.client_id
|
local client_id = args.data.client_id
|
||||||
|
@ -49,6 +50,8 @@ return {
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Create an autocmd that will run *before* we save the buffer.
|
||||||
|
-- Run the formatting command for the LSP that has just attached.
|
||||||
vim.api.nvim_create_autocmd('BufWritePre', {
|
vim.api.nvim_create_autocmd('BufWritePre', {
|
||||||
group = get_augroup(client),
|
group = get_augroup(client),
|
||||||
buffer = bufnr,
|
buffer = bufnr,
|
||||||
|
@ -57,7 +60,12 @@ return {
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.lsp.buf.format { async = false }
|
vim.lsp.buf.format {
|
||||||
|
async = false,
|
||||||
|
filter = function(c)
|
||||||
|
return c.id == client.id
|
||||||
|
end,
|
||||||
|
}
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
|
|
Loading…
Reference in a new issue