adds oil, blame, lazygit, and minimap

This commit is contained in:
Vishal Raj 2025-01-20 11:59:31 -08:00
parent 2ba39c6973
commit 6d8dc4e2de
6 changed files with 275 additions and 51 deletions

147
init.lua
View File

@ -102,7 +102,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'
@ -616,7 +616,10 @@ require('lazy').setup({
local servers = {
-- clangd = {},
-- gopls = {},
-- pyright = {},
pyright = {},
ruff = {},
debugpy = {},
taplo = {},
-- rust_analyzer = {},
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
--
@ -709,7 +712,7 @@ require('lazy').setup({
formatters_by_ft = {
lua = { 'stylua' },
-- Conform can also run multiple formatters sequentially
-- python = { "isort", "black" },
python = { 'ruff_format', 'isort', 'black', stop_after_first = true },
--
-- You can use 'stop_after_first' to run the first available formatter from the list
-- javascript = { "prettierd", "prettier", stop_after_first = true },
@ -773,24 +776,24 @@ require('lazy').setup({
-- No, but seriously. Please read `:help ins-completion`, it is really good!
mapping = cmp.mapping.preset.insert {
-- Select the [n]ext item
['<C-n>'] = cmp.mapping.select_next_item(),
-- ['<C-n>'] = cmp.mapping.select_next_item(),
-- Select the [p]revious item
['<C-p>'] = cmp.mapping.select_prev_item(),
-- ['<C-p>'] = cmp.mapping.select_prev_item(),
-- Scroll the documentation window [b]ack / [f]orward
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
-- ['<C-b>'] = cmp.mapping.scroll_docs(-4),
-- ['<C-f>'] = cmp.mapping.scroll_docs(4),
-- Accept ([y]es) the completion.
-- This will auto-import if your LSP supports it.
-- This will expand snippets if the LSP sent a snippet.
['<C-y>'] = cmp.mapping.confirm { select = true },
-- ['<C-y>'] = cmp.mapping.confirm { select = true },
-- If you prefer more traditional completion keymaps,
-- you can uncomment the following lines
--['<CR>'] = cmp.mapping.confirm { select = true },
--['<Tab>'] = cmp.mapping.select_next_item(),
--['<S-Tab>'] = cmp.mapping.select_prev_item(),
['<CR>'] = cmp.mapping.confirm { select = true },
['<Tab>'] = cmp.mapping.select_next_item(),
['<S-Tab>'] = cmp.mapping.select_prev_item(),
-- Manually trigger a completion from nvim-cmp.
-- Generally you don't need this, because nvim-cmp will display
@ -829,6 +832,12 @@ require('lazy').setup({
{ name = 'luasnip' },
{ name = 'path' },
},
cmp.setup.filetype({ 'sql' }, {
sources = {
{ name = 'vim-dadbod-completion' },
{ name = 'buffer' },
},
}),
}
end,
},
@ -838,13 +847,16 @@ require('lazy').setup({
-- change the command in the config to whatever the name of that colorscheme is.
--
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
'folke/tokyonight.nvim',
-- 'folke/tokyonight.nvim',
'rose-pine/neovim',
priority = 1000, -- Make sure to load this before all the other start plugins.
init = 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'
-- vim.cmd.colorscheme 'tokyonight-night'
-- vim.cmd.colorscheme 'rose-pine'
vim.cmd.colorscheme 'retrobox'
-- You can configure highlights by doing something like:
vim.cmd.hi 'Comment gui=none'
@ -854,50 +866,68 @@ require('lazy').setup({
-- Highlight todo, notes, etc in comments
{ 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } },
{ -- Collection of various small independent plugins/modules
'echasnovski/mini.nvim',
config = function()
-- Better Around/Inside textobjects
-- { -- Collection of various small independent plugins/modules
-- 'echasnovski/mini.nvim',
-- config = function()
-- -- Better Around/Inside textobjects
-- --
-- -- Examples:
-- -- - va) - [V]isually select [A]round [)]paren
-- -- - yinq - [Y]ank [I]nside [N]ext [Q]uote
-- -- - ci' - [C]hange [I]nside [']quote
-- require('mini.ai').setup { n_lines = 500 }
--
-- Examples:
-- - va) - [V]isually select [A]round [)]paren
-- - yinq - [Y]ank [I]nside [N]ext [Q]uote
-- - ci' - [C]hange [I]nside [']quote
require('mini.ai').setup { n_lines = 500 }
-- Add/delete/replace surroundings (brackets, quotes, etc.)
-- -- 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 [)] [']
-- require('mini.surround').setup()
--
-- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren
-- - sd' - [S]urround [D]elete [']quotes
-- - sr)' - [S]urround [R]eplace [)] [']
require('mini.surround').setup()
-- -- Simple and easy statusline.
-- -- You could remove this setup call if you don't like it,
-- -- and try some other statusline plugin
-- local statusline = require 'mini.statusline'
-- -- set use_icons to true if you have a Nerd Font
-- statusline.setup { use_icons = vim.g.have_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
-- statusline.section_location = function()
-- return '%2l:%-2v'
-- end
--
-- -- ... and there is more!
-- -- Check out: https://github.com/echasnovski/mini.nvim
-- end,
-- },
-- Simple and easy statusline.
-- You could remove this setup call if you don't like it,
-- and try some other statusline plugin
local statusline = require 'mini.statusline'
-- set use_icons to true if you have a Nerd Font
statusline.setup { use_icons = vim.g.have_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
statusline.section_location = function()
return '%2l:%-2v'
end
-- ... and there is more!
-- Check out: https://github.com/echasnovski/mini.nvim
end,
},
{ -- Highlight, edit, and navigate code
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
opts = {
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
ensure_installed = {
'bash',
'c',
'diff',
'html',
'lua',
'luadoc',
'markdown',
'markdown_inline',
'query',
'vim',
'vimdoc',
'python',
'markdown_inline',
'markdown',
'rst',
'ninja',
},
-- Autoinstall languages that are not installed
auto_install = true,
highlight = {
@ -937,7 +967,7 @@ require('lazy').setup({
-- This is the easiest way to modularize your config.
--
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
-- { import = 'custom.plugins' },
{ import = 'custom.plugins' },
--
-- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
-- Or use telescope!
@ -965,5 +995,24 @@ require('lazy').setup({
},
})
-- MiniMap = require 'mini.map'
-- vim.keymap.set('n', '<leader>mt', MiniMap.toggle, { desc = 'Toggle MiniMap' })
-- vim.keymap.set('n', '<leader>mo', MiniMap.open, { desc = 'Open MiniMap' })
-- vim.keymap.set('n', '<leader>mc', MiniMap.close, { desc = 'Close MiniMap' })
-- vim.keymap.set('n', '<leader>mf', MiniMap.toggle_focus, { desc = 'Toggle MiniMap Focus' })
-- vim.keymap.set('n', '<leader>mr', MiniMap.refresh, { desc = 'Refresh MiniMap' })
-- vim.keymap.set('n', '<leader>ms', MiniMap.toggle_side, { desc = 'Toggle MiniMap side' })
--
vim.api.nvim_create_user_command('LintProject', function()
vim.cmd '!poetry run task lint'
end, {})
vim.api.nvim_create_user_command('FormatProject', function()
vim.cmd '!poetry run task format'
end, {})
vim.api.nvim_create_user_command('ShowDiagnostic', function()
vim.cmd '!lua vim.diagnostic.open_float()'
end, {})
-- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et

View File

@ -0,0 +1,18 @@
return {
{
'FabijanZulj/blame.nvim',
lazy = false,
config = function()
require('blame').setup()
end,
},
-- keys = {
-- {
-- '<leader>mt',
-- function()
-- vim.keymap.set('n', '<leader>bt', ':BlameToggle<CR>')
-- end,
-- desc = 'Toggle git blame window',
-- },
-- },
}

View File

@ -0,0 +1,5 @@
return {
'tpope/vim-dadbod',
'kristijanhusak/vim-dadbod-completion',
'kristijanhusak/vim-dadbod-ui',
}

View File

@ -0,0 +1,21 @@
-- nvim v0.8.0
return {
'kdheepak/lazygit.nvim',
lazy = true,
cmd = {
'LazyGit',
'LazyGitConfig',
'LazyGitCurrentFile',
'LazyGitFilter',
'LazyGitFilterCurrentFile',
},
-- optional for floating window border decoration
dependencies = {
'nvim-lua/plenary.nvim',
},
-- setting the keybinding for LazyGit with 'keys' is recommended in
-- order to load the plugin when the command is run for the first time
keys = {
{ '<leader>lg', '<cmd>LazyGit<cr>', desc = 'LazyGit' },
},
}

View File

@ -0,0 +1,77 @@
return {
'echasnovski/mini.map',
version = '*',
-- vim.keymap.set('n', '<leader>mo', MiniMap.open, { desc = 'Open MiniMap' }),
config = function()
-- require('mini.map').setup()
local map = require 'mini.map'
local diagnostic_integration = map.gen_integration.diagnostic {
error = 'DiagnosticFloatingError',
warn = 'DiagnosticFloatingWarn',
info = 'DiagnosticFloatingInfo',
hint = 'DiagnosticFloatingHint',
}
local builtin_search_integration = map.gen_integration.builtin_search()
local gitsigns_integration = map.gen_integration.gitsigns {
add = 'GitSignsAdd',
change = 'GitSignsChange',
delete = 'GitSignsDelete',
}
map.setup {
integrations = {
diagnostic_integration,
builtin_search_integration,
gitsigns_integration,
},
}
end,
keys = {
{
'<leader>mt',
function()
require('mini.map').toggle()
end,
desc = 'Toggle minimap',
},
{
'<leader>mc',
function()
require('mini.map').close()
end,
desc = 'Close minimap',
},
{
'<leader>mf',
function()
require('mini.map').toggle_focus()
end,
desc = 'Toggle minimap focus',
},
{
'<leader>mo',
function()
require('mini.map').open()
end,
desc = 'Open minimap',
},
{
'<leader>mr',
function()
require('mini.map').refresh()
end,
desc = 'Refresh minimap',
},
{
'<leader>ms',
function()
require('mini.map').toggle_side()
end,
desc = 'Toggle minimap side',
},
},
}

View File

@ -0,0 +1,54 @@
return {
'stevearc/oil.nvim',
---@module 'oil'
---@type oil.SetupOpts
-- to open oil with - as shortcut
vim.keymap.set('n', '-', '<CMD>Oil<CR>', { desc = 'Open parent directory' }),
opts = {},
-- Optional dependencies
dependencies = { { 'echasnovski/mini.icons', opts = {} } },
-- dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if prefer nvim-web-devicons
}
-- return {
-- {
-- 'stevearc/oil.nvim',
-- vim.keymap.set('n', '-', '<CMD>Oil<CR>', { desc = 'Open parent directory' }),
-- dependencies = { "nvim-tree/nvim-web-devicons" },
-- config = function()
-- CustomOilBar = function()
-- local path = vim.fn.expand "%"
-- path = path:gsub("oil://", "")
--
-- return " " .. vim.fn.fnamemodify(path, ":.")
-- end
--
-- require("oil").setup {
-- columns = { "icon" },
-- keymaps = {
-- ["<C-h>"] = false,
-- ["<C-l>"] = false,
-- ["<C-k>"] = false,
-- ["<C-j>"] = false,
-- ["<M-h>"] = "actions.select_split",
-- },
-- win_options = {
-- winbar = "%{v:lua.CustomOilBar()}",
-- },
-- view_options = {
-- show_hidden = true,
-- is_always_hidden = function(name, _)
-- local folder_skip = { "dev-tools.locks", "dune.lock", "_build" }
-- return vim.tbl_contains(folder_skip, name)
-- end,
-- },
-- }
--
-- -- Open parent directory in current window
-- vim.keymap.set("n", "-", "<CMD>Oil<CR>", { desc = "Open parent directory" })
--
-- -- Open parent directory in floating window
-- vim.keymap.set("n", "<space>-", require("oil").toggle_float)
-- end,
-- },
-- }