decent config ngl
This commit is contained in:
parent
285c67a2a9
commit
a269e21cbc
44
init.lua
44
init.lua
|
@ -196,19 +196,28 @@ vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right win
|
||||||
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' })
|
||||||
|
|
||||||
-- [[ Basic Autocommands ]]
|
-- markdown keybinds
|
||||||
-- See `:help lua-guide-autocommands`
|
on_attach =
|
||||||
|
function(bufnr)
|
||||||
-- Highlight when yanking (copying) text
|
local map = vim.keymap.set
|
||||||
-- Try it with `yap` in normal mode
|
local opts = { buffer = bufnr }
|
||||||
-- See `:help vim.highlight.on_yank()`
|
map({ 'n', 'i' }, '<M-l><M-o>', '<Cmd>MDListItemBelow<CR>', opts)
|
||||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
map({ 'n', 'i' }, '<M-L><M-O>', '<Cmd>MDListItemAbove<CR>', opts)
|
||||||
desc = 'Highlight when yanking (copying) text',
|
map('n', '<M-c>', '<Cmd>MDTaskToggle<CR>', opts)
|
||||||
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
|
map('x', '<M-c>', ':MDTaskToggle<CR>', opts)
|
||||||
callback = function()
|
|
||||||
vim.highlight.on_yank()
|
|
||||||
end,
|
end,
|
||||||
})
|
-- [[ Basic Autocommands ]]
|
||||||
|
-- See `:help lua-guide-autocommands`
|
||||||
|
-- Highlight when yanking (copying) text
|
||||||
|
-- Try it with `yap` in normal mode
|
||||||
|
-- See `:help vim.highlight.on_yank()`
|
||||||
|
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||||
|
desc = 'Highlight when yanking (copying) text',
|
||||||
|
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
|
||||||
|
callback = function()
|
||||||
|
vim.highlight.on_yank()
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
-- [[ Install `lazy.nvim` plugin manager ]]
|
-- [[ Install `lazy.nvim` plugin manager ]]
|
||||||
-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
|
-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
|
||||||
|
@ -486,6 +495,12 @@ require('lazy').setup({
|
||||||
'hrsh7th/cmp-nvim-lsp',
|
'hrsh7th/cmp-nvim-lsp',
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
|
-- personal setup for bracket autocompletion
|
||||||
|
|
||||||
|
local cmp_autopairs = require 'nvim-autopairs.completion.cmp'
|
||||||
|
local cmp = require 'cmp'
|
||||||
|
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
|
||||||
|
|
||||||
-- Brief aside: **What is LSP?**
|
-- Brief aside: **What is LSP?**
|
||||||
--
|
--
|
||||||
-- LSP is an initialism you've probably heard, but might not understand what it is.
|
-- LSP is an initialism you've probably heard, but might not understand what it is.
|
||||||
|
@ -561,6 +576,9 @@ require('lazy').setup({
|
||||||
-- or a suggestion from your LSP for this to activate.
|
-- or a suggestion from your LSP for this to activate.
|
||||||
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' })
|
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' })
|
||||||
|
|
||||||
|
-- open explorer
|
||||||
|
map('<leader>E', ':NvimTreeOpen<CR>', '[E]xplorer')
|
||||||
|
|
||||||
-- WARN: This is not Goto Definition, this is Goto Declaration.
|
-- WARN: This is not Goto Definition, this is Goto Declaration.
|
||||||
-- For example, in C this would take you to the header.
|
-- For example, in C this would take you to the header.
|
||||||
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
||||||
|
@ -841,7 +859,7 @@ require('lazy').setup({
|
||||||
-- Accept ([y]es) the completion.
|
-- Accept ([y]es) the completion.
|
||||||
-- This will auto-import if your LSP supports it.
|
-- This will auto-import if your LSP supports it.
|
||||||
-- This will expand snippets if the LSP sent a snippet.
|
-- This will expand snippets if the LSP sent a snippet.
|
||||||
['<C-y>'] = cmp.mapping.confirm { select = true },
|
['<Tab>'] = cmp.mapping.confirm { select = true },
|
||||||
|
|
||||||
-- If you prefer more traditional completion keymaps,
|
-- If you prefer more traditional completion keymaps,
|
||||||
-- you can uncomment the following lines
|
-- you can uncomment the following lines
|
||||||
|
|
|
@ -3,197 +3,247 @@
|
||||||
--
|
--
|
||||||
-- See the kickstart.nvim README for more information
|
-- See the kickstart.nvim README for more information
|
||||||
return {
|
return {
|
||||||
'folke/snacks.nvim',
|
-- snacks type shit
|
||||||
lazy = false,
|
{
|
||||||
priority = 1000,
|
'folke/snacks.nvim',
|
||||||
---@type snacks.Config
|
lazy = false,
|
||||||
opts = {
|
priority = 1000,
|
||||||
bigfile = { enabled = true },
|
---@type snacks.Config
|
||||||
dashboard = { enabled = true },
|
opts = {
|
||||||
explorer = { enabled = true },
|
bigfile = { enabled = true },
|
||||||
indent = { enabled = true },
|
dashboard = { enabled = true },
|
||||||
input = { enabled = true },
|
explorer = { enabled = true },
|
||||||
notifier = {
|
indent = { enabled = true },
|
||||||
enabled = true,
|
input = { enabled = true },
|
||||||
timeout = 3000,
|
notifier = {
|
||||||
},
|
enabled = true,
|
||||||
picker = { enabled = true },
|
timeout = 3000,
|
||||||
quickfile = { enabled = true },
|
},
|
||||||
scope = { enabled = true },
|
picker = { enabled = true },
|
||||||
scroll = { enabled = true },
|
quickfile = { enabled = true },
|
||||||
statuscolumn = { enabled = true },
|
scope = { enabled = true },
|
||||||
words = { enabled = true },
|
statuscolumn = { enabled = true },
|
||||||
styles = {
|
words = { enabled = true },
|
||||||
notification = {
|
styles = {
|
||||||
-- wo = { wrap = true } -- Wrap notifications
|
notification = {
|
||||||
|
-- wo = { wrap = true } -- Wrap notifications
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
keys = {
|
||||||
keys = {
|
-- git
|
||||||
-- git
|
{
|
||||||
{
|
'<leader>gb',
|
||||||
'<leader>gb',
|
function()
|
||||||
function()
|
Snacks.picker.git_branches()
|
||||||
Snacks.picker.git_branches()
|
end,
|
||||||
end,
|
desc = 'Git Branches',
|
||||||
desc = 'Git Branches',
|
},
|
||||||
|
{
|
||||||
|
'<leader>gl',
|
||||||
|
function()
|
||||||
|
Snacks.picker.git_log()
|
||||||
|
end,
|
||||||
|
desc = 'Git Log',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<leader>gL',
|
||||||
|
function()
|
||||||
|
Snacks.picker.git_log_line()
|
||||||
|
end,
|
||||||
|
desc = 'Git Log Line',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<leader>gs',
|
||||||
|
function()
|
||||||
|
Snacks.picker.git_status()
|
||||||
|
end,
|
||||||
|
desc = 'Git Status',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<leader>gS',
|
||||||
|
function()
|
||||||
|
Snacks.picker.git_stash()
|
||||||
|
end,
|
||||||
|
desc = 'Git Stash',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<leader>gd',
|
||||||
|
function()
|
||||||
|
Snacks.picker.git_diff()
|
||||||
|
end,
|
||||||
|
desc = 'Git Diff (Hunks)',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<leader>gf',
|
||||||
|
function()
|
||||||
|
Snacks.picker.git_log_file()
|
||||||
|
end,
|
||||||
|
desc = 'Git Log File',
|
||||||
|
},
|
||||||
|
-- Grep
|
||||||
|
{
|
||||||
|
'<leader>sb',
|
||||||
|
function()
|
||||||
|
Snacks.picker.lines()
|
||||||
|
end,
|
||||||
|
desc = 'Buffer Lines',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<leader>sB',
|
||||||
|
function()
|
||||||
|
Snacks.picker.grep_buffers()
|
||||||
|
end,
|
||||||
|
desc = 'Grep Open Buffers',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<leader>sg',
|
||||||
|
function()
|
||||||
|
Snacks.picker.grep()
|
||||||
|
end,
|
||||||
|
desc = 'Grep',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<leader>sw',
|
||||||
|
function()
|
||||||
|
Snacks.picker.grep_word()
|
||||||
|
end,
|
||||||
|
desc = 'Visual selection or word',
|
||||||
|
mode = { 'n', 'x' },
|
||||||
|
},
|
||||||
|
-- Other
|
||||||
|
{
|
||||||
|
'<leader>z',
|
||||||
|
function()
|
||||||
|
Snacks.zen()
|
||||||
|
end,
|
||||||
|
desc = 'Toggle Zen Mode',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<leader>gB',
|
||||||
|
function()
|
||||||
|
Snacks.gitbrowse()
|
||||||
|
end,
|
||||||
|
desc = 'Git Browse',
|
||||||
|
mode = { 'n', 'v' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<leader>gg',
|
||||||
|
function()
|
||||||
|
Snacks.lazygit()
|
||||||
|
end,
|
||||||
|
desc = 'Lazygit',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
']]',
|
||||||
|
function()
|
||||||
|
Snacks.words.jump(vim.v.count1)
|
||||||
|
end,
|
||||||
|
desc = 'Next Reference',
|
||||||
|
mode = { 'n', 't' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'[[',
|
||||||
|
function()
|
||||||
|
Snacks.words.jump(-vim.v.count1)
|
||||||
|
end,
|
||||||
|
desc = 'Prev Reference',
|
||||||
|
mode = { 'n', 't' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<leader>N',
|
||||||
|
desc = 'Neovim News',
|
||||||
|
function()
|
||||||
|
Snacks.win {
|
||||||
|
file = vim.api.nvim_get_runtime_file('doc/news.txt', false)[1],
|
||||||
|
width = 0.6,
|
||||||
|
height = 0.6,
|
||||||
|
wo = {
|
||||||
|
spell = false,
|
||||||
|
wrap = false,
|
||||||
|
signcolumn = 'yes',
|
||||||
|
statuscolumn = ' ',
|
||||||
|
conceallevel = 3,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
init = function()
|
||||||
'<leader>gl',
|
vim.api.nvim_create_autocmd('User', {
|
||||||
function()
|
pattern = 'VeryLazy',
|
||||||
Snacks.picker.git_log()
|
callback = function()
|
||||||
end,
|
-- Setup some globals for debugging (lazy-loaded)
|
||||||
desc = 'Git Log',
|
_G.dd = function(...)
|
||||||
},
|
Snacks.debug.inspect(...)
|
||||||
{
|
end
|
||||||
'<leader>gL',
|
_G.bt = function()
|
||||||
function()
|
Snacks.debug.backtrace()
|
||||||
Snacks.picker.git_log_line()
|
end
|
||||||
end,
|
vim.print = _G.dd -- Override print to use snacks for `:=` command
|
||||||
desc = 'Git Log Line',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'<leader>gs',
|
|
||||||
function()
|
|
||||||
Snacks.picker.git_status()
|
|
||||||
end,
|
|
||||||
desc = 'Git Status',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'<leader>gS',
|
|
||||||
function()
|
|
||||||
Snacks.picker.git_stash()
|
|
||||||
end,
|
|
||||||
desc = 'Git Stash',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'<leader>gd',
|
|
||||||
function()
|
|
||||||
Snacks.picker.git_diff()
|
|
||||||
end,
|
|
||||||
desc = 'Git Diff (Hunks)',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'<leader>gf',
|
|
||||||
function()
|
|
||||||
Snacks.picker.git_log_file()
|
|
||||||
end,
|
|
||||||
desc = 'Git Log File',
|
|
||||||
},
|
|
||||||
-- Grep
|
|
||||||
{
|
|
||||||
'<leader>sb',
|
|
||||||
function()
|
|
||||||
Snacks.picker.lines()
|
|
||||||
end,
|
|
||||||
desc = 'Buffer Lines',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'<leader>sB',
|
|
||||||
function()
|
|
||||||
Snacks.picker.grep_buffers()
|
|
||||||
end,
|
|
||||||
desc = 'Grep Open Buffers',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'<leader>sg',
|
|
||||||
function()
|
|
||||||
Snacks.picker.grep()
|
|
||||||
end,
|
|
||||||
desc = 'Grep',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'<leader>sw',
|
|
||||||
function()
|
|
||||||
Snacks.picker.grep_word()
|
|
||||||
end,
|
|
||||||
desc = 'Visual selection or word',
|
|
||||||
mode = { 'n', 'x' },
|
|
||||||
},
|
|
||||||
-- Other
|
|
||||||
{
|
|
||||||
'<leader>z',
|
|
||||||
function()
|
|
||||||
Snacks.zen()
|
|
||||||
end,
|
|
||||||
desc = 'Toggle Zen Mode',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'<leader>gB',
|
|
||||||
function()
|
|
||||||
Snacks.gitbrowse()
|
|
||||||
end,
|
|
||||||
desc = 'Git Browse',
|
|
||||||
mode = { 'n', 'v' },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'<leader>gg',
|
|
||||||
function()
|
|
||||||
Snacks.lazygit()
|
|
||||||
end,
|
|
||||||
desc = 'Lazygit',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
']]',
|
|
||||||
function()
|
|
||||||
Snacks.words.jump(vim.v.count1)
|
|
||||||
end,
|
|
||||||
desc = 'Next Reference',
|
|
||||||
mode = { 'n', 't' },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'[[',
|
|
||||||
function()
|
|
||||||
Snacks.words.jump(-vim.v.count1)
|
|
||||||
end,
|
|
||||||
desc = 'Prev Reference',
|
|
||||||
mode = { 'n', 't' },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'<leader>N',
|
|
||||||
desc = 'Neovim News',
|
|
||||||
function()
|
|
||||||
Snacks.win {
|
|
||||||
file = vim.api.nvim_get_runtime_file('doc/news.txt', false)[1],
|
|
||||||
width = 0.6,
|
|
||||||
height = 0.6,
|
|
||||||
wo = {
|
|
||||||
spell = false,
|
|
||||||
wrap = false,
|
|
||||||
signcolumn = 'yes',
|
|
||||||
statuscolumn = ' ',
|
|
||||||
conceallevel = 3,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
init = function()
|
|
||||||
vim.api.nvim_create_autocmd('User', {
|
|
||||||
pattern = 'VeryLazy',
|
|
||||||
callback = function()
|
|
||||||
-- Setup some globals for debugging (lazy-loaded)
|
|
||||||
_G.dd = function(...)
|
|
||||||
Snacks.debug.inspect(...)
|
|
||||||
end
|
|
||||||
_G.bt = function()
|
|
||||||
Snacks.debug.backtrace()
|
|
||||||
end
|
|
||||||
vim.print = _G.dd -- Override print to use snacks for `:=` command
|
|
||||||
|
|
||||||
-- Create some toggle mappings
|
-- Create some toggle mappings
|
||||||
Snacks.toggle.option('spell', { name = 'Spelling' }):map '<leader>us'
|
Snacks.toggle.option('spell', { name = 'Spelling' }):map '<leader>us'
|
||||||
Snacks.toggle.option('wrap', { name = 'Wrap' }):map '<leader>uw'
|
Snacks.toggle.option('wrap', { name = 'Wrap' }):map '<leader>uw'
|
||||||
Snacks.toggle.option('relativenumber', { name = 'Relative Number' }):map '<leader>uL'
|
Snacks.toggle.option('relativenumber', { name = 'Relative Number' }):map '<leader>uL'
|
||||||
Snacks.toggle.diagnostics():map '<leader>ud'
|
Snacks.toggle.diagnostics():map '<leader>ud'
|
||||||
Snacks.toggle.line_number():map '<leader>ul'
|
Snacks.toggle.line_number():map '<leader>ul'
|
||||||
Snacks.toggle.option('conceallevel', { off = 0, on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2 }):map '<leader>uc'
|
Snacks.toggle.option('conceallevel', { off = 0, on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2 }):map '<leader>uc'
|
||||||
Snacks.toggle.treesitter():map '<leader>uT'
|
Snacks.toggle.treesitter():map '<leader>uT'
|
||||||
Snacks.toggle.option('background', { off = 'light', on = 'dark', name = 'Dark Background' }):map '<leader>ub'
|
Snacks.toggle.option('background', { off = 'light', on = 'dark', name = 'Dark Background' }):map '<leader>ub'
|
||||||
Snacks.toggle.inlay_hints():map '<leader>uh'
|
Snacks.toggle.inlay_hints():map '<leader>uh'
|
||||||
Snacks.toggle.indent():map '<leader>ug'
|
Snacks.toggle.indent():map '<leader>ug'
|
||||||
Snacks.toggle.dim():map '<leader>uD'
|
Snacks.toggle.dim():map '<leader>uD'
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- bracket autocomplete
|
||||||
|
{
|
||||||
|
'windwp/nvim-autopairs',
|
||||||
|
event = 'InsertEnter',
|
||||||
|
config = true,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- typst preview
|
||||||
|
{
|
||||||
|
'chomosuke/typst-preview.nvim',
|
||||||
|
lazy = false,
|
||||||
|
version = '1.*',
|
||||||
|
opts = {},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- mini
|
||||||
|
{ 'echasnovski/mini.nvim', version = '*' },
|
||||||
|
|
||||||
|
-- file explorer
|
||||||
|
{
|
||||||
|
'nvim-tree/nvim-tree.lua',
|
||||||
|
version = '*',
|
||||||
|
lazy = false,
|
||||||
|
dependencies = {
|
||||||
|
'nvim-tree/nvim-web-devicons',
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require('nvim-tree').setup {}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- markdown stuff
|
||||||
|
{
|
||||||
|
'tadmccorkle/markdown.nvim',
|
||||||
|
ft = 'markdown', -- or 'event = "VeryLazy"'
|
||||||
|
opts = {
|
||||||
|
-- configuration here or empty for defaults
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
'MeanderingProgrammer/render-markdown.nvim',
|
||||||
|
dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.nvim' }, -- if you use the mini.nvim suite
|
||||||
|
---@module 'render-markdown'
|
||||||
|
---@type render.md.UserConfig
|
||||||
|
opts = {},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue