Откройте папку на курсоре с помощью другого приложения NerdTree

378
Jean Carlo Machado

Я использую NERDTree, было бы замечательно, если бы, когда я наведу курсор на папку, у меня был способ вызвать мой файловый менеджер, скажем thunar, с отображением, чтобы открыть эту папку. Как и Sublime.

0

1 ответ на вопрос

0
Christoph

I do something similar like this on windows. This executes a command on the current directory (when doing :pwd in vim).

I do not know how to directly do this in Nerdtree but it is a start. Do keep in mind if you press cd on a folder in Nerdtree the working directory automatically changes to the folder you are on so it is fairly quick.

Add following to your vimrc.

" Open current file in New Google Chrome window command Chrome :silent ! start chrome /new-window "%:p" " Open current file in Windows explorer command Explorer :silent ! start explorer "%:p:h" 

Explanation:

  • command Chrome => you can execute the command in vim by pressing :Chrome
  • :silent => open the window without having to confirm in vim
  • ! => this is where the command line command starts
  • %:p:h => the current working directory, literally this means the path (:p) of current file (%), without the head (:h).

In your case it will be something like:

command Thunar :silent ! thunar "%:p"