Compare commits
1 Commits
cfdc17be3a
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| a07f128628 |
317
init.lua
317
init.lua
@@ -1,89 +1,3 @@
|
|||||||
--[[
|
|
||||||
|
|
||||||
=====================================================================
|
|
||||||
==================== 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! :)
|
|
||||||
--]]
|
|
||||||
|
|
||||||
-- ============================================================
|
-- ============================================================
|
||||||
-- SECTION 1: FOUNDATION
|
-- SECTION 1: FOUNDATION
|
||||||
-- Core Neovim settings, leaders, options, basic keymaps, basic autocmds
|
-- Core Neovim settings, leaders, options, basic keymaps, basic autocmds
|
||||||
@@ -91,7 +5,6 @@ P.S. You can delete this when you're done too. It's your config now! :)
|
|||||||
do
|
do
|
||||||
-- Enable faster startup by caching compiled Lua modules
|
-- Enable faster startup by caching compiled Lua modules
|
||||||
vim.loader.enable()
|
vim.loader.enable()
|
||||||
|
|
||||||
-- Set <space> as the leader key
|
-- Set <space> as the leader key
|
||||||
-- See `:help mapleader`
|
-- See `:help mapleader`
|
||||||
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
|
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
|
||||||
@@ -99,19 +12,43 @@ do
|
|||||||
vim.g.maplocalleader = ' '
|
vim.g.maplocalleader = ' '
|
||||||
|
|
||||||
-- Set to true if you have a Nerd Font installed and selected in the terminal
|
-- 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 ]]
|
-- [[ Setting options ]]
|
||||||
-- See `:help vim.o`
|
-- See `:help vim.o`
|
||||||
-- NOTE: You can change these options as you wish!
|
-- NOTE: You can change these options as you wish!
|
||||||
-- For more options, you can see `:help option-list`
|
-- For more options, you can see `:help option-list`
|
||||||
|
|
||||||
-- Make line numbers default
|
-- Make line numbers default
|
||||||
vim.o.number = true
|
vim.o.number = true
|
||||||
-- You can also add relative line numbers, to help with jumping.
|
-- You can also add relative line numbers, to help with jumping.
|
||||||
-- Experiment for yourself to see if you like it!
|
-- Experiment for yourself to see if you like it!
|
||||||
-- vim.o.relativenumber = true
|
-- vim.o.relativenumber = true
|
||||||
|
|
||||||
|
vim.o.allowrevins = true
|
||||||
|
|
||||||
|
vim.o.autocompletedelay = 10
|
||||||
|
vim.o.autoindent = true
|
||||||
|
vim.o.autoread = true
|
||||||
|
vim.o.background = 'dark'
|
||||||
|
vim.o.backspace = 'indent,eol,start'
|
||||||
|
vim.o.wrap = true
|
||||||
|
vim.o.linebreak = true
|
||||||
|
vim.o.breakat = ' I!@*-+;:,./?'
|
||||||
|
vim.o.tabstop = 4
|
||||||
|
vim.o.shiftwidth = 4
|
||||||
|
vim.o.expandtab = true
|
||||||
|
vim.o.smartindent = true
|
||||||
|
vim.o.hlsearch = true
|
||||||
|
vim.o.incsearch = true
|
||||||
|
vim.o.signcolumn = 'yes'
|
||||||
|
vim.o.relativenumber = true
|
||||||
|
vim.opt.completeopt = { 'menu', 'menuone', 'noselect' }
|
||||||
|
vim.o.wildmode = 'longest:full,full'
|
||||||
|
vim.o.virtualedit = 'block'
|
||||||
|
vim.o.winborder = 'rounded'
|
||||||
|
|
||||||
|
vim.opt.termguicolors = true
|
||||||
|
|
||||||
-- Enable mouse mode, can be useful for resizing splits for example!
|
-- Enable mouse mode, can be useful for resizing splits for example!
|
||||||
vim.o.mouse = 'a'
|
vim.o.mouse = 'a'
|
||||||
|
|
||||||
@@ -165,7 +102,7 @@ do
|
|||||||
vim.o.cursorline = true
|
vim.o.cursorline = true
|
||||||
|
|
||||||
-- Minimal number of screen lines to keep above and below the cursor.
|
-- Minimal number of screen lines to keep above and below the cursor.
|
||||||
vim.o.scrolloff = 10
|
vim.o.scrolloff = 5
|
||||||
|
|
||||||
-- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`),
|
-- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`),
|
||||||
-- instead raise a dialog asking if you wish to save the current file(s)
|
-- instead raise a dialog asking if you wish to save the current file(s)
|
||||||
@@ -205,35 +142,19 @@ do
|
|||||||
|
|
||||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
|
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
|
||||||
|
|
||||||
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
|
vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
|
||||||
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
|
vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
|
||||||
-- is not what someone will guess without a bit more experience.
|
vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
|
||||||
--
|
vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
|
||||||
-- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping
|
|
||||||
-- or just use <C-\><C-n> to exit terminal mode
|
|
||||||
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
|
|
||||||
|
|
||||||
-- TIP: Disable arrow keys in normal mode
|
|
||||||
-- vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
|
|
||||||
-- vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
|
|
||||||
-- vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
|
|
||||||
-- vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
|
|
||||||
|
|
||||||
-- Keybinds to make split navigation easier.
|
-- Keybinds to make split navigation easier.
|
||||||
-- Use CTRL+<hjkl> to switch between windows
|
-- Use CTRL+<hjkl> to switch between windows
|
||||||
--
|
--
|
||||||
-- See `:help wincmd` for a list of all window commands
|
|
||||||
vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' })
|
vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' })
|
||||||
vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' })
|
vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' })
|
||||||
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
|
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
|
||||||
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
|
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
|
||||||
|
|
||||||
-- NOTE: Some terminals have colliding keymaps or are not able to send distinct keycodes
|
|
||||||
-- vim.keymap.set("n", "<C-S-h>", "<C-w>H", { desc = "Move window to the left" })
|
|
||||||
-- vim.keymap.set("n", "<C-S-l>", "<C-w>L", { desc = "Move window to the right" })
|
|
||||||
-- vim.keymap.set("n", "<C-S-j>", "<C-w>J", { desc = "Move window to the lower" })
|
|
||||||
-- vim.keymap.set("n", "<C-S-k>", "<C-w>K", { desc = "Move window to the upper" })
|
|
||||||
|
|
||||||
-- [[ Basic Autocommands ]]
|
-- [[ Basic Autocommands ]]
|
||||||
-- See `:help lua-guide-autocommands`
|
-- See `:help lua-guide-autocommands`
|
||||||
|
|
||||||
@@ -391,10 +312,14 @@ do
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vim.pack.add { gh 'navarasu/onedark.nvim' }
|
||||||
|
require('onedark').setup {
|
||||||
|
style = 'deep',
|
||||||
|
}
|
||||||
-- Load the colorscheme here.
|
-- Load the colorscheme here.
|
||||||
-- Like many other themes, this one has different styles, and you could load
|
-- Like many other themes, this one has different styles, and you could load
|
||||||
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
|
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
|
||||||
vim.cmd.colorscheme 'tokyonight-night'
|
vim.cmd.colorscheme 'onedark'
|
||||||
|
|
||||||
-- Highlight todo, notes, etc in comments
|
-- Highlight todo, notes, etc in comments
|
||||||
vim.pack.add { gh 'folke/todo-comments.nvim' }
|
vim.pack.add { gh 'folke/todo-comments.nvim' }
|
||||||
@@ -404,6 +329,10 @@ do
|
|||||||
-- A collection of various small independent plugins/modules
|
-- A collection of various small independent plugins/modules
|
||||||
vim.pack.add { gh 'nvim-mini/mini.nvim' }
|
vim.pack.add { gh 'nvim-mini/mini.nvim' }
|
||||||
|
|
||||||
|
vim.pack.add {
|
||||||
|
gh 'nvim-treesitter/nvim-treesitter-textobjects',
|
||||||
|
}
|
||||||
|
|
||||||
-- Better Around/Inside textobjects
|
-- Better Around/Inside textobjects
|
||||||
--
|
--
|
||||||
-- Examples:
|
-- Examples:
|
||||||
@@ -686,10 +615,42 @@ do
|
|||||||
-- See `:help lsp-config` for information about keys and how to configure
|
-- See `:help lsp-config` for information about keys and how to configure
|
||||||
---@type table<string, vim.lsp.Config>
|
---@type table<string, vim.lsp.Config>
|
||||||
local servers = {
|
local servers = {
|
||||||
-- clangd = {},
|
clangd = {
|
||||||
|
cmd = {
|
||||||
|
'clangd',
|
||||||
|
'--background-index',
|
||||||
|
'--clang-tidy',
|
||||||
|
'--header-insertion=iwyu',
|
||||||
|
'--completion-style=detailed',
|
||||||
|
},
|
||||||
|
},
|
||||||
-- gopls = {},
|
-- gopls = {},
|
||||||
-- pyright = {},
|
pyright = {
|
||||||
-- rust_analyzer = {},
|
settings = {
|
||||||
|
python = {
|
||||||
|
analysis = {
|
||||||
|
typeCheckingMode = 'basic',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rust_analyzer = {
|
||||||
|
settings = {
|
||||||
|
['rust-analyzer'] = {
|
||||||
|
cargo = {
|
||||||
|
allFeatures = true,
|
||||||
|
},
|
||||||
|
|
||||||
|
checkOnSave = true,
|
||||||
|
|
||||||
|
procMacro = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
marksman = {},
|
||||||
|
cmake = {},
|
||||||
--
|
--
|
||||||
-- Some languages (like typescript) have entire language plugins that can be useful:
|
-- Some languages (like typescript) have entire language plugins that can be useful:
|
||||||
-- https://github.com/pmizio/typescript-tools.nvim
|
-- https://github.com/pmizio/typescript-tools.nvim
|
||||||
@@ -776,8 +737,12 @@ do
|
|||||||
format_on_save = function(bufnr)
|
format_on_save = function(bufnr)
|
||||||
-- You can specify filetypes to autoformat on save here:
|
-- You can specify filetypes to autoformat on save here:
|
||||||
local enabled_filetypes = {
|
local enabled_filetypes = {
|
||||||
-- lua = true,
|
lua = true,
|
||||||
-- python = true,
|
python = true,
|
||||||
|
rust = true,
|
||||||
|
c = true,
|
||||||
|
cpp = true,
|
||||||
|
cmake = true,
|
||||||
}
|
}
|
||||||
if enabled_filetypes[vim.bo[bufnr].filetype] then
|
if enabled_filetypes[vim.bo[bufnr].filetype] then
|
||||||
return { timeout_ms = 500 }
|
return { timeout_ms = 500 }
|
||||||
@@ -790,9 +755,16 @@ do
|
|||||||
},
|
},
|
||||||
-- You can also specify external formatters in here.
|
-- You can also specify external formatters in here.
|
||||||
formatters_by_ft = {
|
formatters_by_ft = {
|
||||||
-- rust = { 'rustfmt' },
|
lua = { 'stylua' },
|
||||||
|
rust = { 'rustfmt' },
|
||||||
-- Conform can also run multiple formatters sequentially
|
-- Conform can also run multiple formatters sequentially
|
||||||
-- python = { "isort", "black" },
|
python = { 'isort', 'black' },
|
||||||
|
|
||||||
|
c = { 'clang_format' },
|
||||||
|
cpp = { 'clang_format' },
|
||||||
|
cmake = { 'cmake_format' },
|
||||||
|
|
||||||
|
markdown = { 'prettier' },
|
||||||
--
|
--
|
||||||
-- You can use 'stop_after_first' to run the first available formatter from the list
|
-- You can use 'stop_after_first' to run the first available formatter from the list
|
||||||
-- javascript = { "prettierd", "prettier", stop_after_first = true },
|
-- javascript = { "prettierd", "prettier", stop_after_first = true },
|
||||||
@@ -818,38 +790,35 @@ do
|
|||||||
-- See the README about individual language/framework/plugin snippets:
|
-- See the README about individual language/framework/plugin snippets:
|
||||||
-- https://github.com/rafamadriz/friendly-snippets
|
-- https://github.com/rafamadriz/friendly-snippets
|
||||||
--
|
--
|
||||||
-- vim.pack.add { gh 'rafamadriz/friendly-snippets' }
|
vim.pack.add { gh 'rafamadriz/friendly-snippets' }
|
||||||
-- require('luasnip.loaders.from_vscode').lazy_load()
|
require('luasnip.loaders.from_vscode').lazy_load()
|
||||||
|
|
||||||
-- [[ Autocomplete Engine ]]
|
-- [[ Autocomplete Engine ]]
|
||||||
vim.pack.add { { src = gh 'saghen/blink.cmp', version = vim.version.range '1.*' } }
|
vim.pack.add { { src = gh 'saghen/blink.cmp', version = vim.version.range '1.*' } }
|
||||||
require('blink.cmp').setup {
|
require('blink.cmp').setup {
|
||||||
keymap = {
|
keymap = {
|
||||||
-- 'default' (recommended) for mappings similar to built-in completions
|
preset = 'none',
|
||||||
-- <c-y> to accept ([y]es) the completion.
|
|
||||||
-- This will auto-import if your LSP supports it.
|
|
||||||
-- This will expand snippets if the LSP sent a snippet.
|
|
||||||
-- 'super-tab' for tab to accept
|
|
||||||
-- 'enter' for enter to accept
|
|
||||||
-- 'none' for no mappings
|
|
||||||
--
|
|
||||||
-- For an understanding of why the 'default' preset is recommended,
|
|
||||||
-- you will need to read `:help ins-completion`
|
|
||||||
--
|
|
||||||
-- No, but seriously. Please read `:help ins-completion`, it is really good!
|
|
||||||
--
|
|
||||||
-- All presets have the following mappings:
|
|
||||||
-- <tab>/<s-tab>: move to right/left of your snippet expansion
|
|
||||||
-- <c-space>: Open menu or open docs if already open
|
|
||||||
-- <c-n>/<c-p> or <up>/<down>: Select next/previous item
|
|
||||||
-- <c-e>: Hide menu
|
|
||||||
-- <c-k>: Toggle signature help
|
|
||||||
--
|
|
||||||
-- See `:help blink-cmp-config-keymap` for defining your own keymap
|
|
||||||
preset = 'default',
|
|
||||||
|
|
||||||
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
|
['<Tab>'] = {
|
||||||
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
|
'select_next',
|
||||||
|
'snippet_forward',
|
||||||
|
'fallback',
|
||||||
|
},
|
||||||
|
|
||||||
|
['<S-Tab>'] = {
|
||||||
|
'select_prev',
|
||||||
|
'snippet_backward',
|
||||||
|
'fallback',
|
||||||
|
},
|
||||||
|
|
||||||
|
['<CR>'] = {
|
||||||
|
'accept',
|
||||||
|
'fallback',
|
||||||
|
},
|
||||||
|
|
||||||
|
['<C-space>'] = { 'show', 'show_documentation', 'hide_documentation' },
|
||||||
|
|
||||||
|
['<C-e>'] = { 'hide' },
|
||||||
},
|
},
|
||||||
|
|
||||||
appearance = {
|
appearance = {
|
||||||
@@ -859,13 +828,25 @@ do
|
|||||||
},
|
},
|
||||||
|
|
||||||
completion = {
|
completion = {
|
||||||
|
menu = {
|
||||||
|
border = 'rounded',
|
||||||
|
},
|
||||||
-- By default, you may press `<c-space>` to show the documentation.
|
-- By default, you may press `<c-space>` to show the documentation.
|
||||||
-- Optionally, set `auto_show = true` to show the documentation after a delay.
|
-- Optionally, set `auto_show = true` to show the documentation after a delay.
|
||||||
documentation = { auto_show = false, auto_show_delay_ms = 500 },
|
documentation = {
|
||||||
|
window = {
|
||||||
|
border = 'rounded',
|
||||||
|
},
|
||||||
|
auto_show = true,
|
||||||
|
auto_show_delay_ms = 500,
|
||||||
|
},
|
||||||
|
ghost_text = {
|
||||||
|
enabled = true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
sources = {
|
sources = {
|
||||||
default = { 'lsp', 'path', 'snippets' },
|
default = { 'lsp', 'path', 'snippets', 'buffer' },
|
||||||
},
|
},
|
||||||
|
|
||||||
snippets = { preset = 'luasnip' },
|
snippets = { preset = 'luasnip' },
|
||||||
@@ -898,7 +879,30 @@ do
|
|||||||
vim.pack.add { { src = gh 'nvim-treesitter/nvim-treesitter', version = 'main' } }
|
vim.pack.add { { src = gh 'nvim-treesitter/nvim-treesitter', version = 'main' } }
|
||||||
|
|
||||||
-- Ensure basic parsers are installed
|
-- Ensure basic parsers are installed
|
||||||
local parsers = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }
|
local parsers = {
|
||||||
|
'bash',
|
||||||
|
'c',
|
||||||
|
'cpp',
|
||||||
|
'rust',
|
||||||
|
'python',
|
||||||
|
'cmake',
|
||||||
|
'markdown',
|
||||||
|
'markdown_inline',
|
||||||
|
'diff',
|
||||||
|
'html',
|
||||||
|
'css',
|
||||||
|
'javascript',
|
||||||
|
'json',
|
||||||
|
'yaml',
|
||||||
|
'toml',
|
||||||
|
'lua',
|
||||||
|
'luadoc',
|
||||||
|
'markdown',
|
||||||
|
'markdown_inline',
|
||||||
|
'query',
|
||||||
|
'vim',
|
||||||
|
'vimdoc',
|
||||||
|
}
|
||||||
require('nvim-treesitter').install(parsers)
|
require('nvim-treesitter').install(parsers)
|
||||||
|
|
||||||
---@param buf integer
|
---@param buf integer
|
||||||
@@ -911,8 +915,9 @@ do
|
|||||||
|
|
||||||
-- Enable treesitter based folds
|
-- Enable treesitter based folds
|
||||||
-- For more info on folds see `:help folds`
|
-- For more info on folds see `:help folds`
|
||||||
-- vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
|
vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
|
||||||
-- vim.wo.foldmethod = 'expr'
|
vim.wo.foldmethod = 'expr'
|
||||||
|
vim.opt.foldlevel = 99
|
||||||
|
|
||||||
-- Check if treesitter indentation is available for this language, and if so enable it
|
-- Check if treesitter indentation is available for this language, and if so enable it
|
||||||
-- in case there is no indent query, the indentexpr will fallback to the vim's built in one
|
-- in case there is no indent query, the indentexpr will fallback to the vim's built in one
|
||||||
@@ -960,17 +965,17 @@ do
|
|||||||
-- Here are some example plugins that I've included in the Kickstart repository.
|
-- Here are some example plugins that I've included in the Kickstart repository.
|
||||||
-- Uncomment any of the lines below to enable them (you will need to restart nvim).
|
-- Uncomment any of the lines below to enable them (you will need to restart nvim).
|
||||||
--
|
--
|
||||||
-- require 'kickstart.plugins.debug'
|
require 'kickstart.plugins.debug'
|
||||||
-- require 'kickstart.plugins.indent_line'
|
require 'kickstart.plugins.indent_line'
|
||||||
-- require 'kickstart.plugins.lint'
|
require 'kickstart.plugins.lint'
|
||||||
-- require 'kickstart.plugins.autopairs'
|
require 'kickstart.plugins.autopairs'
|
||||||
-- require 'kickstart.plugins.neo-tree'
|
require 'kickstart.plugins.neo-tree'
|
||||||
-- require 'kickstart.plugins.gitsigns' -- adds gitsigns recommended keymaps
|
require 'kickstart.plugins.gitsigns' -- adds gitsigns recommended keymaps
|
||||||
|
|
||||||
-- NOTE: You can add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
|
-- NOTE: You can add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
|
||||||
--
|
--
|
||||||
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
|
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
|
||||||
-- require 'custom.plugins'
|
require 'custom.plugins'
|
||||||
end
|
end
|
||||||
|
|
||||||
-- The line beneath this is called `modeline`. See `:help modeline`
|
-- The line beneath this is called `modeline`. See `:help modeline`
|
||||||
|
|||||||
122
lua/custom/plugins/buffertabs.lua
Normal file
122
lua/custom/plugins/buffertabs.lua
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
-- ============================================================
|
||||||
|
-- BUFFERLINE
|
||||||
|
-- Buffer tabs
|
||||||
|
-- ============================================================
|
||||||
|
|
||||||
|
local plugins = {
|
||||||
|
{
|
||||||
|
src = 'https://github.com/akinsho/bufferline.nvim',
|
||||||
|
version = vim.version.range '*',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
if vim.g.have_nerd_font then table.insert(plugins, 'https://github.com/nvim-tree/nvim-web-devicons') end
|
||||||
|
|
||||||
|
vim.pack.add(plugins)
|
||||||
|
|
||||||
|
-- ============================================================
|
||||||
|
-- SETUP
|
||||||
|
-- ============================================================
|
||||||
|
|
||||||
|
require('bufferline').setup {
|
||||||
|
options = {
|
||||||
|
mode = 'buffers',
|
||||||
|
|
||||||
|
numbers = 'none',
|
||||||
|
|
||||||
|
close_command = 'bdelete! %d',
|
||||||
|
right_mouse_command = 'bdelete! %d',
|
||||||
|
|
||||||
|
left_mouse_command = 'buffer %d',
|
||||||
|
middle_mouse_command = nil,
|
||||||
|
|
||||||
|
indicator = {
|
||||||
|
style = 'underline',
|
||||||
|
},
|
||||||
|
|
||||||
|
buffer_close_icon = '',
|
||||||
|
modified_icon = '●',
|
||||||
|
close_icon = '',
|
||||||
|
left_trunc_marker = '',
|
||||||
|
right_trunc_marker = '',
|
||||||
|
|
||||||
|
max_name_length = 24,
|
||||||
|
max_prefix_length = 18,
|
||||||
|
tab_size = 20,
|
||||||
|
|
||||||
|
diagnostics = 'nvim_lsp',
|
||||||
|
|
||||||
|
diagnostics_indicator = function(_, _, diagnostics_dict)
|
||||||
|
local s = ' '
|
||||||
|
for e, n in pairs(diagnostics_dict) do
|
||||||
|
local sym = e == 'error' and ' ' or (e == 'warning' and ' ') or ' '
|
||||||
|
|
||||||
|
s = s .. n .. sym
|
||||||
|
end
|
||||||
|
return s
|
||||||
|
end,
|
||||||
|
|
||||||
|
offsets = {
|
||||||
|
{
|
||||||
|
filetype = 'neo-tree',
|
||||||
|
text = 'File Explorer',
|
||||||
|
highlight = 'Directory',
|
||||||
|
text_align = 'left',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
show_buffer_icons = true,
|
||||||
|
show_buffer_close_icons = false,
|
||||||
|
show_close_icon = false,
|
||||||
|
|
||||||
|
show_tab_indicators = true,
|
||||||
|
|
||||||
|
persist_buffer_sort = true,
|
||||||
|
separator_style = 'slant',
|
||||||
|
|
||||||
|
enforce_regular_tabs = false,
|
||||||
|
always_show_bufferline = true,
|
||||||
|
|
||||||
|
hover = {
|
||||||
|
enabled = true,
|
||||||
|
delay = 200,
|
||||||
|
reveal = { 'close' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- ============================================================
|
||||||
|
-- KEYMAPS
|
||||||
|
-- ============================================================
|
||||||
|
|
||||||
|
-- Next buffer
|
||||||
|
vim.keymap.set('n', '<Tab>', '<Cmd>BufferLineCycleNext<CR>', {
|
||||||
|
desc = 'Next Buffer',
|
||||||
|
silent = true,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Previous buffer
|
||||||
|
vim.keymap.set('n', '<S-Tab>', '<Cmd>BufferLineCyclePrev<CR>', {
|
||||||
|
desc = 'Previous Buffer',
|
||||||
|
silent = true,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Pin buffer
|
||||||
|
vim.keymap.set('n', '<leader>bp', '<Cmd>BufferLineTogglePin<CR>', {
|
||||||
|
desc = 'Pin Buffer',
|
||||||
|
silent = true,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Close buffer
|
||||||
|
vim.keymap.set('n', '<leader>bc', '<Cmd>bdelete<CR>', {
|
||||||
|
desc = 'Close Buffer',
|
||||||
|
silent = true,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Go to buffer by number
|
||||||
|
for i = 1, 9 do
|
||||||
|
vim.keymap.set('n', '<leader>' .. i, function() require('bufferline').go_to(i, true) end, {
|
||||||
|
desc = 'Go to buffer ' .. i,
|
||||||
|
silent = true,
|
||||||
|
})
|
||||||
|
end
|
||||||
104
lua/custom/plugins/lualine.lua
Normal file
104
lua/custom/plugins/lualine.lua
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
-- ============================================================
|
||||||
|
-- LUALINE
|
||||||
|
-- Statusline
|
||||||
|
-- ============================================================
|
||||||
|
|
||||||
|
vim.pack.add {
|
||||||
|
{
|
||||||
|
src = 'https://github.com/nvim-lualine/lualine.nvim',
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
src = 'https://github.com/nvim-tree/nvim-web-devicons',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
require('lualine').setup {
|
||||||
|
options = {
|
||||||
|
theme = 'onedark',
|
||||||
|
|
||||||
|
icons_enabled = true,
|
||||||
|
|
||||||
|
component_separators = {
|
||||||
|
left = '│',
|
||||||
|
right = '│',
|
||||||
|
},
|
||||||
|
|
||||||
|
section_separators = {
|
||||||
|
left = '',
|
||||||
|
right = '',
|
||||||
|
},
|
||||||
|
|
||||||
|
disabled_filetypes = {
|
||||||
|
statusline = {},
|
||||||
|
winbar = {},
|
||||||
|
},
|
||||||
|
|
||||||
|
ignore_focus = {},
|
||||||
|
|
||||||
|
always_divide_middle = true,
|
||||||
|
|
||||||
|
globalstatus = true,
|
||||||
|
|
||||||
|
refresh = {
|
||||||
|
statusline = 100,
|
||||||
|
tabline = 100,
|
||||||
|
winbar = 100,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
sections = {
|
||||||
|
lualine_a = { {
|
||||||
|
'mode',
|
||||||
|
upper = true,
|
||||||
|
} },
|
||||||
|
|
||||||
|
lualine_b = {
|
||||||
|
'branch',
|
||||||
|
'diff',
|
||||||
|
'diagnostics',
|
||||||
|
},
|
||||||
|
|
||||||
|
lualine_c = {
|
||||||
|
{
|
||||||
|
'filename',
|
||||||
|
path = 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
lualine_x = {
|
||||||
|
{
|
||||||
|
'encoding',
|
||||||
|
show_bomb = true,
|
||||||
|
},
|
||||||
|
|
||||||
|
'fileformat',
|
||||||
|
'filetype',
|
||||||
|
},
|
||||||
|
|
||||||
|
lualine_y = {
|
||||||
|
'progress',
|
||||||
|
},
|
||||||
|
|
||||||
|
lualine_z = {
|
||||||
|
'location',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
inactive_sections = {
|
||||||
|
lualine_a = {},
|
||||||
|
lualine_b = {},
|
||||||
|
lualine_c = { 'filename' },
|
||||||
|
lualine_x = { 'location' },
|
||||||
|
lualine_y = {},
|
||||||
|
lualine_z = {},
|
||||||
|
},
|
||||||
|
|
||||||
|
extensions = {
|
||||||
|
'trouble',
|
||||||
|
'quickfix',
|
||||||
|
'fzf',
|
||||||
|
'lazy',
|
||||||
|
'mason',
|
||||||
|
},
|
||||||
|
}
|
||||||
65
lua/custom/plugins/toggleterm.lua
Normal file
65
lua/custom/plugins/toggleterm.lua
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
-- ============================================================
|
||||||
|
-- TOGGLETERM
|
||||||
|
-- Floating terminal
|
||||||
|
-- ============================================================
|
||||||
|
|
||||||
|
vim.pack.add {
|
||||||
|
{
|
||||||
|
src = 'https://github.com/akinsho/toggleterm.nvim',
|
||||||
|
version = vim.version.range '*',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
require('toggleterm').setup {
|
||||||
|
size = 20,
|
||||||
|
|
||||||
|
open_mapping = [[<leader>tt]],
|
||||||
|
|
||||||
|
hide_numbers = true,
|
||||||
|
|
||||||
|
shade_filetypes = {},
|
||||||
|
|
||||||
|
shade_terminals = true,
|
||||||
|
|
||||||
|
start_in_insert = true,
|
||||||
|
|
||||||
|
insert_mappings = true,
|
||||||
|
|
||||||
|
terminal_mappings = true,
|
||||||
|
|
||||||
|
persist_size = true,
|
||||||
|
|
||||||
|
persist_mode = true,
|
||||||
|
|
||||||
|
direction = 'float',
|
||||||
|
|
||||||
|
close_on_exit = true,
|
||||||
|
|
||||||
|
shell = vim.o.shell,
|
||||||
|
|
||||||
|
float_opts = {
|
||||||
|
border = 'rounded',
|
||||||
|
|
||||||
|
winblend = 0,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- ============================================================
|
||||||
|
-- TERMINAL KEYMAPS
|
||||||
|
-- ============================================================
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd('TermOpen', {
|
||||||
|
pattern = 'term://*',
|
||||||
|
callback = function()
|
||||||
|
local opts = { buffer = 0 }
|
||||||
|
|
||||||
|
-- ESC exits terminal insert mode
|
||||||
|
vim.keymap.set('t', '<Esc>', [[<C-\><C-n>]], opts)
|
||||||
|
|
||||||
|
-- Better window navigation
|
||||||
|
vim.keymap.set('t', '<C-h>', [[<Cmd>wincmd h<CR>]], opts)
|
||||||
|
vim.keymap.set('t', '<C-j>', [[<Cmd>wincmd j<CR>]], opts)
|
||||||
|
vim.keymap.set('t', '<C-k>', [[<Cmd>wincmd k<CR>]], opts)
|
||||||
|
vim.keymap.set('t', '<C-l>', [[<Cmd>wincmd l<CR>]], opts)
|
||||||
|
end,
|
||||||
|
})
|
||||||
67
lua/custom/plugins/trouble.lua
Normal file
67
lua/custom/plugins/trouble.lua
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
-- ============================================================
|
||||||
|
-- TROUBLE.NVIM
|
||||||
|
-- Better diagnostics / references / quickfix UI
|
||||||
|
-- ============================================================
|
||||||
|
|
||||||
|
vim.pack.add {
|
||||||
|
{
|
||||||
|
src = 'https://github.com/folke/trouble.nvim',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
require('trouble').setup {
|
||||||
|
auto_close = false,
|
||||||
|
auto_open = false,
|
||||||
|
auto_preview = true,
|
||||||
|
|
||||||
|
focus = true,
|
||||||
|
|
||||||
|
modes = {
|
||||||
|
diagnostics = {
|
||||||
|
auto_open = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
icons = {
|
||||||
|
indent = {
|
||||||
|
top = '│ ',
|
||||||
|
middle = '├╴',
|
||||||
|
last = '└╴',
|
||||||
|
fold_open = ' ',
|
||||||
|
fold_closed = ' ',
|
||||||
|
ws = ' ',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
local trouble = require 'trouble'
|
||||||
|
|
||||||
|
-- ============================================================
|
||||||
|
-- KEYMAPS
|
||||||
|
-- ============================================================
|
||||||
|
|
||||||
|
-- General diagnostics
|
||||||
|
vim.keymap.set('n', '<leader>xx', function() trouble.toggle 'diagnostics' end, { desc = 'Trouble: Diagnostics' })
|
||||||
|
|
||||||
|
-- Workspace diagnostics
|
||||||
|
vim.keymap.set('n', '<leader>xw', function() trouble.toggle 'workspace_diagnostics' end, { desc = 'Trouble: Workspace Diagnostics' })
|
||||||
|
|
||||||
|
-- Current buffer diagnostics
|
||||||
|
vim.keymap.set('n', '<leader>xd', function() trouble.toggle 'document_diagnostics' end, { desc = 'Trouble: Document Diagnostics' })
|
||||||
|
|
||||||
|
-- Quickfix
|
||||||
|
vim.keymap.set('n', '<leader>xq', function() trouble.toggle 'quickfix' end, { desc = 'Trouble: Quickfix' })
|
||||||
|
|
||||||
|
-- Location list
|
||||||
|
vim.keymap.set('n', '<leader>xl', function() trouble.toggle 'loclist' end, { desc = 'Trouble: Location List' })
|
||||||
|
|
||||||
|
-- LSP references
|
||||||
|
vim.keymap.set('n', 'gr', function() trouble.toggle 'lsp_references' end, { desc = 'Trouble: References' })
|
||||||
|
|
||||||
|
-- Symbols
|
||||||
|
vim.keymap.set('n', '<leader>xs', function() trouble.toggle 'symbols' end, { desc = 'Trouble: Symbols' })
|
||||||
|
|
||||||
|
-- Toggle previous/next diagnostics
|
||||||
|
vim.keymap.set('n', '[x', function() trouble.prev { skip_groups = true, jump = true } end, { desc = 'Previous Trouble Item' })
|
||||||
|
|
||||||
|
vim.keymap.set('n', ']x', function() trouble.next { skip_groups = true, jump = true } end, { desc = 'Next Trouble Item' })
|
||||||
@@ -1,25 +1,82 @@
|
|||||||
-- Neo-tree is a Neovim plugin to browse the file system
|
-- ============================================================
|
||||||
-- https://github.com/nvim-neo-tree/neo-tree.nvim
|
-- NEO-TREE
|
||||||
|
-- File explorer
|
||||||
|
-- ============================================================
|
||||||
|
|
||||||
local plugins = {
|
local plugins = {
|
||||||
{ src = 'https://github.com/nvim-neo-tree/neo-tree.nvim', version = vim.version.range '*' },
|
{
|
||||||
|
src = 'https://github.com/nvim-neo-tree/neo-tree.nvim',
|
||||||
|
version = vim.version.range '*',
|
||||||
|
},
|
||||||
|
|
||||||
'https://github.com/nvim-lua/plenary.nvim',
|
'https://github.com/nvim-lua/plenary.nvim',
|
||||||
'https://github.com/MunifTanjim/nui.nvim',
|
'https://github.com/MunifTanjim/nui.nvim',
|
||||||
}
|
}
|
||||||
|
|
||||||
if vim.g.have_nerd_font then
|
if vim.g.have_nerd_font then table.insert(plugins, 'https://github.com/nvim-tree/nvim-web-devicons') end
|
||||||
table.insert(plugins, 'https://github.com/nvim-tree/nvim-web-devicons') -- not strictly required, but recommended
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.pack.add(plugins)
|
vim.pack.add(plugins)
|
||||||
|
|
||||||
vim.keymap.set('n', '\\', '<Cmd>Neotree reveal<CR>', { desc = 'NeoTree reveal', silent = true })
|
-- ============================================================
|
||||||
|
-- KEYMAPS
|
||||||
|
-- ============================================================
|
||||||
|
|
||||||
|
vim.keymap.set('n', '<leader>e', '<Cmd>Neotree toggle<CR>', {
|
||||||
|
desc = 'Toggle NeoTree',
|
||||||
|
silent = true,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- ============================================================
|
||||||
|
-- SETUP
|
||||||
|
-- ============================================================
|
||||||
|
|
||||||
require('neo-tree').setup {
|
require('neo-tree').setup {
|
||||||
|
close_if_last_window = true,
|
||||||
|
|
||||||
|
popup_border_style = 'rounded',
|
||||||
|
|
||||||
|
enable_git_status = true,
|
||||||
|
enable_diagnostics = true,
|
||||||
|
|
||||||
filesystem = {
|
filesystem = {
|
||||||
|
filtered_items = {
|
||||||
|
visible = false,
|
||||||
|
hide_dotfiles = false,
|
||||||
|
hide_gitignored = false,
|
||||||
|
},
|
||||||
|
|
||||||
|
follow_current_file = {
|
||||||
|
enabled = true,
|
||||||
|
},
|
||||||
|
|
||||||
|
use_libuv_file_watcher = true,
|
||||||
|
|
||||||
window = {
|
window = {
|
||||||
|
width = 32,
|
||||||
|
|
||||||
mappings = {
|
mappings = {
|
||||||
['\\'] = 'close_window',
|
['<leader>e'] = 'close_window',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
default_component_configs = {
|
||||||
|
indent = {
|
||||||
|
with_markers = true,
|
||||||
|
indent_size = 2,
|
||||||
|
},
|
||||||
|
|
||||||
|
git_status = {
|
||||||
|
symbols = {
|
||||||
|
added = '✚',
|
||||||
|
modified = '',
|
||||||
|
deleted = '✖',
|
||||||
|
renamed = '',
|
||||||
|
untracked = '',
|
||||||
|
ignored = '',
|
||||||
|
unstaged = '',
|
||||||
|
staged = '',
|
||||||
|
conflict = '',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user