mirror of
https://github.com/nmasur/dotfiles
synced 2024-11-26 06:05:37 +00:00
neovim improve bufferline and tree
This commit is contained in:
parent
ee305529ce
commit
a22acac57d
@ -26,15 +26,11 @@ key("n", "<A-k>", ":m .-2<CR>==")
|
||||
key("v", "<A-j>", ":m '>+1<CR>gv=gv")
|
||||
key("v", "<A-k>", ":m '<-2<CR>gv=gv")
|
||||
|
||||
-- Buffer tabs
|
||||
key("n", "<C-L>", "gt")
|
||||
key("i", "<C-L>", "<Esc>gt")
|
||||
key("n", "<C-H>", "gT")
|
||||
key("i", "<C-H>", "<Esc>gT")
|
||||
|
||||
-- Move buffers
|
||||
key("n", "L", ":bnext<CR>")
|
||||
key("n", "H", ":bprevious<CR>")
|
||||
-- Better window navigation
|
||||
key("n", "<C-h>", "<C-w>h")
|
||||
key("n", "<C-j>", "<C-w>j")
|
||||
key("n", "<C-k>", "<C-w>k")
|
||||
key("n", "<C-l>", "<C-w>l")
|
||||
|
||||
-- File commands
|
||||
key("n", "<Leader>q", ":quit<CR>")
|
||||
@ -80,3 +76,4 @@ key("n", "<A-CR>", ":noh<CR>", { silent = true }) --- Clear search in VimWiki
|
||||
key("n", "Y", "y$") --- Copy to end of line
|
||||
key("v", "<C-r>", "y<Esc>:%s/<C-r>+//gc<left><left><left>") --- Substitute selected
|
||||
key("v", "D", "y'>gp") --- Duplicate selected
|
||||
key("v", "p", '"_dP') -- Don't overwrite register when pasting
|
||||
|
@ -9,7 +9,6 @@ M.packer = function(use)
|
||||
use("tpope/vim-vinegar") --- Fixes netrw file explorer
|
||||
use("tpope/vim-fugitive") --- Git commands and syntax
|
||||
use("tpope/vim-repeat") --- Actually repeat using .
|
||||
use("christoomey/vim-tmux-navigator") --- Hotkeys for tmux panes
|
||||
|
||||
-- Use gc or gcc to add comments
|
||||
use({
|
||||
|
@ -13,6 +13,7 @@ M.packer = function(use)
|
||||
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)
|
||||
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)
|
||||
vim.keymap.set("v", "<Leader>hs", gitsigns.reset_hunk)
|
||||
@ -37,7 +38,7 @@ M.packer = function(use)
|
||||
use({
|
||||
"akinsho/bufferline.nvim",
|
||||
tag = "v2.*",
|
||||
requires = "kyazdani42/nvim-web-devicons",
|
||||
requires = { "kyazdani42/nvim-web-devicons", "moll/vim-bbye" },
|
||||
config = function()
|
||||
require("bufferline").setup({
|
||||
options = {
|
||||
@ -47,7 +48,18 @@ M.packer = function(use)
|
||||
offsets = { { filetype = "NvimTree" } },
|
||||
},
|
||||
})
|
||||
vim.keymap.set("n", "<Leader>x", " :bdelete<CR>")
|
||||
-- Move buffers
|
||||
vim.keymap.set("n", "L", ":BufferLineCycleNext<CR>")
|
||||
vim.keymap.set("n", "H", ":BufferLineCyclePrev<CR>")
|
||||
|
||||
-- Kill buffer
|
||||
vim.keymap.set("n", "<Leader>x", " :Bdelete<CR>")
|
||||
|
||||
-- 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,
|
||||
})
|
||||
|
||||
@ -56,8 +68,39 @@ M.packer = function(use)
|
||||
"kyazdani42/nvim-tree.lua",
|
||||
requires = { "kyazdani42/nvim-web-devicons" },
|
||||
config = function()
|
||||
require("nvim-tree").setup()
|
||||
vim.keymap.set("n", "<Leader>e", ":NvimTreeToggle")
|
||||
require("nvim-tree").setup({
|
||||
disable_netrw = true,
|
||||
hijack_netrw = true,
|
||||
diagnostics = {
|
||||
enable = true,
|
||||
icons = {
|
||||
hint = "",
|
||||
info = "",
|
||||
warning = "",
|
||||
error = "",
|
||||
},
|
||||
},
|
||||
view = {
|
||||
width = 30,
|
||||
height = 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,
|
||||
},
|
||||
})
|
||||
vim.keymap.set("n", "<Leader>e", ":NvimTreeFindFileToggle<CR>")
|
||||
end,
|
||||
})
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
local fn = vim.fn
|
||||
local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
|
||||
if fn.empty(fn.glob(install_path)) > 0 then
|
||||
packer_bootstrap = fn.system({
|
||||
PACKER_BOOTSTRAP = fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--depth",
|
||||
@ -27,7 +27,7 @@ require("packer").startup(function(use)
|
||||
require("packer.telescope").packer(use)
|
||||
|
||||
-- Auto-install after bootstrapping
|
||||
if packer_bootstrap then
|
||||
if PACKER_BOOTSTRAP then
|
||||
require("packer").sync()
|
||||
end
|
||||
end)
|
||||
|
Loading…
Reference in New Issue
Block a user