Add barbar plugin and config

This commit is contained in:
Evie Litherland-Smith 2023-04-21 14:25:24 +01:00
parent 0203b73757
commit 88beab55c6
7 changed files with 78 additions and 13 deletions

View file

@ -0,0 +1,6 @@
return {
auto_hide = false,
hide = { extensions = true },
modified = { button = "" },
pinned = { button = "", filename = true, separator = { right = "" } },
}

View file

@ -3,6 +3,7 @@ return {
term_colors = true, term_colors = true,
transparent_background = false, transparent_background = false,
integrations = { integrations = {
barbar = true,
barbecue = { barbecue = {
dim_dirname = true, dim_dirname = true,
}, },

View file

@ -14,20 +14,28 @@ return {
action = "Telescope find_files", action = "Telescope find_files",
key = "f", key = "f",
}, },
{
icon = "",
icon_hl = "@variable",
desc = "Projects",
group = "Files",
action = "Telescope projects",
key = "p",
},
{ {
icon = "", icon = "",
icon_hl = "@variable", icon_hl = "@variable",
desc = "Terminal", desc = "Terminal",
group = "Files", group = "Files",
action = "ToggleTerm", action = "ToggleTerm",
key = "|", key = "t",
}, },
{ {
icon = "", icon = "",
desc = "Neotree", desc = "Neotree",
group = "Files", group = "Files",
action = "Neotree float reveal reveal_force_cwd", action = "Neotree float reveal reveal_force_cwd",
key = "/", key = "n",
}, },
{ {
icon = "", icon = "",
@ -45,14 +53,6 @@ return {
action = "Neogit commit", action = "Neogit commit",
key = "c", key = "c",
}, },
{
icon = "",
icon_hl = "@variable",
desc = "Git pull",
group = "Label",
action = "Neogit pull",
key = "p",
},
}, },
}, },
} }

View file

@ -8,8 +8,8 @@ vim.keymap.set("n", "<leader>gg", "<cmd>Neogit kind=split<CR>")
vim.keymap.set("n", "<leader>cc", "<cmd>Neogit commit<CR>") vim.keymap.set("n", "<leader>cc", "<cmd>Neogit commit<CR>")
vim.keymap.set("n", "<leader>gp", "<cmd>Neogit kind=split pull<CR>") vim.keymap.set("n", "<leader>gp", "<cmd>Neogit kind=split pull<CR>")
vim.keymap.set("n", "<leader>gP", "<cmd>Neogit kind=split push<CR>") vim.keymap.set("n", "<leader>gP", "<cmd>Neogit kind=split push<CR>")
vim.keymap.set("n", "<leader>|", "<cmd>ToggleTerm<CR>")
vim.keymap.set("n", "<leader>tt", "<cmd>ToggleTerm direction=float<CR>") vim.keymap.set("n", "<leader>tt", "<cmd>ToggleTerm direction=float<CR>")
vim.keymap.set("n", "<leader>tf", "<cmd>ToggleTerm<CR>")
vim.keymap.set({ "n", "t" }, "<A-h>", "<CMD>NavigatorLeft<CR>") vim.keymap.set({ "n", "t" }, "<A-h>", "<CMD>NavigatorLeft<CR>")
vim.keymap.set({ "n", "t" }, "<A-l>", "<CMD>NavigatorRight<CR>") vim.keymap.set({ "n", "t" }, "<A-l>", "<CMD>NavigatorRight<CR>")
vim.keymap.set({ "n", "t" }, "<A-k>", "<CMD>NavigatorUp<CR>") vim.keymap.set({ "n", "t" }, "<A-k>", "<CMD>NavigatorUp<CR>")
@ -28,7 +28,7 @@ vim.keymap.set("n", "<leader>fz", "<cmd>Telescope current_buffer_fuzzy_find<cr>"
vim.keymap.set("n", "<leader>fp", "<cmd>Telescope projects<cr>") vim.keymap.set("n", "<leader>fp", "<cmd>Telescope projects<cr>")
-- Neotree -- Neotree
vim.keymap.set("n", "/", "<cmd>Neotree float reveal reveal_force_cwd<cr>") vim.keymap.set("n", "<leader>nn", "<cmd>Neotree float reveal reveal_force_cwd<cr>")
vim.keymap.set("n", "<leader>nb", "<cmd>Neotree toggle show buffers right<cr>") vim.keymap.set("n", "<leader>nb", "<cmd>Neotree toggle show buffers right<cr>")
vim.keymap.set("n", "<leader>ns", "<cmd>Neotree float git_status<cr>") vim.keymap.set("n", "<leader>ns", "<cmd>Neotree float git_status<cr>")
@ -50,3 +50,49 @@ vim.keymap.set("n", "<leader>tn", "<cmd>TestNearest<cr>")
vim.keymap.set("n", "<leader>tl", "<cmd>TestLast<cr>") vim.keymap.set("n", "<leader>tl", "<cmd>TestLast<cr>")
vim.keymap.set("n", "<leader>tv", "<cmd>TestVisit<cr>") vim.keymap.set("n", "<leader>tv", "<cmd>TestVisit<cr>")
vim.keymap.set("n", "<leader>ti", "<cmd>TestInfo<cr>") vim.keymap.set("n", "<leader>ti", "<cmd>TestInfo<cr>")
-- barbar
-- local map = vim.api.nvim_set_keymap
local map = vim.keymap.set
local opts = { noremap = true, silent = true }
-- Move to previous/next
map('n', '<A-,>', '<Cmd>BufferPrevious<CR>', opts)
map('n', '<A-.>', '<Cmd>BufferNext<CR>', opts)
-- Re-order to previous/next
map('n', '<A-<>', '<Cmd>BufferMovePrevious<CR>', opts)
map('n', '<A->>', '<Cmd>BufferMoveNext<CR>', opts)
-- Goto buffer in position...
map('n', '<A-1>', '<Cmd>BufferGoto 1<CR>', opts)
map('n', '<A-2>', '<Cmd>BufferGoto 2<CR>', opts)
map('n', '<A-3>', '<Cmd>BufferGoto 3<CR>', opts)
map('n', '<A-4>', '<Cmd>BufferGoto 4<CR>', opts)
map('n', '<A-5>', '<Cmd>BufferGoto 5<CR>', opts)
map('n', '<A-6>', '<Cmd>BufferGoto 6<CR>', opts)
map('n', '<A-7>', '<Cmd>BufferGoto 7<CR>', opts)
map('n', '<A-8>', '<Cmd>BufferGoto 8<CR>', opts)
map('n', '<A-9>', '<Cmd>BufferGoto 9<CR>', opts)
map('n', '<A-0>', '<Cmd>BufferLast<CR>', opts)
-- Pin/unpin buffer
map('n', '<A-p>', '<Cmd>BufferPin<CR>', opts)
-- Close buffer
map('n', '<A-c>', '<Cmd>BufferClose<CR>', opts)
-- Wipeout buffer
-- :BufferWipeout
-- Close commands
-- :BufferCloseAllButCurrent
-- :BufferCloseAllButPinned
-- :BufferCloseAllButCurrentOrPinned
-- :BufferCloseBuffersLeft
-- :BufferCloseBuffersRight
-- Magic buffer-picking mode
map('n', '<C-p>', '<Cmd>BufferPick<CR>', opts)
-- Sort automatically by...
map('n', '<Space>bb', '<Cmd>BufferOrderByBufferNumber<CR>', opts)
map('n', '<Space>bd', '<Cmd>BufferOrderByDirectory<CR>', opts)
map('n', '<Space>bl', '<Cmd>BufferOrderByLanguage<CR>', opts)
map('n', '<Space>bw', '<Cmd>BufferOrderByWindowNumber<CR>', opts)
-- Other:
-- :BarbarEnable - enables barbar (enabled by default)
-- :BarbarDisable - very bad command, should never be used

View file

@ -12,6 +12,7 @@ return {
hide_dotfiles = false, hide_dotfiles = false,
}, },
group_empty_dirs = true, group_empty_dirs = true,
hijack_netrw_behavior = "open_current",
}, },
buffers = { buffers = {
bind_to_cwd = true, bind_to_cwd = true,

View file

@ -0,0 +1,8 @@
return {
"romgrk/barbar.nvim",
dependencies = "nvim-tree/nvim-web-devicons",
event = { "BufReadPre", "BufNewFile" },
init = function() vim.g.barbar_auto_setup = false end,
-- opts = require "config.barbar",
version = "^1.0.0", -- optional: only update when a new 1.x version is released
}

View file

@ -7,8 +7,11 @@ return {
"MunifTanjim/nui.nvim", "MunifTanjim/nui.nvim",
}, },
cmd = "Neotree", cmd = "Neotree",
event = { "BufReadPre", "BufNewFile" },
config = function() config = function()
vim.cmd [[ let g:neo_tree_remove_legacy_commands = 1 ]] vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
vim.g.neo_tree_remove_legacy_commands = 1
require("neo-tree").setup(require "config.neotree") require("neo-tree").setup(require "config.neotree")
end, end,
} }