summaryrefslogtreecommitdiffstats
path: root/.config/nvim/lua/sidebars.lua
blob: 058a673301338c816f60dda86fd83403e306d882 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
vim.g.NERDTreeWinPos = 'left'
vim.g.NERDTreeWinSize = 30
vim.g.NERDTreeQuitOnOpen = 0
vim.g.tagbar_left = 1
vim.g.tagbar_width = 30
vim.g.tagbar_autoclose = 0
vim.g.tagbar_autofocus = 1
vim.g.tagbar_sort = 0
vim.g.undotree_SetFocusWhenToggle = 1
vim.g.undotree_SplitWidth = 30

vim.cmd [[
let g:sidebars = {
			\ 'nerdtree': {
			\     'position': 'left',
			\     'check_win': {nr -> getwinvar(nr, '&filetype') ==# 'nerdtree'},
			\     'open': 'NERDTree',
			\     'close': 'NERDTreeClose'
			\ },
			\ 'tagbar': {
			\     'position': 'left',
			\     'check_win': {nr -> bufname(winbufnr(nr)) =~ '__Tagbar__'},
			\     'open': 'TagbarOpen',
			\     'close': 'TagbarClose'
			\ },
			\ 'undotree': {
			\     'position': 'left',
			\     'check_win': {nr -> getwinvar(nr, '&filetype') ==# 'undotree'},
			\     'open': 'UndotreeShow',
			\     'close': 'UndotreeHide'
			\ }
			\ }
let g:startify_session_before_save = ['call sidebar#close_all()']
]]

vim.keymap.set('n', '<F2>', ':call sidebar#toggle("nerdtree")<CR>', { noremap = true, silent = true })
vim.keymap.set('n', '<F4>', ':make<space>-j5<space>', { noremap = true, silent = false })
vim.keymap.set('n', '<F3>', ':call sidebar#toggle("tagbar")<CR>', { noremap = true, silent = true })
vim.keymap.set('n', '<F5>', ':call sidebar#toggle("undotree")<CR>', { noremap = true, silent = true })