-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hide square brackets around flag string? #815
Comments
You can achieve that by concealing those characters with augroup nerdtreeconcealbrackets
autocmd!
autocmd FileType nerdtree syntax match hideBracketsInNerdTree "\]" contained conceal containedin=ALL
autocmd FileType nerdtree syntax match hideBracketsInNerdTree "\[" contained conceal containedin=ALL
autocmd FileType nerdtree setlocal conceallevel=3
autocmd FileType nerdtree setlocal concealcursor=nvic
augroup END By the way, if by any chance happen to use vim-devicons plugin in future; that plugin handles those characters for you. |
Thank you for this. :) It did work, but it was a bit buggy. The "+" symbol was a too close. And I would prefer to have a space between the symbol and the title. Maybe to have the icons at the end of the title would be best, so the indentation of files/folders are always the same. Now it can be a bit visually confusing as they get indented differently depending on if they have a icon or not. Think I will stick with default settings for now. :) But I will check out the great bonus tips. For others seeing this, remember that default vim shipped with macOS doesn't have the conceal thing, so you need to get a newer |
Changing the |
Or even better than augroup nerdtreeconcealbrackets
autocmd!
autocmd FileType nerdtree syntax match hideBracketsInNerdTree "\]" contained conceal containedin=ALL cchar=
autocmd FileType nerdtree syntax match hideBracketsInNerdTree "\[" contained conceal containedin=ALL
autocmd FileType nerdtree setlocal conceallevel=2
autocmd FileType nerdtree setlocal concealcursor=nvic
augroup END The The reason your concealed characters are visible is because your color scheme is not setting the |
You can tweak that by adding a space character after each icon for that plugin. I know I know, it's still hacky solution but that's what we have. let g:NERDTreeIndicatorMapCustom = {
\ "Modified" : "✹ ",
\ "Staged" : "✚ ",
\ "Untracked" : "✭ ",
\ "Renamed" : "➜ ",
\ "Unmerged" : "═ ",
\ "Deleted" : "✖ ",
\ "Dirty" : "✗ ",
\ "Clean" : "✔︎ ",
\ 'Ignored' : '☒ ',
\ "Unknown" : "? "
\ }
Yes, I feel you. That's probably why I don't use that plugin. I think it would be better to get rid off all icon stuff and just use highlighting instead of icons; if it's modified, then highlight its foreground color as yellow like other IDEs does. NERDTree itself is poorly written, so its plugins use some hacks to achieve that kind of functionality. |
@eivindml If you are satisfied with these answers, please close the issue. Thanks! |
Back then, I did something with my local nerdtree-git-plugin fork but it was buggy, not usable; and due to vim highlight mechanics, it was slow; we were creating a highlight element every single file node, which is insane when it comes to performance. I don't have any motivation to continue now. I've been using vim for years and I'd like to say it's not really great experience (at least for me) when you start to make some integration plugins like git. |
Yeah. I can see that. That looks really good though. :) |
Since I am also using the syntax highlighting plugin, this did the trick for me: augroup nerdtree
autocmd!
autocmd FileType nerdtree syntax clear NERDTreeFlags
autocmd FileType nerdtree syntax match hideBracketsInNerdTree "\]" contained conceal containedin=ALL
autocmd FileType nerdtree syntax match hideBracketsInNerdTree "\[" contained conceal containedin=ALL
autocmd FileType nerdtree setlocal conceallevel=3
autocmd FileType nerdtree setlocal concealcursor=nvic
augroup END |
Hi,
is there a way, or is it possible to add an option to hide the square brackets around the flag string (e.g. used by the nerdtree-git-plugin)? I think that would look much cleaner.
Relevant code here: https://github.com/scrooloose/nerdtree/blob/509122df20e200b50e887c32cb7d92b19171a4ab/lib/nerdtree/flag_set.vim#L55
The text was updated successfully, but these errors were encountered: