Remove lazy in favour of mini.deps
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
require('config.opts')
|
||||
require('config.maps')
|
||||
require('config.autocmds')
|
||||
require('config.lazy')
|
||||
require('config.plug')
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
-- bootstrap lazy
|
||||
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
|
||||
local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo({
|
||||
{ 'Failed to clone lazy.nvim:\n', 'ErrorMsg' },
|
||||
{ out, 'WarningMsg' },
|
||||
}, true, {})
|
||||
return 1
|
||||
end
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require('lazy').setup({
|
||||
change_detection = { enabled = false },
|
||||
defaults = {
|
||||
lazy = true,
|
||||
},
|
||||
spec = { { import = 'plugin' } },
|
||||
})
|
||||
|
||||
Map('n', '<leader>L', '<cmd>Lazy<cr>', { desc = 'open Lazy' })
|
||||
26
.config/nvim/lua/config/plug.lua
Normal file
26
.config/nvim/lua/config/plug.lua
Normal file
@@ -0,0 +1,26 @@
|
||||
-- Clone 'mini.nvim' manually in a way that it gets managed by 'mini.deps'
|
||||
local pkgpat = vim.fn.stdpath('data') .. '/site/'
|
||||
local minipat = pkgpat .. 'pack/deps/start/mini.nvim'
|
||||
if not vim.uv.fs_stat(minipat) then
|
||||
vim.cmd('echo "Installing [`mini.nvim`](../doc/mini-nvim.qmd#mini.nvim)" | redraw')
|
||||
local clone_cmd = {
|
||||
'git', 'clone', '--filter=blob:none',
|
||||
'https://github.com/nvim-mini/mini.nvim', minipat
|
||||
}
|
||||
vim.fn.system(clone_cmd)
|
||||
vim.cmd('packadd mini.nvim | helptags ALL')
|
||||
vim.cmd('echo "Installed [`mini.nvim`](../doc/mini-nvim.qmd#mini.nvim)" | redraw')
|
||||
end
|
||||
require('mini.deps').setup({ path = { package = pkgpat } })
|
||||
|
||||
require('plugin.auto-session')
|
||||
require('plugin.blink-cmp')
|
||||
require('plugin.conform')
|
||||
require('plugin.gruvbox')
|
||||
require('plugin.lazydev')
|
||||
require('plugin.lspconfig')
|
||||
require('plugin.luasnip')
|
||||
require('plugin.mini')
|
||||
require('plugin.nvim-lint')
|
||||
require('plugin.nvim-treesitter')
|
||||
require('plugin.toggleterm')
|
||||
@@ -1,44 +1,37 @@
|
||||
---@type LazySpec
|
||||
return {
|
||||
"rmagatti/auto-session",
|
||||
lazy = false,
|
||||
priority = 100,
|
||||
---@module "auto-session"
|
||||
---@type AutoSession.Config
|
||||
opts = {
|
||||
enabled = true,
|
||||
auto_save = true,
|
||||
auto_create = true,
|
||||
auto_restore = true,
|
||||
auto_restore_last_session = false,
|
||||
cwd_change_handling = true,
|
||||
single_session_mode = false,
|
||||
close_unsupported_windows = true,
|
||||
suppressed_dirs = { '~/', '~/software/', '~/downloads/', '~/desktop/', '/etc/' },
|
||||
close_filetypes_on_save = { 'checkhealth', 'man', 'oil' },
|
||||
bypass_save_filetypes = { 'netrw', 'oil' },
|
||||
MiniDeps.add({ source = 'https://github.com/rmagatti/auto-session' })
|
||||
|
||||
auto_delete_empty_sessions = true,
|
||||
purge_after_minutes = 14 * 24 * 60,
|
||||
local path = vim.fn.argv(0)
|
||||
if not path or type(path) ~= 'string' then return end
|
||||
|
||||
lazy_support = true,
|
||||
legacy_cmds = false,
|
||||
args_allow_single_directory = true,
|
||||
args_allow_files_auto_save = false,
|
||||
local realpath = vim.uv.fs_realpath(path)
|
||||
if not realpath then return end
|
||||
|
||||
-- log_level = 'debug',
|
||||
show_auto_restore_notif = true,
|
||||
},
|
||||
init = function()
|
||||
local path = vim.fn.argv(0)
|
||||
if not path or type(path) ~= 'string' then return end
|
||||
if vim.fn.isdirectory(realpath) ~= 1 then return end
|
||||
vim.fn.chdir(realpath)
|
||||
|
||||
local realpath = vim.uv.fs_realpath(path)
|
||||
if not realpath then return end
|
||||
vim.notify("loaded directory: '" .. realpath .. "'", vim.log.levels.INFO)
|
||||
|
||||
if vim.fn.isdirectory(realpath) ~= 1 then return end
|
||||
vim.fn.chdir(realpath)
|
||||
require('auto-session').setup({
|
||||
enabled = true,
|
||||
auto_save = true,
|
||||
auto_create = true,
|
||||
auto_restore = true,
|
||||
auto_restore_last_session = false,
|
||||
cwd_change_handling = true,
|
||||
single_session_mode = false,
|
||||
close_unsupported_windows = true,
|
||||
suppressed_dirs = { '~/', '~/software/', '~/downloads/', '~/desktop/', '/etc/' },
|
||||
close_filetypes_on_save = { 'checkhealth', 'man', 'oil' },
|
||||
bypass_save_filetypes = { 'netrw', 'oil' },
|
||||
|
||||
vim.notify("loaded directory: '" .. realpath .. "'", vim.log.levels.INFO)
|
||||
end,
|
||||
}
|
||||
auto_delete_empty_sessions = true,
|
||||
purge_after_minutes = 14 * 24 * 60,
|
||||
|
||||
lazy_support = true,
|
||||
legacy_cmds = false,
|
||||
args_allow_single_directory = true,
|
||||
args_allow_files_auto_save = false,
|
||||
|
||||
-- log_level = 'debug',
|
||||
show_auto_restore_notif = true,
|
||||
})
|
||||
|
||||
@@ -1,69 +1,70 @@
|
||||
---@module 'lazy'
|
||||
---@type LazySpec
|
||||
return { {
|
||||
'saghen/blink.cmp',
|
||||
event = 'InsertEnter',
|
||||
version = '*',
|
||||
build = 'cargo build --release',
|
||||
dependencies = {
|
||||
'saghen/blink.compat',
|
||||
local function build_blink(params)
|
||||
vim.notify('Building blink.cmp', vim.log.levels.INFO)
|
||||
local obj = vim.system({ 'cargo', 'build', '--release' }, { cwd = params.path }):wait()
|
||||
if obj.code == 0 then
|
||||
vim.notify('Building blink.cmp done', vim.log.levels.INFO)
|
||||
else
|
||||
vim.notify('Building blink.cmp failed', vim.log.levels.ERROR)
|
||||
end
|
||||
end
|
||||
MiniDeps.add({
|
||||
source = 'https://github.com/saghen/blink.cmp',
|
||||
hooks = {
|
||||
post_install = build_blink,
|
||||
post_checkout = build_blink,
|
||||
},
|
||||
---@module 'blink.cmp'
|
||||
---@type blink.cmp.Config
|
||||
opts = {
|
||||
keymap = {
|
||||
preset = 'none',
|
||||
['<tab>'] = { 'accept', 'fallback' }, -- accept the snippet
|
||||
['<c-space>'] = { 'show', 'show_documentation', 'hide_documentation' }, -- toggle auto-cmp manually
|
||||
['<c-k>'] = { 'show_signature', 'hide_signature', 'fallback' }, -- toggle signature
|
||||
['<c-n>'] = { 'select_next', 'fallback' }, -- next item
|
||||
['<c-p>'] = { 'select_prev', 'fallback' }, -- previous item
|
||||
['<c-f>'] = { 'scroll_documentation_down', 'fallback' }, -- forwards into the docs
|
||||
['<c-b>'] = { 'scroll_documentation_up', 'fallback' }, -- backwards into the docs
|
||||
['<c-e>'] = { 'cancel', 'fallback' }, -- keybind for cancelling completion
|
||||
},
|
||||
snippets = { preset = 'luasnip' },
|
||||
sources = {
|
||||
default = { 'lsp', 'path', 'snippets' },
|
||||
},
|
||||
completion = {
|
||||
menu = {
|
||||
auto_show = true, -- whether to automatically show the window when new completion items are available
|
||||
border = 'rounded',
|
||||
draw = {
|
||||
columns = { { "kind_icon" }, { "label", "label_description", gap = 1 }, { 'kind' } },
|
||||
treesitter = { 'lsp', 'snippets' },
|
||||
},
|
||||
})
|
||||
|
||||
require('blink.cmp').setup({
|
||||
keymap = {
|
||||
preset = 'none',
|
||||
['<tab>'] = { 'accept', 'fallback' }, -- accept the snippet
|
||||
['<c-space>'] = { 'show', 'show_documentation', 'hide_documentation' }, -- toggle auto-cmp manually
|
||||
['<c-k>'] = { 'show_signature', 'hide_signature', 'fallback' }, -- toggle signature
|
||||
['<c-n>'] = { 'select_next', 'fallback' }, -- next item
|
||||
['<c-p>'] = { 'select_prev', 'fallback' }, -- previous item
|
||||
['<c-f>'] = { 'scroll_documentation_down', 'fallback' }, -- forwards into the docs
|
||||
['<c-b>'] = { 'scroll_documentation_up', 'fallback' }, -- backwards into the docs
|
||||
['<c-e>'] = { 'cancel', 'fallback' }, -- keybind for cancelling completion
|
||||
},
|
||||
snippets = { preset = 'luasnip' },
|
||||
sources = {
|
||||
default = { 'lsp', 'path', 'snippets' },
|
||||
},
|
||||
completion = {
|
||||
menu = {
|
||||
auto_show = true, -- whether to automatically show the window when new completion items are available
|
||||
border = 'rounded',
|
||||
draw = {
|
||||
columns = { { "kind_icon" }, { "label", "label_description", gap = 1 }, { 'kind' } },
|
||||
treesitter = { 'lsp', 'snippets' },
|
||||
},
|
||||
documentation = {
|
||||
auto_show = true, -- whether documentation is automatically shown when selecting a completion item
|
||||
auto_show_delay_ms = 250,
|
||||
treesitter_highlighting = true,
|
||||
window = { border = "rounded" },
|
||||
},
|
||||
list = { selection = { preselect = true, auto_insert = true } },
|
||||
trigger = {
|
||||
show_on_insert_on_trigger_character = true,
|
||||
show_on_accept_on_trigger_character = true,
|
||||
show_in_snippet = false,
|
||||
},
|
||||
ghost_text = {
|
||||
enabled = true,
|
||||
show_with_selection = false, -- whether the ghost text is shown when an item is selected
|
||||
show_without_selection = true, -- whether the ghost text is shown when no item is selected
|
||||
show_with_menu = true, -- show ghost text when the menu is open
|
||||
show_without_menu = true, -- show ghost text when the menu is closed
|
||||
}
|
||||
},
|
||||
fuzzy = {
|
||||
use_proximity = true,
|
||||
frecency = { enabled = true, },
|
||||
prebuilt_binaries = {
|
||||
download = false, -- we are building from source
|
||||
}
|
||||
documentation = {
|
||||
auto_show = true, -- whether documentation is automatically shown when selecting a completion item
|
||||
auto_show_delay_ms = 250,
|
||||
treesitter_highlighting = true,
|
||||
window = { border = "rounded" },
|
||||
},
|
||||
list = { selection = { preselect = true, auto_insert = true } },
|
||||
trigger = {
|
||||
show_on_insert_on_trigger_character = true,
|
||||
show_on_accept_on_trigger_character = true,
|
||||
show_in_snippet = false,
|
||||
},
|
||||
ghost_text = {
|
||||
enabled = true,
|
||||
show_with_selection = false, -- whether the ghost text is shown when an item is selected
|
||||
show_without_selection = true, -- whether the ghost text is shown when no item is selected
|
||||
show_with_menu = true, -- show ghost text when the menu is open
|
||||
show_without_menu = true, -- show ghost text when the menu is closed
|
||||
}
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("blink.cmp").setup(opts)
|
||||
end
|
||||
} }
|
||||
fuzzy = {
|
||||
use_proximity = true,
|
||||
frecency = { enabled = true, },
|
||||
prebuilt_binaries = {
|
||||
download = true, -- we are building from source
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,38 +1,23 @@
|
||||
---@module 'lazy'
|
||||
---@type LazySpec
|
||||
return { {
|
||||
'stevearc/conform.nvim', -- allows you to format a buffer
|
||||
event = { 'BufWritePre' },
|
||||
cmd = { 'ConformInfo' },
|
||||
keys = {
|
||||
{
|
||||
'<leader>f',
|
||||
function()
|
||||
require('conform').format { async = true, lsp_format = 'fallback' } -- execute the formatter
|
||||
-- vim.cmd [[keepjumps keeppatterns %s/\s\+$//e]] -- removes trailing whitespace
|
||||
end,
|
||||
mode = 'n',
|
||||
desc = '[f]ormat buffer',
|
||||
},
|
||||
MiniDeps.add({ source = 'https://github.com/stevearc/conform.nvim' })
|
||||
require('conform').setup({
|
||||
notify_on_error = true,
|
||||
formatters_by_ft = {
|
||||
c = { 'clang-format' },
|
||||
h = { 'clang-format' },
|
||||
cpp = { 'clang-format' },
|
||||
hpp = { 'clang-format' },
|
||||
glsl = { 'clang-format', lsp_format = "first" },
|
||||
typescript = { 'clang-format', lsp_format = "first" },
|
||||
css = { 'clang-format' },
|
||||
rust = { 'rustfmt' },
|
||||
sh = { 'shfmt' },
|
||||
python = { 'isort' },
|
||||
-- json = { 'jq' },
|
||||
-- yaml = { 'yq' },
|
||||
toml = { 'yq' },
|
||||
xml = { 'yq' },
|
||||
},
|
||||
---@type conform.setupOpts
|
||||
opts = {
|
||||
notify_on_error = true,
|
||||
formatters_by_ft = {
|
||||
c = { 'clang-format' },
|
||||
h = { 'clang-format' },
|
||||
cpp = { 'clang-format' },
|
||||
hpp = { 'clang-format' },
|
||||
glsl = { 'clang-format', lsp_format = "first" },
|
||||
typescript = { 'clang-format', lsp_format = "first" },
|
||||
css = { 'clang-format' },
|
||||
rust = { 'rustfmt' },
|
||||
sh = { 'shfmt' },
|
||||
python = { 'isort' },
|
||||
-- json = { 'jq' },
|
||||
-- yaml = { 'yq' },
|
||||
toml = { 'yq' },
|
||||
xml = { 'yq' },
|
||||
},
|
||||
}
|
||||
} }
|
||||
})
|
||||
Map('n', '<leader>f', function()
|
||||
require('conform').format({ async = true, lsp_format = 'fallback' })
|
||||
end, { desc = 'Format Buffer' })
|
||||
|
||||
@@ -1,32 +1,20 @@
|
||||
---@module 'lazy'
|
||||
---@type LazySpec
|
||||
return { {
|
||||
'ellisonleao/gruvbox.nvim',
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
---@module 'gruvbox'
|
||||
---@type GruvboxConfig
|
||||
opts = {
|
||||
styles = {
|
||||
comments = { italic = true }
|
||||
}
|
||||
},
|
||||
config = function(_, opts)
|
||||
local colour = require('gruvbox')
|
||||
colour.setup(opts)
|
||||
vim.cmd.colorscheme('gruvbox')
|
||||
_G.userdat.palette = colour.palette
|
||||
MiniDeps.add({ source = 'https://github.com/ellisonleao/gruvbox.nvim' })
|
||||
local colour = require('gruvbox')
|
||||
colour.setup({
|
||||
styles = {
|
||||
comments = { italic = true }
|
||||
}
|
||||
})
|
||||
vim.cmd.colorscheme('gruvbox')
|
||||
_G.userdat.palette = colour.palette
|
||||
|
||||
-- non-essential configuration should be put in here
|
||||
Autocmd('VimEnter', {
|
||||
callback =
|
||||
function()
|
||||
-- spell highlight must be grey
|
||||
for _, spell in pairs { 'SpellBad', 'SpellCap', 'SpellRare', 'SpellLocal' } do
|
||||
vim.api.nvim_set_hl(0, spell,
|
||||
{ fg = nil, bg = nil, sp = _G.userdat.palette.gray, undercurl = true })
|
||||
end
|
||||
end
|
||||
})
|
||||
-- non-essential configuration should be put in here
|
||||
Autocmd('VimEnter', {
|
||||
callback = function()
|
||||
-- spell highlight must be grey
|
||||
for _, spell in pairs { 'SpellBad', 'SpellCap', 'SpellRare', 'SpellLocal' } do
|
||||
vim.api.nvim_set_hl(0, spell,
|
||||
{ fg = nil, bg = nil, sp = _G.userdat.palette.gray, undercurl = true })
|
||||
end
|
||||
end
|
||||
} }
|
||||
})
|
||||
|
||||
@@ -1,12 +1,2 @@
|
||||
---@module 'lazy'
|
||||
---@type LazySpec
|
||||
return { {
|
||||
'folke/lazydev.nvim', -- provides the lua LSP for the neovim config.
|
||||
event = 'VeryLazy',
|
||||
ft = 'lua',
|
||||
opts = {
|
||||
library = {
|
||||
{ path = '${3rd}/luv/library', words = { 'vim%.uv' } }, -- load luvit types when the `vim.uv` word is found
|
||||
},
|
||||
},
|
||||
}, }
|
||||
MiniDeps.add({ source = 'https://github.com/folke/lazydev.nvim' })
|
||||
require('lazydev').setup()
|
||||
|
||||
@@ -1,51 +1,41 @@
|
||||
---@module 'lazy'
|
||||
---@type LazySpec
|
||||
return { {
|
||||
'neovim/nvim-lspconfig',
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = { 'saghen/blink.cmp' },
|
||||
---@type table<string, boolean|vim.lsp.Config>
|
||||
opts = {
|
||||
['clangd'] = false,
|
||||
['ccls'] = true,
|
||||
['glsl_analyzer'] = true,
|
||||
['rust_analyzer'] = true,
|
||||
['omnisharp'] = false,
|
||||
['lua_ls'] = true,
|
||||
MiniDeps.add({ source = 'https://github.com/neovim/nvim-lspconfig' })
|
||||
local opts = {
|
||||
['clangd'] = false,
|
||||
['ccls'] = true,
|
||||
['glsl_analyzer'] = true,
|
||||
['rust_analyzer'] = true,
|
||||
['omnisharp'] = false,
|
||||
['lua_ls'] = true,
|
||||
|
||||
['html'] = true,
|
||||
['cssls'] = true,
|
||||
['ts_ls'] = true,
|
||||
['html'] = true,
|
||||
['cssls'] = true,
|
||||
['ts_ls'] = true,
|
||||
|
||||
['jsonls'] = true,
|
||||
['yamlls'] = {
|
||||
settings = {
|
||||
yaml = {
|
||||
schemas = {
|
||||
["https://json.schemastore.org/github-workflow.json"] =
|
||||
"/.github/workflows/*",
|
||||
["https://json.schemastore.org/clang-format"] = ".clang-format",
|
||||
["https://json.schemastore.org/clang-tidy"] = ".clang-tidy",
|
||||
},
|
||||
['jsonls'] = true,
|
||||
['yamlls'] = {
|
||||
settings = {
|
||||
yaml = {
|
||||
schemas = {
|
||||
["https://json.schemastore.org/github-workflow.json"] =
|
||||
"/.github/workflows/*",
|
||||
["https://json.schemastore.org/clang-format"] = ".clang-format",
|
||||
["https://json.schemastore.org/clang-tidy"] = ".clang-tidy",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
---@param opts table<string,boolean|vim.lsp.Config>
|
||||
config = function(_, opts)
|
||||
-- store the default capabilities
|
||||
local capabilities = require('blink.cmp').get_lsp_capabilities()
|
||||
}
|
||||
-- store the default capabilities
|
||||
local capabilities = require('blink.cmp').get_lsp_capabilities()
|
||||
|
||||
-- enable the LSP
|
||||
for server, config in pairs(opts) do
|
||||
if type(config) == 'boolean' then
|
||||
vim.lsp.enable(server, config)
|
||||
else
|
||||
vim.lsp.enable(server, true)
|
||||
vim.lsp.config[server] = vim.tbl_deep_extend('force', {}, vim.lsp.config[server],
|
||||
config or {})
|
||||
end
|
||||
vim.lsp.config[server].capabilities = capabilities
|
||||
end
|
||||
-- enable the LSP
|
||||
for server, config in pairs(opts) do
|
||||
if type(config) == 'boolean' then
|
||||
vim.lsp.enable(server, config)
|
||||
else
|
||||
vim.lsp.enable(server, true)
|
||||
vim.lsp.config[server] = vim.tbl_deep_extend('force', {}, vim.lsp.config[server],
|
||||
config or {})
|
||||
end
|
||||
} }
|
||||
vim.lsp.config[server].capabilities = capabilities
|
||||
end
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
return { {
|
||||
'L3MON4D3/LuaSnip',
|
||||
build = 'make install_jsregexp',
|
||||
version = "v2.*",
|
||||
} }
|
||||
local function compile(params)
|
||||
local obj = vim.system({ 'make', 'install_jsregexp' }, { cwd = params.path }):wait()
|
||||
if obj.code == 0 then
|
||||
vim.notify('Building lacmp done', vim.log.levels.INFO)
|
||||
else
|
||||
vim.notify('Building blink.cmp failed', vim.log.levels.ERROR)
|
||||
end
|
||||
end
|
||||
|
||||
MiniDeps.add({
|
||||
source = 'https://github.com/L3MON4D3/LuaSnip',
|
||||
hooks = {
|
||||
post_install = compile,
|
||||
post_checkout = compile,
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,21 +1,9 @@
|
||||
-- Clone 'mini.nvim' manually in a way that it gets managed by 'mini.deps'
|
||||
local path_package = vim.fn.stdpath('data') .. '/site/'
|
||||
local mini_path = path_package .. 'pack/deps/start/mini.nvim'
|
||||
if not (vim.uv or vim.loop).fs_stat(mini_path) then
|
||||
vim.cmd('echo "Installing [`mini.nvim`](../doc/mini-nvim.qmd#mini.nvim)" | redraw')
|
||||
local clone_cmd = {
|
||||
'git', 'clone', '--filter=blob:none',
|
||||
'https://github.com/nvim-mini/mini.nvim', mini_path
|
||||
}
|
||||
vim.fn.system(clone_cmd)
|
||||
vim.cmd('packadd mini.nvim | helptags ALL')
|
||||
vim.cmd('echo "Installed [`mini.nvim`](../doc/mini-nvim.qmd#mini.nvim)" | redraw')
|
||||
end
|
||||
require('mini.deps').setup({ path = { package = path_package } })
|
||||
MiniDeps.add({ source = 'https://github.com/nvim-mini/mini.nvim' })
|
||||
|
||||
require('mini.ai').setup() -- enhances the use of a/i textobjects
|
||||
require('mini.align').setup() -- utility to align text in various ways
|
||||
require('mini.comment').setup() -- for toggling comments inline
|
||||
-- TODO: mini.completion to replace blink?
|
||||
require('mini.move').setup() -- moving lines
|
||||
require('mini.operators').setup() -- duplicating lines and evaluating equations inline
|
||||
require('mini.pairs').setup() -- automatic closing pairs
|
||||
@@ -65,9 +53,7 @@ require('mini.clue').setup({ -- shows available keybinds when performing ke
|
||||
},
|
||||
})
|
||||
require('mini.diff').setup({ -- shows git diffs in the file
|
||||
view = {
|
||||
style = 'sign',
|
||||
}
|
||||
view = { style = 'sign' }
|
||||
})
|
||||
require('mini.files').setup({ -- file browser
|
||||
content = {
|
||||
@@ -104,12 +90,14 @@ require('mini.files').setup({ -- file browser
|
||||
Map('n', '<leader>o', MiniFiles.open, { desc = "Open mini file browser" })
|
||||
require('mini.jump').setup() -- extends f,F,t,T to work across multiple lines
|
||||
require('mini.pick').setup()
|
||||
require('mini.extra').setup()
|
||||
Map('n', '<c-s>', MiniPick.builtin.resume, { desc = "Resume Previous Search" })
|
||||
Map('n', '<c-p>', MiniPick.builtin.files, { desc = "File Picker" })
|
||||
Map('n', '<c-g>', MiniPick.builtin.live_grep, { desc = "Live Grep" })
|
||||
Map('n', '<c-g>', MiniPick.builtin.grep_live, { desc = "Live Grep" })
|
||||
Map('n', '<leader>p', MiniPick.builtin.files, { desc = "File Picker" })
|
||||
Map('n', '<leader>sg', MiniPick.builtin.grep_live, { desc = "Search Live Grep" })
|
||||
Map('n', '<leader>sd', MiniExtra.pickers.diagnositc, { desc = "Search Diagnostics" })
|
||||
|
||||
Map('n', '<leader>sd', MiniExtra.pickers.diagnostic, { desc = "Search Diagnostics" })
|
||||
-- TODO: Use mini.sessions?
|
||||
require('mini.cursorword').setup() -- highlight words beneath the cursor
|
||||
require('mini.hipatterns').setup({
|
||||
highlighters = {
|
||||
@@ -193,7 +181,3 @@ require('mini.statusline').setup({
|
||||
})
|
||||
require('mini.tabline').setup() -- shows buffers that are open
|
||||
require('mini.trailspace').setup() -- trailing space indication and removal.
|
||||
|
||||
---@module 'lazy'
|
||||
---@type LazySpec
|
||||
return {}
|
||||
|
||||
@@ -1,57 +1,50 @@
|
||||
---@module 'lazy'
|
||||
---@type LazySpec
|
||||
return { {
|
||||
'mfussenegger/nvim-lint',
|
||||
event = { 'BufWritePost', 'BufReadPost', 'TextChanged' },
|
||||
---@module 'lint'
|
||||
opts = {
|
||||
---@type table<string, string[]>
|
||||
linters_by_ft = {
|
||||
sh = { 'shellcheck' },
|
||||
glsl = { 'glslang' },
|
||||
},
|
||||
linters = {
|
||||
glslang = {
|
||||
cmd = 'glslangValidator',
|
||||
stdin = false,
|
||||
args = { '-C' },
|
||||
ignore_exitcode = true,
|
||||
parser = function(output)
|
||||
local diags = {}
|
||||
for _, line in ipairs(vim.split(output, '\n')) do
|
||||
local f, lnum, sev, msg = line:match(
|
||||
'^([^:]+):(%d+):%s+([^:]+):%s+(.+)$') -- file:line: severity: message
|
||||
if not f then sev, f, lnum, msg = line:match(
|
||||
'^(%w+):%s+([^:]+):(%d+):%s+(.+)$') end -- severity: file:line: message
|
||||
MiniDeps.add({ source = 'https://github.com/mfussenegger/nvim-lint' })
|
||||
local lint = require('lint')
|
||||
|
||||
if lnum then
|
||||
local s = sev:lower() == 'error'
|
||||
and vim.diagnostic.severity.ERROR
|
||||
or vim.diagnostic.severity.WARN
|
||||
table.insert(diags, {
|
||||
lnum = tonumber(lnum) - 1,
|
||||
col = 0,
|
||||
message = msg,
|
||||
source = 'glslang',
|
||||
severity = s
|
||||
})
|
||||
end
|
||||
end
|
||||
return diags
|
||||
local linters = {
|
||||
glslang = {
|
||||
cmd = 'glslangValidator',
|
||||
stdin = false,
|
||||
args = { '-C' },
|
||||
ignore_exitcode = true,
|
||||
parser = function(output)
|
||||
local diags = {}
|
||||
for _, line in ipairs(vim.split(output, '\n')) do
|
||||
local f, lnum, sev, msg = line:match(
|
||||
'^([^:]+):(%d+):%s+([^:]+):%s+(.+)$') -- file:line: severity: message
|
||||
if not f then
|
||||
sev, f, lnum, msg = line:match(
|
||||
'^(%w+):%s+([^:]+):(%d+):%s+(.+)$')
|
||||
end -- severity: file:line: message
|
||||
|
||||
if lnum then
|
||||
local s = sev:lower() == 'error'
|
||||
and vim.diagnostic.severity.ERROR
|
||||
or vim.diagnostic.severity.WARN
|
||||
table.insert(diags, {
|
||||
lnum = tonumber(lnum) - 1,
|
||||
col = 0,
|
||||
message = msg,
|
||||
source = 'glslang',
|
||||
severity = s
|
||||
})
|
||||
end
|
||||
}
|
||||
}
|
||||
},
|
||||
config = function(_, opts)
|
||||
local lint = require('lint')
|
||||
lint.linters_by_ft = opts.linters_by_ft
|
||||
|
||||
for name, linter in pairs(opts.linters) do
|
||||
lint.linters[name] = linter
|
||||
end
|
||||
return diags
|
||||
end
|
||||
}
|
||||
}
|
||||
|
||||
-- autocommand for linting
|
||||
Autocmd({ 'BufWritePost', 'BufWinEnter', 'TextChanged' },
|
||||
{ callback = function() lint.try_lint() end });
|
||||
end
|
||||
} }
|
||||
|
||||
lint.linters_by_ft = {
|
||||
sh = { 'shellcheck' },
|
||||
glsl = { 'glslang' },
|
||||
}
|
||||
|
||||
for name, linter in pairs(linters) do
|
||||
lint.linters[name] = linter
|
||||
end
|
||||
|
||||
-- autocommand for linting
|
||||
Autocmd({ 'BufWritePost', 'BufWinEnter', 'TextChanged' },
|
||||
{ callback = function() lint.try_lint() end });
|
||||
|
||||
@@ -1,39 +1,32 @@
|
||||
---@module 'lazy'
|
||||
---@type LazySpec
|
||||
return { {
|
||||
'nvim-treesitter/nvim-treesitter', -- highlight, edit, and navigate code
|
||||
build = ':TSUpdate',
|
||||
lazy = false,
|
||||
config = function()
|
||||
-- Pre-install a few languages we're (very) likely going to use
|
||||
local ts = require('nvim-treesitter')
|
||||
ts.setup({ install_dir = vim.fn.stdpath('cache') .. '/tree-sitter' })
|
||||
ts.install({
|
||||
'c', 'make',
|
||||
'bash', 'gitignore', 'editorconfig',
|
||||
'ini', 'json', 'yaml',
|
||||
'markdown', 'markdown_inline',
|
||||
})
|
||||
MiniDeps.add({ source = 'https://github.com/nvim-treesitter/nvim-treesitter' })
|
||||
|
||||
-- Define aliases for entries that lack an entry, but should have one.
|
||||
local alias = {
|
||||
{ 'sh', 'bash' },
|
||||
}
|
||||
-- Pre-install a few languages we're (very) likely going to use
|
||||
local ts = require('nvim-treesitter')
|
||||
ts.setup({ install_dir = vim.fn.stdpath('cache') .. '/tree-sitter' })
|
||||
ts.install({
|
||||
'c', 'make',
|
||||
'bash', 'gitignore', 'editorconfig',
|
||||
'ini', 'json', 'yaml',
|
||||
'markdown', 'markdown_inline',
|
||||
})
|
||||
|
||||
local pat = vim.iter(alias):map(function(a) return a[1] end):totable()
|
||||
vim.list_extend(pat, ts.get_available())
|
||||
Autocmd('FileType', {
|
||||
pattern = pat,
|
||||
callback = function(arg)
|
||||
local a = vim.iter(alias)
|
||||
:find(function(a) return arg.match == a[1] end)
|
||||
if not a then -- Ensure we only install if an alias was found
|
||||
require('nvim-treesitter').install(vim.bo.ft)
|
||||
pcall(vim.treesitter.start)
|
||||
return
|
||||
end
|
||||
vim.bo.ft = a[2] -- Retriggers function
|
||||
end
|
||||
})
|
||||
end,
|
||||
} }
|
||||
-- Define aliases for entries that lack an entry, but should have one.
|
||||
local alias = {
|
||||
{ 'sh', 'bash' },
|
||||
}
|
||||
|
||||
local pat = vim.iter(alias):map(function(a) return a[1] end):totable()
|
||||
vim.list_extend(pat, ts.get_available())
|
||||
Autocmd('FileType', {
|
||||
pattern = pat,
|
||||
callback = function(arg)
|
||||
local a = vim.iter(alias)
|
||||
:find(function(a) return arg.match == a[1] end)
|
||||
if not a then -- Ensure we only install if an alias was found
|
||||
require('nvim-treesitter').install(vim.bo.ft)
|
||||
pcall(vim.treesitter.start)
|
||||
return
|
||||
end
|
||||
vim.bo.ft = a[2] -- Retriggers function
|
||||
end
|
||||
})
|
||||
|
||||
@@ -1,56 +1,46 @@
|
||||
---@module 'lazy'
|
||||
---@type LazySpec
|
||||
return { {
|
||||
'akinsho/toggleterm.nvim', -- allows to toggle the terminal rather than open one in a separate window
|
||||
event = 'VeryLazy',
|
||||
---@type ToggleTermConfig
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
opts = {
|
||||
direction = "float",
|
||||
open_mapping = [[<C-\>]]
|
||||
},
|
||||
config = function(_, opts)
|
||||
local tt = require('toggleterm')
|
||||
local term = require('toggleterm.terminal')
|
||||
tt.setup(opts)
|
||||
MiniDeps.add({ source = 'https://github.com/akinsho/toggleterm.nvim' })
|
||||
local tt = require('toggleterm')
|
||||
local term = require('toggleterm.terminal')
|
||||
tt.setup({
|
||||
direction = 'float',
|
||||
open_mapping = [[<C-\>]]
|
||||
})
|
||||
|
||||
local term_lazygit = term.Terminal:new({ cmd = "lazygit", hidden = true, direction = 'float' })
|
||||
local term_lazygit = term.Terminal:new({ cmd = "lazygit", hidden = true, direction = 'float' })
|
||||
|
||||
-- Set mappings to toggle the above
|
||||
Map({ 'n' }, '<leader>gg', function() term_lazygit:toggle() end)
|
||||
-- Set mappings to toggle the above
|
||||
Map({ 'n' }, '<leader>gg', function() term_lazygit:toggle() end)
|
||||
|
||||
-- Add a keymap for executing makefiles, or launch scripts
|
||||
Map({ 'n', 't', 'v' }, '<c-b>', function()
|
||||
local cwd = vim.fn.getcwd()
|
||||
local cmd = nil
|
||||
local launchcfg = cwd .. '/.launch.sh'
|
||||
-- Add a keymap for executing makefiles, or launch scripts
|
||||
Map({ 'n', 't', 'v' }, '<c-b>', function()
|
||||
local cwd = vim.fn.getcwd()
|
||||
local cmd = nil
|
||||
local launchcfg = cwd .. '/.launch.sh'
|
||||
|
||||
-- If the path is readable, the attached command is executed and no more is checked.
|
||||
for _, obj in ipairs({
|
||||
{ launchcfg, launchcfg },
|
||||
{ cwd .. '/Makefile', 'make -C ' .. cwd },
|
||||
{ cwd .. '/makefile', 'make -C ' .. cwd },
|
||||
}) do
|
||||
local pat = obj[1]
|
||||
local exec = obj[2]
|
||||
if (vim.fn.filereadable(pat) == 1) then
|
||||
cmd = '\r' .. exec -- use \r to override text if it's present
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
-- If cmd still hasn't been set; edit the file
|
||||
if (not cmd) then
|
||||
local buf = vim.api.nvim_create_buf(true, false) -- listed, not scratch
|
||||
vim.api.nvim_set_current_buf(buf)
|
||||
vim.api.nvim_buf_set_name(buf, launchcfg)
|
||||
vim.api.nvim_buf_set_text(0, 0, 0, 0, 0, { '#!/usr/bin/env sh', 'exec ' })
|
||||
vim.bo.ft = 'sh'
|
||||
return
|
||||
end
|
||||
|
||||
-- Execute the command in terminal 1
|
||||
tt.exec(cmd, 1, nil, nil, nil, nil, false, true)
|
||||
end, { desc = 'compile the program using .buildcofig placed in PWD' })
|
||||
-- If the path is readable, the attached command is executed and no more is checked.
|
||||
for _, obj in ipairs({
|
||||
{ launchcfg, launchcfg },
|
||||
{ cwd .. '/Makefile', 'make -C ' .. cwd },
|
||||
{ cwd .. '/makefile', 'make -C ' .. cwd },
|
||||
}) do
|
||||
local pat = obj[1]
|
||||
local exec = obj[2]
|
||||
if (vim.fn.filereadable(pat) == 1) then
|
||||
cmd = '\r' .. exec -- use \r to override text if it's present
|
||||
break
|
||||
end
|
||||
end
|
||||
} }
|
||||
|
||||
-- If cmd still hasn't been set; edit the file
|
||||
if (not cmd) then
|
||||
local buf = vim.api.nvim_create_buf(true, false) -- listed, not scratch
|
||||
vim.api.nvim_set_current_buf(buf)
|
||||
vim.api.nvim_buf_set_name(buf, launchcfg)
|
||||
vim.api.nvim_buf_set_text(0, 0, 0, 0, 0, { '#!/usr/bin/env sh', 'exec ' })
|
||||
vim.bo.ft = 'sh'
|
||||
return
|
||||
end
|
||||
|
||||
-- Execute the command in terminal 1
|
||||
tt.exec(cmd, 1, nil, nil, nil, nil, false, true)
|
||||
end, { desc = 'compile the program using .buildcofig placed in PWD' })
|
||||
|
||||
Reference in New Issue
Block a user