Có một lối tắt để hiển thị tệp hiện tại trong bảng điều khiển thư mục NerdTree hay không.NerdTree - Hiển thị tập tin trong cây
Giống như TextMate 'Reveal tập tin trong Drawer' - Ctrl + Command + R
Có một lối tắt để hiển thị tệp hiện tại trong bảng điều khiển thư mục NerdTree hay không.NerdTree - Hiển thị tập tin trong cây
Giống như TextMate 'Reveal tập tin trong Drawer' - Ctrl + Command + R
tại: h NERDTree:
:NERDTreeFind :NERDTreeFind
Find the current file in the tree. If no tree exists for the current tab,
or the file is not under the current root, then initialize a new tree where
the root is the directory of the current file.
Tôi không nghĩ rằng đó là ràng buộc bất cứ điều gì theo mặc định, vì vậy bạn phải làm một keybind chính mình.
nmap ,n :NERDTreeFind<CR>
là những gì xuất hiện trong vimrc của tôi, cùng với
nmap ,m :NERDTreeToggle<CR>
Kiểm tra này ra, nó tự động hóa hoạt động đồng bộ, bất cứ khi nào bạn thay đổi bộ đệm, các nerdtree sẽ tự động làm mới bản thân (Tôi sao chép từ here với những sửa đổi nhỏ)
" Check if NERDTree is open or active
function! IsNERDTreeOpen()
return exists("t:NERDTreeBufName") && (bufwinnr(t:NERDTreeBufName) != -1)
endfunction
" Call NERDTreeFind iff NERDTree is active, current window contains a modifiable
" file, and we're not in vimdiff
function! SyncTree()
if &modifiable && IsNERDTreeOpen() && strlen(expand('%')) > 0 && !&diff
NERDTreeFind
wincmd p
endif
endfunction
" Highlight currently open buffer in NERDTree
autocmd BufEnter * call SyncTree()
Cảm ơn bạn, tôi đã tìm kiếm điều này trong một thời gian dài! :) – Gnagno
Thao tác keymapping hoạt động, nhưng cách gọi NERDTreeFind trong vim? – toszter
@toszter chỉ ': NERDTreeFind' – Thomas
Có cách nào để thiết lập nó để làm điều này bất cứ khi nào NERDTree được tạo trong tab đó? –