summaryrefslogtreecommitdiff
path: root/.config/nvim
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim')
-rw-r--r--.config/nvim/init.vim1
-rw-r--r--.config/nvim/plugins/_install.vim1
-rw-r--r--.config/nvim/plugins/_load.vim1
-rw-r--r--.config/nvim/plugins/diffview.vim6
-rw-r--r--.config/nvim/plugins/nerdtree.vim21
5 files changed, 28 insertions, 2 deletions
diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim
index 7c59a81..5e9fb44 100644
--- a/.config/nvim/init.vim
+++ b/.config/nvim/init.vim
@@ -8,6 +8,7 @@ function UtilityWinfiletypes()
return winfiletypes
endfunction
+let g:NERDTreeNoInitFiletypes = ["DiffviewFiles"]
let g:NERDTreeStatusLineTabSwitchFiletypes = ["nerdtree", "help"]
diff --git a/.config/nvim/plugins/_install.vim b/.config/nvim/plugins/_install.vim
index 9bc483c..60a1f74 100644
--- a/.config/nvim/plugins/_install.vim
+++ b/.config/nvim/plugins/_install.vim
@@ -10,6 +10,7 @@ Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim'
+Plug 'sindrets/diffview.nvim'
Plug 'airblade/vim-gitgutter'
diff --git a/.config/nvim/plugins/_load.vim b/.config/nvim/plugins/_load.vim
index c101014..4917b89 100644
--- a/.config/nvim/plugins/_load.vim
+++ b/.config/nvim/plugins/_load.vim
@@ -1,5 +1,6 @@
source ~/.config/nvim/plugins/aerial.vim
source ~/.config/nvim/plugins/comment.vim
+source ~/.config/nvim/plugins/diffview.vim
source ~/.config/nvim/plugins/gitgutter.vim
source ~/.config/nvim/plugins/indent_blankline.vim
source ~/.config/nvim/plugins/leap.vim
diff --git a/.config/nvim/plugins/diffview.vim b/.config/nvim/plugins/diffview.vim
new file mode 100644
index 0000000..4b9d2f0
--- /dev/null
+++ b/.config/nvim/plugins/diffview.vim
@@ -0,0 +1,6 @@
+lua <<EOF
+require('diffview').setup({})
+EOF
+
+" close all windows when Diffview is closed
+autocmd QuitPre * if &filetype == 'DiffviewFiles' | quitall | endif
diff --git a/.config/nvim/plugins/nerdtree.vim b/.config/nvim/plugins/nerdtree.vim
index 8a7869a..57ffba2 100644
--- a/.config/nvim/plugins/nerdtree.vim
+++ b/.config/nvim/plugins/nerdtree.vim
@@ -3,10 +3,27 @@ let g:NERDTreeGitStatusShowIgnored=1
if !&diff
autocmd StdinReadPre * let s:std_in=1
- autocmd VimEnter * NERDTree | if argc() > 0 || exists('s:std_in') | wincmd p | endif
- autocmd VimEnter * if argc() > 0 | silent NERDTreeFind | wincmd p | endif
endif
+function NERDTreeInit()
+ if !&diff
+ let buffer_type = getbufvar(bufnr(), "&filetype")
+ if index(g:NERDTreeNoInitFiletypes, buffer_type) == -1
+ NERDTree
+
+ if argc() > 0 || exists('s:std_in')
+ wincmd p
+ endif
+
+ if argc() > 0
+ silent NERDTreeFind
+ wincmd p
+ endif
+ endif
+ endif
+endfunction
+autocmd VimEnter * call NERDTreeInit()
+
autocmd BufWinEnter * if getcmdwintype() == '' | silent NERDTreeMirror | endif
autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif