Giter Club home page Giter Club logo

Comments (8)

rzvxa avatar rzvxa commented on June 16, 2024 1

@Hritik14 You should use | when you are entering the command directly, and escape it like this \| if you are using it in your config file(for example using as a custom binding), In addition to \| you may also use <bar>.
So either do :NERDTreeVCS | NERDTreeClose | NERDTreeFind
or use something like this map <C-f> :NERDTreeVCS \| NERDTreeClose \| NERDTreeFind<CR> in your .vimrc/init.vim to bind these commands to <C-f> (or your preferred short cut)

from nerdtree.

rzvxa avatar rzvxa commented on June 16, 2024

This can be achieved by chaining these commands, Maybe it's not the prettiest approach, But it will do exactly what you want(If I'm not mistaken about your situation)

map <C-f> :NERDTreeVCS \| NERDTreeClose \| NERDTreeFind<CR>

WindowsTerminal_7dJNyXPAq6

Let me know if it didn't fix your problem, In that case, we can work on something else together.

from nerdtree.

Hritik14 avatar Hritik14 commented on June 16, 2024

@rzvxa

This appears weird on my machine. :NERDTreeVCS \| NERDTreeClose \| NERDTreeFind<CR> does not work but when commands separately, it works.

:NERDTreeVCS | NERDTreeClose | NERDTreeFind
asciicast

Issued separately:
asciicast

from nerdtree.

rzvxa avatar rzvxa commented on June 16, 2024

@Hritik14 Have you found this answer to solve your problem? If that's the case I would appreciate it if you go ahead and close your issue.

from nerdtree.

Hritik14 avatar Hritik14 commented on June 16, 2024

@rzvxa thanks, this seems to work partially with two problems

  1. Cursor does not switch to NERDTree (https://asciinema.org/a/FHm3cAqoulmYVbZwenZJVAW7J)
  2. I cannot toggle nerdtree, need to use q to quit

I tried solving (1) by adding NERDTreeFocus but to no avail. Although, the original command, when issued from vim without hotkey focuses NERDTree (https://asciinema.org/a/ueYAkoBDOiCioTPGTI9tmv2vU)

from nerdtree.

rzvxa avatar rzvxa commented on June 16, 2024

@rzvxa thanks, this seems to work partially with two problems

1. Cursor does not switch to NERDTree (https://asciinema.org/a/FHm3cAqoulmYVbZwenZJVAW7J)

2. I cannot toggle nerdtree, need to use `q` to quit

I tried solving (1) by adding NERDTreeFocus but to no avail. Although, the original command, when issued from vim without hotkey focuses NERDTree (https://asciinema.org/a/ueYAkoBDOiCioTPGTI9tmv2vU)

that's weird with my setup it works correctly(both get focus and toggle with NERDTreeToggle) would you kindly provide some minimal vim config to reproduce this? try to remove as many lines as possible in your vimrc / init.vim
What is your operating system and what version of Vim / Neovim do you use? Currently, I'm using Neovim as my daily driver so it may be a vim specific issue.
Anything that can help me with narrowing the problem and get it to be reproducible on my machine can help(I can test on both Linux and Windows but I don't have a Mac machine so I can't really help with Macvim)

from nerdtree.

Hritik14 avatar Hritik14 commented on June 16, 2024

@rzvxa (1) is working now. I don't know what went wrong earlier. Thanks.

Although, cannot toggle with the same key mapping (ie <C-f> above). I can use a different hotkey for that or q. thanks

from nerdtree.

rzvxa avatar rzvxa commented on June 16, 2024

for toggling you can use this:

map <C-f> :if g:NERDTree.IsOpen() \| NERDTreeClose \| else \| NERDTreeVCS \| NERDTreeClose \| NERDTreeFind \| endif<cr>

or you can go the extra mile and do it the "right" way:

function! s:NERDTreeFindVCSToggle() abort
  if g:NERDTree.IsOpen()
    execute("NERDTreeClose")
  else
    execute("NERDTreeVCS | NERDTreeClose | NERDTreeFind")
  endif
endfunction
command NERDTreeFindVCSToggle call s:NERDTreeFindVCSToggle()
map <C-f> :NERDTreeFindVCSToggle<cr>

from nerdtree.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.