2024-11-04 11:36:57 -08:00
-- #selene: allow(mixed_table)
2024-07-17 11:16:19 -07:00
local utils = require ( " utils " )
return {
2025-01-10 10:21:16 -08:00
{ import = " lazy.colorschemes " } ,
2024-07-17 11:16:19 -07:00
-- Some helpers
-- Auto and ends to some ifs and dos
{ " https://github.com/tpope/vim-endwise " } ,
-- Unix commands from vim? Yup!
{ " https://github.com/tpope/vim-eunuch " } ,
-- Adds repeats for custom motions
{ " https://github.com/tpope/vim-repeat " } ,
-- Readline shortcuts
{ " https://github.com/tpope/vim-rsi " } ,
-- Surround motions
{ " https://github.com/tpope/vim-surround " } ,
-- Better netrw
{ " https://github.com/tpope/vim-vinegar " } ,
-- Easier jumping to lines
{ " https://github.com/vim-scripts/file-line " } ,
-- Auto ctags generation
{ " https://github.com/ludovicchabant/vim-gutentags " } ,
2025-01-10 10:21:16 -08:00
2024-07-17 11:16:19 -07:00
{
2025-01-15 10:03:03 -08:00
-- Make it easier to discover some of my keymaps
2024-07-17 11:16:19 -07:00
" https://github.com/folke/which-key.nvim " ,
2024-07-17 17:27:53 -07:00
opts = {
2024-07-18 14:02:43 -07:00
-- Ignore warnings about config. Turn these on when switching major versions
notify = false ,
2024-11-27 12:14:01 -08:00
icons = {
mappings = require ( " icons " ) . nerd_font ,
} ,
2024-07-18 14:02:43 -07:00
} ,
version = utils.map_version_rule ( {
2025-01-15 10:03:03 -08:00
[ " >=0.9.4 " ] = " ^3 " ,
2024-07-18 14:02:43 -07:00
[ " >=0.9.0 " ] = " <3.4.0 " ,
[ " <0.9.0 " ] = " 1.x.x " ,
} ) ,
keys = {
{
" <leader>? " ,
function ( )
require ( " which-key " ) . show ( { global = false } )
end ,
desc = " Buffer Local Keymaps (which-key) " ,
2024-07-17 17:27:53 -07:00
} ,
} ,
2024-07-18 14:02:43 -07:00
event = " VeryLazy " ,
2024-07-17 11:16:19 -07:00
} ,
{
2025-01-15 10:03:03 -08:00
-- Better commenting
2024-07-17 11:16:19 -07:00
" https://github.com/tomtom/tcomment_vim " ,
2024-07-17 12:10:25 -07:00
keys = {
{ " // " , " :TComment<CR> " , desc = " Toggle comment " } ,
{ " // " , " :TCommentBlock<CR> " , mode = " v " , desc = " Toggle comment " } ,
} ,
2024-07-17 11:16:19 -07:00
} ,
{
2025-01-15 10:03:03 -08:00
-- Allow wrapping and joining of arguments across multiple lines
" https://git.foosoft.net/alex/vim-argwrap " ,
2024-07-17 12:10:25 -07:00
keys = {
{ " <Leader>a " , " <cmd>ArgWrap<CR> " , desc = " Wrap or unwrap arguments " } ,
} ,
2024-07-17 11:16:19 -07:00
} ,
{
2025-01-15 10:03:03 -08:00
-- Adds git operations to vim
2024-07-17 11:16:19 -07:00
" https://github.com/tpope/vim-fugitive " ,
2025-01-15 10:03:03 -08:00
version = utils.map_version_rule ( {
[ " >=0.9.2 " ] = " ^3 " ,
2025-01-08 11:41:55 -08:00
-- Pinning to avoid neovim bug https://github.com/neovim/neovim/issues/10121
2024-07-17 11:16:19 -07:00
-- when used in status line.
2025-01-15 10:03:03 -08:00
[ " <0.9.2 " ] = " 3.6 " ,
2024-07-17 11:16:19 -07:00
} ) ,
2024-07-17 12:10:25 -07:00
keys = {
{ " gb " , " <cmd>Git blame<CR> " , desc = " Git blame " } ,
{ " gc " , " <cmd>Git commit<CR> " , desc = " Git commit " } ,
{ " gd " , " <cmd>Git diff<CR> " , desc = " Git diff " } ,
{ " gs " , " <cmd>Git<CR> " , desc = " Git status " } ,
{ " gw " , " <cmd>Git write<CR> " , desc = " Git write " } ,
} ,
2024-09-25 15:57:33 -07:00
cmd = { " Git " } ,
2024-07-17 11:16:19 -07:00
} ,
{
2025-01-15 10:03:03 -08:00
-- Quick toggling of Location and Quickfix lists
2024-07-17 11:16:19 -07:00
" https://github.com/milkypostman/vim-togglelist " ,
2025-01-15 10:03:03 -08:00
-- Stable plugin, pinning to avoid any issues stemming from possible takeover
commit = " 48f0d30292efdf20edc883e61b121e6123e03df7 " ,
2024-07-17 12:10:25 -07:00
keys = {
{ " <F6> " , " :call ToggleQuickfixList()<CR> " , desc = " Toggle quickfix " } ,
{ " <F7> " , " :call ToggleLocationList()<CR> " , desc = " Toggle location list " } ,
} ,
2024-07-17 11:16:19 -07:00
} ,
{
2025-01-15 10:03:03 -08:00
-- Find text everywhere!
2024-07-17 11:16:19 -07:00
" https://github.com/mhinz/vim-grepper " ,
config = function ( )
2024-07-17 17:36:44 -07:00
-- Grepper settings and shortcuts
vim.g . grepper = {
quickfix = 1 ,
open = 1 ,
switch = 0 ,
jump = 0 ,
tools = { " git " , " rg " , " ag " , " ack " , " pt " , " grep " } ,
dir = " repo,cwd " ,
}
require ( " utils " ) . keymap_set ( { " n " , " x " } , " gs " , " <plug>(GrepperOperator) " , {
silent = true ,
noremap = false ,
desc = " Grepper " ,
} )
-- Override Todo command to use Grepper
vim.api . nvim_create_user_command (
" Todo " ,
" :Grepper -noprompt -query TODO " ,
{ desc = " Search for TODO tags " }
)
-- Make some shortands for various grep programs
if vim.fn . executable ( " rg " ) == 1 then
vim.api . nvim_create_user_command ( " Rg " , " :GrepperRg <args> " , { nargs = " + " , desc = " Ripgrep " } )
end
if vim.fn . executable ( " ag " ) == 1 then
vim.api . nvim_create_user_command ( " Ag " , " :GrepperAg <args> " , { nargs = " + " , desc = " Silversearcher " } )
end
if vim.fn . executable ( " ack " ) == 1 then
vim.api . nvim_create_user_command ( " Ack " , " :GrepperAck <args> " , { nargs = " + " , desc = " Ack search " } )
end
2024-07-17 11:16:19 -07:00
end ,
} ,
{
2025-01-15 10:03:03 -08:00
-- Highlight inline colors
2024-07-17 11:16:19 -07:00
" https://github.com/norcalli/nvim-colorizer.lua " ,
config = true ,
2024-07-17 12:10:25 -07:00
cmd = { " ColorizerToggle " } ,
2024-07-17 11:16:19 -07:00
} ,
{
2025-01-15 10:03:03 -08:00
-- Custom status line
2024-07-17 11:16:19 -07:00
" https://github.com/nvim-lualine/lualine.nvim " ,
config = function ( )
require ( " plugins.lualine " ) . config_lualine ( )
end ,
dependencies = {
{
" https://github.com/SmiteshP/nvim-navic " ,
dependencies = { { " https://github.com/neovim/nvim-lspconfig " } } ,
} ,
} ,
2024-07-18 11:21:21 -07:00
event = " VeryLazy " ,
2024-07-17 11:16:19 -07:00
} ,
{
2025-01-15 10:03:03 -08:00
-- On Mac, update colors when dark mode changes
2024-07-17 11:16:19 -07:00
" https://github.com/cormacrelf/dark-notify " ,
2025-01-15 10:03:03 -08:00
-- Pinned because project has had no commits in 4 years
commit = " 891adc07dd7b367b840f1e9875b075fd8af4dc52 " ,
2024-07-17 11:16:19 -07:00
enabled = vim.g . is_mac ,
-- Download latest release on install
build = " curl -s https://api.github.com/repos/cormacrelf/dark-notify/releases/latest | jq '.assets[].browser_download_url' | xargs curl -Ls | tar xz -C ~/.local/bin/ " , -- luacheck: no max line length
config = function ( )
require ( " plugins.darknotify " )
end ,
dependencies = { { " https://github.com/nvim-lualine/lualine.nvim " } } ,
2024-09-25 15:57:33 -07:00
event = " VeryLazy " ,
2024-07-17 11:16:19 -07:00
} ,
{
2025-01-15 10:03:03 -08:00
-- Custom start screen
2024-07-17 11:16:19 -07:00
" https://github.com/mhinz/vim-startify " ,
config = function ( )
require ( " utils " ) . require_with_local ( " plugins.startify " )
end ,
2025-01-08 11:41:31 -08:00
dependencies = {
-- Plenary isn't used by startify, but it is used in my config
{ " https://github.com/nvim-lua/plenary.nvim " } ,
} ,
2024-07-17 11:16:19 -07:00
} ,
-- LSP
-- Debug adapter protocol
2025-01-10 10:21:16 -08:00
{ import = " lazy.dap " } ,
{ import = " lazy.language_servers " } ,
2024-07-17 11:16:19 -07:00
{
2025-01-15 10:03:03 -08:00
-- Better display of lsp diagnostics
2024-07-17 11:16:19 -07:00
" https://github.com/folke/trouble.nvim " ,
2025-01-08 11:42:12 -08:00
config = true ,
2024-07-17 11:16:19 -07:00
version = utils.map_version_rule ( {
2025-01-15 10:03:03 -08:00
[ " >=0.9.2 " ] = " ^3 " ,
[ " >=0.7.2 " ] = " ^2 " ,
[ " <0.7.2 " ] = " ^1 " ,
2024-07-17 11:16:19 -07:00
} ) ,
} ,
-- Incremental lsp rename view
{
" https://github.com/smjonas/inc-rename.nvim " ,
opts = {
input_buffer_type = " dressing " ,
} ,
2024-07-17 17:18:36 -07:00
lazy = true ,
2025-01-08 11:42:37 -08:00
enabled = vim.fn . has ( " nvim-0.8 " ) == 1 ,
2024-07-17 11:16:19 -07:00
} ,
-- Writing
-- abolish/pencil
{
" https://github.com/preservim/vim-pencil " ,
2025-01-15 10:03:03 -08:00
version = " ^1 " ,
2024-09-25 15:56:39 -07:00
dependencies = {
{
" https://github.com/preservim/vim-textobj-sentence " ,
dependencies = {
{ " https://github.com/kana/vim-textobj-user " } ,
} ,
config = function ( )
vim.fn [ " textobj#sentence#init " ] ( )
end ,
} ,
} ,
2024-07-17 11:16:19 -07:00
cmd = { " Pencil " } ,
} ,
{
" https://github.com/junegunn/goyo.vim " ,
cmd = { " Goyo " , " Zen " } ,
config = function ( )
require ( " plugins.goyo-limelight " )
end ,
dependencies = {
{ " https://github.com/junegunn/limelight.vim " , cmd = " Limelight " } ,
} ,
} ,
-- Treesitter
{
" https://github.com/nvim-treesitter/nvim-treesitter " ,
build = " :TSUpdate " ,
2024-07-18 14:02:43 -07:00
version = utils.map_version_rule ( {
2025-01-09 07:01:31 +00:00
[ " >=0.10.0 " ] = utils.nil_val ,
[ " >=0.9.2 " ] = " 0.9.3 " ,
2024-09-25 15:57:51 -07:00
[ " ==0.9.2 " ] = " 0.9.2 " ,
[ " ==0.9.1 " ] = " 0.9.1 " ,
[ " ==0.9.0 " ] = " 0.9.0 " ,
2024-07-17 11:16:19 -07:00
} ) ,
config = function ( )
require ( " utils " ) . require_with_local ( " plugins.treesitter " ) . setup ( )
end ,
2024-07-18 14:02:43 -07:00
dependencies = {
2024-09-25 15:57:51 -07:00
{ " https://github.com/nvim-treesitter/nvim-treesitter-textobjects " } ,
2024-07-18 14:02:43 -07:00
} ,
2024-07-17 11:16:19 -07:00
} ,
{
" https://github.com/ray-x/lsp_signature.nvim " ,
2024-07-18 11:21:21 -07:00
lazy = true ,
2024-07-17 11:16:19 -07:00
opts = {
extra_trigger_chars = { " ( " , " , " } ,
auto_close_after = nil ,
-- Toggle these to use hint only
floating_window = true ,
hint_enable = false ,
} ,
2025-01-10 10:21:16 -08:00
event = " InsertEnter * " ,
2024-07-17 11:16:19 -07:00
} ,
-- Fuzzy Finder
{
" https://github.com/nvim-telescope/telescope.nvim " ,
dependencies = {
{ " https://github.com/nvim-lua/plenary.nvim " } ,
{ " https://github.com/nvim-telescope/telescope-file-browser.nvim " } ,
} ,
version = " 0.1.x " ,
config = function ( )
require ( " plugins.telescope " )
end ,
2024-09-19 11:01:04 -07:00
lazy = true ,
2024-07-17 11:16:19 -07:00
} ,
-- Filetypes
{ " https://github.com/ViViDboarder/vim-forcedotcom " } ,
{ " https://github.com/hsanson/vim-android " } ,
2024-10-28 15:43:40 -07:00
{
" https://github.com/ray-x/go.nvim " ,
dependencies = { -- optional packages
-- "https://github.com/ray-x/guihua.lua",
" https://github.com/neovim/nvim-lspconfig " ,
" https://github.com/nvim-treesitter/nvim-treesitter " ,
" https://github.com/rcarriga/nvim-dap-ui " ,
} ,
config = function ( )
require ( " go " ) . setup ( {
icons = false ,
-- I don't like the normal mode keymap because it overrides `w`
dap_debug_keymap = false ,
-- Disable gui setup becuase this is set up with dap-ui
dap_debug_gui = false ,
} )
-- Override some keymaps because this plugin needs to start with debug run
local godap = require ( " go.dap " )
utils.keymap_set ( " n " , " <leader>dc " , function ( )
if require ( " dap " ) . session ( ) == nil then
godap.run ( )
else
godap.continue ( )
end
end , { desc = " Continue " } )
utils.keymap_set ( " n " , " <leader>dR " , godap.run , { desc = " Debug " } )
utils.keymap_set ( " n " , " <leader>ds " , godap.stop , { desc = " Stop " } )
end ,
event = { " CmdlineEnter " } ,
ft = { " go " , " gomod " } ,
2024-10-28 16:18:31 -07:00
version = utils.map_version_rule ( {
[ " >=0.10.0 " ] = utils.nil_val ,
[ " <0.10.0 " ] = " v0.9.0 " ,
} ) ,
enabled = vim.fn . has ( " nvim-0.9 " ) == 1 ,
2024-10-28 15:43:40 -07:00
} ,
2024-07-17 11:16:19 -07:00
{
" https://github.com/sheerun/vim-polyglot " ,
2025-01-10 10:21:16 -08:00
init = function ( )
vim.g . polyglot_disabled = { " go " , " rust " }
end ,
2024-07-17 11:16:19 -07:00
config = function ( )
local gid = vim.api . nvim_create_augroup ( " polyglot_fts " , { clear = true } )
vim.api . nvim_create_autocmd ( { " BufRead " , " BufNewFile " } , {
pattern = { " */playbooks/*.yml " , " */playbooks/*.yaml " } ,
command = " set filetype=yaml.ansible " ,
group = gid ,
} )
vim.api . nvim_create_autocmd ( { " BufRead " , " BufNewFile " } , {
pattern = { " go.mod " , " go.sum " } ,
command = " set filetype=gomod " ,
group = gid ,
} )
end ,
} ,
-- Debuging nvim config
{
" https://github.com/tweekmonster/startuptime.vim " ,
cmd = { " StartupTime " } ,
} ,
-- Fancy todo highlighting
{
" https://github.com/folke/todo-comments.nvim " ,
dependencies = {
{ " https://github.com/nvim-lua/plenary.nvim " } ,
} ,
config = function ( )
require ( " plugins.todo " )
end ,
version = " 1.x.x " ,
} ,
-- Fancy notifications
{
" https://github.com/rcarriga/nvim-notify " ,
2025-01-08 23:19:02 -08:00
version = utils.map_version_rule ( {
[ " >=0.10.0 " ] = " 3.x.x " ,
[ " <0.10.0 " ] = " 3.13.5 " ,
} ) ,
2024-07-17 11:16:19 -07:00
config = function ( )
require ( " plugins.notify " )
end ,
} ,
{
" https://github.com/stevearc/dressing.nvim " ,
branch = utils.map_version_rule ( {
[ " >=0.8.0 " ] = utils.nil_val ,
[ " <0.8.0 " ] = " nvim-0.7 " ,
} ) ,
config = true ,
} ,
2025-01-10 10:21:16 -08:00
{ import = " lazy.completion " } ,
{ import = " lazy.obsidian " } ,
2024-07-17 11:16:19 -07:00
-- Work things
-- Sourcegraph
{
" https://github.com/sourcegraph/sg.nvim " ,
build = " nvim -l build/init.lua " ,
dependencies = {
{ " https://github.com/nvim-lua/plenary.nvim " } ,
} ,
opts = {
enable_cody = false ,
-- Empty attach because I dont want to use default keymaps. Maybe I'll remap something later.
on_attach = function ( ) end ,
} ,
cmd = {
" SourcegraphBuild " ,
" SourcegraphDownloadBinaries " ,
" SourcegraphInfo " ,
" SourcegraphLink " ,
" SourcegraphLogin " ,
" SourcegraphSearch " ,
} ,
enabled = vim.g . install_sourcegraph ,
} ,
2025-01-10 10:21:16 -08:00
{ import = " lazy.copilot " } ,
2024-07-17 11:16:19 -07:00
}