feat(vim): add NERDTree
This commit is contained in:
@@ -144,6 +144,7 @@ nmap <Leader>fb :Buffers<CR>
|
|||||||
nmap <Leader>fg :Rg ""<CR>
|
nmap <Leader>fg :Rg ""<CR>
|
||||||
nmap <expr> <Leader>fe &filetype ==# 'netrw' ? ':Rex<CR>' : ':Ex<CR>'
|
nmap <expr> <Leader>fe &filetype ==# 'netrw' ? ':Rex<CR>' : ':Ex<CR>'
|
||||||
nmap <C-w>q :bn \| bd#<CR>
|
nmap <C-w>q :bn \| bd#<CR>
|
||||||
|
nmap <Leader>tt :NERDTreeToggle<CR>
|
||||||
|
|
||||||
" {{{2 Default Mappings
|
" {{{2 Default Mappings
|
||||||
|
|
||||||
@@ -210,6 +211,20 @@ let g:gitgutter_sign_removed = '┃'
|
|||||||
|
|
||||||
let g:colorizer_colornames = 0
|
let g:colorizer_colornames = 0
|
||||||
|
|
||||||
|
" {{{3 NERDTree
|
||||||
|
|
||||||
|
let g:NERDTreeDirArrowCollapsible = ""
|
||||||
|
let g:NERDTreeDirArrowExpandable = ""
|
||||||
|
let g:NERDTreeHijackNetrw = 0
|
||||||
|
let g:NERDTreeShowHidden = 1
|
||||||
|
let g:NERDTreeWinSize = 40
|
||||||
|
let g:NERDTreeMinimalUI = 1
|
||||||
|
let g:NERDTreeCascadeSingleChildDir = 0
|
||||||
|
let g:NERDTreeRemoveFileCmd = "gio trash "
|
||||||
|
let g:NERDTreeRemoveDirCmd = "gio trash "
|
||||||
|
let g:NERDTreeMapActivateNode = "l"
|
||||||
|
let g:NERDTreeMapCloseDir = "h"
|
||||||
|
|
||||||
" {{{2 Install
|
" {{{2 Install
|
||||||
let s:plug_file = expand('$HOME/.vim/autoload/plug.vim')
|
let s:plug_file = expand('$HOME/.vim/autoload/plug.vim')
|
||||||
if !filereadable(s:plug_file)
|
if !filereadable(s:plug_file)
|
||||||
@@ -230,6 +245,8 @@ call plug#begin(s:plug_dir)
|
|||||||
Plug 'rbong/vim-flog'
|
Plug 'rbong/vim-flog'
|
||||||
Plug 'chrisbra/Colorizer'
|
Plug 'chrisbra/Colorizer'
|
||||||
Plug 'jceb/vim-orgmode'
|
Plug 'jceb/vim-orgmode'
|
||||||
|
Plug 'preservim/nerdtree'
|
||||||
|
Plug 'ryanoasis/vim-devicons'
|
||||||
|
|
||||||
" Plug 'prabirshrestha/vim-lsp'
|
" Plug 'prabirshrestha/vim-lsp'
|
||||||
" Plug 'dense-analysis/ale'
|
" Plug 'dense-analysis/ale'
|
||||||
@@ -582,4 +599,22 @@ function! s:SetupGitGutter()
|
|||||||
\\ %4.4(%p%%%)%5.5l:%-3.3v
|
\\ %4.4(%p%%%)%5.5l:%-3.3v
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:SetupNERDTree()
|
||||||
|
if !exists('g:loaded_nerd_tree')
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Exit Vim if NERDTree is the only window remaining in the only tab.
|
||||||
|
autocmd BufEnter * if tabpagenr('$') == 1 &&
|
||||||
|
\ winnr('$') == 1 &&
|
||||||
|
\ exists('b:NERDTree') &&
|
||||||
|
\ b:NERDTree.isTabTree() |
|
||||||
|
\ quit |
|
||||||
|
\ endif
|
||||||
|
|
||||||
|
" Start NERDTree and put the cursor back in the other window.
|
||||||
|
NERDTree | wincmd p
|
||||||
|
endfunction
|
||||||
|
|
||||||
autocmd VimEnter * call s:SetupGitGutter()
|
autocmd VimEnter * call s:SetupGitGutter()
|
||||||
|
autocmd VimEnter * call s:SetupNERDTree()
|
||||||
|
|||||||
Reference in New Issue
Block a user