|
|
|
|
@ -1,97 +1,14 @@
|
|
|
|
|
--[[
|
|
|
|
|
|
|
|
|
|
=====================================================================
|
|
|
|
|
==================== READ THIS BEFORE CONTINUING ====================
|
|
|
|
|
=====================================================================
|
|
|
|
|
======== .-----. ========
|
|
|
|
|
======== .----------------------. | === | ========
|
|
|
|
|
======== |.-""""""""""""""""""-.| |-----| ========
|
|
|
|
|
======== || || | === | ========
|
|
|
|
|
======== || KICKSTART.NVIM || |-----| ========
|
|
|
|
|
======== || || | === | ========
|
|
|
|
|
======== || || |-----| ========
|
|
|
|
|
======== ||:Tutor || |:::::| ========
|
|
|
|
|
======== |'-..................-'| |____o| ========
|
|
|
|
|
======== `"")----------------(""` ___________ ========
|
|
|
|
|
======== /::::::::::| |::::::::::\ \ no mouse \ ========
|
|
|
|
|
======== /:::========| |==hjkl==:::\ \ required \ ========
|
|
|
|
|
======== '""""""""""""' '""""""""""""' '""""""""""' ========
|
|
|
|
|
======== ========
|
|
|
|
|
=====================================================================
|
|
|
|
|
=====================================================================
|
|
|
|
|
|
|
|
|
|
What is Kickstart?
|
|
|
|
|
|
|
|
|
|
Kickstart.nvim is *not* a distribution.
|
|
|
|
|
|
|
|
|
|
Kickstart.nvim is a starting point for your own configuration.
|
|
|
|
|
The goal is that you can read every line of code, top-to-bottom, understand
|
|
|
|
|
what your configuration is doing, and modify it to suit your needs.
|
|
|
|
|
|
|
|
|
|
Once you've done that, you can start exploring, configuring and tinkering to
|
|
|
|
|
make Neovim your own! That might mean leaving Kickstart just the way it is for a while
|
|
|
|
|
or immediately breaking it into modular pieces. It's up to you!
|
|
|
|
|
|
|
|
|
|
If you don't know anything about Lua, I recommend taking some time to read through
|
|
|
|
|
a guide. One possible example which will only take 10-15 minutes:
|
|
|
|
|
- https://learnxinyminutes.com/docs/lua/
|
|
|
|
|
|
|
|
|
|
After understanding a bit more about Lua, you can use `:help lua-guide` as a
|
|
|
|
|
reference for how Neovim integrates Lua.
|
|
|
|
|
- :help lua-guide
|
|
|
|
|
- (or HTML version): https://neovim.io/doc/user/lua-guide.html
|
|
|
|
|
|
|
|
|
|
Kickstart Guide:
|
|
|
|
|
|
|
|
|
|
TODO: The very first thing you should do is to run the command `:Tutor` in Neovim.
|
|
|
|
|
|
|
|
|
|
If you don't know what this means, type the following:
|
|
|
|
|
- <escape key>
|
|
|
|
|
- :
|
|
|
|
|
- Tutor
|
|
|
|
|
- <enter key>
|
|
|
|
|
|
|
|
|
|
(If you already know the Neovim basics, you can skip this step.)
|
|
|
|
|
|
|
|
|
|
Once you've completed that, you can continue working through **AND READING** the rest
|
|
|
|
|
of the kickstart init.lua.
|
|
|
|
|
|
|
|
|
|
Next, run AND READ `:help`.
|
|
|
|
|
This will open up a help window with some basic information
|
|
|
|
|
about reading, navigating and searching the builtin help documentation.
|
|
|
|
|
|
|
|
|
|
This should be the first place you go to look when you're stuck or confused
|
|
|
|
|
with something. It's one of my favorite Neovim features.
|
|
|
|
|
|
|
|
|
|
MOST IMPORTANTLY, we provide a keymap "<space>sh" to [s]earch the [h]elp documentation,
|
|
|
|
|
which is very useful when you're not exactly sure of what you're looking for.
|
|
|
|
|
|
|
|
|
|
I have left several `:help X` comments throughout the init.lua
|
|
|
|
|
These are hints about where to find more information about the relevant settings,
|
|
|
|
|
plugins or Neovim features used in Kickstart.
|
|
|
|
|
|
|
|
|
|
NOTE: Look for lines like this
|
|
|
|
|
|
|
|
|
|
Throughout the file. These are for you, the reader, to help you understand what is happening.
|
|
|
|
|
Feel free to delete them once you know what you're doing, but they should serve as a guide
|
|
|
|
|
for when you are first encountering a few different constructs in your Neovim config.
|
|
|
|
|
|
|
|
|
|
If you experience any errors while trying to install kickstart, run `:checkhealth` for more info.
|
|
|
|
|
|
|
|
|
|
I hope you enjoy your Neovim journey,
|
|
|
|
|
- TJ
|
|
|
|
|
|
|
|
|
|
P.S. You can delete this when you're done too. It's your config now! :)
|
|
|
|
|
--]]
|
|
|
|
|
-- Thanks TJ :)
|
|
|
|
|
|
|
|
|
|
-- Set <space> as the leader key
|
|
|
|
|
-- See `:help mapleader`
|
|
|
|
|
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
|
|
|
|
|
vim.g.mapleader = ' '
|
|
|
|
|
vim.g.maplocalleader = ' '
|
|
|
|
|
vim.opt.guicursor = ''
|
|
|
|
|
|
|
|
|
|
-- Set to true if you have a Nerd Font installed and selected in the terminal
|
|
|
|
|
vim.g.have_nerd_font = false
|
|
|
|
|
vim.g.have_nerd_font = true
|
|
|
|
|
|
|
|
|
|
-- [[ Setting options ]]
|
|
|
|
|
-- See `:help vim.o`
|
|
|
|
|
@ -100,9 +17,7 @@ vim.g.have_nerd_font = false
|
|
|
|
|
|
|
|
|
|
-- Make line numbers default
|
|
|
|
|
vim.o.number = true
|
|
|
|
|
-- You can also add relative line numbers, to help with jumping.
|
|
|
|
|
-- Experiment for yourself to see if you like it!
|
|
|
|
|
-- vim.o.relativenumber = true
|
|
|
|
|
vim.o.relativenumber = true
|
|
|
|
|
|
|
|
|
|
-- Enable mouse mode, can be useful for resizing splits for example!
|
|
|
|
|
vim.o.mouse = 'a'
|
|
|
|
|
@ -114,13 +29,35 @@ vim.o.showmode = false
|
|
|
|
|
-- Schedule the setting after `UiEnter` because it can increase startup-time.
|
|
|
|
|
-- Remove this option if you want your OS clipboard to remain independent.
|
|
|
|
|
-- See `:help 'clipboard'`
|
|
|
|
|
vim.schedule(function() vim.o.clipboard = 'unnamedplus' end)
|
|
|
|
|
-- vim.schedule(function() vim.o.clipboard = 'unnamedplus' end)
|
|
|
|
|
vim.keymap.set('n', '<leader>y', '"+y')
|
|
|
|
|
vim.keymap.set('v', '<leader>y', '"+y')
|
|
|
|
|
vim.keymap.set('n', '<leader>yap', '"+yap')
|
|
|
|
|
vim.keymap.set('v', '<leader>yap', '"+yap')
|
|
|
|
|
vim.keymap.set('n', '<leader>p', '"+p')
|
|
|
|
|
|
|
|
|
|
-- Navigating highlighted text after vap or v-j or k
|
|
|
|
|
vim.keymap.set('v', '<A-j>', ":m '>+1<CR>gv=gv")
|
|
|
|
|
vim.keymap.set('v', '<A-k>', ":m '<-2<CR>gv=gv")
|
|
|
|
|
vim.keymap.set('v', '<A-h>', '<gv')
|
|
|
|
|
|
|
|
|
|
-- Deleting buffers
|
|
|
|
|
vim.keymap.set('n', '<leader>bd', vim.cmd.bdelete)
|
|
|
|
|
|
|
|
|
|
-- go to project view
|
|
|
|
|
vim.keymap.set('n', '<leader>pv', vim.cmd.Ex)
|
|
|
|
|
|
|
|
|
|
-- Enable break indent
|
|
|
|
|
vim.o.breakindent = true
|
|
|
|
|
vim.keymap.set('v', '<A-l>', '>gv')
|
|
|
|
|
|
|
|
|
|
-- Enable break indent
|
|
|
|
|
-- vim.o.breakindent = true
|
|
|
|
|
|
|
|
|
|
-- Enable undo/redo changes even after closing and reopening a file
|
|
|
|
|
vim.o.undofile = true
|
|
|
|
|
vim.opt.swapfile = false
|
|
|
|
|
vim.opt.undodir = os.getenv 'HOME' .. '/.vim/undodir'
|
|
|
|
|
|
|
|
|
|
-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
|
|
|
|
|
vim.o.ignorecase = true
|
|
|
|
|
@ -129,6 +66,11 @@ vim.o.smartcase = true
|
|
|
|
|
-- Keep signcolumn on by default
|
|
|
|
|
vim.o.signcolumn = 'yes'
|
|
|
|
|
|
|
|
|
|
-- color column
|
|
|
|
|
vim.opt.colorcolumn = '100'
|
|
|
|
|
|
|
|
|
|
-- most disgusting keymap to quit
|
|
|
|
|
vim.keymap.set('n', '<leader>qq', vim.cmd.q)
|
|
|
|
|
-- Decrease update time
|
|
|
|
|
vim.o.updatetime = 250
|
|
|
|
|
|
|
|
|
|
@ -150,6 +92,11 @@ vim.o.splitbelow = true
|
|
|
|
|
vim.o.list = true
|
|
|
|
|
vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' }
|
|
|
|
|
|
|
|
|
|
vim.opt.tabstop = 4
|
|
|
|
|
vim.opt.softtabstop = 4
|
|
|
|
|
vim.opt.shiftwidth = 4
|
|
|
|
|
vim.opt.expandtab = false
|
|
|
|
|
|
|
|
|
|
-- Preview substitutions live, as you type!
|
|
|
|
|
vim.o.inccommand = 'split'
|
|
|
|
|
|
|
|
|
|
@ -167,6 +114,9 @@ vim.o.confirm = true
|
|
|
|
|
-- [[ Basic Keymaps ]]
|
|
|
|
|
-- See `:help vim.keymap.set()`
|
|
|
|
|
|
|
|
|
|
-- making jj to act like Esc
|
|
|
|
|
vim.keymap.set('i', 'jj', '<Esc>')
|
|
|
|
|
|
|
|
|
|
-- Clear highlights on search when pressing <Esc> in normal mode
|
|
|
|
|
-- See `:help hlsearch`
|
|
|
|
|
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
|
|
|
|
@ -303,27 +253,28 @@ require('lazy').setup({
|
|
|
|
|
-- Then, because we use the `opts` key (recommended), the configuration runs
|
|
|
|
|
-- after the plugin has been loaded as `require(MODULE).setup(opts)`.
|
|
|
|
|
|
|
|
|
|
{ -- Useful plugin to show you pending keybinds.
|
|
|
|
|
'folke/which-key.nvim',
|
|
|
|
|
event = 'VimEnter',
|
|
|
|
|
---@module 'which-key'
|
|
|
|
|
---@type wk.Opts
|
|
|
|
|
---@diagnostic disable-next-line: missing-fields
|
|
|
|
|
opts = {
|
|
|
|
|
-- delay between pressing a key and opening which-key (milliseconds)
|
|
|
|
|
delay = 0,
|
|
|
|
|
icons = { mappings = vim.g.have_nerd_font },
|
|
|
|
|
|
|
|
|
|
-- Document existing key chains
|
|
|
|
|
spec = {
|
|
|
|
|
{ '<leader>s', group = '[S]earch', mode = { 'n', 'v' } },
|
|
|
|
|
{ '<leader>t', group = '[T]oggle' },
|
|
|
|
|
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } }, -- Enable gitsigns recommended keymaps first
|
|
|
|
|
{ 'gr', group = 'LSP Actions', mode = { 'n' } },
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
-- I'd intentionally hide which key... might see its use later
|
|
|
|
|
-- { -- Useful plugin to show you pending keybinds.
|
|
|
|
|
-- 'folke/which-key.nvim',
|
|
|
|
|
-- event = 'VimEnter',
|
|
|
|
|
-- ---@module 'which-key'
|
|
|
|
|
-- ---@type wk.Opts
|
|
|
|
|
-- ---@diagnostic disable-next-line: missing-fields
|
|
|
|
|
-- opts = {
|
|
|
|
|
-- -- delay between pressing a key and opening which-key (milliseconds)
|
|
|
|
|
-- delay = 0,
|
|
|
|
|
-- icons = { mappings = vim.g.have_nerd_font },
|
|
|
|
|
--
|
|
|
|
|
-- -- Document existing key chains
|
|
|
|
|
-- spec = {
|
|
|
|
|
-- { '<leader>s', group = '[S]earch', mode = { 'n', 'v' } },
|
|
|
|
|
-- { '<leader>t', group = '[T]oggle' },
|
|
|
|
|
-- { '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } }, -- Enable gitsigns recommended keymaps first
|
|
|
|
|
-- { 'gr', group = 'LSP Actions', mode = { 'n' } },
|
|
|
|
|
-- },
|
|
|
|
|
-- },
|
|
|
|
|
-- },
|
|
|
|
|
--
|
|
|
|
|
-- NOTE: Plugins can specify dependencies.
|
|
|
|
|
--
|
|
|
|
|
-- The dependencies are proper plugin specifications as well - anything
|
|
|
|
|
@ -360,7 +311,7 @@ require('lazy').setup({
|
|
|
|
|
{ 'nvim-telescope/telescope-ui-select.nvim' },
|
|
|
|
|
|
|
|
|
|
-- Useful for getting pretty icons, but requires a Nerd Font.
|
|
|
|
|
{ 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
|
|
|
|
|
{ 'nvim-tree/nvim-web-devicons', disabled = vim.g.have_nerd_font },
|
|
|
|
|
},
|
|
|
|
|
config = function()
|
|
|
|
|
-- Telescope is a fuzzy finder that comes with a lot of different things that
|
|
|
|
|
@ -589,9 +540,9 @@ require('lazy').setup({
|
|
|
|
|
-- code, if the language server you are using supports them
|
|
|
|
|
--
|
|
|
|
|
-- This may be unwanted, since they displace some of your code
|
|
|
|
|
if client and client:supports_method('textDocument/inlayHint', event.buf) then
|
|
|
|
|
map('<leader>th', function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) end, '[T]oggle Inlay [H]ints')
|
|
|
|
|
end
|
|
|
|
|
-- if client and client:supports_method('textDocument/inlayHint', event.buf) then
|
|
|
|
|
-- map('<leader>th', function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) end, '[T]oggle Inlay [H]ints')
|
|
|
|
|
-- end
|
|
|
|
|
end,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
@ -600,9 +551,9 @@ require('lazy').setup({
|
|
|
|
|
-- See `:help lsp-config` for information about keys and how to configure
|
|
|
|
|
---@type table<string, vim.lsp.Config>
|
|
|
|
|
local servers = {
|
|
|
|
|
-- clangd = {},
|
|
|
|
|
clangd = {},
|
|
|
|
|
-- gopls = {},
|
|
|
|
|
-- pyright = {},
|
|
|
|
|
pyright = {},
|
|
|
|
|
-- rust_analyzer = {},
|
|
|
|
|
--
|
|
|
|
|
-- Some languages (like typescript) have entire language plugins that can be useful:
|
|
|
|
|
@ -811,6 +762,7 @@ require('lazy').setup({
|
|
|
|
|
styles = {
|
|
|
|
|
comments = { italic = false }, -- Disable italics in comments
|
|
|
|
|
},
|
|
|
|
|
transparent = true,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-- Load the colorscheme here.
|
|
|
|
|
@ -854,7 +806,7 @@ require('lazy').setup({
|
|
|
|
|
-- and try some other statusline plugin
|
|
|
|
|
local statusline = require 'mini.statusline'
|
|
|
|
|
-- set use_icons to true if you have a Nerd Font
|
|
|
|
|
statusline.setup { use_icons = vim.g.have_nerd_font }
|
|
|
|
|
statusline.setup { use_icons = false }
|
|
|
|
|
|
|
|
|
|
-- You can configure sections in the statusline by overriding their
|
|
|
|
|
-- default behavior. For example, here we set the section for
|
|
|
|
|
@ -920,7 +872,7 @@ require('lazy').setup({
|
|
|
|
|
-- This is the easiest way to modularize your config.
|
|
|
|
|
--
|
|
|
|
|
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
|
|
|
|
|
-- { import = 'custom.plugins' },
|
|
|
|
|
{ import = 'custom.plugins' },
|
|
|
|
|
--
|
|
|
|
|
-- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
|
|
|
|
|
-- Or use telescope!
|
|
|
|
|
|