From 961e6d1c6ce1e7b7b4be61c5f6f25454435788ba Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 20 Mar 2019 16:13:18 +0100 Subject: [PATCH] set up nerdtree plugin --- .config/nvim/init.vim | 70 ++++++++++++++++++++++++++++++------------- 1 file changed, 50 insertions(+), 20 deletions(-) diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 8179fb8..72ad72c 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -43,7 +43,7 @@ Plug 'jiangmiao/auto-pairs' " Auto close brackets and '' " Ecosystem " Plug 'tpope/vim-fugitive' - Will have to take a closer look some other time -Plug 'scrooloose/nerdtree' " directory thingy - perhaps replace it with something more efficient +Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } " show a directory listing within vim Plug 'Yggdroot/LeaderF' " fuzzy matcher, apparently faster than fzf, ctrlp, unit, denite " Language Integration @@ -75,6 +75,49 @@ endif " ================================================================================ " PLUGIN CONFIGURATION {{{ " ================================================================================ + +" PLUGIN: NERDTree +" highlight the line the cursor is on +let NERDTreeHighlightCursorline = 1 + +" remove Press ? for help +let NERDTreeMinimalUI=1 + +" loads nerdtree plugin when starting vim with a directory +" this is necessary when we lazyload nerdtree with vimplug above +" since it would only get loaded with nttoggle otherwise, and run netrw +augroup nerd_loader + autocmd! + autocmd VimEnter * silent! autocmd! FileExplorer + autocmd BufEnter,BufNew * + \ if isdirectory(expand('')) + \| call plug#load('nerdtree') + \| execute 'autocmd! nerd_loader' + \| endif +augroup END + +" PLUGIN: DEOPLETE +" enable deoplete at startup +let g:deoplete#enable_at_startup = 1 +let g:deoplete#enable_ignore_case = 1 +let g:deoplete#enable_smart_case = 1 +let g:deoplete#enable_camel_case = 1 +let g:deoplete#enable_refresh_always = 1 +let g:deoplete#max_abbr_width = 0 +let g:deoplete#max_menu_width = 0 +let g:deoplete#omni#input_patterns = get(g:,'deoplete#omni#input_patterns',{}) + +" PLUGIN: ALE +let g:ale_fix_on_save = 1 +let g:ale_fixers = { + \'javascipt': ['eslint', 'prettier'], + \'html': ['tidy','prettier'], + \'typescript': ['prettier','tslint'], + \'*': ['remove_trailing_lines', 'trim_whitespace'], + \} + +" PLUGIN: AIRLINE +" PLUGIN: TMUXLINE let g:airline_powerline_fonts=1 let g:airline_theme='raven' colorscheme allomancer @@ -98,24 +141,6 @@ let g:tmuxline_preset = { " automatically save the current buffer when navigating away from vim let g:tmux_navigator_save_on_switch = 1 -" enable deoplete at startup -let g:deoplete#enable_at_startup = 1 -let g:deoplete#enable_ignore_case = 1 -let g:deoplete#enable_smart_case = 1 -let g:deoplete#enable_camel_case = 1 -let g:deoplete#enable_refresh_always = 1 -let g:deoplete#max_abbr_width = 0 -let g:deoplete#max_menu_width = 0 -let g:deoplete#omni#input_patterns = get(g:,'deoplete#omni#input_patterns',{}) - -let g:ale_fix_on_save = 1 -let g:ale_fixers = { - \'javascipt': ['eslint', 'prettier'], - \'html': ['tidy','prettier'], - \'typescript': ['prettier','tslint'], - \'*': ['remove_trailing_lines', 'trim_whitespace'], - \} - " }}} " ================================================================================ " VIM SETTINGS {{{ @@ -207,8 +232,13 @@ nnoremap T :tabedit . " save current buffer with Ctrl-s nnoremap :w -" open NERDtree with leader-e +" open/close NERDtree with leader-e +" whatever method tree has been opened by, leader-e closes it again nnoremap e :NERDTreeToggle +" open root of current VCS project in tree +nnoremap :NERDTreeVCS +" open current nerdtree with current file highlighted +nnoremap E :NERDTreeFind " }}} " ================================================================================