added plugins

This commit is contained in:
Dynocoder 2024-06-06 22:22:10 -04:00
parent 5aeddfdd5d
commit 42a8b0ff06
19 changed files with 322 additions and 74 deletions

111
init.lua
View File

@ -20,49 +20,6 @@
=====================================================================
=====================================================================
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.
@ -91,7 +48,7 @@ vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
-- 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 ]]
-- See `:help vim.opt`
@ -102,7 +59,7 @@ vim.g.have_nerd_font = false
vim.opt.number = true
-- You can also add relative line numbers, to help with jumping.
-- Experiment for yourself to see if you like it!
-- vim.opt.relativenumber = true
vim.opt.relativenumber = true
-- Enable mouse mode, can be useful for resizing splits for example!
vim.opt.mouse = 'a'
@ -129,7 +86,7 @@ vim.opt.smartcase = true
vim.opt.signcolumn = 'yes'
-- Decrease update time
vim.opt.updatetime = 250
vim.opt.updatetime = 50
-- Decrease mapped sequence wait time
-- Displays which-key popup sooner
@ -152,7 +109,7 @@ vim.opt.inccommand = 'split'
vim.opt.cursorline = true
-- Minimal number of screen lines to keep above and below the cursor.
vim.opt.scrolloff = 10
vim.opt.scrolloff = 999
-- [[ Basic Keymaps ]]
-- See `:help vim.keymap.set()`
@ -161,10 +118,21 @@ vim.opt.scrolloff = 10
vim.opt.hlsearch = true
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
-- Diagnostic keymaps
-- vim move line commands
vim.keymap.set('v', 'J', ":m '>+1<CR>gv=gv")
vim.keymap.set('v', 'K', ":m '<-2<CR>gv=gv")
-- setup command for ctrl-backspace - delete whole word
-- vim.api.nvim_set_keymap('i', '<C-H>', '<C-w>', { noremap = true, silent = true })
vim.keymap.set('i', '<C-BS>', '<C-w>', { noremap = true, silent = false })
-- replace the current word
vim.keymap.set('n', '<leader>rw', [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
-- Diagnostic keymaps(look)
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' })
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' })
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' })
vim.keymap.set('n', '<leader>de', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' })
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
@ -185,10 +153,10 @@ vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' }
-- 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-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-k>', '<C-w><C-k>', { desc = 'Move focus to the upper 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-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' })
-- [[ Basic Autocommands ]]
-- See `:help lua-guide-autocommands`
@ -372,25 +340,27 @@ require('lazy').setup({
-- See `:help telescope.builtin`
local builtin = require 'telescope.builtin'
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
vim.keymap.set('n', '<leader><leader>', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' })
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
vim.keymap.set('n', '<leader>/', builtin.live_grep, { desc = '[S]earch by [G]rep' })
vim.keymap.set('n', '<leader>sG', ':LiveGrepGitRoot<cr>', { desc = '[S]earch by [G]rep on Git Root' })
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
vim.keymap.set('n', '<leader>sb', builtin.buffers, { desc = '[ ] Find existing buffers' })
-- Slightly advanced example of overriding default behavior and theme
vim.keymap.set('n', '<leader>/', function()
vim.keymap.set('n', '<leader>c/', function()
-- You can pass additional configuration to Telescope to change the theme, layout, etc.
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
winblend = 10,
previewer = false,
})
end, { desc = '[/] Fuzzily search in current buffer' })
end, { desc = 'Fuzzily search in [c]urrent buffer [/] ' })
-- It's also possible to pass additional configuration options.
-- See `:help telescope.builtin.live_grep()` for information about particular keys
@ -565,7 +535,7 @@ require('lazy').setup({
-- - settings (table): Override the default settings passed when initializing the server.
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
local servers = {
-- clangd = {},
clangd = {},
-- gopls = {},
-- pyright = {},
-- rust_analyzer = {},
@ -575,7 +545,7 @@ require('lazy').setup({
-- https://github.com/pmizio/typescript-tools.nvim
--
-- But for many setups, the LSP (`tsserver`) will work just fine
-- tsserver = {},
tsserver = {},
--
lua_ls = {
@ -682,12 +652,12 @@ require('lazy').setup({
-- `friendly-snippets` contains a variety of premade snippets.
-- See the README about individual language/framework/plugin snippets:
-- https://github.com/rafamadriz/friendly-snippets
-- {
-- 'rafamadriz/friendly-snippets',
-- config = function()
-- require('luasnip.loaders.from_vscode').lazy_load()
-- end,
-- },
{
'rafamadriz/friendly-snippets',
config = function()
require('luasnip.loaders.from_vscode').lazy_load()
end,
},
},
},
'saadparwaiz1/cmp_luasnip',
@ -710,6 +680,7 @@ require('lazy').setup({
luasnip.lsp_expand(args.body)
end,
},
-- NOTE: probably better to also have 'noselect' to get so that the first suggestion is not selecte, then I can probably skip noinsert. (custom).
completion = { completeopt = 'menu,menuone,noinsert' },
-- For an understanding of why these mappings were
@ -792,7 +763,7 @@ require('lazy').setup({
},
-- Highlight todo, notes, etc in comments
{ 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } },
{ 'folke/todo-comments.nvim', event = 'VeryLazy', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } },
{ -- Collection of various small independent plugins/modules
'echasnovski/mini.nvim',
@ -885,7 +856,7 @@ require('lazy').setup({
--
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
-- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins`
-- { import = 'custom.plugins' },
{ import = 'custom.plugins' },
}, {
ui = {
-- If you are using a Nerd Font: set icons to an empty table which will use the

View File

@ -0,0 +1,13 @@
return {
'windwp/nvim-autopairs',
event = 'InsertEnter',
-- Optional dependency
dependencies = { 'hrsh7th/nvim-cmp' },
config = function()
require('nvim-autopairs').setup {}
-- If you want to automatically add `(` after selecting a function or method
local cmp_autopairs = require 'nvim-autopairs.completion.cmp'
local cmp = require 'cmp'
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
end,
}

View File

@ -0,0 +1,7 @@
return {
'NvChad/nvim-colorizer.lua',
event = 'UIEnter',
config = function()
require('colorizer').setup {}
end,
}

View File

@ -0,0 +1,5 @@
return {
'sindrets/diffview.nvim',
event = 'InsertEnter',
config = function() end,
}

View File

@ -0,0 +1,14 @@
return {
'folke/flash.nvim',
event = 'VeryLazy',
---@type Flash.Config
opts = {},
-- stylua: ignore
keys = {
{ "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" },
{ "S", mode = { "n", "x", "o" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" },
{ "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" },
{ "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" },
{ "<c-s>", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" },
},
}

View File

@ -0,0 +1,9 @@
return {
-- 'akinsho/flutter-tools.nvim',
-- event = 'InsertEnter',
-- dependencies = {
-- 'nvim-lua/plenary.nvim',
-- 'stevearc/dressing.nvim', -- optional for vim.ui.select
-- },
-- config = true,
}

View File

@ -0,0 +1,12 @@
return {
'f-person/git-blame.nvim',
event = 'UIEnter',
config = function()
require('gitblame').setup {
enabled = false,
}
vim.keymap.set('n', '<leader>gb', ':GitBlameToggle<CR>', { desc = 'Toggle Git Blame' })
vim.keymap.set('n', '<leader>go', ':GitBlameOpenCommitURL<CR>', { desc = '[G]it Blame [O]pen Commit URL' })
vim.keymap.set('n', '<leader>gf', ':GitBlameOpenFileURL<CR>', { desc = '[G]it Blame Open [F]ile URL' })
end,
}

View File

@ -0,0 +1,33 @@
return {
'ThePrimeagen/harpoon',
branch = 'harpoon2',
dependencies = { 'nvim-lua/plenary.nvim' },
config = function()
local harpoon = require 'harpoon'
harpoon:setup()
vim.keymap.set('n', '<leader>ha', function()
harpoon:list():append()
end, { desc = '[h]arpoon [a]ppend' })
vim.keymap.set('n', '<leader>hm', function()
harpoon.ui:toggle_quick_menu(harpoon:list())
end, {
noremap = true,
desc = 'Open [H]arpoon [M]enu',
})
for i = 1, 9 do
vim.keymap.set('n', '<leader>' .. i, function()
harpoon:list():select(i)
end, { desc = 'Goto [' .. i .. ']th buffer' })
end
-- Toggle previous & next buffers stored within Harpoon list
vim.keymap.set('n', '<C-S-P>', function()
harpoon:list():prev()
end, { desc = 'Goto [P]revious buffer' })
vim.keymap.set('n', '<C-S-N>', function()
harpoon:list():next()
end, { desc = 'Goto [N]ext buffer' })
end,
}

View File

@ -0,0 +1,29 @@
return {
'b0o/incline.nvim',
config = function()
local helper = require 'incline.helpers'
local devicons = require 'nvim-web-devicons'
require('incline').setup {
window = {
padding = 0,
margin = { horizontal = 0 },
},
render = function(props)
local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ':p:.')
if filename == '' then
filename = '[No Name]'
end
local ft_icon, ft_color = devicons.get_icon_color(filename)
local modified = vim.bo[props.buf].modified
return {
ft_icon and { ' ', ft_icon, ' ', guibg = ft_color, guifg = helper.contrast_color(ft_color) } or '',
' ',
{ filename, gui = modified and 'bold,italic' or 'bold' },
' ',
guibg = '#44406e',
}
end,
}
end,
}

View File

@ -1,5 +1 @@
-- You can add your own plugins here or in other files in this directory!
-- I promise not to create any merge conflicts in this directory :)
--
-- See the kickstart.nvim README for more information
return {}

View File

@ -0,0 +1,12 @@
return {
'kdheepak/lazygit.nvim',
-- optional for floating window border decoration
dependencies = {
'nvim-lua/plenary.nvim',
'nvim-telescope/telescope.nvim',
},
config = function()
require('telescope').load_extension 'lazygit'
vim.keymap.set('n', '<leader>gg', '<CMD>:LazyGit<CR>', { desc = 'open lazygit' })
end,
}

View File

@ -0,0 +1,19 @@
return {
-- 'echasnovski/mini.surround',
-- config = function()
-- require('mini.surround').setup {
-- mappings = {
-- add = 'ysa', -- Add surrounding in Normal and Visual modes
-- delete = 'ysd', -- Delete surrounding
-- find = 'ysf', -- Find surrounding (to the right)
-- find_left = 'ysF', -- Find surrounding (to the left)
-- highlight = 'ysh', -- Highlight surrounding
-- replace = 'ysr', -- Replace surrounding
-- update_n_lines = 'ysn', -- Update `n_lines`
--
-- suffix_last = 'yl', -- Suffix to search with "prev" method
-- suffix_next = 'yn', -- Suffix to search wwth "next" method
-- },
-- }
-- end,
}

View File

@ -0,0 +1,6 @@
return {
-- "rcarriga/nvim-notify",
-- config = function ()
-- vim.notify = require("notify")
-- end
}

View File

@ -0,0 +1,9 @@
return {
'stevearc/oil.nvim',
opts = {},
dependencies = { 'nvim-tree/nvim-web-devicons' },
config = function()
require('oil').setup()
vim.keymap.set('n', '<leader>e', '<CMD>Oil<CR>', { desc = 'Open parent directory' })
end,
}

View File

@ -0,0 +1,20 @@
return {
'nvim-pack/nvim-spectre',
dependencies = {
'nvim-lua/plenary.nvim',
},
config = function()
vim.keymap.set('n', '<leader>S', '<cmd>lua require("spectre").toggle()<CR>', {
desc = 'Toggle Spectre',
})
vim.keymap.set('n', '<leader>scw', '<cmd>lua require("spectre").open_visual({select_word=true})<CR>', {
desc = 'Search current word',
})
vim.keymap.set('v', '<leader>scww', '<esc><cmd>lua require("spectre").open_visual()<CR>', {
desc = 'Search current word',
})
vim.keymap.set('n', '<leader>socf', '<cmd>lua require("spectre").open_file_search({select_word=true})<CR>', {
desc = 'Search on current file',
})
end,
}

View File

@ -0,0 +1,7 @@
return {
'nvim-treesitter/nvim-treesitter-context',
-- event = 'VimEnter',
enabled = true,
opts = { mode = 'cursor', max_lines = 3 },
config = function() end,
}

View File

@ -0,0 +1,39 @@
return {
'folke/trouble.nvim',
cmd = { 'TroubleToggle', 'Trouble' },
opts = { use_diagnostic_signs = true },
keys = {
{ '<leader>xx', '<cmd>TroubleToggle document_diagnostics<cr>', desc = 'Document Diagnostics (Trouble)' },
{ '<leader>X', '<cmd>TroubleToggle workspace_diagnostics<cr>', desc = 'Workspace Diagnostics (Trouble)' },
{ '<leader>xL', '<cmd>TroubleToggle loclist<cr>', desc = 'Location List (Trouble)' },
{ '<leader>xq', '<cmd>TroubleToggle quickfix<cr>', desc = 'Quickfix List (Trouble)' },
{
'[q',
function()
if require('trouble').is_open() then
require('trouble').previous { skip_groups = true, jump = true }
else
local ok, err = pcall(vim.cmd.cprev)
if not ok then
vim.notify(err, vim.log.levels.ERROR)
end
end
end,
desc = 'Previous trouble/quickfix item',
},
{
']q',
function()
if require('trouble').is_open() then
require('trouble').next { skip_groups = true, jump = true }
else
local ok, err = pcall(vim.cmd.cnext)
if not ok then
vim.notify(err, vim.log.levels.ERROR)
end
end
end,
desc = 'Next trouble/quickfix item',
},
},
}

View File

@ -0,0 +1,37 @@
return {
-- 'RRethy/vim-illuminate',
-- event = 'UIEnter',
-- opts = {
-- keys = {},
-- delay = 200,
-- large_file_cutoff = 2000,
-- large_file_overrides = {
-- providers = { 'lsp' },
-- },
-- },
-- config = function(_, opts)
-- require('illuminate').configure(opts)
--
-- local function map(key, dir, buffer)
-- vim.keymap.set('n', key, function()
-- require('illuminate')['goto_' .. dir .. '_reference'](false)
-- end, { desc = dir:sub(1, 1):upper() .. dir:sub(2) .. ' Reference', buffer = buffer })
-- end
--
-- -- map("]]", "next")
-- -- map("[[", "prev")
--
-- -- also set it after loading ftplugins, since a lot overwrite [[ and ]]
-- vim.api.nvim_create_autocmd('FileType', {
-- callback = function()
-- local buffer = vim.api.nvim_get_current_buf()
-- -- map("]]", "next", buffer)
-- -- map("[[", "prev", buffer)
-- end,
-- })
-- end,
-- keys = {
-- -- { "]]", desc = "Next Reference" },
-- -- { "[[", desc = "Prev Reference" },
-- },
}

View File

@ -0,0 +1,10 @@
return {
'alexghergh/nvim-tmux-navigation',
config = function()
require('nvim-tmux-navigation').setup {}
vim.keymap.set('n', '<C-h>', '<Cmd>NvimTmuxNavigateLeft<CR>', {})
vim.keymap.set('n', '<C-j>', '<Cmd>NvimTmuxNavigateDown<CR>', {})
vim.keymap.set('n', '<C-k>', '<Cmd>NvimTmuxNavigateUp<CR>', {})
vim.keymap.set('n', '<C-l>', '<Cmd>NvimTmuxNavigateRight<CR>', {})
end,
}