You can try this command to switch to the previous window after NERDTree is opened.
autocmd VimEnter * if &filetype !=# 'gitcommit' | NERDTree | wincmd p | endif
Question
Currently I have NERDTree opening by default when I edit a file that is not a git commit message using this command:
autocmd VimEnter * if &filetype !=# 'gitcommit' | NERDTree | endif
Only issue is that when the file opens, NERDTree is the default buffer, which is very annoying. What can I add to my vimrc file so that when I open a file, that file is the focused buffer, and not NERDTree?
Solution
You can try this command to switch to the previous window after NERDTree is opened.
autocmd VimEnter * if &filetype !=# 'gitcommit' | NERDTree | wincmd p | endif
OTHER TIPS
nerdtree tabs will handle that for you automatically.
let g:nerdtree_tabs_open_on_console_startup=1
let g:nerdtree_tabs_open_on_gui_startup=1
It will also select the right buffer for you.