dotfiles/modules/neovim/lua/packer/visuals.lua

165 lines
5.6 KiB
Lua
Raw Normal View History

2022-07-09 21:27:04 +00:00
local M = {}
M.packer = function(use)
-- Git next to line numbers
use({
"lewis6991/gitsigns.nvim",
branch = "main",
requires = { "nvim-lua/plenary.nvim" },
config = function()
local gitsigns = require("gitsigns")
gitsigns.setup()
vim.keymap.set("n", "<Leader>gB", gitsigns.blame_line)
vim.keymap.set("n", "<Leader>gp", gitsigns.preview_hunk)
vim.keymap.set("v", "<Leader>gp", gitsigns.preview_hunk)
vim.keymap.set("n", "<Leader>gd", gitsigns.diffthis)
2022-07-12 12:36:10 +00:00
vim.keymap.set("v", "<Leader>gd", gitsigns.diffthis)
vim.keymap.set("n", "<Leader>rgf", gitsigns.reset_buffer)
vim.keymap.set("v", "<Leader>hs", gitsigns.stage_hunk)
2022-09-25 14:46:50 +00:00
vim.keymap.set("v", "<Leader>hr", gitsigns.reset_hunk)
vim.keymap.set("v", "<Leader>hr", gitsigns.reset_hunk)
-- Navigation
vim.keymap.set("n", "]g", function()
if vim.wo.diff then
return "]g"
end
vim.schedule(function()
gitsigns.next_hunk()
end)
return "<Ignore>"
end, { expr = true })
vim.keymap.set("n", "[g", function()
if vim.wo.diff then
return "[g"
end
vim.schedule(function()
gitsigns.prev_hunk()
end)
return "<Ignore>"
end, { expr = true })
2022-07-09 21:27:04 +00:00
end,
})
-- Status bar
use({
"hoob3rt/lualine.nvim",
requires = { "kyazdani42/nvim-web-devicons", opt = true },
config = function()
require("lualine").setup({
options = {
theme = "gruvbox",
icons_enabled = true,
},
})
end,
})
-- Buffer line ("tabs")
use({
"akinsho/bufferline.nvim",
2022-08-16 04:29:23 +00:00
tag = "v2.4.0",
2022-07-12 12:36:10 +00:00
requires = { "kyazdani42/nvim-web-devicons", "moll/vim-bbye" },
config = function()
require("bufferline").setup({
options = {
diagnostics = "nvim_lsp",
always_show_bufferline = false,
separator_style = "slant",
offsets = { { filetype = "NvimTree" } },
},
})
2022-07-12 12:36:10 +00:00
-- Move buffers
2022-07-13 02:15:00 +00:00
vim.keymap.set("n", "L", ":BufferLineCycleNext<CR>", { silent = true })
vim.keymap.set("n", "H", ":BufferLineCyclePrev<CR>", { silent = true })
2022-07-12 12:36:10 +00:00
-- Kill buffer
2022-07-13 02:15:00 +00:00
vim.keymap.set("n", "<Leader>x", " :Bdelete<CR>", { silent = true })
2022-07-12 12:36:10 +00:00
-- Shift buffers
-- vim.keymap.set("n", "<C-L>", ":BufferLineMoveNext<CR>")
-- vim.keymap.set("i", "<C-L>", "<Esc>:BufferLineMoveNext<CR>i")
-- vim.keymap.set("n", "<C-H>", ":BufferLineMovePrev<CR>")
-- vim.keymap.set("i", "<C-H>", "<Esc>:BufferLineMovePrev<CR>i")
end,
})
-- File explorer
use({
"kyazdani42/nvim-tree.lua",
requires = { "kyazdani42/nvim-web-devicons" },
config = function()
2022-07-12 12:36:10 +00:00
require("nvim-tree").setup({
disable_netrw = true,
hijack_netrw = true,
2022-07-19 03:34:32 +00:00
update_focused_file = {
enable = true,
update_cwd = true,
ignore_list = {},
},
2022-07-12 12:36:10 +00:00
diagnostics = {
enable = true,
icons = {
hint = "",
info = "",
warning = "",
error = "",
},
},
2022-07-13 04:23:38 +00:00
renderer = {
icons = {
glyphs = {
git = {
unstaged = "~",
staged = "+",
unmerged = "",
renamed = "",
deleted = "",
untracked = "?",
ignored = "",
},
},
},
},
2022-07-12 12:36:10 +00:00
view = {
width = 30,
hide_root_folder = false,
side = "left",
mappings = {
custom_only = false,
list = {
{
key = { "l", "<CR>", "o" },
cb = require("nvim-tree.config").nvim_tree_callback("edit"),
},
{ key = "h", cb = require("nvim-tree.config").nvim_tree_callback("close_node") },
{ key = "v", cb = require("nvim-tree.config").nvim_tree_callback("vsplit") },
},
},
number = false,
relativenumber = false,
},
})
2022-07-13 02:15:00 +00:00
vim.keymap.set("n", "<Leader>e", ":NvimTreeFindFileToggle<CR>", { silent = true })
2022-09-18 01:15:31 +00:00
-- https://github.com/kyazdani42/nvim-tree.lua/commit/fb8735e96cecf004fbefb086ce85371d003c5129
vim.g.loaded = 1
vim.g.loaded_netrwPlugin = 1
end,
})
2022-07-09 21:27:04 +00:00
-- Markdown pretty view
use("ellisonleao/glow.nvim")
-- Hex color previews
use({
"norcalli/nvim-colorizer.lua",
config = function()
require("colorizer").setup()
end,
})
end
return M