131 lines
5.3 KiB
Lua
131 lines
5.3 KiB
Lua
-- ============================================================
|
|
-- SECTION 3: UI / CORE UX PLUGINS
|
|
-- guess-indent, gitsigns, which-key, colorscheme, todo-comments, mini modules
|
|
-- ============================================================
|
|
|
|
do
|
|
-- [[ Installing and Configuring Plugins ]]
|
|
--
|
|
-- To install a plugin simply call `vim.pack.add` with its git url.
|
|
-- This will download the default branch of the plugin, which will usually be `main` or `master`
|
|
-- You can also have more advanced specs, which we will talk about later.
|
|
--
|
|
-- For most plugins its not enough to install them, you also need to call their `.setup()` to start them.
|
|
--
|
|
-- For example, lets say we want to install `guess-indent.nvim` - a plugin for
|
|
-- automatically detecting and setting the indentation.
|
|
--
|
|
-- We first install it from https://github.com/NMAC427/guess-indent.nvim
|
|
-- and then call its `setup()` function to start it with default settings.
|
|
vim.pack.add { gh 'NMAC427/guess-indent.nvim' }
|
|
safe_require 'guess-indent'
|
|
|
|
-- Because lua is a real programming language, you can also have some logic to your installation -
|
|
-- like only installing a plugin if a condition is met.
|
|
--
|
|
-- Here we only install `nvim-web-devicons` (which adds pretty icons) if we have a Nerd Font,
|
|
-- since otherwise the icons won't display properly.
|
|
if vim.g.have_nerd_font then vim.pack.add { gh 'nvim-tree/nvim-web-devicons' } end
|
|
|
|
-- Here is a more advanced configuration example that passes options to `gitsigns.nvim`
|
|
--
|
|
-- See `:help gitsigns` to understand what each configuration key does.
|
|
-- Adds git related signs to the gutter, as well as utilities for managing changes
|
|
vim.pack.add { gh 'lewis6991/gitsigns.nvim' }
|
|
safe_require('gitsigns', {
|
|
signs = {
|
|
add = { text = '+' }, ---@diagnostic disable-line: missing-fields
|
|
change = { text = '~' }, ---@diagnostic disable-line: missing-fields
|
|
delete = { text = '_' }, ---@diagnostic disable-line: missing-fields
|
|
topdelete = { text = '‾' }, ---@diagnostic disable-line: missing-fields
|
|
changedelete = { text = '~' }, ---@diagnostic disable-line: missing-fields
|
|
},
|
|
})
|
|
|
|
-- Useful plugin to show you pending keybinds.
|
|
vim.pack.add { gh 'folke/which-key.nvim' }
|
|
safe_require('which-key', {
|
|
-- 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' } },
|
|
},
|
|
})
|
|
|
|
-- [[ Colorscheme ]]
|
|
-- You can easily change to a different colorscheme.
|
|
-- Change the name of the colorscheme plugin below, and then
|
|
-- change the command under that to load whatever the name of that colorscheme is.
|
|
--
|
|
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
|
|
vim.pack.add { gh 'folke/tokyonight.nvim' }
|
|
safe_require('tokyonight', {
|
|
styles = {
|
|
comments = { italic = false }, -- Disable italics in comments
|
|
},
|
|
}, function(_)
|
|
-- Load the colorscheme here.
|
|
-- Like many other themes, this one has different styles, and you could load
|
|
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
|
|
vim.cmd.colorscheme 'tokyonight-night'
|
|
end)
|
|
|
|
-- vim.pack.add { gh 'catppuccin/nvim' }
|
|
-- vim.cmd.colorscheme 'catppuccin-nvim'
|
|
--
|
|
-- -- Highlight todo, notes, etc in comments
|
|
-- vim.pack.add { gh 'folke/todo-comments.nvim' }
|
|
-- safe_require('todo-comments', { signs = false })
|
|
--
|
|
-- [[ mini.nvim ]]
|
|
-- A collection of various small independent plugins/modules
|
|
vim.pack.add { gh 'nvim-mini/mini.nvim' }
|
|
vim.cmd.packadd 'mini.nvim'
|
|
|
|
-- Better Around/Inside textobjects
|
|
--
|
|
-- Examples:
|
|
-- - va) - [V]isually select [A]round [)]paren
|
|
-- - yiiq - [Y]ank [I]nside [I]+1 [Q]uote
|
|
-- - ci' - [C]hange [I]nside [']quote
|
|
safe_require('mini.ai', {
|
|
-- NOTE: Avoid conflicts with the built-in incremental selection mappings on Neovim>=0.12 (see `:help treesitter-incremental-selection`)
|
|
mappings = {
|
|
around_next = 'aa',
|
|
inside_next = 'ii',
|
|
},
|
|
n_lines = 500,
|
|
})
|
|
|
|
-- Add/delete/replace surroundings (brackets, quotes, etc.)
|
|
--
|
|
-- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren
|
|
-- - sd' - [S]urround [D]elete [']quotes
|
|
-- - sr)' - [S]urround [R]eplace [)] [']
|
|
safe_require 'mini.surround'
|
|
|
|
-- Simple and easy statusline.
|
|
-- You could remove this setup call if you don't like it,
|
|
-- and try some other statusline plugin
|
|
-- Set `use_icons` to true if you have a Nerd Font
|
|
-- You can configure sections in the statusline by overriding their
|
|
-- default behavior. For example, here we set the section for
|
|
-- cursor location to LINE:COLUMN
|
|
---@diagnostic disable-next-line: duplicate-set-field
|
|
-- ... and there is more!
|
|
-- Check out: https://github.com/nvim-mini/mini.nvim
|
|
safe_require('mini.statusline', { use_icons = vim.g.have_nerd_font }, function(statusline)
|
|
statusline.section_location = function() return '%2l:%-2v' end
|
|
end)
|
|
|
|
-- vim.pack.add {
|
|
-- { src = 'https://github.com/nvim-mini/mini.files', version = 'stable' },
|
|
-- }
|
|
-- safe_require 'mini.files'
|
|
end
|