Add sidebar, adjust settings for nvim-tree and aerial to work together
This commit is contained in:
parent
d6e2c38ef7
commit
79bc4e86f5
|
@ -1,14 +1,16 @@
|
||||||
require('aerial').setup {
|
local aerial = require('aerial')
|
||||||
backends = { "treesitter", "lsp", "markdown", "man" },
|
aerial.setup {
|
||||||
|
backends = { "lsp", "treesitter", "markdown", "man" },
|
||||||
layout = {
|
layout = {
|
||||||
default_direction = "right", -- "float",
|
default_direction = "float",
|
||||||
placement = "edge",
|
placement = "edge",
|
||||||
},
|
},
|
||||||
attach_mode = "global",
|
attach_mode = "global",
|
||||||
|
highlight_mode = "none",
|
||||||
lazy_load = false,
|
lazy_load = false,
|
||||||
on_attach = function(bufnr)
|
on_attach = function(bufnr)
|
||||||
-- Toggle the aerial window with <leader>a
|
-- Toggle the aerial window with <leader>a
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>k', '<cmd>AerialToggle!<CR>', {})
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>a', '<cmd>AerialToggle!<CR>', {})
|
||||||
-- Jump forwards/backwards with '{' and '}'
|
-- Jump forwards/backwards with '{' and '}'
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '{', '<cmd>AerialPrev<CR>', {})
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '{', '<cmd>AerialPrev<CR>', {})
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '}', '<cmd>AerialNext<CR>', {})
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '}', '<cmd>AerialNext<CR>', {})
|
||||||
|
@ -17,4 +19,6 @@ require('aerial').setup {
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', ']]', '<cmd>AerialNextUp<CR>', {})
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', ']]', '<cmd>AerialNextUp<CR>', {})
|
||||||
end,
|
end,
|
||||||
open_automatic = false,
|
open_automatic = false,
|
||||||
|
close_automatic_events = { "unfocus", "switch_buffer", "unsupported" },
|
||||||
|
show_guides = true,
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,21 +5,41 @@ require('gitsigns').setup {
|
||||||
current_line_blame = true,
|
current_line_blame = true,
|
||||||
word_diff = false,
|
word_diff = false,
|
||||||
on_attach = function(bufnr)
|
on_attach = function(bufnr)
|
||||||
-- Setup keymaps
|
local gs = package.loaded.gitsigns
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '[g', '<cmd>Gitsigns prev_hunk<CR>', {})
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', ']g', '<cmd>Gitsigns next_hunk<CR>', {})
|
local function map(mode, l, r, opts)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>d', '<cmd>Gitsigns diffthis<CR>', {})
|
opts = opts or {}
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>gq', '<cmd>Gitsigns setqflist<CR>', {})
|
opts.buffer = bufnr
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>gl', '<cmd>Gitsigns setloclist<CR>', {})
|
vim.keymap.set(mode, l, r, opts)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>hp', '<cmd>Gitsigns preview_hunk<CR>', {})
|
end
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>hs', '<cmd>Gitsigns stage_hunk<CR>', {})
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>hr', '<cmd>Gitsigns reset_hunk<CR>', {})
|
-- Navigation
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>bs', '<cmd>Gitsigns stage_buffer<CR>', {})
|
map('n', ']c', function()
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>br', '<cmd>Gitsigns reset_buffer<CR>', {})
|
if vim.wo.diff then return ']c' end
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>lb', '<cmd>Gitsigns blame_line<CR>', {})
|
vim.schedule(function() gs.next_hunk() end)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>btn', '<cmd>Gitsigns toggle_numhl<CR>', {})
|
return '<Ignore>'
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>btl', '<cmd>Gitsigns toggle_linehl<CR>', {})
|
end, {expr=true})
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>btc', '<cmd>Gitsigns toggle_current_line_blame<CR>', {})
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>btw', '<cmd>Gitsigns toggle_word_diff<CR>', {})
|
map('n', '[c', function()
|
||||||
|
if vim.wo.diff then return '[c' end
|
||||||
|
vim.schedule(function() gs.prev_hunk() end)
|
||||||
|
return '<Ignore>'
|
||||||
|
end, {expr=true})
|
||||||
|
|
||||||
|
-- Actions
|
||||||
|
map({'n', 'v'}, '<leader>hs', ':Gitsigns stage_hunk<CR>')
|
||||||
|
map({'n', 'v'}, '<leader>hr', ':Gitsigns reset_hunk<CR>')
|
||||||
|
map('n', '<leader>hS', gs.stage_buffer)
|
||||||
|
map('n', '<leader>hu', gs.undo_stage_hunk)
|
||||||
|
map('n', '<leader>hR', gs.reset_buffer)
|
||||||
|
map('n', '<leader>hp', gs.preview_hunk)
|
||||||
|
map('n', '<leader>hb', function() gs.blame_line{full=true} end)
|
||||||
|
map('n', '<leader>tb', gs.toggle_current_line_blame)
|
||||||
|
map('n', '<leader>hd', gs.diffthis)
|
||||||
|
map('n', '<leader>hD', function() gs.diffthis('~') end)
|
||||||
|
map('n', '<leader>td', gs.toggle_deleted)
|
||||||
|
|
||||||
|
-- Text object
|
||||||
|
map({'o', 'x'}, 'ih', ':<C-U>Gitsigns select_hunk<CR>')
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,47 @@
|
||||||
vim.g.loaded_netrw = 1
|
vim.g.loaded_netrw = 1
|
||||||
vim.g.loaded_netrwPlugin = 1
|
vim.g.loaded_netrwPlugin = 1
|
||||||
|
vim.opt.termguicolors = true
|
||||||
require('nvim-tree').setup {
|
require('nvim-tree').setup {
|
||||||
open_on_setup=false,
|
disable_netrw = true,
|
||||||
open_on_setup_file=false,
|
open_on_setup = true,
|
||||||
hijack_cursor=false,
|
open_on_setup_file = true,
|
||||||
sync_root_with_cwd=true,
|
hijack_cursor = true,
|
||||||
update_focused_file = {
|
update_focused_file = {
|
||||||
enable = true,
|
enable = true,
|
||||||
|
update_root = true,
|
||||||
},
|
},
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
enable = true,
|
enable = true,
|
||||||
show_on_dirs = false,
|
show_on_dirs = true,
|
||||||
|
show_on_open_dirs = false,
|
||||||
|
},
|
||||||
|
git = {
|
||||||
|
enable = true,
|
||||||
|
show_on_dirs = true,
|
||||||
|
show_on_open_dirs = false,
|
||||||
|
},
|
||||||
|
modified = {
|
||||||
|
enable = true,
|
||||||
|
show_on_dirs = true,
|
||||||
|
show_on_open_dirs = false,
|
||||||
|
},
|
||||||
|
view = {
|
||||||
|
centralize_selection = true,
|
||||||
},
|
},
|
||||||
filters = { custom = { "^.git$" } },
|
|
||||||
renderer = {
|
renderer = {
|
||||||
|
add_trailing = true,
|
||||||
group_empty = true,
|
group_empty = true,
|
||||||
|
full_name = true,
|
||||||
highlight_git = true,
|
highlight_git = true,
|
||||||
|
highlight_modified = "name",
|
||||||
|
indent_markers = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
icons = {
|
||||||
|
show = {
|
||||||
|
git = false,
|
||||||
|
modified = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
17
config/nvim/lua/config_plugins/config_sidebar.lua
Normal file
17
config/nvim/lua/config_plugins/config_sidebar.lua
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
require("sidebar-nvim").setup({
|
||||||
|
disable_default_keybindings = 0,
|
||||||
|
bindings = nil,
|
||||||
|
open = true,
|
||||||
|
side = "right",
|
||||||
|
initial_width = 35,
|
||||||
|
hide_statusline = false,
|
||||||
|
update_interval = 1000,
|
||||||
|
sections = { "git", "diagnostics", "symbols" },
|
||||||
|
section_separator = { "-----" },
|
||||||
|
section_title_separator = { "" },
|
||||||
|
containers = {
|
||||||
|
attach_shell = "/bin/sh", show_all = true, interval = 5000,
|
||||||
|
},
|
||||||
|
datetime = { format = "%a %b %d, %H:%M", clocks = { { name = "local" } } },
|
||||||
|
todos = { ignored_paths = { "~" } },
|
||||||
|
})
|
|
@ -13,33 +13,26 @@ end
|
||||||
vim.g.mapleader = ' '
|
vim.g.mapleader = ' '
|
||||||
-- Misc
|
-- Misc
|
||||||
imap('jk', '<Esc>')
|
imap('jk', '<Esc>')
|
||||||
nmap('<leader>gu', '<cmd>Git pull<cr>')
|
nmap('<leader>gl', '<cmd>Git pull<cr>')
|
||||||
nmap('<leader>gp', '<cmd>Git push<cr>')
|
nmap('<leader>gp', '<cmd>Git push<cr>')
|
||||||
nmap('<leader>cc', '<cmd>Git commit<cr>')
|
nmap('<leader>cc', '<cmd>Git commit<cr>')
|
||||||
|
|
||||||
-- Telescope
|
-- Telescope
|
||||||
nmap('<leader>;', '<cmd>Telescope builtin<cr>')
|
nmap('<leader>;', '<cmd>Telescope builtin<cr>')
|
||||||
nmap('<leader>ff', '<cmd>Telescope find_files<cr>')
|
nmap('<leader>ff', '<cmd>Telescope find_files<cr>')
|
||||||
nmap('<leader>fr', '<cmd>Telescope resume<cr>')
|
nmap('<leader>fa', '<cmd>Telescope aerial<cr>')
|
||||||
nmap('<leader>fb', '<cmd>Telescope buffers<cr>')
|
|
||||||
nmap('<leader>fh', '<cmd>Telescope help_tags<cr>')
|
|
||||||
nmap('<leader>fk', '<cmd>Telescope aerial<cr>')
|
|
||||||
nmap('<leader>fd', '<cmd>Telescope lsp_document_symbols<cr>')
|
nmap('<leader>fd', '<cmd>Telescope lsp_document_symbols<cr>')
|
||||||
nmap('<leader>fe', '<cmd>Telescope diagnostics<cr>')
|
nmap('<leader>fe', '<cmd>Telescope diagnostics<cr>')
|
||||||
nmap('<leader>fn', '<cmd>Telescope notify<cr>')
|
|
||||||
nmap('<leader>ft', '<cmd>Telescope treesitter<cr>')
|
nmap('<leader>ft', '<cmd>Telescope treesitter<cr>')
|
||||||
nmap('<leader>fz', '<cmd>Telescope current_buffer_fuzzy_find<cr>')
|
nmap('<leader>fz', '<cmd>Telescope current_buffer_fuzzy_find<cr>')
|
||||||
nmap('<leader>gg', '<cmd>Telescope git_status<cr>')
|
|
||||||
nmap('<leader>gc', '<cmd>Telescope git_commits<cr>')
|
|
||||||
nmap('<leader>gb', '<cmd>Telescope git_bcommits<cr>')
|
|
||||||
nmap('<leader>co', '<cmd>Telescope git_branches<cr>')
|
|
||||||
|
|
||||||
-- Hop
|
-- Hop
|
||||||
nmap('<leader>hl', '<cmd>HopLine<cr>')
|
nmap('<leader>hl', '<cmd>HopLine<cr>')
|
||||||
nmap('<leader>hw', '<cmd>HopWord<cr>')
|
nmap('<leader>hw', '<cmd>HopWord<cr>')
|
||||||
|
|
||||||
-- Nvim-tree
|
-- Nvim-tree
|
||||||
nmap('<leader>nt', '<cmd>NvimTreeToggle<cr>')
|
nmap('<leader>n', '<cmd>NvimTreeToggle<cr>')
|
||||||
|
nmap('<leader>s', '<cmd>SidebarNvimToggle<cr>')
|
||||||
|
|
||||||
-- Trouble
|
-- Trouble
|
||||||
nmap('<leader>xx', '<cmd>TroubleToggle<cr>')
|
nmap('<leader>xx', '<cmd>TroubleToggle<cr>')
|
||||||
|
@ -47,6 +40,3 @@ nmap('<leader>xw', '<cmd>TroubleToggle workspace_diagnostics<cr>')
|
||||||
nmap('<leader>xd', '<cmd>TroubleToggle document_diagnostics<cr>')
|
nmap('<leader>xd', '<cmd>TroubleToggle document_diagnostics<cr>')
|
||||||
nmap('<leader>xq', '<cmd>TroubleToggle quickfix<cr>')
|
nmap('<leader>xq', '<cmd>TroubleToggle quickfix<cr>')
|
||||||
nmap('<leader>xl', '<cmd>TroubleToggle loclist<cr>')
|
nmap('<leader>xl', '<cmd>TroubleToggle loclist<cr>')
|
||||||
|
|
||||||
-- SnipRun
|
|
||||||
nmap('<leader>sr', '<cmd>%SnipRun<cr>')
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ vim.g.python_indent = {
|
||||||
closed_paren_align_last_line = 'v:false',
|
closed_paren_align_last_line = 'v:false',
|
||||||
}
|
}
|
||||||
vim.opt.termguicolors = true
|
vim.opt.termguicolors = true
|
||||||
vim.opt.mouse = "nvi"
|
vim.opt.mouse = "nv"
|
||||||
vim.opt.shiftwidth = 4
|
vim.opt.shiftwidth = 4
|
||||||
vim.opt.number = true
|
vim.opt.number = true
|
||||||
vim.opt.relativenumber = true
|
vim.opt.relativenumber = true
|
||||||
|
|
|
@ -84,6 +84,12 @@ require('packer').startup {
|
||||||
require 'config_plugins.config_nvim-tree'
|
require 'config_plugins.config_nvim-tree'
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
use {
|
||||||
|
'sidebar-nvim/sidebar.nvim',
|
||||||
|
config = function()
|
||||||
|
require 'config_plugins.config_sidebar'
|
||||||
|
end
|
||||||
|
}
|
||||||
use {
|
use {
|
||||||
'akinsho/toggleterm.nvim',
|
'akinsho/toggleterm.nvim',
|
||||||
tag = 'v2.*',
|
tag = 'v2.*',
|
||||||
|
|
Loading…
Reference in a new issue